diff options
author | David Woodhouse <dwmw2@infradead.org> | 2006-09-24 17:05:59 -0400 |
---|---|---|
committer | David Woodhouse <dwmw2@infradead.org> | 2006-09-24 17:05:59 -0400 |
commit | 02b25fcff676125a88169c8a78d4c6dd647574ed (patch) | |
tree | 372fc8e885be41ba1819b2767c8889ecd97ff948 /include | |
parent | 1694176a210189312e31b083bac1e1688981219a (diff) | |
parent | a68aa1cc6f3203b8a332683ebde67a00f39eec43 (diff) |
Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6
Diffstat (limited to 'include')
225 files changed, 6890 insertions, 3171 deletions
diff --git a/include/asm-alpha/libata-portmap.h b/include/asm-alpha/libata-portmap.h new file mode 100644 index 000000000000..75484ef0c743 --- /dev/null +++ b/include/asm-alpha/libata-portmap.h | |||
@@ -0,0 +1 @@ | |||
#include <asm-generic/libata-portmap.h> | |||
diff --git a/include/asm-arm/arch-ep93xx/ep93xx-regs.h b/include/asm-arm/arch-ep93xx/ep93xx-regs.h index 8c322975f96e..593f562f85c3 100644 --- a/include/asm-arm/arch-ep93xx/ep93xx-regs.h +++ b/include/asm-arm/arch-ep93xx/ep93xx-regs.h | |||
@@ -27,6 +27,7 @@ | |||
27 | #define EP93XX_DMA_BASE (EP93XX_AHB_VIRT_BASE + 0x00000000) | 27 | #define EP93XX_DMA_BASE (EP93XX_AHB_VIRT_BASE + 0x00000000) |
28 | 28 | ||
29 | #define EP93XX_ETHERNET_BASE (EP93XX_AHB_VIRT_BASE + 0x00010000) | 29 | #define EP93XX_ETHERNET_BASE (EP93XX_AHB_VIRT_BASE + 0x00010000) |
30 | #define EP93XX_ETHERNET_PHYS_BASE (EP93XX_AHB_PHYS_BASE + 0x00010000) | ||
30 | 31 | ||
31 | #define EP93XX_USB_BASE (EP93XX_AHB_VIRT_BASE + 0x00020000) | 32 | #define EP93XX_USB_BASE (EP93XX_AHB_VIRT_BASE + 0x00020000) |
32 | #define EP93XX_USB_PHYS_BASE (EP93XX_AHB_PHYS_BASE + 0x00020000) | 33 | #define EP93XX_USB_PHYS_BASE (EP93XX_AHB_PHYS_BASE + 0x00020000) |
diff --git a/include/asm-arm/arch-ep93xx/platform.h b/include/asm-arm/arch-ep93xx/platform.h index d7a34ce20293..b4a8deb8bdef 100644 --- a/include/asm-arm/arch-ep93xx/platform.h +++ b/include/asm-arm/arch-ep93xx/platform.h | |||
@@ -11,5 +11,11 @@ void ep93xx_init_devices(void); | |||
11 | void ep93xx_clock_init(void); | 11 | void ep93xx_clock_init(void); |
12 | extern struct sys_timer ep93xx_timer; | 12 | extern struct sys_timer ep93xx_timer; |
13 | 13 | ||
14 | struct ep93xx_eth_data | ||
15 | { | ||
16 | unsigned char dev_addr[6]; | ||
17 | unsigned char phy_id; | ||
18 | }; | ||
19 | |||
14 | 20 | ||
15 | #endif | 21 | #endif |
diff --git a/include/asm-generic/audit_change_attr.h b/include/asm-generic/audit_change_attr.h index cb05bf69745a..50764550a60c 100644 --- a/include/asm-generic/audit_change_attr.h +++ b/include/asm-generic/audit_change_attr.h | |||
@@ -1,16 +1,20 @@ | |||
1 | __NR_chmod, | 1 | __NR_chmod, |
2 | __NR_fchmod, | 2 | __NR_fchmod, |
3 | #ifdef __NR_chown | ||
3 | __NR_chown, | 4 | __NR_chown, |
4 | __NR_fchown, | 5 | __NR_fchown, |
5 | __NR_lchown, | 6 | __NR_lchown, |
7 | #endif | ||
6 | __NR_setxattr, | 8 | __NR_setxattr, |
7 | __NR_lsetxattr, | 9 | __NR_lsetxattr, |
8 | __NR_fsetxattr, | 10 | __NR_fsetxattr, |
9 | __NR_removexattr, | 11 | __NR_removexattr, |
10 | __NR_lremovexattr, | 12 | __NR_lremovexattr, |
11 | __NR_fremovexattr, | 13 | __NR_fremovexattr, |
14 | #ifdef __NR_fchownat | ||
12 | __NR_fchownat, | 15 | __NR_fchownat, |
13 | __NR_fchmodat, | 16 | __NR_fchmodat, |
17 | #endif | ||
14 | #ifdef __NR_chown32 | 18 | #ifdef __NR_chown32 |
15 | __NR_chown32, | 19 | __NR_chown32, |
16 | __NR_fchown32, | 20 | __NR_fchown32, |
diff --git a/include/asm-generic/audit_dir_write.h b/include/asm-generic/audit_dir_write.h index 161a7a58fbab..6621bd82cbe8 100644 --- a/include/asm-generic/audit_dir_write.h +++ b/include/asm-generic/audit_dir_write.h | |||
@@ -1,14 +1,18 @@ | |||
1 | __NR_rename, | 1 | __NR_rename, |
2 | __NR_mkdir, | 2 | __NR_mkdir, |
3 | __NR_rmdir, | 3 | __NR_rmdir, |
4 | #ifdef __NR_creat | ||
4 | __NR_creat, | 5 | __NR_creat, |
6 | #endif | ||
5 | __NR_link, | 7 | __NR_link, |
6 | __NR_unlink, | 8 | __NR_unlink, |
7 | __NR_symlink, | 9 | __NR_symlink, |
8 | __NR_mknod, | 10 | __NR_mknod, |
11 | #ifdef __NR_mkdirat | ||
9 | __NR_mkdirat, | 12 | __NR_mkdirat, |
10 | __NR_mknodat, | 13 | __NR_mknodat, |
11 | __NR_unlinkat, | 14 | __NR_unlinkat, |
12 | __NR_renameat, | 15 | __NR_renameat, |
13 | __NR_linkat, | 16 | __NR_linkat, |
14 | __NR_symlinkat, | 17 | __NR_symlinkat, |
18 | #endif | ||
diff --git a/include/asm-generic/libata-portmap.h b/include/asm-generic/libata-portmap.h new file mode 100644 index 000000000000..9202fd02d5be --- /dev/null +++ b/include/asm-generic/libata-portmap.h | |||
@@ -0,0 +1,12 @@ | |||
1 | #ifndef __ASM_GENERIC_LIBATA_PORTMAP_H | ||
2 | #define __ASM_GENERIC_LIBATA_PORTMAP_H | ||
3 | |||
4 | #define ATA_PRIMARY_CMD 0x1F0 | ||
5 | #define ATA_PRIMARY_CTL 0x3F6 | ||
6 | #define ATA_PRIMARY_IRQ 14 | ||
7 | |||
8 | #define ATA_SECONDARY_CMD 0x170 | ||
9 | #define ATA_SECONDARY_CTL 0x376 | ||
10 | #define ATA_SECONDARY_IRQ 15 | ||
11 | |||
12 | #endif | ||
diff --git a/include/asm-i386/libata-portmap.h b/include/asm-i386/libata-portmap.h new file mode 100644 index 000000000000..75484ef0c743 --- /dev/null +++ b/include/asm-i386/libata-portmap.h | |||
@@ -0,0 +1 @@ | |||
#include <asm-generic/libata-portmap.h> | |||
diff --git a/include/asm-ia64/libata-portmap.h b/include/asm-ia64/libata-portmap.h new file mode 100644 index 000000000000..75484ef0c743 --- /dev/null +++ b/include/asm-ia64/libata-portmap.h | |||
@@ -0,0 +1 @@ | |||
#include <asm-generic/libata-portmap.h> | |||
diff --git a/include/asm-powerpc/cputable.h b/include/asm-powerpc/cputable.h index 1ba3c9983614..12707ab9dc98 100644 --- a/include/asm-powerpc/cputable.h +++ b/include/asm-powerpc/cputable.h | |||
@@ -23,6 +23,7 @@ | |||
23 | #define PPC_FEATURE_SMT 0x00004000 | 23 | #define PPC_FEATURE_SMT 0x00004000 |
24 | #define PPC_FEATURE_ICACHE_SNOOP 0x00002000 | 24 | #define PPC_FEATURE_ICACHE_SNOOP 0x00002000 |
25 | #define PPC_FEATURE_ARCH_2_05 0x00001000 | 25 | #define PPC_FEATURE_ARCH_2_05 0x00001000 |
26 | #define PPC_FEATURE_PA6T 0x00000800 | ||
26 | 27 | ||
27 | #define PPC_FEATURE_TRUE_LE 0x00000002 | 28 | #define PPC_FEATURE_TRUE_LE 0x00000002 |
28 | #define PPC_FEATURE_PPC_LE 0x00000001 | 29 | #define PPC_FEATURE_PPC_LE 0x00000001 |
@@ -36,6 +37,7 @@ | |||
36 | struct cpu_spec; | 37 | struct cpu_spec; |
37 | 38 | ||
38 | typedef void (*cpu_setup_t)(unsigned long offset, struct cpu_spec* spec); | 39 | typedef void (*cpu_setup_t)(unsigned long offset, struct cpu_spec* spec); |
40 | typedef void (*cpu_restore_t)(void); | ||
39 | 41 | ||
40 | enum powerpc_oprofile_type { | 42 | enum powerpc_oprofile_type { |
41 | PPC_OPROFILE_INVALID = 0, | 43 | PPC_OPROFILE_INVALID = 0, |
@@ -65,6 +67,8 @@ struct cpu_spec { | |||
65 | * BHT, SPD, etc... from head.S before branching to identify_machine | 67 | * BHT, SPD, etc... from head.S before branching to identify_machine |
66 | */ | 68 | */ |
67 | cpu_setup_t cpu_setup; | 69 | cpu_setup_t cpu_setup; |
70 | /* Used to restore cpu setup on secondary processors and at resume */ | ||
71 | cpu_restore_t cpu_restore; | ||
68 | 72 | ||
69 | /* Used by oprofile userspace to select the right counters */ | 73 | /* Used by oprofile userspace to select the right counters */ |
70 | char *oprofile_cpu_type; | 74 | char *oprofile_cpu_type; |
@@ -145,7 +149,7 @@ extern void do_cpu_ftr_fixups(unsigned long offset); | |||
145 | 149 | ||
146 | #define CPU_FTR_PPCAS_ARCH_V2_BASE (CPU_FTR_SLB | \ | 150 | #define CPU_FTR_PPCAS_ARCH_V2_BASE (CPU_FTR_SLB | \ |
147 | CPU_FTR_TLBIEL | CPU_FTR_NOEXECUTE | \ | 151 | CPU_FTR_TLBIEL | CPU_FTR_NOEXECUTE | \ |
148 | CPU_FTR_NODSISRALIGN | CPU_FTR_CTRL) | 152 | CPU_FTR_NODSISRALIGN) |
149 | 153 | ||
150 | /* iSeries doesn't support large pages */ | 154 | /* iSeries doesn't support large pages */ |
151 | #ifdef CONFIG_PPC_ISERIES | 155 | #ifdef CONFIG_PPC_ISERIES |
@@ -310,24 +314,29 @@ extern void do_cpu_ftr_fixups(unsigned long offset); | |||
310 | CPU_FTR_HPTE_TABLE | CPU_FTR_IABR | \ | 314 | CPU_FTR_HPTE_TABLE | CPU_FTR_IABR | \ |
311 | CPU_FTR_MMCRA | CPU_FTR_CTRL) | 315 | CPU_FTR_MMCRA | CPU_FTR_CTRL) |
312 | #define CPU_FTRS_POWER4 (CPU_FTR_SPLIT_ID_CACHE | CPU_FTR_USE_TB | \ | 316 | #define CPU_FTRS_POWER4 (CPU_FTR_SPLIT_ID_CACHE | CPU_FTR_USE_TB | \ |
313 | CPU_FTR_HPTE_TABLE | CPU_FTR_PPCAS_ARCH_V2 | CPU_FTR_MMCRA) | 317 | CPU_FTR_HPTE_TABLE | CPU_FTR_PPCAS_ARCH_V2 | CPU_FTR_CTRL | \ |
318 | CPU_FTR_MMCRA) | ||
314 | #define CPU_FTRS_PPC970 (CPU_FTR_SPLIT_ID_CACHE | CPU_FTR_USE_TB | \ | 319 | #define CPU_FTRS_PPC970 (CPU_FTR_SPLIT_ID_CACHE | CPU_FTR_USE_TB | \ |
315 | CPU_FTR_HPTE_TABLE | CPU_FTR_PPCAS_ARCH_V2 | \ | 320 | CPU_FTR_HPTE_TABLE | CPU_FTR_PPCAS_ARCH_V2 | CPU_FTR_CTRL | \ |
316 | CPU_FTR_ALTIVEC_COMP | CPU_FTR_CAN_NAP | CPU_FTR_MMCRA) | 321 | CPU_FTR_ALTIVEC_COMP | CPU_FTR_CAN_NAP | CPU_FTR_MMCRA) |
317 | #define CPU_FTRS_POWER5 (CPU_FTR_SPLIT_ID_CACHE | CPU_FTR_USE_TB | \ | 322 | #define CPU_FTRS_POWER5 (CPU_FTR_SPLIT_ID_CACHE | CPU_FTR_USE_TB | \ |
318 | CPU_FTR_HPTE_TABLE | CPU_FTR_PPCAS_ARCH_V2 | \ | 323 | CPU_FTR_HPTE_TABLE | CPU_FTR_PPCAS_ARCH_V2 | CPU_FTR_CTRL | \ |
319 | CPU_FTR_MMCRA | CPU_FTR_SMT | \ | 324 | CPU_FTR_MMCRA | CPU_FTR_SMT | \ |
320 | CPU_FTR_COHERENT_ICACHE | CPU_FTR_LOCKLESS_TLBIE | \ | 325 | CPU_FTR_COHERENT_ICACHE | CPU_FTR_LOCKLESS_TLBIE | \ |
321 | CPU_FTR_PURR) | 326 | CPU_FTR_PURR) |
322 | #define CPU_FTRS_POWER6 (CPU_FTR_SPLIT_ID_CACHE | CPU_FTR_USE_TB | \ | 327 | #define CPU_FTRS_POWER6 (CPU_FTR_SPLIT_ID_CACHE | CPU_FTR_USE_TB | \ |
323 | CPU_FTR_HPTE_TABLE | CPU_FTR_PPCAS_ARCH_V2 | \ | 328 | CPU_FTR_HPTE_TABLE | CPU_FTR_PPCAS_ARCH_V2 | CPU_FTR_CTRL | \ |
324 | CPU_FTR_MMCRA | CPU_FTR_SMT | \ | 329 | CPU_FTR_MMCRA | CPU_FTR_SMT | \ |
325 | CPU_FTR_COHERENT_ICACHE | CPU_FTR_LOCKLESS_TLBIE | \ | 330 | CPU_FTR_COHERENT_ICACHE | CPU_FTR_LOCKLESS_TLBIE | \ |
326 | CPU_FTR_PURR | CPU_FTR_CI_LARGE_PAGE | CPU_FTR_REAL_LE) | 331 | CPU_FTR_PURR | CPU_FTR_CI_LARGE_PAGE | CPU_FTR_REAL_LE) |
327 | #define CPU_FTRS_CELL (CPU_FTR_SPLIT_ID_CACHE | CPU_FTR_USE_TB | \ | 332 | #define CPU_FTRS_CELL (CPU_FTR_SPLIT_ID_CACHE | CPU_FTR_USE_TB | \ |
328 | CPU_FTR_HPTE_TABLE | CPU_FTR_PPCAS_ARCH_V2 | \ | 333 | CPU_FTR_HPTE_TABLE | CPU_FTR_PPCAS_ARCH_V2 | CPU_FTR_CTRL | \ |
329 | CPU_FTR_ALTIVEC_COMP | CPU_FTR_MMCRA | CPU_FTR_SMT | \ | 334 | CPU_FTR_ALTIVEC_COMP | CPU_FTR_MMCRA | CPU_FTR_SMT | \ |
330 | CPU_FTR_CTRL | CPU_FTR_PAUSE_ZERO | CPU_FTR_CI_LARGE_PAGE) | 335 | CPU_FTR_PAUSE_ZERO | CPU_FTR_CI_LARGE_PAGE) |
336 | #define CPU_FTRS_PA6T (CPU_FTR_SPLIT_ID_CACHE | CPU_FTR_USE_TB | \ | ||
337 | CPU_FTR_HPTE_TABLE | CPU_FTR_PPCAS_ARCH_V2 | \ | ||
338 | CPU_FTR_ALTIVEC_COMP | CPU_FTR_CI_LARGE_PAGE | \ | ||
339 | CPU_FTR_PURR | CPU_FTR_REAL_LE) | ||
331 | #define CPU_FTRS_COMPATIBLE (CPU_FTR_SPLIT_ID_CACHE | CPU_FTR_USE_TB | \ | 340 | #define CPU_FTRS_COMPATIBLE (CPU_FTR_SPLIT_ID_CACHE | CPU_FTR_USE_TB | \ |
332 | CPU_FTR_HPTE_TABLE | CPU_FTR_PPCAS_ARCH_V2) | 341 | CPU_FTR_HPTE_TABLE | CPU_FTR_PPCAS_ARCH_V2) |
333 | #endif | 342 | #endif |
@@ -336,7 +345,7 @@ extern void do_cpu_ftr_fixups(unsigned long offset); | |||
336 | #define CPU_FTRS_POSSIBLE \ | 345 | #define CPU_FTRS_POSSIBLE \ |
337 | (CPU_FTRS_POWER3 | CPU_FTRS_RS64 | CPU_FTRS_POWER4 | \ | 346 | (CPU_FTRS_POWER3 | CPU_FTRS_RS64 | CPU_FTRS_POWER4 | \ |
338 | CPU_FTRS_PPC970 | CPU_FTRS_POWER5 | CPU_FTRS_POWER6 | \ | 347 | CPU_FTRS_PPC970 | CPU_FTRS_POWER5 | CPU_FTRS_POWER6 | \ |
339 | CPU_FTRS_CELL | CPU_FTR_CI_LARGE_PAGE) | 348 | CPU_FTRS_CELL | CPU_FTRS_PA6T) |
340 | #else | 349 | #else |
341 | enum { | 350 | enum { |
342 | CPU_FTRS_POSSIBLE = | 351 | CPU_FTRS_POSSIBLE = |
@@ -375,7 +384,7 @@ enum { | |||
375 | #define CPU_FTRS_ALWAYS \ | 384 | #define CPU_FTRS_ALWAYS \ |
376 | (CPU_FTRS_POWER3 & CPU_FTRS_RS64 & CPU_FTRS_POWER4 & \ | 385 | (CPU_FTRS_POWER3 & CPU_FTRS_RS64 & CPU_FTRS_POWER4 & \ |
377 | CPU_FTRS_PPC970 & CPU_FTRS_POWER5 & CPU_FTRS_POWER6 & \ | 386 | CPU_FTRS_PPC970 & CPU_FTRS_POWER5 & CPU_FTRS_POWER6 & \ |
378 | CPU_FTRS_CELL & CPU_FTRS_POSSIBLE) | 387 | CPU_FTRS_CELL & CPU_FTRS_PA6T & CPU_FTRS_POSSIBLE) |
379 | #else | 388 | #else |
380 | enum { | 389 | enum { |
381 | CPU_FTRS_ALWAYS = | 390 | CPU_FTRS_ALWAYS = |
diff --git a/include/asm-powerpc/hvcall.h b/include/asm-powerpc/hvcall.h index 0d3c4e85711a..257d1cecb8c9 100644 --- a/include/asm-powerpc/hvcall.h +++ b/include/asm-powerpc/hvcall.h | |||
@@ -164,9 +164,15 @@ | |||
164 | #define H_VIO_SIGNAL 0x104 | 164 | #define H_VIO_SIGNAL 0x104 |
165 | #define H_SEND_CRQ 0x108 | 165 | #define H_SEND_CRQ 0x108 |
166 | #define H_COPY_RDMA 0x110 | 166 | #define H_COPY_RDMA 0x110 |
167 | #define H_REGISTER_LOGICAL_LAN 0x114 | ||
168 | #define H_FREE_LOGICAL_LAN 0x118 | ||
169 | #define H_ADD_LOGICAL_LAN_BUFFER 0x11C | ||
170 | #define H_SEND_LOGICAL_LAN 0x120 | ||
171 | #define H_MULTICAST_CTRL 0x130 | ||
167 | #define H_SET_XDABR 0x134 | 172 | #define H_SET_XDABR 0x134 |
168 | #define H_STUFF_TCE 0x138 | 173 | #define H_STUFF_TCE 0x138 |
169 | #define H_PUT_TCE_INDIRECT 0x13C | 174 | #define H_PUT_TCE_INDIRECT 0x13C |
175 | #define H_CHANGE_LOGICAL_LAN_MAC 0x14C | ||
170 | #define H_VTERM_PARTNER_INFO 0x150 | 176 | #define H_VTERM_PARTNER_INFO 0x150 |
171 | #define H_REGISTER_VTERM 0x154 | 177 | #define H_REGISTER_VTERM 0x154 |
172 | #define H_FREE_VTERM 0x158 | 178 | #define H_FREE_VTERM 0x158 |
@@ -196,102 +202,59 @@ | |||
196 | #define H_GET_HCA_INFO 0x1B8 | 202 | #define H_GET_HCA_INFO 0x1B8 |
197 | #define H_GET_PERF_COUNT 0x1BC | 203 | #define H_GET_PERF_COUNT 0x1BC |
198 | #define H_MANAGE_TRACE 0x1C0 | 204 | #define H_MANAGE_TRACE 0x1C0 |
205 | #define H_FREE_LOGICAL_LAN_BUFFER 0x1D4 | ||
199 | #define H_QUERY_INT_STATE 0x1E4 | 206 | #define H_QUERY_INT_STATE 0x1E4 |
200 | #define H_POLL_PENDING 0x1D8 | 207 | #define H_POLL_PENDING 0x1D8 |
201 | #define H_JOIN 0x298 | 208 | #define H_JOIN 0x298 |
202 | #define H_VASI_STATE 0x2A4 | 209 | #define H_VASI_STATE 0x2A4 |
203 | #define H_ENABLE_CRQ 0x2B0 | 210 | #define H_ENABLE_CRQ 0x2B0 |
211 | #define MAX_HCALL_OPCODE H_ENABLE_CRQ | ||
204 | 212 | ||
205 | #ifndef __ASSEMBLY__ | 213 | #ifndef __ASSEMBLY__ |
206 | 214 | ||
207 | /* plpar_hcall() -- Generic call interface using above opcodes | 215 | /** |
216 | * plpar_hcall_norets: - Make a pseries hypervisor call with no return arguments | ||
217 | * @opcode: The hypervisor call to make. | ||
208 | * | 218 | * |
209 | * The actual call interface is a hypervisor call instruction with | 219 | * This call supports up to 7 arguments and only returns the status of |
210 | * the opcode in R3 and input args in R4-R7. | 220 | * the hcall. Use this version where possible, its slightly faster than |
211 | * Status is returned in R3 with variable output values in R4-R11. | 221 | * the other plpar_hcalls. |
212 | * Only H_PTE_READ with H_READ_4 uses R6-R11 so we ignore it for now | ||
213 | * and return only two out args which MUST ALWAYS BE PROVIDED. | ||
214 | */ | ||
215 | long plpar_hcall(unsigned long opcode, | ||
216 | unsigned long arg1, | ||
217 | unsigned long arg2, | ||
218 | unsigned long arg3, | ||
219 | unsigned long arg4, | ||
220 | unsigned long *out1, | ||
221 | unsigned long *out2, | ||
222 | unsigned long *out3); | ||
223 | |||
224 | /* Same as plpar_hcall but for those opcodes that return no values | ||
225 | * other than status. Slightly more efficient. | ||
226 | */ | 222 | */ |
227 | long plpar_hcall_norets(unsigned long opcode, ...); | 223 | long plpar_hcall_norets(unsigned long opcode, ...); |
228 | 224 | ||
229 | /* | 225 | /** |
230 | * Special hcall interface for ibmveth support. | 226 | * plpar_hcall: - Make a pseries hypervisor call |
231 | * Takes 8 input parms. Returns a rc and stores the | 227 | * @opcode: The hypervisor call to make. |
232 | * R4 return value in *out1. | 228 | * @retbuf: Buffer to store up to 4 return arguments in. |
233 | */ | ||
234 | long plpar_hcall_8arg_2ret(unsigned long opcode, | ||
235 | unsigned long arg1, | ||
236 | unsigned long arg2, | ||
237 | unsigned long arg3, | ||
238 | unsigned long arg4, | ||
239 | unsigned long arg5, | ||
240 | unsigned long arg6, | ||
241 | unsigned long arg7, | ||
242 | unsigned long arg8, | ||
243 | unsigned long *out1); | ||
244 | |||
245 | /* plpar_hcall_4out() | ||
246 | * | 229 | * |
247 | * same as plpar_hcall except with 4 output arguments. | 230 | * This call supports up to 6 arguments and 4 return arguments. Use |
231 | * PLPAR_HCALL_BUFSIZE to size the return argument buffer. | ||
248 | * | 232 | * |
233 | * Used for all but the craziest of phyp interfaces (see plpar_hcall9) | ||
249 | */ | 234 | */ |
250 | long plpar_hcall_4out(unsigned long opcode, | 235 | #define PLPAR_HCALL_BUFSIZE 4 |
251 | unsigned long arg1, | 236 | long plpar_hcall(unsigned long opcode, unsigned long *retbuf, ...); |
252 | unsigned long arg2, | ||
253 | unsigned long arg3, | ||
254 | unsigned long arg4, | ||
255 | unsigned long *out1, | ||
256 | unsigned long *out2, | ||
257 | unsigned long *out3, | ||
258 | unsigned long *out4); | ||
259 | 237 | ||
260 | long plpar_hcall_7arg_7ret(unsigned long opcode, | 238 | /** |
261 | unsigned long arg1, | 239 | * plpar_hcall9: - Make a pseries hypervisor call with up to 9 return arguments |
262 | unsigned long arg2, | 240 | * @opcode: The hypervisor call to make. |
263 | unsigned long arg3, | 241 | * @retbuf: Buffer to store up to 9 return arguments in. |
264 | unsigned long arg4, | 242 | * |
265 | unsigned long arg5, | 243 | * This call supports up to 9 arguments and 9 return arguments. Use |
266 | unsigned long arg6, | 244 | * PLPAR_HCALL9_BUFSIZE to size the return argument buffer. |
267 | unsigned long arg7, | 245 | */ |
268 | unsigned long *out1, | 246 | #define PLPAR_HCALL9_BUFSIZE 9 |
269 | unsigned long *out2, | 247 | long plpar_hcall9(unsigned long opcode, unsigned long *retbuf, ...); |
270 | unsigned long *out3, | ||
271 | unsigned long *out4, | ||
272 | unsigned long *out5, | ||
273 | unsigned long *out6, | ||
274 | unsigned long *out7); | ||
275 | 248 | ||
276 | long plpar_hcall_9arg_9ret(unsigned long opcode, | 249 | /* For hcall instrumentation. One structure per-hcall, per-CPU */ |
277 | unsigned long arg1, | 250 | struct hcall_stats { |
278 | unsigned long arg2, | 251 | unsigned long num_calls; /* number of calls (on this CPU) */ |
279 | unsigned long arg3, | 252 | unsigned long tb_total; /* total wall time (mftb) of calls. */ |
280 | unsigned long arg4, | 253 | unsigned long purr_total; /* total cpu time (PURR) of calls. */ |
281 | unsigned long arg5, | 254 | }; |
282 | unsigned long arg6, | 255 | void update_hcall_stats(unsigned long opcode, unsigned long tb_delta, |
283 | unsigned long arg7, | 256 | unsigned long purr_delta); |
284 | unsigned long arg8, | 257 | #define HCALL_STAT_ARRAY_SIZE ((MAX_HCALL_OPCODE >> 2) + 1) |
285 | unsigned long arg9, | ||
286 | unsigned long *out1, | ||
287 | unsigned long *out2, | ||
288 | unsigned long *out3, | ||
289 | unsigned long *out4, | ||
290 | unsigned long *out5, | ||
291 | unsigned long *out6, | ||
292 | unsigned long *out7, | ||
293 | unsigned long *out8, | ||
294 | unsigned long *out9); | ||
295 | 258 | ||
296 | #endif /* __ASSEMBLY__ */ | 259 | #endif /* __ASSEMBLY__ */ |
297 | #endif /* __KERNEL__ */ | 260 | #endif /* __KERNEL__ */ |
diff --git a/include/asm-powerpc/ibmebus.h b/include/asm-powerpc/ibmebus.h index 7a42723d107c..7ab195a27888 100644 --- a/include/asm-powerpc/ibmebus.h +++ b/include/asm-powerpc/ibmebus.h | |||
@@ -48,7 +48,7 @@ extern struct dma_mapping_ops ibmebus_dma_ops; | |||
48 | extern struct bus_type ibmebus_bus_type; | 48 | extern struct bus_type ibmebus_bus_type; |
49 | 49 | ||
50 | struct ibmebus_dev { | 50 | struct ibmebus_dev { |
51 | char *name; | 51 | const char *name; |
52 | struct of_device ofdev; | 52 | struct of_device ofdev; |
53 | }; | 53 | }; |
54 | 54 | ||
diff --git a/include/asm-powerpc/ide.h b/include/asm-powerpc/ide.h index b09b42af6a1e..c8390f9485de 100644 --- a/include/asm-powerpc/ide.h +++ b/include/asm-powerpc/ide.h | |||
@@ -12,6 +12,7 @@ | |||
12 | #include <linux/sched.h> | 12 | #include <linux/sched.h> |
13 | #include <asm/mpc8xx.h> | 13 | #include <asm/mpc8xx.h> |
14 | #endif | 14 | #endif |
15 | #include <asm/io.h> | ||
15 | 16 | ||
16 | #ifndef MAX_HWIFS | 17 | #ifndef MAX_HWIFS |
17 | #ifdef __powerpc64__ | 18 | #ifdef __powerpc64__ |
@@ -21,15 +22,14 @@ | |||
21 | #endif | 22 | #endif |
22 | #endif | 23 | #endif |
23 | 24 | ||
25 | #define __ide_mm_insw(p, a, c) _insw_ns((volatile u16 __iomem *)(p), (a), (c)) | ||
26 | #define __ide_mm_insl(p, a, c) _insl_ns((volatile u32 __iomem *)(p), (a), (c)) | ||
27 | #define __ide_mm_outsw(p, a, c) _outsw_ns((volatile u16 __iomem *)(p), (a), (c)) | ||
28 | #define __ide_mm_outsl(p, a, c) _outsl_ns((volatile u32 __iomem *)(p), (a), (c)) | ||
29 | |||
24 | #ifndef __powerpc64__ | 30 | #ifndef __powerpc64__ |
25 | #include <linux/hdreg.h> | 31 | #include <linux/hdreg.h> |
26 | #include <linux/ioport.h> | 32 | #include <linux/ioport.h> |
27 | #include <asm/io.h> | ||
28 | |||
29 | extern void __ide_mm_insw(void __iomem *port, void *addr, u32 count); | ||
30 | extern void __ide_mm_outsw(void __iomem *port, void *addr, u32 count); | ||
31 | extern void __ide_mm_insl(void __iomem *port, void *addr, u32 count); | ||
32 | extern void __ide_mm_outsl(void __iomem *port, void *addr, u32 count); | ||
33 | 33 | ||
34 | struct ide_machdep_calls { | 34 | struct ide_machdep_calls { |
35 | int (*default_irq)(unsigned long base); | 35 | int (*default_irq)(unsigned long base); |
diff --git a/include/asm-powerpc/io.h b/include/asm-powerpc/io.h index 212428db0d8b..46bae1cf385b 100644 --- a/include/asm-powerpc/io.h +++ b/include/asm-powerpc/io.h | |||
@@ -20,20 +20,11 @@ extern int check_legacy_ioport(unsigned long base_port); | |||
20 | #include <asm/page.h> | 20 | #include <asm/page.h> |
21 | #include <asm/byteorder.h> | 21 | #include <asm/byteorder.h> |
22 | #include <asm/paca.h> | 22 | #include <asm/paca.h> |
23 | #ifdef CONFIG_PPC_ISERIES | ||
24 | #include <asm/iseries/iseries_io.h> | ||
25 | #endif | ||
26 | #include <asm/synch.h> | 23 | #include <asm/synch.h> |
27 | #include <asm/delay.h> | 24 | #include <asm/delay.h> |
28 | 25 | ||
29 | #include <asm-generic/iomap.h> | 26 | #include <asm-generic/iomap.h> |
30 | 27 | ||
31 | #define __ide_mm_insw(p, a, c) _insw_ns((volatile u16 __iomem *)(p), (a), (c)) | ||
32 | #define __ide_mm_insl(p, a, c) _insl_ns((volatile u32 __iomem *)(p), (a), (c)) | ||
33 | #define __ide_mm_outsw(p, a, c) _outsw_ns((volatile u16 __iomem *)(p), (a), (c)) | ||
34 | #define __ide_mm_outsl(p, a, c) _outsl_ns((volatile u32 __iomem *)(p), (a), (c)) | ||
35 | |||
36 | |||
37 | #define SIO_CONFIG_RA 0x398 | 28 | #define SIO_CONFIG_RA 0x398 |
38 | #define SIO_CONFIG_RD 0x399 | 29 | #define SIO_CONFIG_RD 0x399 |
39 | 30 | ||
@@ -43,42 +34,53 @@ extern unsigned long isa_io_base; | |||
43 | extern unsigned long pci_io_base; | 34 | extern unsigned long pci_io_base; |
44 | 35 | ||
45 | #ifdef CONFIG_PPC_ISERIES | 36 | #ifdef CONFIG_PPC_ISERIES |
46 | /* __raw_* accessors aren't supported on iSeries */ | 37 | |
47 | #define __raw_readb(addr) { BUG(); 0; } | 38 | extern int in_8(const volatile unsigned char __iomem *addr); |
48 | #define __raw_readw(addr) { BUG(); 0; } | 39 | extern void out_8(volatile unsigned char __iomem *addr, int val); |
49 | #define __raw_readl(addr) { BUG(); 0; } | 40 | extern int in_le16(const volatile unsigned short __iomem *addr); |
50 | #define __raw_readq(addr) { BUG(); 0; } | 41 | extern int in_be16(const volatile unsigned short __iomem *addr); |
51 | #define __raw_writeb(v, addr) { BUG(); 0; } | 42 | extern void out_le16(volatile unsigned short __iomem *addr, int val); |
52 | #define __raw_writew(v, addr) { BUG(); 0; } | 43 | extern void out_be16(volatile unsigned short __iomem *addr, int val); |
53 | #define __raw_writel(v, addr) { BUG(); 0; } | 44 | extern unsigned in_le32(const volatile unsigned __iomem *addr); |
54 | #define __raw_writeq(v, addr) { BUG(); 0; } | 45 | extern unsigned in_be32(const volatile unsigned __iomem *addr); |
55 | #define readb(addr) iSeries_Read_Byte(addr) | 46 | extern void out_le32(volatile unsigned __iomem *addr, int val); |
56 | #define readw(addr) iSeries_Read_Word(addr) | 47 | extern void out_be32(volatile unsigned __iomem *addr, int val); |
57 | #define readl(addr) iSeries_Read_Long(addr) | 48 | extern unsigned long in_le64(const volatile unsigned long __iomem *addr); |
58 | #define writeb(data, addr) iSeries_Write_Byte((data),(addr)) | 49 | extern unsigned long in_be64(const volatile unsigned long __iomem *addr); |
59 | #define writew(data, addr) iSeries_Write_Word((data),(addr)) | 50 | extern void out_le64(volatile unsigned long __iomem *addr, unsigned long val); |
60 | #define writel(data, addr) iSeries_Write_Long((data),(addr)) | 51 | extern void out_be64(volatile unsigned long __iomem *addr, unsigned long val); |
61 | #define memset_io(a,b,c) iSeries_memset_io((a),(b),(c)) | 52 | |
62 | #define memcpy_fromio(a,b,c) iSeries_memcpy_fromio((a), (b), (c)) | 53 | extern unsigned char __raw_readb(const volatile void __iomem *addr); |
63 | #define memcpy_toio(a,b,c) iSeries_memcpy_toio((a), (b), (c)) | 54 | extern unsigned short __raw_readw(const volatile void __iomem *addr); |
64 | 55 | extern unsigned int __raw_readl(const volatile void __iomem *addr); | |
65 | #define inb(addr) readb(((void __iomem *)(long)(addr))) | 56 | extern unsigned long __raw_readq(const volatile void __iomem *addr); |
66 | #define inw(addr) readw(((void __iomem *)(long)(addr))) | 57 | extern void __raw_writeb(unsigned char v, volatile void __iomem *addr); |
67 | #define inl(addr) readl(((void __iomem *)(long)(addr))) | 58 | extern void __raw_writew(unsigned short v, volatile void __iomem *addr); |
68 | #define outb(data,addr) writeb(data,((void __iomem *)(long)(addr))) | 59 | extern void __raw_writel(unsigned int v, volatile void __iomem *addr); |
69 | #define outw(data,addr) writew(data,((void __iomem *)(long)(addr))) | 60 | extern void __raw_writeq(unsigned long v, volatile void __iomem *addr); |
70 | #define outl(data,addr) writel(data,((void __iomem *)(long)(addr))) | 61 | |
71 | /* | 62 | extern void memset_io(volatile void __iomem *addr, int c, unsigned long n); |
72 | * The *_ns versions below don't do byte-swapping. | 63 | extern void memcpy_fromio(void *dest, const volatile void __iomem *src, |
73 | * Neither do the standard versions now, these are just here | 64 | unsigned long n); |
74 | * for older code. | 65 | extern void memcpy_toio(volatile void __iomem *dest, const void *src, |
75 | */ | 66 | unsigned long n); |
76 | #define insb(port, buf, ns) _insb((u8 __iomem *)((port)+pci_io_base), (buf), (ns)) | 67 | |
77 | #define insw(port, buf, ns) _insw_ns((u8 __iomem *)((port)+pci_io_base), (buf), (ns)) | 68 | #else /* CONFIG_PPC_ISERIES */ |
78 | #define insl(port, buf, nl) _insl_ns((u8 __iomem *)((port)+pci_io_base), (buf), (nl)) | 69 | |
79 | #define insw_ns(port, buf, ns) _insw_ns((u16 __iomem *)((port)+pci_io_base), (buf), (ns)) | 70 | #define in_8(addr) __in_8((addr)) |
80 | #define insl_ns(port, buf, nl) _insl_ns((u32 __iomem *)((port)+pci_io_base), (buf), (nl)) | 71 | #define out_8(addr, val) __out_8((addr), (val)) |
81 | #else | 72 | #define in_le16(addr) __in_le16((addr)) |
73 | #define in_be16(addr) __in_be16((addr)) | ||
74 | #define out_le16(addr, val) __out_le16((addr), (val)) | ||
75 | #define out_be16(addr, val) __out_be16((addr), (val)) | ||
76 | #define in_le32(addr) __in_le32((addr)) | ||
77 | #define in_be32(addr) __in_be32((addr)) | ||
78 | #define out_le32(addr, val) __out_le32((addr), (val)) | ||
79 | #define out_be32(addr, val) __out_be32((addr), (val)) | ||
80 | #define in_le64(addr) __in_le64((addr)) | ||
81 | #define in_be64(addr) __in_be64((addr)) | ||
82 | #define out_le64(addr, val) __out_le64((addr), (val)) | ||
83 | #define out_be64(addr, val) __out_be64((addr), (val)) | ||
82 | 84 | ||
83 | static inline unsigned char __raw_readb(const volatile void __iomem *addr) | 85 | static inline unsigned char __raw_readb(const volatile void __iomem *addr) |
84 | { | 86 | { |
@@ -112,23 +114,11 @@ static inline void __raw_writeq(unsigned long v, volatile void __iomem *addr) | |||
112 | { | 114 | { |
113 | *(volatile unsigned long __force *)addr = v; | 115 | *(volatile unsigned long __force *)addr = v; |
114 | } | 116 | } |
115 | #define readb(addr) eeh_readb(addr) | ||
116 | #define readw(addr) eeh_readw(addr) | ||
117 | #define readl(addr) eeh_readl(addr) | ||
118 | #define readq(addr) eeh_readq(addr) | ||
119 | #define writeb(data, addr) eeh_writeb((data), (addr)) | ||
120 | #define writew(data, addr) eeh_writew((data), (addr)) | ||
121 | #define writel(data, addr) eeh_writel((data), (addr)) | ||
122 | #define writeq(data, addr) eeh_writeq((data), (addr)) | ||
123 | #define memset_io(a,b,c) eeh_memset_io((a),(b),(c)) | 117 | #define memset_io(a,b,c) eeh_memset_io((a),(b),(c)) |
124 | #define memcpy_fromio(a,b,c) eeh_memcpy_fromio((a),(b),(c)) | 118 | #define memcpy_fromio(a,b,c) eeh_memcpy_fromio((a),(b),(c)) |
125 | #define memcpy_toio(a,b,c) eeh_memcpy_toio((a),(b),(c)) | 119 | #define memcpy_toio(a,b,c) eeh_memcpy_toio((a),(b),(c)) |
126 | #define inb(port) eeh_inb((unsigned long)port) | 120 | |
127 | #define outb(val, port) eeh_outb(val, (unsigned long)port) | 121 | #endif /* CONFIG_PPC_ISERIES */ |
128 | #define inw(port) eeh_inw((unsigned long)port) | ||
129 | #define outw(val, port) eeh_outw(val, (unsigned long)port) | ||
130 | #define inl(port) eeh_inl((unsigned long)port) | ||
131 | #define outl(val, port) eeh_outl(val, (unsigned long)port) | ||
132 | 122 | ||
133 | /* | 123 | /* |
134 | * The insw/outsw/insl/outsl macros don't do byte-swapping. | 124 | * The insw/outsw/insl/outsl macros don't do byte-swapping. |
@@ -138,30 +128,37 @@ static inline void __raw_writeq(unsigned long v, volatile void __iomem *addr) | |||
138 | #define insb(port, buf, ns) eeh_insb((port), (buf), (ns)) | 128 | #define insb(port, buf, ns) eeh_insb((port), (buf), (ns)) |
139 | #define insw(port, buf, ns) eeh_insw_ns((port), (buf), (ns)) | 129 | #define insw(port, buf, ns) eeh_insw_ns((port), (buf), (ns)) |
140 | #define insl(port, buf, nl) eeh_insl_ns((port), (buf), (nl)) | 130 | #define insl(port, buf, nl) eeh_insl_ns((port), (buf), (nl)) |
141 | #define insw_ns(port, buf, ns) eeh_insw_ns((port), (buf), (ns)) | ||
142 | #define insl_ns(port, buf, nl) eeh_insl_ns((port), (buf), (nl)) | ||
143 | |||
144 | #endif | ||
145 | 131 | ||
146 | #define outsb(port, buf, ns) _outsb((u8 __iomem *)((port)+pci_io_base), (buf), (ns)) | 132 | #define outsb(port, buf, ns) _outsb((u8 __iomem *)((port)+pci_io_base), (buf), (ns)) |
147 | #define outsw(port, buf, ns) _outsw_ns((u16 __iomem *)((port)+pci_io_base), (buf), (ns)) | 133 | #define outsw(port, buf, ns) _outsw_ns((u16 __iomem *)((port)+pci_io_base), (buf), (ns)) |
148 | #define outsl(port, buf, nl) _outsl_ns((u32 __iomem *)((port)+pci_io_base), (buf), (nl)) | 134 | #define outsl(port, buf, nl) _outsl_ns((u32 __iomem *)((port)+pci_io_base), (buf), (nl)) |
149 | 135 | ||
136 | #define readb(addr) eeh_readb(addr) | ||
137 | #define readw(addr) eeh_readw(addr) | ||
138 | #define readl(addr) eeh_readl(addr) | ||
139 | #define readq(addr) eeh_readq(addr) | ||
140 | #define writeb(data, addr) eeh_writeb((data), (addr)) | ||
141 | #define writew(data, addr) eeh_writew((data), (addr)) | ||
142 | #define writel(data, addr) eeh_writel((data), (addr)) | ||
143 | #define writeq(data, addr) eeh_writeq((data), (addr)) | ||
144 | #define inb(port) eeh_inb((unsigned long)port) | ||
145 | #define outb(val, port) eeh_outb(val, (unsigned long)port) | ||
146 | #define inw(port) eeh_inw((unsigned long)port) | ||
147 | #define outw(val, port) eeh_outw(val, (unsigned long)port) | ||
148 | #define inl(port) eeh_inl((unsigned long)port) | ||
149 | #define outl(val, port) eeh_outl(val, (unsigned long)port) | ||
150 | |||
150 | #define readb_relaxed(addr) readb(addr) | 151 | #define readb_relaxed(addr) readb(addr) |
151 | #define readw_relaxed(addr) readw(addr) | 152 | #define readw_relaxed(addr) readw(addr) |
152 | #define readl_relaxed(addr) readl(addr) | 153 | #define readl_relaxed(addr) readl(addr) |
153 | #define readq_relaxed(addr) readq(addr) | 154 | #define readq_relaxed(addr) readq(addr) |
154 | 155 | ||
155 | extern void _insb(volatile u8 __iomem *port, void *buf, int ns); | 156 | extern void _insb(volatile u8 __iomem *port, void *buf, long count); |
156 | extern void _outsb(volatile u8 __iomem *port, const void *buf, int ns); | 157 | extern void _outsb(volatile u8 __iomem *port, const void *buf, long count); |
157 | extern void _insw(volatile u16 __iomem *port, void *buf, int ns); | 158 | extern void _insw_ns(volatile u16 __iomem *port, void *buf, long count); |
158 | extern void _outsw(volatile u16 __iomem *port, const void *buf, int ns); | 159 | extern void _outsw_ns(volatile u16 __iomem *port, const void *buf, long count); |
159 | extern void _insl(volatile u32 __iomem *port, void *buf, int nl); | 160 | extern void _insl_ns(volatile u32 __iomem *port, void *buf, long count); |
160 | extern void _outsl(volatile u32 __iomem *port, const void *buf, int nl); | 161 | extern void _outsl_ns(volatile u32 __iomem *port, const void *buf, long count); |
161 | extern void _insw_ns(volatile u16 __iomem *port, void *buf, int ns); | ||
162 | extern void _outsw_ns(volatile u16 __iomem *port, const void *buf, int ns); | ||
163 | extern void _insl_ns(volatile u32 __iomem *port, void *buf, int nl); | ||
164 | extern void _outsl_ns(volatile u32 __iomem *port, const void *buf, int nl); | ||
165 | 162 | ||
166 | static inline void mmiowb(void) | 163 | static inline void mmiowb(void) |
167 | { | 164 | { |
@@ -180,14 +177,6 @@ static inline void mmiowb(void) | |||
180 | #define inl_p(port) inl(port) | 177 | #define inl_p(port) inl(port) |
181 | #define outl_p(val, port) (udelay(1), outl((val), (port))) | 178 | #define outl_p(val, port) (udelay(1), outl((val), (port))) |
182 | 179 | ||
183 | /* | ||
184 | * The *_ns versions below don't do byte-swapping. | ||
185 | * Neither do the standard versions now, these are just here | ||
186 | * for older code. | ||
187 | */ | ||
188 | #define outsw_ns(port, buf, ns) _outsw_ns((u16 __iomem *)((port)+pci_io_base), (buf), (ns)) | ||
189 | #define outsl_ns(port, buf, nl) _outsl_ns((u32 __iomem *)((port)+pci_io_base), (buf), (nl)) | ||
190 | |||
191 | 180 | ||
192 | #define IO_SPACE_LIMIT ~(0UL) | 181 | #define IO_SPACE_LIMIT ~(0UL) |
193 | 182 | ||
@@ -279,7 +268,7 @@ static inline void iosync(void) | |||
279 | * and should not be used directly by device drivers. Use inb/readb | 268 | * and should not be used directly by device drivers. Use inb/readb |
280 | * instead. | 269 | * instead. |
281 | */ | 270 | */ |
282 | static inline int in_8(const volatile unsigned char __iomem *addr) | 271 | static inline int __in_8(const volatile unsigned char __iomem *addr) |
283 | { | 272 | { |
284 | int ret; | 273 | int ret; |
285 | 274 | ||
@@ -288,14 +277,14 @@ static inline int in_8(const volatile unsigned char __iomem *addr) | |||
288 | return ret; | 277 | return ret; |
289 | } | 278 | } |
290 | 279 | ||
291 | static inline void out_8(volatile unsigned char __iomem *addr, int val) | 280 | static inline void __out_8(volatile unsigned char __iomem *addr, int val) |
292 | { | 281 | { |
293 | __asm__ __volatile__("sync; stb%U0%X0 %1,%0" | 282 | __asm__ __volatile__("sync; stb%U0%X0 %1,%0" |
294 | : "=m" (*addr) : "r" (val)); | 283 | : "=m" (*addr) : "r" (val)); |
295 | get_paca()->io_sync = 1; | 284 | get_paca()->io_sync = 1; |
296 | } | 285 | } |
297 | 286 | ||
298 | static inline int in_le16(const volatile unsigned short __iomem *addr) | 287 | static inline int __in_le16(const volatile unsigned short __iomem *addr) |
299 | { | 288 | { |
300 | int ret; | 289 | int ret; |
301 | 290 | ||
@@ -304,7 +293,7 @@ static inline int in_le16(const volatile unsigned short __iomem *addr) | |||
304 | return ret; | 293 | return ret; |
305 | } | 294 | } |
306 | 295 | ||
307 | static inline int in_be16(const volatile unsigned short __iomem *addr) | 296 | static inline int __in_be16(const volatile unsigned short __iomem *addr) |
308 | { | 297 | { |
309 | int ret; | 298 | int ret; |
310 | 299 | ||
@@ -313,21 +302,21 @@ static inline int in_be16(const volatile unsigned short __iomem *addr) | |||
313 | return ret; | 302 | return ret; |
314 | } | 303 | } |
315 | 304 | ||
316 | static inline void out_le16(volatile unsigned short __iomem *addr, int val) | 305 | static inline void __out_le16(volatile unsigned short __iomem *addr, int val) |
317 | { | 306 | { |
318 | __asm__ __volatile__("sync; sthbrx %1,0,%2" | 307 | __asm__ __volatile__("sync; sthbrx %1,0,%2" |
319 | : "=m" (*addr) : "r" (val), "r" (addr)); | 308 | : "=m" (*addr) : "r" (val), "r" (addr)); |
320 | get_paca()->io_sync = 1; | 309 | get_paca()->io_sync = 1; |
321 | } | 310 | } |
322 | 311 | ||
323 | static inline void out_be16(volatile unsigned short __iomem *addr, int val) | 312 | static inline void __out_be16(volatile unsigned short __iomem *addr, int val) |
324 | { | 313 | { |
325 | __asm__ __volatile__("sync; sth%U0%X0 %1,%0" | 314 | __asm__ __volatile__("sync; sth%U0%X0 %1,%0" |
326 | : "=m" (*addr) : "r" (val)); | 315 | : "=m" (*addr) : "r" (val)); |
327 | get_paca()->io_sync = 1; | 316 | get_paca()->io_sync = 1; |
328 | } | 317 | } |
329 | 318 | ||
330 | static inline unsigned in_le32(const volatile unsigned __iomem *addr) | 319 | static inline unsigned __in_le32(const volatile unsigned __iomem *addr) |
331 | { | 320 | { |
332 | unsigned ret; | 321 | unsigned ret; |
333 | 322 | ||
@@ -336,7 +325,7 @@ static inline unsigned in_le32(const volatile unsigned __iomem *addr) | |||
336 | return ret; | 325 | return ret; |
337 | } | 326 | } |
338 | 327 | ||
339 | static inline unsigned in_be32(const volatile unsigned __iomem *addr) | 328 | static inline unsigned __in_be32(const volatile unsigned __iomem *addr) |
340 | { | 329 | { |
341 | unsigned ret; | 330 | unsigned ret; |
342 | 331 | ||
@@ -345,21 +334,21 @@ static inline unsigned in_be32(const volatile unsigned __iomem *addr) | |||
345 | return ret; | 334 | return ret; |
346 | } | 335 | } |
347 | 336 | ||
348 | static inline void out_le32(volatile unsigned __iomem *addr, int val) | 337 | static inline void __out_le32(volatile unsigned __iomem *addr, int val) |
349 | { | 338 | { |
350 | __asm__ __volatile__("sync; stwbrx %1,0,%2" : "=m" (*addr) | 339 | __asm__ __volatile__("sync; stwbrx %1,0,%2" : "=m" (*addr) |
351 | : "r" (val), "r" (addr)); | 340 | : "r" (val), "r" (addr)); |
352 | get_paca()->io_sync = 1; | 341 | get_paca()->io_sync = 1; |
353 | } | 342 | } |
354 | 343 | ||
355 | static inline void out_be32(volatile unsigned __iomem *addr, int val) | 344 | static inline void __out_be32(volatile unsigned __iomem *addr, int val) |
356 | { | 345 | { |
357 | __asm__ __volatile__("sync; stw%U0%X0 %1,%0" | 346 | __asm__ __volatile__("sync; stw%U0%X0 %1,%0" |
358 | : "=m" (*addr) : "r" (val)); | 347 | : "=m" (*addr) : "r" (val)); |
359 | get_paca()->io_sync = 1; | 348 | get_paca()->io_sync = 1; |
360 | } | 349 | } |
361 | 350 | ||
362 | static inline unsigned long in_le64(const volatile unsigned long __iomem *addr) | 351 | static inline unsigned long __in_le64(const volatile unsigned long __iomem *addr) |
363 | { | 352 | { |
364 | unsigned long tmp, ret; | 353 | unsigned long tmp, ret; |
365 | 354 | ||
@@ -379,7 +368,7 @@ static inline unsigned long in_le64(const volatile unsigned long __iomem *addr) | |||
379 | return ret; | 368 | return ret; |
380 | } | 369 | } |
381 | 370 | ||
382 | static inline unsigned long in_be64(const volatile unsigned long __iomem *addr) | 371 | static inline unsigned long __in_be64(const volatile unsigned long __iomem *addr) |
383 | { | 372 | { |
384 | unsigned long ret; | 373 | unsigned long ret; |
385 | 374 | ||
@@ -388,7 +377,7 @@ static inline unsigned long in_be64(const volatile unsigned long __iomem *addr) | |||
388 | return ret; | 377 | return ret; |
389 | } | 378 | } |
390 | 379 | ||
391 | static inline void out_le64(volatile unsigned long __iomem *addr, unsigned long val) | 380 | static inline void __out_le64(volatile unsigned long __iomem *addr, unsigned long val) |
392 | { | 381 | { |
393 | unsigned long tmp; | 382 | unsigned long tmp; |
394 | 383 | ||
@@ -406,15 +395,13 @@ static inline void out_le64(volatile unsigned long __iomem *addr, unsigned long | |||
406 | get_paca()->io_sync = 1; | 395 | get_paca()->io_sync = 1; |
407 | } | 396 | } |
408 | 397 | ||
409 | static inline void out_be64(volatile unsigned long __iomem *addr, unsigned long val) | 398 | static inline void __out_be64(volatile unsigned long __iomem *addr, unsigned long val) |
410 | { | 399 | { |
411 | __asm__ __volatile__("sync; std%U0%X0 %1,%0" : "=m" (*addr) : "r" (val)); | 400 | __asm__ __volatile__("sync; std%U0%X0 %1,%0" : "=m" (*addr) : "r" (val)); |
412 | get_paca()->io_sync = 1; | 401 | get_paca()->io_sync = 1; |
413 | } | 402 | } |
414 | 403 | ||
415 | #ifndef CONFIG_PPC_ISERIES | ||
416 | #include <asm/eeh.h> | 404 | #include <asm/eeh.h> |
417 | #endif | ||
418 | 405 | ||
419 | /** | 406 | /** |
420 | * check_signature - find BIOS signatures | 407 | * check_signature - find BIOS signatures |
@@ -430,7 +417,6 @@ static inline int check_signature(const volatile void __iomem * io_addr, | |||
430 | const unsigned char *signature, int length) | 417 | const unsigned char *signature, int length) |
431 | { | 418 | { |
432 | int retval = 0; | 419 | int retval = 0; |
433 | #ifndef CONFIG_PPC_ISERIES | ||
434 | do { | 420 | do { |
435 | if (readb(io_addr) != *signature) | 421 | if (readb(io_addr) != *signature) |
436 | goto out; | 422 | goto out; |
@@ -440,7 +426,6 @@ static inline int check_signature(const volatile void __iomem * io_addr, | |||
440 | } while (length); | 426 | } while (length); |
441 | retval = 1; | 427 | retval = 1; |
442 | out: | 428 | out: |
443 | #endif | ||
444 | return retval; | 429 | return retval; |
445 | } | 430 | } |
446 | 431 | ||
diff --git a/include/asm-powerpc/irq.h b/include/asm-powerpc/irq.h index d903a62959da..4da41efb1319 100644 --- a/include/asm-powerpc/irq.h +++ b/include/asm-powerpc/irq.h | |||
@@ -137,7 +137,7 @@ struct irq_map_entry { | |||
137 | extern struct irq_map_entry irq_map[NR_IRQS]; | 137 | extern struct irq_map_entry irq_map[NR_IRQS]; |
138 | 138 | ||
139 | 139 | ||
140 | /*** | 140 | /** |
141 | * irq_alloc_host - Allocate a new irq_host data structure | 141 | * irq_alloc_host - Allocate a new irq_host data structure |
142 | * @node: device-tree node of the interrupt controller | 142 | * @node: device-tree node of the interrupt controller |
143 | * @revmap_type: type of reverse mapping to use | 143 | * @revmap_type: type of reverse mapping to use |
@@ -159,14 +159,14 @@ extern struct irq_host *irq_alloc_host(unsigned int revmap_type, | |||
159 | irq_hw_number_t inval_irq); | 159 | irq_hw_number_t inval_irq); |
160 | 160 | ||
161 | 161 | ||
162 | /*** | 162 | /** |
163 | * irq_find_host - Locates a host for a given device node | 163 | * irq_find_host - Locates a host for a given device node |
164 | * @node: device-tree node of the interrupt controller | 164 | * @node: device-tree node of the interrupt controller |
165 | */ | 165 | */ |
166 | extern struct irq_host *irq_find_host(struct device_node *node); | 166 | extern struct irq_host *irq_find_host(struct device_node *node); |
167 | 167 | ||
168 | 168 | ||
169 | /*** | 169 | /** |
170 | * irq_set_default_host - Set a "default" host | 170 | * irq_set_default_host - Set a "default" host |
171 | * @host: default host pointer | 171 | * @host: default host pointer |
172 | * | 172 | * |
@@ -178,7 +178,7 @@ extern struct irq_host *irq_find_host(struct device_node *node); | |||
178 | extern void irq_set_default_host(struct irq_host *host); | 178 | extern void irq_set_default_host(struct irq_host *host); |
179 | 179 | ||
180 | 180 | ||
181 | /*** | 181 | /** |
182 | * irq_set_virq_count - Set the maximum number of virt irqs | 182 | * irq_set_virq_count - Set the maximum number of virt irqs |
183 | * @count: number of linux virtual irqs, capped with NR_IRQS | 183 | * @count: number of linux virtual irqs, capped with NR_IRQS |
184 | * | 184 | * |
@@ -188,7 +188,7 @@ extern void irq_set_default_host(struct irq_host *host); | |||
188 | extern void irq_set_virq_count(unsigned int count); | 188 | extern void irq_set_virq_count(unsigned int count); |
189 | 189 | ||
190 | 190 | ||
191 | /*** | 191 | /** |
192 | * irq_create_mapping - Map a hardware interrupt into linux virq space | 192 | * irq_create_mapping - Map a hardware interrupt into linux virq space |
193 | * @host: host owning this hardware interrupt or NULL for default host | 193 | * @host: host owning this hardware interrupt or NULL for default host |
194 | * @hwirq: hardware irq number in that host space | 194 | * @hwirq: hardware irq number in that host space |
@@ -202,13 +202,13 @@ extern unsigned int irq_create_mapping(struct irq_host *host, | |||
202 | irq_hw_number_t hwirq); | 202 | irq_hw_number_t hwirq); |
203 | 203 | ||
204 | 204 | ||
205 | /*** | 205 | /** |
206 | * irq_dispose_mapping - Unmap an interrupt | 206 | * irq_dispose_mapping - Unmap an interrupt |
207 | * @virq: linux virq number of the interrupt to unmap | 207 | * @virq: linux virq number of the interrupt to unmap |
208 | */ | 208 | */ |
209 | extern void irq_dispose_mapping(unsigned int virq); | 209 | extern void irq_dispose_mapping(unsigned int virq); |
210 | 210 | ||
211 | /*** | 211 | /** |
212 | * irq_find_mapping - Find a linux virq from an hw irq number. | 212 | * irq_find_mapping - Find a linux virq from an hw irq number. |
213 | * @host: host owning this hardware interrupt | 213 | * @host: host owning this hardware interrupt |
214 | * @hwirq: hardware irq number in that host space | 214 | * @hwirq: hardware irq number in that host space |
@@ -221,7 +221,7 @@ extern unsigned int irq_find_mapping(struct irq_host *host, | |||
221 | irq_hw_number_t hwirq); | 221 | irq_hw_number_t hwirq); |
222 | 222 | ||
223 | 223 | ||
224 | /*** | 224 | /** |
225 | * irq_radix_revmap - Find a linux virq from a hw irq number. | 225 | * irq_radix_revmap - Find a linux virq from a hw irq number. |
226 | * @host: host owning this hardware interrupt | 226 | * @host: host owning this hardware interrupt |
227 | * @hwirq: hardware irq number in that host space | 227 | * @hwirq: hardware irq number in that host space |
@@ -232,7 +232,7 @@ extern unsigned int irq_find_mapping(struct irq_host *host, | |||
232 | extern unsigned int irq_radix_revmap(struct irq_host *host, | 232 | extern unsigned int irq_radix_revmap(struct irq_host *host, |
233 | irq_hw_number_t hwirq); | 233 | irq_hw_number_t hwirq); |
234 | 234 | ||
235 | /*** | 235 | /** |
236 | * irq_linear_revmap - Find a linux virq from a hw irq number. | 236 | * irq_linear_revmap - Find a linux virq from a hw irq number. |
237 | * @host: host owning this hardware interrupt | 237 | * @host: host owning this hardware interrupt |
238 | * @hwirq: hardware irq number in that host space | 238 | * @hwirq: hardware irq number in that host space |
@@ -247,7 +247,7 @@ extern unsigned int irq_linear_revmap(struct irq_host *host, | |||
247 | 247 | ||
248 | 248 | ||
249 | 249 | ||
250 | /*** | 250 | /** |
251 | * irq_alloc_virt - Allocate virtual irq numbers | 251 | * irq_alloc_virt - Allocate virtual irq numbers |
252 | * @host: host owning these new virtual irqs | 252 | * @host: host owning these new virtual irqs |
253 | * @count: number of consecutive numbers to allocate | 253 | * @count: number of consecutive numbers to allocate |
@@ -261,7 +261,7 @@ extern unsigned int irq_alloc_virt(struct irq_host *host, | |||
261 | unsigned int count, | 261 | unsigned int count, |
262 | unsigned int hint); | 262 | unsigned int hint); |
263 | 263 | ||
264 | /*** | 264 | /** |
265 | * irq_free_virt - Free virtual irq numbers | 265 | * irq_free_virt - Free virtual irq numbers |
266 | * @virq: virtual irq number of the first interrupt to free | 266 | * @virq: virtual irq number of the first interrupt to free |
267 | * @count: number of interrupts to free | 267 | * @count: number of interrupts to free |
@@ -300,7 +300,7 @@ extern unsigned int irq_of_parse_and_map(struct device_node *dev, int index); | |||
300 | 300 | ||
301 | /* -- End OF helpers -- */ | 301 | /* -- End OF helpers -- */ |
302 | 302 | ||
303 | /*** | 303 | /** |
304 | * irq_early_init - Init irq remapping subsystem | 304 | * irq_early_init - Init irq remapping subsystem |
305 | */ | 305 | */ |
306 | extern void irq_early_init(void); | 306 | extern void irq_early_init(void); |
diff --git a/include/asm-powerpc/iseries/hv_call_xm.h b/include/asm-powerpc/iseries/hv_call_xm.h index ca9202cb01ed..392ac3f54df0 100644 --- a/include/asm-powerpc/iseries/hv_call_xm.h +++ b/include/asm-powerpc/iseries/hv_call_xm.h | |||
@@ -16,23 +16,6 @@ | |||
16 | #define HvCallXmSetTce HvCallXm + 11 | 16 | #define HvCallXmSetTce HvCallXm + 11 |
17 | #define HvCallXmSetTces HvCallXm + 13 | 17 | #define HvCallXmSetTces HvCallXm + 13 |
18 | 18 | ||
19 | /* | ||
20 | * Structure passed to HvCallXm_getTceTableParms | ||
21 | */ | ||
22 | struct iommu_table_cb { | ||
23 | unsigned long itc_busno; /* Bus number for this tce table */ | ||
24 | unsigned long itc_start; /* Will be NULL for secondary */ | ||
25 | unsigned long itc_totalsize; /* Size (in pages) of whole table */ | ||
26 | unsigned long itc_offset; /* Index into real tce table of the | ||
27 | start of our section */ | ||
28 | unsigned long itc_size; /* Size (in pages) of our section */ | ||
29 | unsigned long itc_index; /* Index of this tce table */ | ||
30 | unsigned short itc_maxtables; /* Max num of tables for partition */ | ||
31 | unsigned char itc_virtbus; /* Flag to indicate virtual bus */ | ||
32 | unsigned char itc_slotno; /* IOA Tce Slot Index */ | ||
33 | unsigned char itc_rsvd[4]; | ||
34 | }; | ||
35 | |||
36 | static inline void HvCallXm_getTceTableParms(u64 cb) | 19 | static inline void HvCallXm_getTceTableParms(u64 cb) |
37 | { | 20 | { |
38 | HvCall1(HvCallXmGetTceTableParms, cb); | 21 | HvCall1(HvCallXmGetTceTableParms, cb); |
diff --git a/include/asm-powerpc/iseries/hv_lp_config.h b/include/asm-powerpc/iseries/hv_lp_config.h index df8b20739719..a006fd1e4a2c 100644 --- a/include/asm-powerpc/iseries/hv_lp_config.h +++ b/include/asm-powerpc/iseries/hv_lp_config.h | |||
@@ -25,7 +25,6 @@ | |||
25 | 25 | ||
26 | #include <asm/iseries/hv_call_sc.h> | 26 | #include <asm/iseries/hv_call_sc.h> |
27 | #include <asm/iseries/hv_types.h> | 27 | #include <asm/iseries/hv_types.h> |
28 | #include <asm/iseries/it_lp_naca.h> | ||
29 | 28 | ||
30 | enum { | 29 | enum { |
31 | HvCallCfg_Cur = 0, | 30 | HvCallCfg_Cur = 0, |
@@ -44,16 +43,8 @@ enum { | |||
44 | #define HvCallCfgGetHostingLpIndex HvCallCfg + 32 | 43 | #define HvCallCfgGetHostingLpIndex HvCallCfg + 32 |
45 | 44 | ||
46 | extern HvLpIndex HvLpConfig_getLpIndex_outline(void); | 45 | extern HvLpIndex HvLpConfig_getLpIndex_outline(void); |
47 | 46 | extern HvLpIndex HvLpConfig_getLpIndex(void); | |
48 | static inline HvLpIndex HvLpConfig_getLpIndex(void) | 47 | extern HvLpIndex HvLpConfig_getPrimaryLpIndex(void); |
49 | { | ||
50 | return itLpNaca.xLpIndex; | ||
51 | } | ||
52 | |||
53 | static inline HvLpIndex HvLpConfig_getPrimaryLpIndex(void) | ||
54 | { | ||
55 | return itLpNaca.xPrimaryLpIndex; | ||
56 | } | ||
57 | 48 | ||
58 | static inline u64 HvLpConfig_getMsChunks(void) | 49 | static inline u64 HvLpConfig_getMsChunks(void) |
59 | { | 50 | { |
diff --git a/include/asm-powerpc/iseries/iseries_io.h b/include/asm-powerpc/iseries/iseries_io.h deleted file mode 100644 index f29009bd63c9..000000000000 --- a/include/asm-powerpc/iseries/iseries_io.h +++ /dev/null | |||
@@ -1,60 +0,0 @@ | |||
1 | #ifndef _ASM_POWERPC_ISERIES_ISERIES_IO_H | ||
2 | #define _ASM_POWERPC_ISERIES_ISERIES_IO_H | ||
3 | |||
4 | |||
5 | #ifdef CONFIG_PPC_ISERIES | ||
6 | #include <linux/types.h> | ||
7 | /* | ||
8 | * Created by Allan Trautman on Thu Dec 28 2000. | ||
9 | * | ||
10 | * Remaps the io.h for the iSeries Io | ||
11 | * Copyright (C) 2000 Allan H Trautman, IBM Corporation | ||
12 | * | ||
13 | * This program is free software; you can redistribute it and/or modify | ||
14 | * it under the terms of the GNU General Public License as published by | ||
15 | * the Free Software Foundation; either version 2 of the License, or | ||
16 | * (at your option) any later version. | ||
17 | * | ||
18 | * This program is distributed in the hope that it will be useful, | ||
19 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
20 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
21 | * GNU General Public License for more details. | ||
22 | * | ||
23 | * You should have received a copy of the GNU General Public License | ||
24 | * along with this program; if not, write to the: | ||
25 | * Free Software Foundation, Inc., | ||
26 | * 59 Temple Place, Suite 330, | ||
27 | * Boston, MA 02111-1307 USA | ||
28 | * | ||
29 | * Change Activity: | ||
30 | * Created December 28, 2000 | ||
31 | * End Change Activity | ||
32 | */ | ||
33 | |||
34 | #ifdef CONFIG_PCI | ||
35 | extern u8 iSeries_Read_Byte(const volatile void __iomem * IoAddress); | ||
36 | extern u16 iSeries_Read_Word(const volatile void __iomem * IoAddress); | ||
37 | extern u32 iSeries_Read_Long(const volatile void __iomem * IoAddress); | ||
38 | extern void iSeries_Write_Byte(u8 IoData, volatile void __iomem * IoAddress); | ||
39 | extern void iSeries_Write_Word(u16 IoData, volatile void __iomem * IoAddress); | ||
40 | extern void iSeries_Write_Long(u32 IoData, volatile void __iomem * IoAddress); | ||
41 | |||
42 | extern void iSeries_memset_io(volatile void __iomem *dest, char x, size_t n); | ||
43 | extern void iSeries_memcpy_toio(volatile void __iomem *dest, void *source, | ||
44 | size_t n); | ||
45 | extern void iSeries_memcpy_fromio(void *dest, | ||
46 | const volatile void __iomem *source, size_t n); | ||
47 | #else | ||
48 | static inline u8 iSeries_Read_Byte(const volatile void __iomem *IoAddress) | ||
49 | { | ||
50 | return 0xff; | ||
51 | } | ||
52 | |||
53 | static inline void iSeries_Write_Byte(u8 IoData, | ||
54 | volatile void __iomem *IoAddress) | ||
55 | { | ||
56 | } | ||
57 | #endif /* CONFIG_PCI */ | ||
58 | |||
59 | #endif /* CONFIG_PPC_ISERIES */ | ||
60 | #endif /* _ASM_POWERPC_ISERIES_ISERIES_IO_H */ | ||
diff --git a/include/asm-powerpc/iseries/it_exp_vpd_panel.h b/include/asm-powerpc/iseries/it_exp_vpd_panel.h deleted file mode 100644 index 304a609ae21a..000000000000 --- a/include/asm-powerpc/iseries/it_exp_vpd_panel.h +++ /dev/null | |||
@@ -1,51 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2002 Dave Boutcher IBM Corporation | ||
3 | * | ||
4 | * This program is free software; you can redistribute it and/or modify | ||
5 | * it under the terms of the GNU General Public License as published by | ||
6 | * the Free Software Foundation; either version 2 of the License, or | ||
7 | * (at your option) any later version. | ||
8 | * | ||
9 | * This program is distributed in the hope that it will be useful, | ||
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
12 | * GNU General Public License for more details. | ||
13 | * | ||
14 | * You should have received a copy of the GNU General Public License | ||
15 | * along with this program; if not, write to the Free Software | ||
16 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
17 | */ | ||
18 | #ifndef _ASM_POWERPC_ISERIES_IT_EXT_VPD_PANEL_H | ||
19 | #define _ASM_POWERPC_ISERIES_IT_EXT_VPD_PANEL_H | ||
20 | |||
21 | /* | ||
22 | * This struct maps the panel information | ||
23 | * | ||
24 | * Warning: | ||
25 | * This data must match the architecture for the panel information | ||
26 | */ | ||
27 | |||
28 | #include <asm/types.h> | ||
29 | |||
30 | struct ItExtVpdPanel { | ||
31 | /* Definition of the Extended Vpd On Panel Data Area */ | ||
32 | char systemSerial[8]; | ||
33 | char mfgID[4]; | ||
34 | char reserved1[24]; | ||
35 | char machineType[4]; | ||
36 | char systemID[6]; | ||
37 | char somUniqueCnt[4]; | ||
38 | char serialNumberCount; | ||
39 | char reserved2[7]; | ||
40 | u16 bbu3; | ||
41 | u16 bbu2; | ||
42 | u16 bbu1; | ||
43 | char xLocationLabel[8]; | ||
44 | u8 xRsvd1[6]; | ||
45 | u16 xFrameId; | ||
46 | u8 xRsvd2[48]; | ||
47 | }; | ||
48 | |||
49 | extern struct ItExtVpdPanel xItExtVpdPanel; | ||
50 | |||
51 | #endif /* _ASM_POWERPC_ISERIES_IT_EXT_VPD_PANEL_H */ | ||
diff --git a/include/asm-powerpc/iseries/it_lp_naca.h b/include/asm-powerpc/iseries/it_lp_naca.h deleted file mode 100644 index 4fdcf052927f..000000000000 --- a/include/asm-powerpc/iseries/it_lp_naca.h +++ /dev/null | |||
@@ -1,80 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2001 Mike Corrigan IBM Corporation | ||
3 | * | ||
4 | * This program is free software; you can redistribute it and/or modify | ||
5 | * it under the terms of the GNU General Public License as published by | ||
6 | * the Free Software Foundation; either version 2 of the License, or | ||
7 | * (at your option) any later version. | ||
8 | * | ||
9 | * This program is distributed in the hope that it will be useful, | ||
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
12 | * GNU General Public License for more details. | ||
13 | * | ||
14 | * You should have received a copy of the GNU General Public License | ||
15 | * along with this program; if not, write to the Free Software | ||
16 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
17 | */ | ||
18 | #ifndef _ASM_POWERPC_ISERIES_IT_LP_NACA_H | ||
19 | #define _ASM_POWERPC_ISERIES_IT_LP_NACA_H | ||
20 | |||
21 | #include <linux/types.h> | ||
22 | |||
23 | /* | ||
24 | * This control block contains the data that is shared between the | ||
25 | * hypervisor (PLIC) and the OS. | ||
26 | */ | ||
27 | |||
28 | struct ItLpNaca { | ||
29 | // CACHE_LINE_1 0x0000 - 0x007F Contains read-only data | ||
30 | u32 xDesc; // Eye catcher x00-x03 | ||
31 | u16 xSize; // Size of this class x04-x05 | ||
32 | u16 xIntHdlrOffset; // Offset to IntHdlr array x06-x07 | ||
33 | u8 xMaxIntHdlrEntries; // Number of entries in array x08-x08 | ||
34 | u8 xPrimaryLpIndex; // LP Index of Primary x09-x09 | ||
35 | u8 xServiceLpIndex; // LP Ind of Service Focal Pointx0A-x0A | ||
36 | u8 xLpIndex; // LP Index x0B-x0B | ||
37 | u16 xMaxLpQueues; // Number of allocated queues x0C-x0D | ||
38 | u16 xLpQueueOffset; // Offset to start of LP queues x0E-x0F | ||
39 | u8 xPirEnvironMode; // Piranha or hardware x10-x10 | ||
40 | u8 xPirConsoleMode; // Piranha console indicator x11-x11 | ||
41 | u8 xPirDasdMode; // Piranha dasd indicator x12-x12 | ||
42 | u8 xRsvd1_0[5]; // Reserved for Piranha related x13-x17 | ||
43 | u8 flags; // flags, see below x18-x1F | ||
44 | u8 xSpVpdFormat; // VPD areas are in CSP format ... | ||
45 | u8 xIntProcRatio; // Ratio of int procs to procs ... | ||
46 | u8 xRsvd1_2[5]; // Reserved ... | ||
47 | u16 xRsvd1_3; // Reserved x20-x21 | ||
48 | u16 xPlicVrmIndex; // VRM index of PLIC x22-x23 | ||
49 | u16 xMinSupportedSlicVrmInd;// Min supported OS VRM index x24-x25 | ||
50 | u16 xMinCompatableSlicVrmInd;// Min compatible OS VRM index x26-x27 | ||
51 | u64 xLoadAreaAddr; // ER address of load area x28-x2F | ||
52 | u32 xLoadAreaChunks; // Chunks for the load area x30-x33 | ||
53 | u32 xPaseSysCallCRMask; // Mask used to test CR before x34-x37 | ||
54 | // doing an ASR switch on PASE | ||
55 | // system call. | ||
56 | u64 xSlicSegmentTablePtr; // Pointer to Slic seg table. x38-x3f | ||
57 | u8 xRsvd1_4[64]; // x40-x7F | ||
58 | |||
59 | // CACHE_LINE_2 0x0080 - 0x00FF Contains local read-write data | ||
60 | u8 xRsvd2_0[128]; // Reserved x00-x7F | ||
61 | |||
62 | // CACHE_LINE_3-6 0x0100 - 0x02FF Contains LP Queue indicators | ||
63 | // NB: Padding required to keep xInterrruptHdlr at x300 which is required | ||
64 | // for v4r4 PLIC. | ||
65 | u8 xOldLpQueue[128]; // LP Queue needed for v4r4 100-17F | ||
66 | u8 xRsvd3_0[384]; // Reserved 180-2FF | ||
67 | |||
68 | // CACHE_LINE_7-8 0x0300 - 0x03FF Contains the address of the OS interrupt | ||
69 | // handlers | ||
70 | u64 xInterruptHdlr[32]; // Interrupt handlers 300-x3FF | ||
71 | }; | ||
72 | |||
73 | extern struct ItLpNaca itLpNaca; | ||
74 | |||
75 | #define ITLPNACA_LPAR 0x80 /* Is LPAR installed on the system */ | ||
76 | #define ITLPNACA_PARTITIONED 0x40 /* Is the system partitioned */ | ||
77 | #define ITLPNACA_HWSYNCEDTBS 0x20 /* Hardware synced TBs */ | ||
78 | #define ITLPNACA_HMTINT 0x10 /* Utilize MHT for interrupts */ | ||
79 | |||
80 | #endif /* _ASM_POWERPC_ISERIES_IT_LP_NACA_H */ | ||
diff --git a/include/asm-powerpc/iseries/it_lp_queue.h b/include/asm-powerpc/iseries/it_lp_queue.h index 284c5a7db3ac..3f6814769295 100644 --- a/include/asm-powerpc/iseries/it_lp_queue.h +++ b/include/asm-powerpc/iseries/it_lp_queue.h | |||
@@ -27,8 +27,6 @@ | |||
27 | #include <asm/types.h> | 27 | #include <asm/types.h> |
28 | #include <asm/ptrace.h> | 28 | #include <asm/ptrace.h> |
29 | 29 | ||
30 | struct HvLpEvent; | ||
31 | |||
32 | #define IT_LP_MAX_QUEUES 8 | 30 | #define IT_LP_MAX_QUEUES 8 |
33 | 31 | ||
34 | #define IT_LP_NOT_USED 0 /* Queue will not be used by PLIC */ | 32 | #define IT_LP_NOT_USED 0 /* Queue will not be used by PLIC */ |
diff --git a/include/asm-powerpc/iseries/vio.h b/include/asm-powerpc/iseries/vio.h index 72a97d37aac3..7a95d296abd1 100644 --- a/include/asm-powerpc/iseries/vio.h +++ b/include/asm-powerpc/iseries/vio.h | |||
@@ -122,6 +122,34 @@ enum viorc { | |||
122 | viorc_openRejected = 0x0301 | 122 | viorc_openRejected = 0x0301 |
123 | }; | 123 | }; |
124 | 124 | ||
125 | /* | ||
126 | * The structure of the events that flow between us and OS/400 for chario | ||
127 | * events. You can't mess with this unless the OS/400 side changes too. | ||
128 | */ | ||
129 | struct viocharlpevent { | ||
130 | struct HvLpEvent event; | ||
131 | u32 reserved; | ||
132 | u16 version; | ||
133 | u16 subtype_result_code; | ||
134 | u8 virtual_device; | ||
135 | u8 len; | ||
136 | u8 data[VIOCHAR_MAX_DATA]; | ||
137 | }; | ||
138 | |||
139 | #define VIOCHAR_WINDOW 10 | ||
140 | |||
141 | enum viocharsubtype { | ||
142 | viocharopen = 0x0001, | ||
143 | viocharclose = 0x0002, | ||
144 | viochardata = 0x0003, | ||
145 | viocharack = 0x0004, | ||
146 | viocharconfig = 0x0005 | ||
147 | }; | ||
148 | |||
149 | enum viochar_rc { | ||
150 | viochar_rc_ebusy = 1 | ||
151 | }; | ||
152 | |||
125 | struct device; | 153 | struct device; |
126 | 154 | ||
127 | extern struct device *iSeries_vio_dev; | 155 | extern struct device *iSeries_vio_dev; |
diff --git a/include/asm-powerpc/libata-portmap.h b/include/asm-powerpc/libata-portmap.h new file mode 100644 index 000000000000..75484ef0c743 --- /dev/null +++ b/include/asm-powerpc/libata-portmap.h | |||
@@ -0,0 +1 @@ | |||
#include <asm-generic/libata-portmap.h> | |||
diff --git a/include/asm-powerpc/lppaca.h b/include/asm-powerpc/lppaca.h index 4dc514aabfe7..821ea0c512b4 100644 --- a/include/asm-powerpc/lppaca.h +++ b/include/asm-powerpc/lppaca.h | |||
@@ -27,7 +27,9 @@ | |||
27 | // | 27 | // |
28 | // | 28 | // |
29 | //---------------------------------------------------------------------------- | 29 | //---------------------------------------------------------------------------- |
30 | #include <linux/cache.h> | ||
30 | #include <asm/types.h> | 31 | #include <asm/types.h> |
32 | #include <asm/mmu.h> | ||
31 | 33 | ||
32 | /* The Hypervisor barfs if the lppaca crosses a page boundary. A 1k | 34 | /* The Hypervisor barfs if the lppaca crosses a page boundary. A 1k |
33 | * alignment is sufficient to prevent this */ | 35 | * alignment is sufficient to prevent this */ |
@@ -114,7 +116,7 @@ struct lppaca { | |||
114 | 116 | ||
115 | 117 | ||
116 | //============================================================================= | 118 | //============================================================================= |
117 | // CACHE_LINE_3 0x0100 - 0x007F: This line is shared with other processors | 119 | // CACHE_LINE_3 0x0100 - 0x017F: This line is shared with other processors |
118 | //============================================================================= | 120 | //============================================================================= |
119 | // This is the yield_count. An "odd" value (low bit on) means that | 121 | // This is the yield_count. An "odd" value (low bit on) means that |
120 | // the processor is yielded (either because of an OS yield or a PLIC | 122 | // the processor is yielded (either because of an OS yield or a PLIC |
@@ -126,12 +128,29 @@ struct lppaca { | |||
126 | u8 reserved6[124]; // Reserved x04-x7F | 128 | u8 reserved6[124]; // Reserved x04-x7F |
127 | 129 | ||
128 | //============================================================================= | 130 | //============================================================================= |
129 | // CACHE_LINE_4-5 0x0100 - 0x01FF Contains PMC interrupt data | 131 | // CACHE_LINE_4-5 0x0180 - 0x027F Contains PMC interrupt data |
130 | //============================================================================= | 132 | //============================================================================= |
131 | u8 pmc_save_area[256]; // PMC interrupt Area x00-xFF | 133 | u8 pmc_save_area[256]; // PMC interrupt Area x00-xFF |
132 | } __attribute__((__aligned__(0x400))); | 134 | } __attribute__((__aligned__(0x400))); |
133 | 135 | ||
134 | extern struct lppaca lppaca[]; | 136 | extern struct lppaca lppaca[]; |
135 | 137 | ||
138 | /* | ||
139 | * SLB shadow buffer structure as defined in the PAPR. The save_area | ||
140 | * contains adjacent ESID and VSID pairs for each shadowed SLB. The | ||
141 | * ESID is stored in the lower 64bits, then the VSID. | ||
142 | */ | ||
143 | struct slb_shadow { | ||
144 | u32 persistent; // Number of persistent SLBs x00-x03 | ||
145 | u32 buffer_length; // Total shadow buffer length x04-x07 | ||
146 | u64 reserved; // Alignment x08-x0f | ||
147 | struct { | ||
148 | u64 esid; | ||
149 | u64 vsid; | ||
150 | } save_area[SLB_NUM_BOLTED]; // x10-x40 | ||
151 | } ____cacheline_aligned; | ||
152 | |||
153 | extern struct slb_shadow slb_shadow[]; | ||
154 | |||
136 | #endif /* __KERNEL__ */ | 155 | #endif /* __KERNEL__ */ |
137 | #endif /* _ASM_POWERPC_LPPACA_H */ | 156 | #endif /* _ASM_POWERPC_LPPACA_H */ |
diff --git a/include/asm-powerpc/paca.h b/include/asm-powerpc/paca.h index 3d5d590bc4b0..0a4e5c93e8e6 100644 --- a/include/asm-powerpc/paca.h +++ b/include/asm-powerpc/paca.h | |||
@@ -23,6 +23,7 @@ | |||
23 | register struct paca_struct *local_paca asm("r13"); | 23 | register struct paca_struct *local_paca asm("r13"); |
24 | #define get_paca() local_paca | 24 | #define get_paca() local_paca |
25 | #define get_lppaca() (get_paca()->lppaca_ptr) | 25 | #define get_lppaca() (get_paca()->lppaca_ptr) |
26 | #define get_slb_shadow() (get_paca()->slb_shadow_ptr) | ||
26 | 27 | ||
27 | struct task_struct; | 28 | struct task_struct; |
28 | 29 | ||
@@ -99,6 +100,8 @@ struct paca_struct { | |||
99 | u64 user_time; /* accumulated usermode TB ticks */ | 100 | u64 user_time; /* accumulated usermode TB ticks */ |
100 | u64 system_time; /* accumulated system TB ticks */ | 101 | u64 system_time; /* accumulated system TB ticks */ |
101 | u64 startpurr; /* PURR/TB value snapshot */ | 102 | u64 startpurr; /* PURR/TB value snapshot */ |
103 | |||
104 | struct slb_shadow *slb_shadow_ptr; | ||
102 | }; | 105 | }; |
103 | 106 | ||
104 | extern struct paca_struct paca[]; | 107 | extern struct paca_struct paca[]; |
diff --git a/include/asm-powerpc/page.h b/include/asm-powerpc/page.h index fb597b37c2a2..b4d38b0b15f8 100644 --- a/include/asm-powerpc/page.h +++ b/include/asm-powerpc/page.h | |||
@@ -55,12 +55,6 @@ | |||
55 | #define PAGE_OFFSET ASM_CONST(CONFIG_KERNEL_START) | 55 | #define PAGE_OFFSET ASM_CONST(CONFIG_KERNEL_START) |
56 | #define KERNELBASE (PAGE_OFFSET + PHYSICAL_START) | 56 | #define KERNELBASE (PAGE_OFFSET + PHYSICAL_START) |
57 | 57 | ||
58 | #ifdef CONFIG_DISCONTIGMEM | ||
59 | #define page_to_pfn(page) discontigmem_page_to_pfn(page) | ||
60 | #define pfn_to_page(pfn) discontigmem_pfn_to_page(pfn) | ||
61 | #define pfn_valid(pfn) discontigmem_pfn_valid(pfn) | ||
62 | #endif | ||
63 | |||
64 | #ifdef CONFIG_FLATMEM | 58 | #ifdef CONFIG_FLATMEM |
65 | #define pfn_valid(pfn) ((pfn) < max_mapnr) | 59 | #define pfn_valid(pfn) ((pfn) < max_mapnr) |
66 | #endif | 60 | #endif |
diff --git a/include/asm-powerpc/ppc-pci.h b/include/asm-powerpc/ppc-pci.h index cf79bc7ebb55..1115756c79f9 100644 --- a/include/asm-powerpc/ppc-pci.h +++ b/include/asm-powerpc/ppc-pci.h | |||
@@ -69,6 +69,17 @@ struct pci_dev *pci_get_device_by_addr(unsigned long addr); | |||
69 | void eeh_slot_error_detail (struct pci_dn *pdn, int severity); | 69 | void eeh_slot_error_detail (struct pci_dn *pdn, int severity); |
70 | 70 | ||
71 | /** | 71 | /** |
72 | * rtas_pci_enableo - enable IO transfers for this slot | ||
73 | * @pdn: pci device node | ||
74 | * @function: either EEH_THAW_MMIO or EEH_THAW_DMA | ||
75 | * | ||
76 | * Enable I/O transfers to this slot | ||
77 | */ | ||
78 | #define EEH_THAW_MMIO 2 | ||
79 | #define EEH_THAW_DMA 3 | ||
80 | int rtas_pci_enable(struct pci_dn *pdn, int function); | ||
81 | |||
82 | /** | ||
72 | * rtas_set_slot_reset -- unfreeze a frozen slot | 83 | * rtas_set_slot_reset -- unfreeze a frozen slot |
73 | * | 84 | * |
74 | * Clear the EEH-frozen condition on a slot. This routine | 85 | * Clear the EEH-frozen condition on a slot. This routine |
diff --git a/include/asm-powerpc/processor.h b/include/asm-powerpc/processor.h index 22e54a2a6604..6cb6fb19e57f 100644 --- a/include/asm-powerpc/processor.h +++ b/include/asm-powerpc/processor.h | |||
@@ -32,6 +32,7 @@ | |||
32 | #define _CHRP_Motorola 0x04 /* motorola chrp, the cobra */ | 32 | #define _CHRP_Motorola 0x04 /* motorola chrp, the cobra */ |
33 | #define _CHRP_IBM 0x05 /* IBM chrp, the longtrail and longtrail 2 */ | 33 | #define _CHRP_IBM 0x05 /* IBM chrp, the longtrail and longtrail 2 */ |
34 | #define _CHRP_Pegasos 0x06 /* Genesi/bplan's Pegasos and Pegasos2 */ | 34 | #define _CHRP_Pegasos 0x06 /* Genesi/bplan's Pegasos and Pegasos2 */ |
35 | #define _CHRP_briq 0x07 /* TotalImpact's briQ */ | ||
35 | 36 | ||
36 | #if defined(__KERNEL__) && defined(CONFIG_PPC32) | 37 | #if defined(__KERNEL__) && defined(CONFIG_PPC32) |
37 | 38 | ||
diff --git a/include/asm-powerpc/prom.h b/include/asm-powerpc/prom.h index d0fa1b9aed35..524629769336 100644 --- a/include/asm-powerpc/prom.h +++ b/include/asm-powerpc/prom.h | |||
@@ -72,8 +72,8 @@ struct property { | |||
72 | }; | 72 | }; |
73 | 73 | ||
74 | struct device_node { | 74 | struct device_node { |
75 | char *name; | 75 | const char *name; |
76 | char *type; | 76 | const char *type; |
77 | phandle node; | 77 | phandle node; |
78 | phandle linux_phandle; | 78 | phandle linux_phandle; |
79 | char *full_name; | 79 | char *full_name; |
@@ -160,7 +160,7 @@ extern void unflatten_device_tree(void); | |||
160 | extern void early_init_devtree(void *); | 160 | extern void early_init_devtree(void *); |
161 | extern int device_is_compatible(struct device_node *device, const char *); | 161 | extern int device_is_compatible(struct device_node *device, const char *); |
162 | extern int machine_is_compatible(const char *compat); | 162 | extern int machine_is_compatible(const char *compat); |
163 | extern void *get_property(struct device_node *node, const char *name, | 163 | extern const void *get_property(struct device_node *node, const char *name, |
164 | int *lenp); | 164 | int *lenp); |
165 | extern void print_properties(struct device_node *node); | 165 | extern void print_properties(struct device_node *node); |
166 | extern int prom_n_addr_cells(struct device_node* np); | 166 | extern int prom_n_addr_cells(struct device_node* np); |
@@ -197,8 +197,8 @@ extern int release_OF_resource(struct device_node* node, int index); | |||
197 | */ | 197 | */ |
198 | 198 | ||
199 | 199 | ||
200 | /* Helper to read a big number */ | 200 | /* Helper to read a big number; size is in cells (not bytes) */ |
201 | static inline u64 of_read_number(u32 *cell, int size) | 201 | static inline u64 of_read_number(const u32 *cell, int size) |
202 | { | 202 | { |
203 | u64 r = 0; | 203 | u64 r = 0; |
204 | while (size--) | 204 | while (size--) |
@@ -206,18 +206,28 @@ static inline u64 of_read_number(u32 *cell, int size) | |||
206 | return r; | 206 | return r; |
207 | } | 207 | } |
208 | 208 | ||
209 | /* Like of_read_number, but we want an unsigned long result */ | ||
210 | #ifdef CONFIG_PPC32 | ||
211 | static inline unsigned long of_read_ulong(const u32 *cell, int size) | ||
212 | { | ||
213 | return cell[size-1]; | ||
214 | } | ||
215 | #else | ||
216 | #define of_read_ulong(cell, size) of_read_number(cell, size) | ||
217 | #endif | ||
218 | |||
209 | /* Translate an OF address block into a CPU physical address | 219 | /* Translate an OF address block into a CPU physical address |
210 | */ | 220 | */ |
211 | #define OF_BAD_ADDR ((u64)-1) | 221 | #define OF_BAD_ADDR ((u64)-1) |
212 | extern u64 of_translate_address(struct device_node *np, u32 *addr); | 222 | extern u64 of_translate_address(struct device_node *np, const u32 *addr); |
213 | 223 | ||
214 | /* Extract an address from a device, returns the region size and | 224 | /* Extract an address from a device, returns the region size and |
215 | * the address space flags too. The PCI version uses a BAR number | 225 | * the address space flags too. The PCI version uses a BAR number |
216 | * instead of an absolute index | 226 | * instead of an absolute index |
217 | */ | 227 | */ |
218 | extern u32 *of_get_address(struct device_node *dev, int index, | 228 | extern const u32 *of_get_address(struct device_node *dev, int index, |
219 | u64 *size, unsigned int *flags); | 229 | u64 *size, unsigned int *flags); |
220 | extern u32 *of_get_pci_address(struct device_node *dev, int bar_no, | 230 | extern const u32 *of_get_pci_address(struct device_node *dev, int bar_no, |
221 | u64 *size, unsigned int *flags); | 231 | u64 *size, unsigned int *flags); |
222 | 232 | ||
223 | /* Get an address as a resource. Note that if your address is | 233 | /* Get an address as a resource. Note that if your address is |
@@ -234,7 +244,7 @@ extern int of_pci_address_to_resource(struct device_node *dev, int bar, | |||
234 | /* Parse the ibm,dma-window property of an OF node into the busno, phys and | 244 | /* Parse the ibm,dma-window property of an OF node into the busno, phys and |
235 | * size parameters. | 245 | * size parameters. |
236 | */ | 246 | */ |
237 | void of_parse_dma_window(struct device_node *dn, unsigned char *dma_window_prop, | 247 | void of_parse_dma_window(struct device_node *dn, const void *dma_window_prop, |
238 | unsigned long *busno, unsigned long *phys, unsigned long *size); | 248 | unsigned long *busno, unsigned long *phys, unsigned long *size); |
239 | 249 | ||
240 | extern void kdump_move_device_tree(void); | 250 | extern void kdump_move_device_tree(void); |
@@ -259,7 +269,7 @@ struct of_irq { | |||
259 | u32 specifier[OF_MAX_IRQ_SPEC]; /* Specifier copy */ | 269 | u32 specifier[OF_MAX_IRQ_SPEC]; /* Specifier copy */ |
260 | }; | 270 | }; |
261 | 271 | ||
262 | /*** | 272 | /** |
263 | * of_irq_map_init - Initialize the irq remapper | 273 | * of_irq_map_init - Initialize the irq remapper |
264 | * @flags: flags defining workarounds to enable | 274 | * @flags: flags defining workarounds to enable |
265 | * | 275 | * |
@@ -272,7 +282,7 @@ struct of_irq { | |||
272 | 282 | ||
273 | extern void of_irq_map_init(unsigned int flags); | 283 | extern void of_irq_map_init(unsigned int flags); |
274 | 284 | ||
275 | /*** | 285 | /** |
276 | * of_irq_map_raw - Low level interrupt tree parsing | 286 | * of_irq_map_raw - Low level interrupt tree parsing |
277 | * @parent: the device interrupt parent | 287 | * @parent: the device interrupt parent |
278 | * @intspec: interrupt specifier ("interrupts" property of the device) | 288 | * @intspec: interrupt specifier ("interrupts" property of the device) |
@@ -289,12 +299,12 @@ extern void of_irq_map_init(unsigned int flags); | |||
289 | * | 299 | * |
290 | */ | 300 | */ |
291 | 301 | ||
292 | extern int of_irq_map_raw(struct device_node *parent, u32 *intspec, | 302 | extern int of_irq_map_raw(struct device_node *parent, const u32 *intspec, |
293 | u32 ointsize, u32 *addr, | 303 | u32 ointsize, const u32 *addr, |
294 | struct of_irq *out_irq); | 304 | struct of_irq *out_irq); |
295 | 305 | ||
296 | 306 | ||
297 | /*** | 307 | /** |
298 | * of_irq_map_one - Resolve an interrupt for a device | 308 | * of_irq_map_one - Resolve an interrupt for a device |
299 | * @device: the device whose interrupt is to be resolved | 309 | * @device: the device whose interrupt is to be resolved |
300 | * @index: index of the interrupt to resolve | 310 | * @index: index of the interrupt to resolve |
@@ -307,7 +317,7 @@ extern int of_irq_map_raw(struct device_node *parent, u32 *intspec, | |||
307 | extern int of_irq_map_one(struct device_node *device, int index, | 317 | extern int of_irq_map_one(struct device_node *device, int index, |
308 | struct of_irq *out_irq); | 318 | struct of_irq *out_irq); |
309 | 319 | ||
310 | /*** | 320 | /** |
311 | * of_irq_map_pci - Resolve the interrupt for a PCI device | 321 | * of_irq_map_pci - Resolve the interrupt for a PCI device |
312 | * @pdev: the device whose interrupt is to be resolved | 322 | * @pdev: the device whose interrupt is to be resolved |
313 | * @out_irq: structure of_irq filled by this function | 323 | * @out_irq: structure of_irq filled by this function |
diff --git a/include/asm-powerpc/ptrace.h b/include/asm-powerpc/ptrace.h index dc4cb9cc73a1..4435efe85d0e 100644 --- a/include/asm-powerpc/ptrace.h +++ b/include/asm-powerpc/ptrace.h | |||
@@ -215,12 +215,10 @@ do { \ | |||
215 | #define PTRACE_GETVRREGS 18 | 215 | #define PTRACE_GETVRREGS 18 |
216 | #define PTRACE_SETVRREGS 19 | 216 | #define PTRACE_SETVRREGS 19 |
217 | 217 | ||
218 | #ifndef __powerpc64__ | ||
219 | /* Get/set all the upper 32-bits of the SPE registers, accumulator, and | 218 | /* Get/set all the upper 32-bits of the SPE registers, accumulator, and |
220 | * spefscr, in one go */ | 219 | * spefscr, in one go */ |
221 | #define PTRACE_GETEVRREGS 20 | 220 | #define PTRACE_GETEVRREGS 20 |
222 | #define PTRACE_SETEVRREGS 21 | 221 | #define PTRACE_SETEVRREGS 21 |
223 | #endif /* __powerpc64__ */ | ||
224 | 222 | ||
225 | /* | 223 | /* |
226 | * Get or set a debug register. The first 16 are DABR registers and the | 224 | * Get or set a debug register. The first 16 are DABR registers and the |
@@ -235,7 +233,6 @@ do { \ | |||
235 | #define PPC_PTRACE_GETFPREGS 0x97 /* Get FPRs 0 - 31 */ | 233 | #define PPC_PTRACE_GETFPREGS 0x97 /* Get FPRs 0 - 31 */ |
236 | #define PPC_PTRACE_SETFPREGS 0x96 /* Set FPRs 0 - 31 */ | 234 | #define PPC_PTRACE_SETFPREGS 0x96 /* Set FPRs 0 - 31 */ |
237 | 235 | ||
238 | #ifdef __powerpc64__ | ||
239 | /* Calls to trace a 64bit program from a 32bit program */ | 236 | /* Calls to trace a 64bit program from a 32bit program */ |
240 | #define PPC_PTRACE_PEEKTEXT_3264 0x95 | 237 | #define PPC_PTRACE_PEEKTEXT_3264 0x95 |
241 | #define PPC_PTRACE_PEEKDATA_3264 0x94 | 238 | #define PPC_PTRACE_PEEKDATA_3264 0x94 |
@@ -243,6 +240,5 @@ do { \ | |||
243 | #define PPC_PTRACE_POKEDATA_3264 0x92 | 240 | #define PPC_PTRACE_POKEDATA_3264 0x92 |
244 | #define PPC_PTRACE_PEEKUSR_3264 0x91 | 241 | #define PPC_PTRACE_PEEKUSR_3264 0x91 |
245 | #define PPC_PTRACE_POKEUSR_3264 0x90 | 242 | #define PPC_PTRACE_POKEUSR_3264 0x90 |
246 | #endif /* __powerpc64__ */ | ||
247 | 243 | ||
248 | #endif /* _ASM_POWERPC_PTRACE_H */ | 244 | #endif /* _ASM_POWERPC_PTRACE_H */ |
diff --git a/include/asm-powerpc/reg.h b/include/asm-powerpc/reg.h index cf73475a0c69..3a9fcc15811b 100644 --- a/include/asm-powerpc/reg.h +++ b/include/asm-powerpc/reg.h | |||
@@ -592,6 +592,7 @@ | |||
592 | #define PV_630p 0x0041 | 592 | #define PV_630p 0x0041 |
593 | #define PV_970MP 0x0044 | 593 | #define PV_970MP 0x0044 |
594 | #define PV_BE 0x0070 | 594 | #define PV_BE 0x0070 |
595 | #define PV_PA6T 0x0090 | ||
595 | 596 | ||
596 | /* | 597 | /* |
597 | * Number of entries in the SLB. If this ever changes we should handle | 598 | * Number of entries in the SLB. If this ever changes we should handle |
diff --git a/include/asm-powerpc/rtas.h b/include/asm-powerpc/rtas.h index 82a27e9a041f..d34f9e1f242c 100644 --- a/include/asm-powerpc/rtas.h +++ b/include/asm-powerpc/rtas.h | |||
@@ -230,5 +230,21 @@ extern unsigned long rtas_rmo_buf; | |||
230 | 230 | ||
231 | #define GLOBAL_INTERRUPT_QUEUE 9005 | 231 | #define GLOBAL_INTERRUPT_QUEUE 9005 |
232 | 232 | ||
233 | /** | ||
234 | * rtas_config_addr - Format a busno, devfn and reg for RTAS. | ||
235 | * @busno: The bus number. | ||
236 | * @devfn: The device and function number as encoded by PCI_DEVFN(). | ||
237 | * @reg: The register number. | ||
238 | * | ||
239 | * This function encodes the given busno, devfn and register number as | ||
240 | * required for RTAS calls that take a "config_addr" parameter. | ||
241 | * See PAPR requirement 7.3.4-1 for more info. | ||
242 | */ | ||
243 | static inline u32 rtas_config_addr(int busno, int devfn, int reg) | ||
244 | { | ||
245 | return ((reg & 0xf00) << 20) | ((busno & 0xff) << 16) | | ||
246 | (devfn << 8) | (reg & 0xff); | ||
247 | } | ||
248 | |||
233 | #endif /* __KERNEL__ */ | 249 | #endif /* __KERNEL__ */ |
234 | #endif /* _POWERPC_RTAS_H */ | 250 | #endif /* _POWERPC_RTAS_H */ |
diff --git a/include/asm-powerpc/smu.h b/include/asm-powerpc/smu.h index 51e65fc46a03..e49f644ca63a 100644 --- a/include/asm-powerpc/smu.h +++ b/include/asm-powerpc/smu.h | |||
@@ -517,7 +517,7 @@ struct smu_sdbp_cpupiddata { | |||
517 | * This returns the pointer to an SMU "sdb" partition data or NULL | 517 | * This returns the pointer to an SMU "sdb" partition data or NULL |
518 | * if not found. The data format is described below | 518 | * if not found. The data format is described below |
519 | */ | 519 | */ |
520 | extern struct smu_sdbp_header *smu_get_sdb_partition(int id, | 520 | extern const struct smu_sdbp_header *smu_get_sdb_partition(int id, |
521 | unsigned int *size); | 521 | unsigned int *size); |
522 | 522 | ||
523 | /* Get "sdb" partition data from an SMU satellite */ | 523 | /* Get "sdb" partition data from an SMU satellite */ |
diff --git a/include/asm-powerpc/spu.h b/include/asm-powerpc/spu.h index c02d105d8294..b42b53c40f5d 100644 --- a/include/asm-powerpc/spu.h +++ b/include/asm-powerpc/spu.h | |||
@@ -106,7 +106,7 @@ struct spu_context; | |||
106 | struct spu_runqueue; | 106 | struct spu_runqueue; |
107 | 107 | ||
108 | struct spu { | 108 | struct spu { |
109 | char *name; | 109 | const char *name; |
110 | unsigned long local_store_phys; | 110 | unsigned long local_store_phys; |
111 | u8 *local_store; | 111 | u8 *local_store; |
112 | unsigned long problem_phys; | 112 | unsigned long problem_phys; |
diff --git a/include/asm-powerpc/system.h b/include/asm-powerpc/system.h index 4c9f5229e833..4b41deaa8d8d 100644 --- a/include/asm-powerpc/system.h +++ b/include/asm-powerpc/system.h | |||
@@ -177,11 +177,6 @@ extern u32 booke_wdt_enabled; | |||
177 | extern u32 booke_wdt_period; | 177 | extern u32 booke_wdt_period; |
178 | #endif /* CONFIG_BOOKE_WDT */ | 178 | #endif /* CONFIG_BOOKE_WDT */ |
179 | 179 | ||
180 | /* EBCDIC -> ASCII conversion for [0-9A-Z] on iSeries */ | ||
181 | extern unsigned char e2a(unsigned char); | ||
182 | extern unsigned char* strne2a(unsigned char *dest, | ||
183 | const unsigned char *src, size_t n); | ||
184 | |||
185 | struct device_node; | 180 | struct device_node; |
186 | extern void note_scsi_host(struct device_node *, void *); | 181 | extern void note_scsi_host(struct device_node *, void *); |
187 | 182 | ||
diff --git a/include/asm-powerpc/vio.h b/include/asm-powerpc/vio.h index dc9bd101ca14..4b51d42e1419 100644 --- a/include/asm-powerpc/vio.h +++ b/include/asm-powerpc/vio.h | |||
@@ -46,8 +46,8 @@ struct iommu_table; | |||
46 | */ | 46 | */ |
47 | struct vio_dev { | 47 | struct vio_dev { |
48 | struct iommu_table *iommu_table; /* vio_map_* uses this */ | 48 | struct iommu_table *iommu_table; /* vio_map_* uses this */ |
49 | char *name; | 49 | const char *name; |
50 | char *type; | 50 | const char *type; |
51 | uint32_t unit_address; | 51 | uint32_t unit_address; |
52 | unsigned int irq; | 52 | unsigned int irq; |
53 | struct device dev; | 53 | struct device dev; |
diff --git a/include/asm-ppc/ibm4xx.h b/include/asm-ppc/ibm4xx.h index cf62b69cb69a..499c14691c71 100644 --- a/include/asm-ppc/ibm4xx.h +++ b/include/asm-ppc/ibm4xx.h | |||
@@ -86,7 +86,7 @@ void ppc4xx_init(unsigned long r3, unsigned long r4, unsigned long r5, | |||
86 | #define PCI_DRAM_OFFSET 0 | 86 | #define PCI_DRAM_OFFSET 0 |
87 | #endif | 87 | #endif |
88 | 88 | ||
89 | #elif CONFIG_44x | 89 | #elif defined(CONFIG_44x) |
90 | 90 | ||
91 | #if defined(CONFIG_BAMBOO) | 91 | #if defined(CONFIG_BAMBOO) |
92 | #include <platforms/4xx/bamboo.h> | 92 | #include <platforms/4xx/bamboo.h> |
diff --git a/include/asm-ppc/io.h b/include/asm-ppc/io.h index 680555be22ec..3d9a9e6f3321 100644 --- a/include/asm-ppc/io.h +++ b/include/asm-ppc/io.h | |||
@@ -327,26 +327,12 @@ __do_out_asm(outl, "stwbrx") | |||
327 | #define inl_p(port) inl((port)) | 327 | #define inl_p(port) inl((port)) |
328 | #define outl_p(val, port) outl((val), (port)) | 328 | #define outl_p(val, port) outl((val), (port)) |
329 | 329 | ||
330 | extern void _insb(volatile u8 __iomem *port, void *buf, int ns); | 330 | extern void _insb(volatile u8 __iomem *port, void *buf, long count); |
331 | extern void _outsb(volatile u8 __iomem *port, const void *buf, int ns); | 331 | extern void _outsb(volatile u8 __iomem *port, const void *buf, long count); |
332 | extern void _insw(volatile u16 __iomem *port, void *buf, int ns); | 332 | extern void _insw_ns(volatile u16 __iomem *port, void *buf, long count); |
333 | extern void _outsw(volatile u16 __iomem *port, const void *buf, int ns); | 333 | extern void _outsw_ns(volatile u16 __iomem *port, const void *buf, long count); |
334 | extern void _insl(volatile u32 __iomem *port, void *buf, int nl); | 334 | extern void _insl_ns(volatile u32 __iomem *port, void *buf, long count); |
335 | extern void _outsl(volatile u32 __iomem *port, const void *buf, int nl); | 335 | extern void _outsl_ns(volatile u32 __iomem *port, const void *buf, long count); |
336 | extern void _insw_ns(volatile u16 __iomem *port, void *buf, int ns); | ||
337 | extern void _outsw_ns(volatile u16 __iomem *port, const void *buf, int ns); | ||
338 | extern void _insl_ns(volatile u32 __iomem *port, void *buf, int nl); | ||
339 | extern void _outsl_ns(volatile u32 __iomem *port, const void *buf, int nl); | ||
340 | |||
341 | /* | ||
342 | * The *_ns versions below don't do byte-swapping. | ||
343 | * Neither do the standard versions now, these are just here | ||
344 | * for older code. | ||
345 | */ | ||
346 | #define insw_ns(port, buf, ns) _insw_ns((port)+___IO_BASE, (buf), (ns)) | ||
347 | #define outsw_ns(port, buf, ns) _outsw_ns((port)+___IO_BASE, (buf), (ns)) | ||
348 | #define insl_ns(port, buf, nl) _insl_ns((port)+___IO_BASE, (buf), (nl)) | ||
349 | #define outsl_ns(port, buf, nl) _outsl_ns((port)+___IO_BASE, (buf), (nl)) | ||
350 | 336 | ||
351 | 337 | ||
352 | #define IO_SPACE_LIMIT ~0 | 338 | #define IO_SPACE_LIMIT ~0 |
diff --git a/include/asm-ppc/mpc8260_pci9.h b/include/asm-ppc/mpc8260_pci9.h index 26b3f6e787bc..9f7176881c56 100644 --- a/include/asm-ppc/mpc8260_pci9.h +++ b/include/asm-ppc/mpc8260_pci9.h | |||
@@ -30,8 +30,6 @@ | |||
30 | #undef inb | 30 | #undef inb |
31 | #undef inw | 31 | #undef inw |
32 | #undef inl | 32 | #undef inl |
33 | #undef insw_ns | ||
34 | #undef insl_ns | ||
35 | #undef memcpy_fromio | 33 | #undef memcpy_fromio |
36 | 34 | ||
37 | extern int readb(volatile unsigned char *addr); | 35 | extern int readb(volatile unsigned char *addr); |
@@ -43,8 +41,6 @@ extern void insl(unsigned port, void *buf, int nl); | |||
43 | extern int inb(unsigned port); | 41 | extern int inb(unsigned port); |
44 | extern int inw(unsigned port); | 42 | extern int inw(unsigned port); |
45 | extern unsigned inl(unsigned port); | 43 | extern unsigned inl(unsigned port); |
46 | extern void insw_ns(unsigned port, void *buf, int ns); | ||
47 | extern void insl_ns(unsigned port, void *buf, int nl); | ||
48 | extern void *memcpy_fromio(void *dest, unsigned long src, size_t count); | 44 | extern void *memcpy_fromio(void *dest, unsigned long src, size_t count); |
49 | 45 | ||
50 | #endif /* !__CONFIG_8260_PCI9_DEFS */ | 46 | #endif /* !__CONFIG_8260_PCI9_DEFS */ |
diff --git a/include/asm-ppc/reg_booke.h b/include/asm-ppc/reg_booke.h index 4944c0fb8bea..602fbadeaf48 100644 --- a/include/asm-ppc/reg_booke.h +++ b/include/asm-ppc/reg_booke.h | |||
@@ -300,14 +300,14 @@ do { \ | |||
300 | #define DBSR_IC 0x80000000 /* Instruction Completion */ | 300 | #define DBSR_IC 0x80000000 /* Instruction Completion */ |
301 | #define DBSR_BT 0x40000000 /* Branch taken */ | 301 | #define DBSR_BT 0x40000000 /* Branch taken */ |
302 | #define DBSR_TIE 0x10000000 /* Trap Instruction debug Event */ | 302 | #define DBSR_TIE 0x10000000 /* Trap Instruction debug Event */ |
303 | #define DBSR_IAC1 0x00800000 /* Instruction Address Compare 1 Event */ | 303 | #define DBSR_IAC1 0x04000000 /* Instruction Address Compare 1 Event */ |
304 | #define DBSR_IAC2 0x00400000 /* Instruction Address Compare 2 Event */ | 304 | #define DBSR_IAC2 0x02000000 /* Instruction Address Compare 2 Event */ |
305 | #define DBSR_IAC3 0x00200000 /* Instruction Address Compare 3 Event */ | 305 | #define DBSR_IAC3 0x00080000 /* Instruction Address Compare 3 Event */ |
306 | #define DBSR_IAC4 0x00100000 /* Instruction Address Compare 4 Event */ | 306 | #define DBSR_IAC4 0x00040000 /* Instruction Address Compare 4 Event */ |
307 | #define DBSR_DAC1R 0x00080000 /* Data Address Compare 1 Read Event */ | 307 | #define DBSR_DAC1R 0x01000000 /* Data Address Compare 1 Read Event */ |
308 | #define DBSR_DAC1W 0x00040000 /* Data Address Compare 1 Write Event */ | 308 | #define DBSR_DAC1W 0x00800000 /* Data Address Compare 1 Write Event */ |
309 | #define DBSR_DAC2R 0x00020000 /* Data Address Compare 2 Read Event */ | 309 | #define DBSR_DAC2R 0x00400000 /* Data Address Compare 2 Read Event */ |
310 | #define DBSR_DAC2W 0x00010000 /* Data Address Compare 2 Write Event */ | 310 | #define DBSR_DAC2W 0x00200000 /* Data Address Compare 2 Write Event */ |
311 | #endif | 311 | #endif |
312 | 312 | ||
313 | /* Bit definitions related to the ESR. */ | 313 | /* Bit definitions related to the ESR. */ |
diff --git a/include/asm-s390/Kbuild b/include/asm-s390/Kbuild index 14158a4a9c87..088969d55e72 100644 --- a/include/asm-s390/Kbuild +++ b/include/asm-s390/Kbuild | |||
@@ -1,6 +1,7 @@ | |||
1 | include include/asm-generic/Kbuild.asm | 1 | include include/asm-generic/Kbuild.asm |
2 | 2 | ||
3 | header-y += dasd.h | 3 | header-y += dasd.h |
4 | header-y += monwriter.h | ||
4 | header-y += qeth.h | 5 | header-y += qeth.h |
5 | header-y += tape390.h | 6 | header-y += tape390.h |
6 | header-y += ucontext.h | 7 | header-y += ucontext.h |
diff --git a/include/asm-s390/appldata.h b/include/asm-s390/appldata.h new file mode 100644 index 000000000000..b1770703b706 --- /dev/null +++ b/include/asm-s390/appldata.h | |||
@@ -0,0 +1,90 @@ | |||
1 | /* | ||
2 | * include/asm-s390/appldata.h | ||
3 | * | ||
4 | * Copyright (C) IBM Corp. 2006 | ||
5 | * | ||
6 | * Author(s): Melissa Howland <melissah@us.ibm.com> | ||
7 | */ | ||
8 | |||
9 | #ifndef _ASM_S390_APPLDATA_H | ||
10 | #define _ASM_S390_APPLDATA_H | ||
11 | |||
12 | #include <asm/io.h> | ||
13 | |||
14 | #ifndef CONFIG_64BIT | ||
15 | |||
16 | #define APPLDATA_START_INTERVAL_REC 0x00 /* Function codes for */ | ||
17 | #define APPLDATA_STOP_REC 0x01 /* DIAG 0xDC */ | ||
18 | #define APPLDATA_GEN_EVENT_REC 0x02 | ||
19 | #define APPLDATA_START_CONFIG_REC 0x03 | ||
20 | |||
21 | /* | ||
22 | * Parameter list for DIAGNOSE X'DC' | ||
23 | */ | ||
24 | struct appldata_parameter_list { | ||
25 | u16 diag; /* The DIAGNOSE code X'00DC' */ | ||
26 | u8 function; /* The function code for the DIAGNOSE */ | ||
27 | u8 parlist_length; /* Length of the parameter list */ | ||
28 | u32 product_id_addr; /* Address of the 16-byte product ID */ | ||
29 | u16 reserved; | ||
30 | u16 buffer_length; /* Length of the application data buffer */ | ||
31 | u32 buffer_addr; /* Address of the application data buffer */ | ||
32 | } __attribute__ ((packed)); | ||
33 | |||
34 | #else /* CONFIG_64BIT */ | ||
35 | |||
36 | #define APPLDATA_START_INTERVAL_REC 0x80 | ||
37 | #define APPLDATA_STOP_REC 0x81 | ||
38 | #define APPLDATA_GEN_EVENT_REC 0x82 | ||
39 | #define APPLDATA_START_CONFIG_REC 0x83 | ||
40 | |||
41 | /* | ||
42 | * Parameter list for DIAGNOSE X'DC' | ||
43 | */ | ||
44 | struct appldata_parameter_list { | ||
45 | u16 diag; | ||
46 | u8 function; | ||
47 | u8 parlist_length; | ||
48 | u32 unused01; | ||
49 | u16 reserved; | ||
50 | u16 buffer_length; | ||
51 | u32 unused02; | ||
52 | u64 product_id_addr; | ||
53 | u64 buffer_addr; | ||
54 | } __attribute__ ((packed)); | ||
55 | |||
56 | #endif /* CONFIG_64BIT */ | ||
57 | |||
58 | struct appldata_product_id { | ||
59 | char prod_nr[7]; /* product number */ | ||
60 | u16 prod_fn; /* product function */ | ||
61 | u8 record_nr; /* record number */ | ||
62 | u16 version_nr; /* version */ | ||
63 | u16 release_nr; /* release */ | ||
64 | u16 mod_lvl; /* modification level */ | ||
65 | } __attribute__ ((packed)); | ||
66 | |||
67 | static inline int appldata_asm(struct appldata_product_id *id, | ||
68 | unsigned short fn, void *buffer, | ||
69 | unsigned short length) | ||
70 | { | ||
71 | struct appldata_parameter_list parm_list; | ||
72 | int ry; | ||
73 | |||
74 | if (!MACHINE_IS_VM) | ||
75 | return -ENOSYS; | ||
76 | parm_list.diag = 0xdc; | ||
77 | parm_list.function = fn; | ||
78 | parm_list.parlist_length = sizeof(parm_list); | ||
79 | parm_list.buffer_length = length; | ||
80 | parm_list.product_id_addr = (unsigned long) id; | ||
81 | parm_list.buffer_addr = virt_to_phys(buffer); | ||
82 | asm volatile( | ||
83 | "diag %1,%0,0xdc" | ||
84 | : "=d" (ry) | ||
85 | : "d" (&parm_list), "m" (parm_list), "m" (*id) | ||
86 | : "cc"); | ||
87 | return ry; | ||
88 | } | ||
89 | |||
90 | #endif /* _ASM_S390_APPLDATA_H */ | ||
diff --git a/include/asm-s390/cio.h b/include/asm-s390/cio.h index 28fdd6e2b8ba..da063cd5f0a0 100644 --- a/include/asm-s390/cio.h +++ b/include/asm-s390/cio.h | |||
@@ -270,6 +270,11 @@ struct diag210 { | |||
270 | __u32 vrdccrft : 8; /* real device feature (output) */ | 270 | __u32 vrdccrft : 8; /* real device feature (output) */ |
271 | } __attribute__ ((packed,aligned(4))); | 271 | } __attribute__ ((packed,aligned(4))); |
272 | 272 | ||
273 | struct ccw_dev_id { | ||
274 | u8 ssid; | ||
275 | u16 devno; | ||
276 | }; | ||
277 | |||
273 | extern int diag210(struct diag210 *addr); | 278 | extern int diag210(struct diag210 *addr); |
274 | 279 | ||
275 | extern void wait_cons_dev(void); | 280 | extern void wait_cons_dev(void); |
@@ -280,6 +285,8 @@ extern void cio_reset_channel_paths(void); | |||
280 | 285 | ||
281 | extern void css_schedule_reprobe(void); | 286 | extern void css_schedule_reprobe(void); |
282 | 287 | ||
288 | extern void reipl_ccw_dev(struct ccw_dev_id *id); | ||
289 | |||
283 | #endif | 290 | #endif |
284 | 291 | ||
285 | #endif | 292 | #endif |
diff --git a/include/asm-s390/dma.h b/include/asm-s390/dma.h index 02720c449cd8..7425c6af6cd4 100644 --- a/include/asm-s390/dma.h +++ b/include/asm-s390/dma.h | |||
@@ -11,6 +11,6 @@ | |||
11 | 11 | ||
12 | #define MAX_DMA_ADDRESS 0x80000000 | 12 | #define MAX_DMA_ADDRESS 0x80000000 |
13 | 13 | ||
14 | #define free_dma(x) | 14 | #define free_dma(x) do { } while (0) |
15 | 15 | ||
16 | #endif /* _ASM_DMA_H */ | 16 | #endif /* _ASM_DMA_H */ |
diff --git a/include/asm-s390/futex.h b/include/asm-s390/futex.h index ffedf14f89f6..5e261e1de671 100644 --- a/include/asm-s390/futex.h +++ b/include/asm-s390/futex.h | |||
@@ -7,75 +7,21 @@ | |||
7 | #include <asm/errno.h> | 7 | #include <asm/errno.h> |
8 | #include <asm/uaccess.h> | 8 | #include <asm/uaccess.h> |
9 | 9 | ||
10 | #ifndef __s390x__ | ||
11 | #define __futex_atomic_fixup \ | ||
12 | ".section __ex_table,\"a\"\n" \ | ||
13 | " .align 4\n" \ | ||
14 | " .long 0b,4b,2b,4b,3b,4b\n" \ | ||
15 | ".previous" | ||
16 | #else /* __s390x__ */ | ||
17 | #define __futex_atomic_fixup \ | ||
18 | ".section __ex_table,\"a\"\n" \ | ||
19 | " .align 8\n" \ | ||
20 | " .quad 0b,4b,2b,4b,3b,4b\n" \ | ||
21 | ".previous" | ||
22 | #endif /* __s390x__ */ | ||
23 | |||
24 | #define __futex_atomic_op(insn, ret, oldval, newval, uaddr, oparg) \ | ||
25 | asm volatile(" sacf 256\n" \ | ||
26 | "0: l %1,0(%6)\n" \ | ||
27 | "1: " insn \ | ||
28 | "2: cs %1,%2,0(%6)\n" \ | ||
29 | "3: jl 1b\n" \ | ||
30 | " lhi %0,0\n" \ | ||
31 | "4: sacf 0\n" \ | ||
32 | __futex_atomic_fixup \ | ||
33 | : "=d" (ret), "=&d" (oldval), "=&d" (newval), \ | ||
34 | "=m" (*uaddr) \ | ||
35 | : "0" (-EFAULT), "d" (oparg), "a" (uaddr), \ | ||
36 | "m" (*uaddr) : "cc" ); | ||
37 | |||
38 | static inline int futex_atomic_op_inuser (int encoded_op, int __user *uaddr) | 10 | static inline int futex_atomic_op_inuser (int encoded_op, int __user *uaddr) |
39 | { | 11 | { |
40 | int op = (encoded_op >> 28) & 7; | 12 | int op = (encoded_op >> 28) & 7; |
41 | int cmp = (encoded_op >> 24) & 15; | 13 | int cmp = (encoded_op >> 24) & 15; |
42 | int oparg = (encoded_op << 8) >> 20; | 14 | int oparg = (encoded_op << 8) >> 20; |
43 | int cmparg = (encoded_op << 20) >> 20; | 15 | int cmparg = (encoded_op << 20) >> 20; |
44 | int oldval = 0, newval, ret; | 16 | int oldval, ret; |
17 | |||
45 | if (encoded_op & (FUTEX_OP_OPARG_SHIFT << 28)) | 18 | if (encoded_op & (FUTEX_OP_OPARG_SHIFT << 28)) |
46 | oparg = 1 << oparg; | 19 | oparg = 1 << oparg; |
47 | 20 | ||
48 | if (! access_ok (VERIFY_WRITE, uaddr, sizeof(int))) | 21 | if (! access_ok (VERIFY_WRITE, uaddr, sizeof(int))) |
49 | return -EFAULT; | 22 | return -EFAULT; |
50 | 23 | ||
51 | inc_preempt_count(); | 24 | ret = uaccess.futex_atomic_op(op, uaddr, oparg, &oldval); |
52 | |||
53 | switch (op) { | ||
54 | case FUTEX_OP_SET: | ||
55 | __futex_atomic_op("lr %2,%5\n", | ||
56 | ret, oldval, newval, uaddr, oparg); | ||
57 | break; | ||
58 | case FUTEX_OP_ADD: | ||
59 | __futex_atomic_op("lr %2,%1\nar %2,%5\n", | ||
60 | ret, oldval, newval, uaddr, oparg); | ||
61 | break; | ||
62 | case FUTEX_OP_OR: | ||
63 | __futex_atomic_op("lr %2,%1\nor %2,%5\n", | ||
64 | ret, oldval, newval, uaddr, oparg); | ||
65 | break; | ||
66 | case FUTEX_OP_ANDN: | ||
67 | __futex_atomic_op("lr %2,%1\nnr %2,%5\n", | ||
68 | ret, oldval, newval, uaddr, oparg); | ||
69 | break; | ||
70 | case FUTEX_OP_XOR: | ||
71 | __futex_atomic_op("lr %2,%1\nxr %2,%5\n", | ||
72 | ret, oldval, newval, uaddr, oparg); | ||
73 | break; | ||
74 | default: | ||
75 | ret = -ENOSYS; | ||
76 | } | ||
77 | |||
78 | dec_preempt_count(); | ||
79 | 25 | ||
80 | if (!ret) { | 26 | if (!ret) { |
81 | switch (cmp) { | 27 | switch (cmp) { |
@@ -91,32 +37,13 @@ static inline int futex_atomic_op_inuser (int encoded_op, int __user *uaddr) | |||
91 | return ret; | 37 | return ret; |
92 | } | 38 | } |
93 | 39 | ||
94 | static inline int | 40 | static inline int futex_atomic_cmpxchg_inatomic(int __user *uaddr, |
95 | futex_atomic_cmpxchg_inatomic(int __user *uaddr, int oldval, int newval) | 41 | int oldval, int newval) |
96 | { | 42 | { |
97 | int ret; | ||
98 | |||
99 | if (! access_ok (VERIFY_WRITE, uaddr, sizeof(int))) | 43 | if (! access_ok (VERIFY_WRITE, uaddr, sizeof(int))) |
100 | return -EFAULT; | 44 | return -EFAULT; |
101 | asm volatile(" sacf 256\n" | 45 | |
102 | " cs %1,%4,0(%5)\n" | 46 | return uaccess.futex_atomic_cmpxchg(uaddr, oldval, newval); |
103 | "0: lr %0,%1\n" | ||
104 | "1: sacf 0\n" | ||
105 | #ifndef __s390x__ | ||
106 | ".section __ex_table,\"a\"\n" | ||
107 | " .align 4\n" | ||
108 | " .long 0b,1b\n" | ||
109 | ".previous" | ||
110 | #else /* __s390x__ */ | ||
111 | ".section __ex_table,\"a\"\n" | ||
112 | " .align 8\n" | ||
113 | " .quad 0b,1b\n" | ||
114 | ".previous" | ||
115 | #endif /* __s390x__ */ | ||
116 | : "=d" (ret), "+d" (oldval), "=m" (*uaddr) | ||
117 | : "0" (-EFAULT), "d" (newval), "a" (uaddr), "m" (*uaddr) | ||
118 | : "cc", "memory" ); | ||
119 | return oldval; | ||
120 | } | 47 | } |
121 | 48 | ||
122 | #endif /* __KERNEL__ */ | 49 | #endif /* __KERNEL__ */ |
diff --git a/include/asm-s390/io.h b/include/asm-s390/io.h index d4614b35f423..a6cc27e77007 100644 --- a/include/asm-s390/io.h +++ b/include/asm-s390/io.h | |||
@@ -116,7 +116,7 @@ extern void iounmap(void *addr); | |||
116 | #define outb(x,addr) ((void) writeb(x,addr)) | 116 | #define outb(x,addr) ((void) writeb(x,addr)) |
117 | #define outb_p(x,addr) outb(x,addr) | 117 | #define outb_p(x,addr) outb(x,addr) |
118 | 118 | ||
119 | #define mmiowb() | 119 | #define mmiowb() do { } while (0) |
120 | 120 | ||
121 | /* | 121 | /* |
122 | * Convert a physical pointer to a virtual kernel pointer for /dev/mem | 122 | * Convert a physical pointer to a virtual kernel pointer for /dev/mem |
diff --git a/include/asm-s390/kdebug.h b/include/asm-s390/kdebug.h new file mode 100644 index 000000000000..40cc68025e01 --- /dev/null +++ b/include/asm-s390/kdebug.h | |||
@@ -0,0 +1,59 @@ | |||
1 | #ifndef _S390_KDEBUG_H | ||
2 | #define _S390_KDEBUG_H | ||
3 | |||
4 | /* | ||
5 | * Feb 2006 Ported to s390 <grundym@us.ibm.com> | ||
6 | */ | ||
7 | #include <linux/notifier.h> | ||
8 | |||
9 | struct pt_regs; | ||
10 | |||
11 | struct die_args { | ||
12 | struct pt_regs *regs; | ||
13 | const char *str; | ||
14 | long err; | ||
15 | int trapnr; | ||
16 | int signr; | ||
17 | }; | ||
18 | |||
19 | /* Note - you should never unregister because that can race with NMIs. | ||
20 | * If you really want to do it first unregister - then synchronize_sched | ||
21 | * - then free. | ||
22 | */ | ||
23 | extern int register_die_notifier(struct notifier_block *); | ||
24 | extern int unregister_die_notifier(struct notifier_block *); | ||
25 | extern int register_page_fault_notifier(struct notifier_block *); | ||
26 | extern int unregister_page_fault_notifier(struct notifier_block *); | ||
27 | extern struct atomic_notifier_head s390die_chain; | ||
28 | |||
29 | |||
30 | enum die_val { | ||
31 | DIE_OOPS = 1, | ||
32 | DIE_BPT, | ||
33 | DIE_SSTEP, | ||
34 | DIE_PANIC, | ||
35 | DIE_NMI, | ||
36 | DIE_DIE, | ||
37 | DIE_NMIWATCHDOG, | ||
38 | DIE_KERNELDEBUG, | ||
39 | DIE_TRAP, | ||
40 | DIE_GPF, | ||
41 | DIE_CALL, | ||
42 | DIE_NMI_IPI, | ||
43 | DIE_PAGE_FAULT, | ||
44 | }; | ||
45 | |||
46 | static inline int notify_die(enum die_val val, const char *str, | ||
47 | struct pt_regs *regs, long err, int trap, int sig) | ||
48 | { | ||
49 | struct die_args args = { | ||
50 | .regs = regs, | ||
51 | .str = str, | ||
52 | .err = err, | ||
53 | .trapnr = trap, | ||
54 | .signr = sig | ||
55 | }; | ||
56 | return atomic_notifier_call_chain(&s390die_chain, val, &args); | ||
57 | } | ||
58 | |||
59 | #endif | ||
diff --git a/include/asm-s390/kprobes.h b/include/asm-s390/kprobes.h new file mode 100644 index 000000000000..b847ff0ec3fa --- /dev/null +++ b/include/asm-s390/kprobes.h | |||
@@ -0,0 +1,114 @@ | |||
1 | #ifndef _ASM_S390_KPROBES_H | ||
2 | #define _ASM_S390_KPROBES_H | ||
3 | /* | ||
4 | * Kernel Probes (KProbes) | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or modify | ||
7 | * it under the terms of the GNU General Public License as published by | ||
8 | * the Free Software Foundation; either version 2 of the License, or | ||
9 | * (at your option) any later version. | ||
10 | * | ||
11 | * This program is distributed in the hope that it will be useful, | ||
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
14 | * GNU General Public License for more details. | ||
15 | * | ||
16 | * You should have received a copy of the GNU General Public License | ||
17 | * along with this program; if not, write to the Free Software | ||
18 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | ||
19 | * | ||
20 | * Copyright (C) IBM Corporation, 2002, 2006 | ||
21 | * | ||
22 | * 2002-Oct Created by Vamsi Krishna S <vamsi_krishna@in.ibm.com> Kernel | ||
23 | * Probes initial implementation ( includes suggestions from | ||
24 | * Rusty Russell). | ||
25 | * 2004-Nov Modified for PPC64 by Ananth N Mavinakayanahalli | ||
26 | * <ananth@in.ibm.com> | ||
27 | * 2005-Dec Used as a template for s390 by Mike Grundy | ||
28 | * <grundym@us.ibm.com> | ||
29 | */ | ||
30 | #include <linux/types.h> | ||
31 | #include <linux/ptrace.h> | ||
32 | #include <linux/percpu.h> | ||
33 | |||
34 | #define __ARCH_WANT_KPROBES_INSN_SLOT | ||
35 | struct pt_regs; | ||
36 | struct kprobe; | ||
37 | |||
38 | typedef u16 kprobe_opcode_t; | ||
39 | #define BREAKPOINT_INSTRUCTION 0x0002 | ||
40 | |||
41 | /* Maximum instruction size is 3 (16bit) halfwords: */ | ||
42 | #define MAX_INSN_SIZE 0x0003 | ||
43 | #define MAX_STACK_SIZE 64 | ||
44 | #define MIN_STACK_SIZE(ADDR) (((MAX_STACK_SIZE) < \ | ||
45 | (((unsigned long)current_thread_info()) + THREAD_SIZE - (ADDR))) \ | ||
46 | ? (MAX_STACK_SIZE) \ | ||
47 | : (((unsigned long)current_thread_info()) + THREAD_SIZE - (ADDR))) | ||
48 | |||
49 | #define JPROBE_ENTRY(pentry) (kprobe_opcode_t *)(pentry) | ||
50 | |||
51 | #define ARCH_SUPPORTS_KRETPROBES | ||
52 | #define ARCH_INACTIVE_KPROBE_COUNT 0 | ||
53 | |||
54 | #define KPROBE_SWAP_INST 0x10 | ||
55 | |||
56 | #define FIXUP_PSW_NORMAL 0x08 | ||
57 | #define FIXUP_BRANCH_NOT_TAKEN 0x04 | ||
58 | #define FIXUP_RETURN_REGISTER 0x02 | ||
59 | #define FIXUP_NOT_REQUIRED 0x01 | ||
60 | |||
61 | /* Architecture specific copy of original instruction */ | ||
62 | struct arch_specific_insn { | ||
63 | /* copy of original instruction */ | ||
64 | kprobe_opcode_t *insn; | ||
65 | int fixup; | ||
66 | int ilen; | ||
67 | int reg; | ||
68 | }; | ||
69 | |||
70 | struct ins_replace_args { | ||
71 | kprobe_opcode_t *ptr; | ||
72 | kprobe_opcode_t old; | ||
73 | kprobe_opcode_t new; | ||
74 | }; | ||
75 | struct prev_kprobe { | ||
76 | struct kprobe *kp; | ||
77 | unsigned long status; | ||
78 | unsigned long saved_psw; | ||
79 | unsigned long kprobe_saved_imask; | ||
80 | unsigned long kprobe_saved_ctl[3]; | ||
81 | }; | ||
82 | |||
83 | /* per-cpu kprobe control block */ | ||
84 | struct kprobe_ctlblk { | ||
85 | unsigned long kprobe_status; | ||
86 | unsigned long kprobe_saved_imask; | ||
87 | unsigned long kprobe_saved_ctl[3]; | ||
88 | struct pt_regs jprobe_saved_regs; | ||
89 | unsigned long jprobe_saved_r14; | ||
90 | unsigned long jprobe_saved_r15; | ||
91 | struct prev_kprobe prev_kprobe; | ||
92 | kprobe_opcode_t jprobes_stack[MAX_STACK_SIZE]; | ||
93 | }; | ||
94 | |||
95 | void arch_remove_kprobe(struct kprobe *p); | ||
96 | void kretprobe_trampoline(void); | ||
97 | int is_prohibited_opcode(kprobe_opcode_t *instruction); | ||
98 | void get_instruction_type(struct arch_specific_insn *ainsn); | ||
99 | |||
100 | #define flush_insn_slot(p) do { } while (0) | ||
101 | |||
102 | #endif /* _ASM_S390_KPROBES_H */ | ||
103 | |||
104 | #ifdef CONFIG_KPROBES | ||
105 | |||
106 | extern int kprobe_exceptions_notify(struct notifier_block *self, | ||
107 | unsigned long val, void *data); | ||
108 | #else /* !CONFIG_KPROBES */ | ||
109 | static inline int kprobe_exceptions_notify(struct notifier_block *self, | ||
110 | unsigned long val, void *data) | ||
111 | { | ||
112 | return 0; | ||
113 | } | ||
114 | #endif | ||
diff --git a/include/asm-s390/lowcore.h b/include/asm-s390/lowcore.h index 596c8b172104..18695d10dedf 100644 --- a/include/asm-s390/lowcore.h +++ b/include/asm-s390/lowcore.h | |||
@@ -35,6 +35,7 @@ | |||
35 | #define __LC_IO_NEW_PSW 0x01f0 | 35 | #define __LC_IO_NEW_PSW 0x01f0 |
36 | #endif /* !__s390x__ */ | 36 | #endif /* !__s390x__ */ |
37 | 37 | ||
38 | #define __LC_IPL_PARMBLOCK_PTR 0x014 | ||
38 | #define __LC_EXT_PARAMS 0x080 | 39 | #define __LC_EXT_PARAMS 0x080 |
39 | #define __LC_CPU_ADDRESS 0x084 | 40 | #define __LC_CPU_ADDRESS 0x084 |
40 | #define __LC_EXT_INT_CODE 0x086 | 41 | #define __LC_EXT_INT_CODE 0x086 |
@@ -47,6 +48,7 @@ | |||
47 | #define __LC_PER_ATMID 0x096 | 48 | #define __LC_PER_ATMID 0x096 |
48 | #define __LC_PER_ADDRESS 0x098 | 49 | #define __LC_PER_ADDRESS 0x098 |
49 | #define __LC_PER_ACCESS_ID 0x0A1 | 50 | #define __LC_PER_ACCESS_ID 0x0A1 |
51 | #define __LC_AR_MODE_ID 0x0A3 | ||
50 | 52 | ||
51 | #define __LC_SUBCHANNEL_ID 0x0B8 | 53 | #define __LC_SUBCHANNEL_ID 0x0B8 |
52 | #define __LC_SUBCHANNEL_NR 0x0BA | 54 | #define __LC_SUBCHANNEL_NR 0x0BA |
@@ -106,18 +108,28 @@ | |||
106 | #define __LC_INT_CLOCK 0xDE8 | 108 | #define __LC_INT_CLOCK 0xDE8 |
107 | #endif /* __s390x__ */ | 109 | #endif /* __s390x__ */ |
108 | 110 | ||
109 | #define __LC_PANIC_MAGIC 0xE00 | ||
110 | 111 | ||
112 | #define __LC_PANIC_MAGIC 0xE00 | ||
111 | #ifndef __s390x__ | 113 | #ifndef __s390x__ |
112 | #define __LC_PFAULT_INTPARM 0x080 | 114 | #define __LC_PFAULT_INTPARM 0x080 |
113 | #define __LC_CPU_TIMER_SAVE_AREA 0x0D8 | 115 | #define __LC_CPU_TIMER_SAVE_AREA 0x0D8 |
116 | #define __LC_CLOCK_COMP_SAVE_AREA 0x0E0 | ||
117 | #define __LC_PSW_SAVE_AREA 0x100 | ||
118 | #define __LC_PREFIX_SAVE_AREA 0x108 | ||
114 | #define __LC_AREGS_SAVE_AREA 0x120 | 119 | #define __LC_AREGS_SAVE_AREA 0x120 |
120 | #define __LC_FPREGS_SAVE_AREA 0x160 | ||
115 | #define __LC_GPREGS_SAVE_AREA 0x180 | 121 | #define __LC_GPREGS_SAVE_AREA 0x180 |
116 | #define __LC_CREGS_SAVE_AREA 0x1C0 | 122 | #define __LC_CREGS_SAVE_AREA 0x1C0 |
117 | #else /* __s390x__ */ | 123 | #else /* __s390x__ */ |
118 | #define __LC_PFAULT_INTPARM 0x11B8 | 124 | #define __LC_PFAULT_INTPARM 0x11B8 |
125 | #define __LC_FPREGS_SAVE_AREA 0x1200 | ||
119 | #define __LC_GPREGS_SAVE_AREA 0x1280 | 126 | #define __LC_GPREGS_SAVE_AREA 0x1280 |
127 | #define __LC_PSW_SAVE_AREA 0x1300 | ||
128 | #define __LC_PREFIX_SAVE_AREA 0x1318 | ||
129 | #define __LC_FP_CREG_SAVE_AREA 0x131C | ||
130 | #define __LC_TODREG_SAVE_AREA 0x1324 | ||
120 | #define __LC_CPU_TIMER_SAVE_AREA 0x1328 | 131 | #define __LC_CPU_TIMER_SAVE_AREA 0x1328 |
132 | #define __LC_CLOCK_COMP_SAVE_AREA 0x1331 | ||
121 | #define __LC_AREGS_SAVE_AREA 0x1340 | 133 | #define __LC_AREGS_SAVE_AREA 0x1340 |
122 | #define __LC_CREGS_SAVE_AREA 0x1380 | 134 | #define __LC_CREGS_SAVE_AREA 0x1380 |
123 | #endif /* __s390x__ */ | 135 | #endif /* __s390x__ */ |
diff --git a/include/asm-s390/monwriter.h b/include/asm-s390/monwriter.h new file mode 100644 index 000000000000..f0cbf96c52e6 --- /dev/null +++ b/include/asm-s390/monwriter.h | |||
@@ -0,0 +1,33 @@ | |||
1 | /* | ||
2 | * include/asm-s390/monwriter.h | ||
3 | * | ||
4 | * Copyright (C) IBM Corp. 2006 | ||
5 | * Character device driver for writing z/VM APPLDATA monitor records | ||
6 | * Version 1.0 | ||
7 | * Author(s): Melissa Howland <melissah@us.ibm.com> | ||
8 | * | ||
9 | */ | ||
10 | |||
11 | #ifndef _ASM_390_MONWRITER_H | ||
12 | #define _ASM_390_MONWRITER_H | ||
13 | |||
14 | /* mon_function values */ | ||
15 | #define MONWRITE_START_INTERVAL 0x00 /* start interval recording */ | ||
16 | #define MONWRITE_STOP_INTERVAL 0x01 /* stop interval or config recording */ | ||
17 | #define MONWRITE_GEN_EVENT 0x02 /* generate event record */ | ||
18 | #define MONWRITE_START_CONFIG 0x03 /* start configuration recording */ | ||
19 | |||
20 | /* the header the app uses in its write() data */ | ||
21 | struct monwrite_hdr { | ||
22 | unsigned char mon_function; | ||
23 | unsigned short applid; | ||
24 | unsigned char record_num; | ||
25 | unsigned short version; | ||
26 | unsigned short release; | ||
27 | unsigned short mod_level; | ||
28 | unsigned short datalen; | ||
29 | unsigned char hdrlen; | ||
30 | |||
31 | } __attribute__((packed)); | ||
32 | |||
33 | #endif /* _ASM_390_MONWRITER_H */ | ||
diff --git a/include/asm-s390/pgalloc.h b/include/asm-s390/pgalloc.h index a78e853e0dd5..803bc7064418 100644 --- a/include/asm-s390/pgalloc.h +++ b/include/asm-s390/pgalloc.h | |||
@@ -22,6 +22,16 @@ | |||
22 | extern void diag10(unsigned long addr); | 22 | extern void diag10(unsigned long addr); |
23 | 23 | ||
24 | /* | 24 | /* |
25 | * Page allocation orders. | ||
26 | */ | ||
27 | #ifndef __s390x__ | ||
28 | # define PGD_ALLOC_ORDER 1 | ||
29 | #else /* __s390x__ */ | ||
30 | # define PMD_ALLOC_ORDER 2 | ||
31 | # define PGD_ALLOC_ORDER 2 | ||
32 | #endif /* __s390x__ */ | ||
33 | |||
34 | /* | ||
25 | * Allocate and free page tables. The xxx_kernel() versions are | 35 | * Allocate and free page tables. The xxx_kernel() versions are |
26 | * used to allocate a kernel page table - this turns on ASN bits | 36 | * used to allocate a kernel page table - this turns on ASN bits |
27 | * if any. | 37 | * if any. |
@@ -29,30 +39,23 @@ extern void diag10(unsigned long addr); | |||
29 | 39 | ||
30 | static inline pgd_t *pgd_alloc(struct mm_struct *mm) | 40 | static inline pgd_t *pgd_alloc(struct mm_struct *mm) |
31 | { | 41 | { |
32 | pgd_t *pgd; | 42 | pgd_t *pgd = (pgd_t *) __get_free_pages(GFP_KERNEL, PGD_ALLOC_ORDER); |
33 | int i; | 43 | int i; |
34 | 44 | ||
45 | if (!pgd) | ||
46 | return NULL; | ||
47 | for (i = 0; i < PTRS_PER_PGD; i++) | ||
35 | #ifndef __s390x__ | 48 | #ifndef __s390x__ |
36 | pgd = (pgd_t *) __get_free_pages(GFP_KERNEL,1); | 49 | pmd_clear(pmd_offset(pgd + i, i*PGDIR_SIZE)); |
37 | if (pgd != NULL) | 50 | #else |
38 | for (i = 0; i < USER_PTRS_PER_PGD; i++) | 51 | pgd_clear(pgd + i); |
39 | pmd_clear(pmd_offset(pgd + i, i*PGDIR_SIZE)); | 52 | #endif |
40 | #else /* __s390x__ */ | ||
41 | pgd = (pgd_t *) __get_free_pages(GFP_KERNEL,2); | ||
42 | if (pgd != NULL) | ||
43 | for (i = 0; i < PTRS_PER_PGD; i++) | ||
44 | pgd_clear(pgd + i); | ||
45 | #endif /* __s390x__ */ | ||
46 | return pgd; | 53 | return pgd; |
47 | } | 54 | } |
48 | 55 | ||
49 | static inline void pgd_free(pgd_t *pgd) | 56 | static inline void pgd_free(pgd_t *pgd) |
50 | { | 57 | { |
51 | #ifndef __s390x__ | 58 | free_pages((unsigned long) pgd, PGD_ALLOC_ORDER); |
52 | free_pages((unsigned long) pgd, 1); | ||
53 | #else /* __s390x__ */ | ||
54 | free_pages((unsigned long) pgd, 2); | ||
55 | #endif /* __s390x__ */ | ||
56 | } | 59 | } |
57 | 60 | ||
58 | #ifndef __s390x__ | 61 | #ifndef __s390x__ |
@@ -68,20 +71,19 @@ static inline void pgd_free(pgd_t *pgd) | |||
68 | #else /* __s390x__ */ | 71 | #else /* __s390x__ */ |
69 | static inline pmd_t * pmd_alloc_one(struct mm_struct *mm, unsigned long vmaddr) | 72 | static inline pmd_t * pmd_alloc_one(struct mm_struct *mm, unsigned long vmaddr) |
70 | { | 73 | { |
71 | pmd_t *pmd; | 74 | pmd_t *pmd = (pmd_t *) __get_free_pages(GFP_KERNEL, PMD_ALLOC_ORDER); |
72 | int i; | 75 | int i; |
73 | 76 | ||
74 | pmd = (pmd_t *) __get_free_pages(GFP_KERNEL, 2); | 77 | if (!pmd) |
75 | if (pmd != NULL) { | 78 | return NULL; |
76 | for (i=0; i < PTRS_PER_PMD; i++) | 79 | for (i=0; i < PTRS_PER_PMD; i++) |
77 | pmd_clear(pmd+i); | 80 | pmd_clear(pmd + i); |
78 | } | ||
79 | return pmd; | 81 | return pmd; |
80 | } | 82 | } |
81 | 83 | ||
82 | static inline void pmd_free (pmd_t *pmd) | 84 | static inline void pmd_free (pmd_t *pmd) |
83 | { | 85 | { |
84 | free_pages((unsigned long) pmd, 2); | 86 | free_pages((unsigned long) pmd, PMD_ALLOC_ORDER); |
85 | } | 87 | } |
86 | 88 | ||
87 | #define __pmd_free_tlb(tlb,pmd) \ | 89 | #define __pmd_free_tlb(tlb,pmd) \ |
@@ -123,15 +125,14 @@ pmd_populate(struct mm_struct *mm, pmd_t *pmd, struct page *page) | |||
123 | static inline pte_t * | 125 | static inline pte_t * |
124 | pte_alloc_one_kernel(struct mm_struct *mm, unsigned long vmaddr) | 126 | pte_alloc_one_kernel(struct mm_struct *mm, unsigned long vmaddr) |
125 | { | 127 | { |
126 | pte_t *pte; | 128 | pte_t *pte = (pte_t *) __get_free_page(GFP_KERNEL|__GFP_REPEAT); |
127 | int i; | 129 | int i; |
128 | 130 | ||
129 | pte = (pte_t *)__get_free_page(GFP_KERNEL|__GFP_REPEAT); | 131 | if (!pte) |
130 | if (pte != NULL) { | 132 | return NULL; |
131 | for (i=0; i < PTRS_PER_PTE; i++) { | 133 | for (i=0; i < PTRS_PER_PTE; i++) { |
132 | pte_clear(mm, vmaddr, pte+i); | 134 | pte_clear(mm, vmaddr, pte + i); |
133 | vmaddr += PAGE_SIZE; | 135 | vmaddr += PAGE_SIZE; |
134 | } | ||
135 | } | 136 | } |
136 | return pte; | 137 | return pte; |
137 | } | 138 | } |
diff --git a/include/asm-s390/pgtable.h b/include/asm-s390/pgtable.h index 24312387fa24..1a07028d575e 100644 --- a/include/asm-s390/pgtable.h +++ b/include/asm-s390/pgtable.h | |||
@@ -89,19 +89,6 @@ extern char empty_zero_page[PAGE_SIZE]; | |||
89 | # define PTRS_PER_PGD 2048 | 89 | # define PTRS_PER_PGD 2048 |
90 | #endif /* __s390x__ */ | 90 | #endif /* __s390x__ */ |
91 | 91 | ||
92 | /* | ||
93 | * pgd entries used up by user/kernel: | ||
94 | */ | ||
95 | #ifndef __s390x__ | ||
96 | # define USER_PTRS_PER_PGD 512 | ||
97 | # define USER_PGD_PTRS 512 | ||
98 | # define KERNEL_PGD_PTRS 512 | ||
99 | #else /* __s390x__ */ | ||
100 | # define USER_PTRS_PER_PGD 2048 | ||
101 | # define USER_PGD_PTRS 2048 | ||
102 | # define KERNEL_PGD_PTRS 2048 | ||
103 | #endif /* __s390x__ */ | ||
104 | |||
105 | #define FIRST_USER_ADDRESS 0 | 92 | #define FIRST_USER_ADDRESS 0 |
106 | 93 | ||
107 | #define pte_ERROR(e) \ | 94 | #define pte_ERROR(e) \ |
@@ -216,12 +203,14 @@ extern char empty_zero_page[PAGE_SIZE]; | |||
216 | #define _PAGE_RO 0x200 /* HW read-only */ | 203 | #define _PAGE_RO 0x200 /* HW read-only */ |
217 | #define _PAGE_INVALID 0x400 /* HW invalid */ | 204 | #define _PAGE_INVALID 0x400 /* HW invalid */ |
218 | 205 | ||
219 | /* Mask and four different kinds of invalid pages. */ | 206 | /* Mask and six different types of pages. */ |
220 | #define _PAGE_INVALID_MASK 0x601 | 207 | #define _PAGE_TYPE_MASK 0x601 |
221 | #define _PAGE_INVALID_EMPTY 0x400 | 208 | #define _PAGE_TYPE_EMPTY 0x400 |
222 | #define _PAGE_INVALID_NONE 0x401 | 209 | #define _PAGE_TYPE_NONE 0x401 |
223 | #define _PAGE_INVALID_SWAP 0x600 | 210 | #define _PAGE_TYPE_SWAP 0x600 |
224 | #define _PAGE_INVALID_FILE 0x601 | 211 | #define _PAGE_TYPE_FILE 0x601 |
212 | #define _PAGE_TYPE_RO 0x200 | ||
213 | #define _PAGE_TYPE_RW 0x000 | ||
225 | 214 | ||
226 | #ifndef __s390x__ | 215 | #ifndef __s390x__ |
227 | 216 | ||
@@ -280,15 +269,14 @@ extern char empty_zero_page[PAGE_SIZE]; | |||
280 | #endif /* __s390x__ */ | 269 | #endif /* __s390x__ */ |
281 | 270 | ||
282 | /* | 271 | /* |
283 | * No mapping available | 272 | * Page protection definitions. |
284 | */ | 273 | */ |
285 | #define PAGE_NONE_SHARED __pgprot(_PAGE_INVALID_NONE) | 274 | #define PAGE_NONE __pgprot(_PAGE_TYPE_NONE) |
286 | #define PAGE_NONE_PRIVATE __pgprot(_PAGE_INVALID_NONE) | 275 | #define PAGE_RO __pgprot(_PAGE_TYPE_RO) |
287 | #define PAGE_RO_SHARED __pgprot(_PAGE_RO) | 276 | #define PAGE_RW __pgprot(_PAGE_TYPE_RW) |
288 | #define PAGE_RO_PRIVATE __pgprot(_PAGE_RO) | 277 | |
289 | #define PAGE_COPY __pgprot(_PAGE_RO) | 278 | #define PAGE_KERNEL PAGE_RW |
290 | #define PAGE_SHARED __pgprot(0) | 279 | #define PAGE_COPY PAGE_RO |
291 | #define PAGE_KERNEL __pgprot(0) | ||
292 | 280 | ||
293 | /* | 281 | /* |
294 | * The S390 can't do page protection for execute, and considers that the | 282 | * The S390 can't do page protection for execute, and considers that the |
@@ -296,23 +284,23 @@ extern char empty_zero_page[PAGE_SIZE]; | |||
296 | * the closest we can get.. | 284 | * the closest we can get.. |
297 | */ | 285 | */ |
298 | /*xwr*/ | 286 | /*xwr*/ |
299 | #define __P000 PAGE_NONE_PRIVATE | 287 | #define __P000 PAGE_NONE |
300 | #define __P001 PAGE_RO_PRIVATE | 288 | #define __P001 PAGE_RO |
301 | #define __P010 PAGE_COPY | 289 | #define __P010 PAGE_RO |
302 | #define __P011 PAGE_COPY | 290 | #define __P011 PAGE_RO |
303 | #define __P100 PAGE_RO_PRIVATE | 291 | #define __P100 PAGE_RO |
304 | #define __P101 PAGE_RO_PRIVATE | 292 | #define __P101 PAGE_RO |
305 | #define __P110 PAGE_COPY | 293 | #define __P110 PAGE_RO |
306 | #define __P111 PAGE_COPY | 294 | #define __P111 PAGE_RO |
307 | 295 | ||
308 | #define __S000 PAGE_NONE_SHARED | 296 | #define __S000 PAGE_NONE |
309 | #define __S001 PAGE_RO_SHARED | 297 | #define __S001 PAGE_RO |
310 | #define __S010 PAGE_SHARED | 298 | #define __S010 PAGE_RW |
311 | #define __S011 PAGE_SHARED | 299 | #define __S011 PAGE_RW |
312 | #define __S100 PAGE_RO_SHARED | 300 | #define __S100 PAGE_RO |
313 | #define __S101 PAGE_RO_SHARED | 301 | #define __S101 PAGE_RO |
314 | #define __S110 PAGE_SHARED | 302 | #define __S110 PAGE_RW |
315 | #define __S111 PAGE_SHARED | 303 | #define __S111 PAGE_RW |
316 | 304 | ||
317 | /* | 305 | /* |
318 | * Certain architectures need to do special things when PTEs | 306 | * Certain architectures need to do special things when PTEs |
@@ -377,18 +365,18 @@ static inline int pmd_bad(pmd_t pmd) | |||
377 | 365 | ||
378 | static inline int pte_none(pte_t pte) | 366 | static inline int pte_none(pte_t pte) |
379 | { | 367 | { |
380 | return (pte_val(pte) & _PAGE_INVALID_MASK) == _PAGE_INVALID_EMPTY; | 368 | return (pte_val(pte) & _PAGE_TYPE_MASK) == _PAGE_TYPE_EMPTY; |
381 | } | 369 | } |
382 | 370 | ||
383 | static inline int pte_present(pte_t pte) | 371 | static inline int pte_present(pte_t pte) |
384 | { | 372 | { |
385 | return !(pte_val(pte) & _PAGE_INVALID) || | 373 | return !(pte_val(pte) & _PAGE_INVALID) || |
386 | (pte_val(pte) & _PAGE_INVALID_MASK) == _PAGE_INVALID_NONE; | 374 | (pte_val(pte) & _PAGE_TYPE_MASK) == _PAGE_TYPE_NONE; |
387 | } | 375 | } |
388 | 376 | ||
389 | static inline int pte_file(pte_t pte) | 377 | static inline int pte_file(pte_t pte) |
390 | { | 378 | { |
391 | return (pte_val(pte) & _PAGE_INVALID_MASK) == _PAGE_INVALID_FILE; | 379 | return (pte_val(pte) & _PAGE_TYPE_MASK) == _PAGE_TYPE_FILE; |
392 | } | 380 | } |
393 | 381 | ||
394 | #define pte_same(a,b) (pte_val(a) == pte_val(b)) | 382 | #define pte_same(a,b) (pte_val(a) == pte_val(b)) |
@@ -461,7 +449,7 @@ static inline void pmd_clear(pmd_t * pmdp) | |||
461 | 449 | ||
462 | static inline void pte_clear(struct mm_struct *mm, unsigned long addr, pte_t *ptep) | 450 | static inline void pte_clear(struct mm_struct *mm, unsigned long addr, pte_t *ptep) |
463 | { | 451 | { |
464 | pte_val(*ptep) = _PAGE_INVALID_EMPTY; | 452 | pte_val(*ptep) = _PAGE_TYPE_EMPTY; |
465 | } | 453 | } |
466 | 454 | ||
467 | /* | 455 | /* |
@@ -477,7 +465,7 @@ static inline pte_t pte_modify(pte_t pte, pgprot_t newprot) | |||
477 | 465 | ||
478 | static inline pte_t pte_wrprotect(pte_t pte) | 466 | static inline pte_t pte_wrprotect(pte_t pte) |
479 | { | 467 | { |
480 | /* Do not clobber _PAGE_INVALID_NONE pages! */ | 468 | /* Do not clobber _PAGE_TYPE_NONE pages! */ |
481 | if (!(pte_val(pte) & _PAGE_INVALID)) | 469 | if (!(pte_val(pte) & _PAGE_INVALID)) |
482 | pte_val(pte) |= _PAGE_RO; | 470 | pte_val(pte) |= _PAGE_RO; |
483 | return pte; | 471 | return pte; |
@@ -556,26 +544,30 @@ static inline pte_t ptep_get_and_clear(struct mm_struct *mm, unsigned long addr, | |||
556 | return pte; | 544 | return pte; |
557 | } | 545 | } |
558 | 546 | ||
559 | static inline pte_t | 547 | static inline void __ptep_ipte(unsigned long address, pte_t *ptep) |
560 | ptep_clear_flush(struct vm_area_struct *vma, | ||
561 | unsigned long address, pte_t *ptep) | ||
562 | { | 548 | { |
563 | pte_t pte = *ptep; | 549 | if (!(pte_val(*ptep) & _PAGE_INVALID)) { |
564 | #ifndef __s390x__ | 550 | #ifndef __s390x__ |
565 | if (!(pte_val(pte) & _PAGE_INVALID)) { | ||
566 | /* S390 has 1mb segments, we are emulating 4MB segments */ | 551 | /* S390 has 1mb segments, we are emulating 4MB segments */ |
567 | pte_t *pto = (pte_t *) (((unsigned long) ptep) & 0x7ffffc00); | 552 | pte_t *pto = (pte_t *) (((unsigned long) ptep) & 0x7ffffc00); |
568 | __asm__ __volatile__ ("ipte %2,%3" | 553 | #else |
569 | : "=m" (*ptep) : "m" (*ptep), | 554 | /* ipte in zarch mode can do the math */ |
570 | "a" (pto), "a" (address) ); | 555 | pte_t *pto = ptep; |
556 | #endif | ||
557 | asm volatile ("ipte %2,%3" | ||
558 | : "=m" (*ptep) : "m" (*ptep), | ||
559 | "a" (pto), "a" (address) ); | ||
571 | } | 560 | } |
572 | #else /* __s390x__ */ | 561 | pte_val(*ptep) = _PAGE_TYPE_EMPTY; |
573 | if (!(pte_val(pte) & _PAGE_INVALID)) | 562 | } |
574 | __asm__ __volatile__ ("ipte %2,%3" | 563 | |
575 | : "=m" (*ptep) : "m" (*ptep), | 564 | static inline pte_t |
576 | "a" (ptep), "a" (address) ); | 565 | ptep_clear_flush(struct vm_area_struct *vma, |
577 | #endif /* __s390x__ */ | 566 | unsigned long address, pte_t *ptep) |
578 | pte_val(*ptep) = _PAGE_INVALID_EMPTY; | 567 | { |
568 | pte_t pte = *ptep; | ||
569 | |||
570 | __ptep_ipte(address, ptep); | ||
579 | return pte; | 571 | return pte; |
580 | } | 572 | } |
581 | 573 | ||
@@ -755,7 +747,7 @@ static inline pte_t mk_swap_pte(unsigned long type, unsigned long offset) | |||
755 | { | 747 | { |
756 | pte_t pte; | 748 | pte_t pte; |
757 | offset &= __SWP_OFFSET_MASK; | 749 | offset &= __SWP_OFFSET_MASK; |
758 | pte_val(pte) = _PAGE_INVALID_SWAP | ((type & 0x1f) << 2) | | 750 | pte_val(pte) = _PAGE_TYPE_SWAP | ((type & 0x1f) << 2) | |
759 | ((offset & 1UL) << 7) | ((offset & ~1UL) << 11); | 751 | ((offset & 1UL) << 7) | ((offset & ~1UL) << 11); |
760 | return pte; | 752 | return pte; |
761 | } | 753 | } |
@@ -778,7 +770,7 @@ static inline pte_t mk_swap_pte(unsigned long type, unsigned long offset) | |||
778 | 770 | ||
779 | #define pgoff_to_pte(__off) \ | 771 | #define pgoff_to_pte(__off) \ |
780 | ((pte_t) { ((((__off) & 0x7f) << 1) + (((__off) >> 7) << 12)) \ | 772 | ((pte_t) { ((((__off) & 0x7f) << 1) + (((__off) >> 7) << 12)) \ |
781 | | _PAGE_INVALID_FILE }) | 773 | | _PAGE_TYPE_FILE }) |
782 | 774 | ||
783 | #endif /* !__ASSEMBLY__ */ | 775 | #endif /* !__ASSEMBLY__ */ |
784 | 776 | ||
diff --git a/include/asm-s390/processor.h b/include/asm-s390/processor.h index 5b71d3731723..a3a4e5fd30d7 100644 --- a/include/asm-s390/processor.h +++ b/include/asm-s390/processor.h | |||
@@ -339,4 +339,21 @@ int unregister_idle_notifier(struct notifier_block *nb); | |||
339 | 339 | ||
340 | #endif | 340 | #endif |
341 | 341 | ||
342 | /* | ||
343 | * Helper macro for exception table entries | ||
344 | */ | ||
345 | #ifndef __s390x__ | ||
346 | #define EX_TABLE(_fault,_target) \ | ||
347 | ".section __ex_table,\"a\"\n" \ | ||
348 | " .align 4\n" \ | ||
349 | " .long " #_fault "," #_target "\n" \ | ||
350 | ".previous\n" | ||
351 | #else | ||
352 | #define EX_TABLE(_fault,_target) \ | ||
353 | ".section __ex_table,\"a\"\n" \ | ||
354 | " .align 8\n" \ | ||
355 | " .quad " #_fault "," #_target "\n" \ | ||
356 | ".previous\n" | ||
357 | #endif | ||
358 | |||
342 | #endif /* __ASM_S390_PROCESSOR_H */ | 359 | #endif /* __ASM_S390_PROCESSOR_H */ |
diff --git a/include/asm-s390/setup.h b/include/asm-s390/setup.h index 19e31979309a..f1959732b6fd 100644 --- a/include/asm-s390/setup.h +++ b/include/asm-s390/setup.h | |||
@@ -14,8 +14,6 @@ | |||
14 | 14 | ||
15 | #define PARMAREA 0x10400 | 15 | #define PARMAREA 0x10400 |
16 | #define COMMAND_LINE_SIZE 896 | 16 | #define COMMAND_LINE_SIZE 896 |
17 | #define RAMDISK_ORIGIN 0x800000 | ||
18 | #define RAMDISK_SIZE 0x800000 | ||
19 | #define MEMORY_CHUNKS 16 /* max 0x7fff */ | 17 | #define MEMORY_CHUNKS 16 /* max 0x7fff */ |
20 | #define IPL_PARMBLOCK_ORIGIN 0x2000 | 18 | #define IPL_PARMBLOCK_ORIGIN 0x2000 |
21 | 19 | ||
@@ -46,10 +44,12 @@ extern unsigned long machine_flags; | |||
46 | #define MACHINE_HAS_IEEE (machine_flags & 2) | 44 | #define MACHINE_HAS_IEEE (machine_flags & 2) |
47 | #define MACHINE_HAS_CSP (machine_flags & 8) | 45 | #define MACHINE_HAS_CSP (machine_flags & 8) |
48 | #define MACHINE_HAS_DIAG44 (1) | 46 | #define MACHINE_HAS_DIAG44 (1) |
47 | #define MACHINE_HAS_MVCOS (0) | ||
49 | #else /* __s390x__ */ | 48 | #else /* __s390x__ */ |
50 | #define MACHINE_HAS_IEEE (1) | 49 | #define MACHINE_HAS_IEEE (1) |
51 | #define MACHINE_HAS_CSP (1) | 50 | #define MACHINE_HAS_CSP (1) |
52 | #define MACHINE_HAS_DIAG44 (machine_flags & 32) | 51 | #define MACHINE_HAS_DIAG44 (machine_flags & 32) |
52 | #define MACHINE_HAS_MVCOS (machine_flags & 512) | ||
53 | #endif /* __s390x__ */ | 53 | #endif /* __s390x__ */ |
54 | 54 | ||
55 | 55 | ||
@@ -70,52 +70,76 @@ extern unsigned int console_irq; | |||
70 | #define SET_CONSOLE_3215 do { console_mode = 2; } while (0) | 70 | #define SET_CONSOLE_3215 do { console_mode = 2; } while (0) |
71 | #define SET_CONSOLE_3270 do { console_mode = 3; } while (0) | 71 | #define SET_CONSOLE_3270 do { console_mode = 3; } while (0) |
72 | 72 | ||
73 | struct ipl_list_header { | 73 | |
74 | u32 length; | 74 | struct ipl_list_hdr { |
75 | u8 reserved[3]; | 75 | u32 len; |
76 | u8 reserved1[3]; | ||
76 | u8 version; | 77 | u8 version; |
78 | u32 blk0_len; | ||
79 | u8 pbt; | ||
80 | u8 flags; | ||
81 | u16 reserved2; | ||
77 | } __attribute__((packed)); | 82 | } __attribute__((packed)); |
78 | 83 | ||
79 | struct ipl_block_fcp { | 84 | struct ipl_block_fcp { |
80 | u32 length; | 85 | u8 reserved1[313-1]; |
81 | u8 pbt; | 86 | u8 opt; |
82 | u8 reserved1[322-1]; | 87 | u8 reserved2[3]; |
88 | u16 reserved3; | ||
83 | u16 devno; | 89 | u16 devno; |
84 | u8 reserved2[4]; | 90 | u8 reserved4[4]; |
85 | u64 wwpn; | 91 | u64 wwpn; |
86 | u64 lun; | 92 | u64 lun; |
87 | u32 bootprog; | 93 | u32 bootprog; |
88 | u8 reserved3[12]; | 94 | u8 reserved5[12]; |
89 | u64 br_lba; | 95 | u64 br_lba; |
90 | u32 scp_data_len; | 96 | u32 scp_data_len; |
91 | u8 reserved4[260]; | 97 | u8 reserved6[260]; |
92 | u8 scp_data[]; | 98 | u8 scp_data[]; |
93 | } __attribute__((packed)); | 99 | } __attribute__((packed)); |
94 | 100 | ||
101 | struct ipl_block_ccw { | ||
102 | u8 load_param[8]; | ||
103 | u8 reserved1[84]; | ||
104 | u8 reserved2[2]; | ||
105 | u16 devno; | ||
106 | u8 vm_flags; | ||
107 | u8 reserved3[3]; | ||
108 | u32 vm_parm_len; | ||
109 | } __attribute__((packed)); | ||
110 | |||
95 | struct ipl_parameter_block { | 111 | struct ipl_parameter_block { |
112 | struct ipl_list_hdr hdr; | ||
96 | union { | 113 | union { |
97 | u32 length; | 114 | struct ipl_block_fcp fcp; |
98 | struct ipl_list_header header; | 115 | struct ipl_block_ccw ccw; |
99 | } hdr; | 116 | } ipl_info; |
100 | struct ipl_block_fcp fcp; | ||
101 | } __attribute__((packed)); | 117 | } __attribute__((packed)); |
102 | 118 | ||
103 | #define IPL_MAX_SUPPORTED_VERSION (0) | 119 | #define IPL_PARM_BLK_FCP_LEN (sizeof(struct ipl_list_hdr) + \ |
120 | sizeof(struct ipl_block_fcp)) | ||
104 | 121 | ||
105 | #define IPL_TYPE_FCP (0) | 122 | #define IPL_PARM_BLK_CCW_LEN (sizeof(struct ipl_list_hdr) + \ |
123 | sizeof(struct ipl_block_ccw)) | ||
124 | |||
125 | #define IPL_MAX_SUPPORTED_VERSION (0) | ||
106 | 126 | ||
107 | /* | 127 | /* |
108 | * IPL validity flags and parameters as detected in head.S | 128 | * IPL validity flags and parameters as detected in head.S |
109 | */ | 129 | */ |
110 | extern u32 ipl_parameter_flags; | 130 | extern u32 ipl_flags; |
111 | extern u16 ipl_devno; | 131 | extern u16 ipl_devno; |
112 | 132 | ||
113 | #define IPL_DEVNO_VALID (ipl_parameter_flags & 1) | 133 | void do_reipl(void); |
114 | #define IPL_PARMBLOCK_VALID (ipl_parameter_flags & 2) | 134 | |
135 | enum { | ||
136 | IPL_DEVNO_VALID = 1, | ||
137 | IPL_PARMBLOCK_VALID = 2, | ||
138 | }; | ||
115 | 139 | ||
116 | #define IPL_PARMBLOCK_START ((struct ipl_parameter_block *) \ | 140 | #define IPL_PARMBLOCK_START ((struct ipl_parameter_block *) \ |
117 | IPL_PARMBLOCK_ORIGIN) | 141 | IPL_PARMBLOCK_ORIGIN) |
118 | #define IPL_PARMBLOCK_SIZE (IPL_PARMBLOCK_START->hdr.length) | 142 | #define IPL_PARMBLOCK_SIZE (IPL_PARMBLOCK_START->hdr.len) |
119 | 143 | ||
120 | #else /* __ASSEMBLY__ */ | 144 | #else /* __ASSEMBLY__ */ |
121 | 145 | ||
diff --git a/include/asm-s390/smp.h b/include/asm-s390/smp.h index 657646054c5e..9fb02e9779c9 100644 --- a/include/asm-s390/smp.h +++ b/include/asm-s390/smp.h | |||
@@ -104,7 +104,7 @@ smp_call_function_on(void (*func) (void *info), void *info, | |||
104 | #define smp_cpu_not_running(cpu) 1 | 104 | #define smp_cpu_not_running(cpu) 1 |
105 | #define smp_get_cpu(cpu) ({ 0; }) | 105 | #define smp_get_cpu(cpu) ({ 0; }) |
106 | #define smp_put_cpu(cpu) ({ 0; }) | 106 | #define smp_put_cpu(cpu) ({ 0; }) |
107 | #define smp_setup_cpu_possible_map() | 107 | #define smp_setup_cpu_possible_map() do { } while (0) |
108 | #endif | 108 | #endif |
109 | 109 | ||
110 | #endif | 110 | #endif |
diff --git a/include/asm-s390/uaccess.h b/include/asm-s390/uaccess.h index 0b7c0ca4c3d7..e2047b0c9092 100644 --- a/include/asm-s390/uaccess.h +++ b/include/asm-s390/uaccess.h | |||
@@ -47,7 +47,7 @@ | |||
47 | S390_lowcore.user_asce : S390_lowcore.kernel_asce; \ | 47 | S390_lowcore.user_asce : S390_lowcore.kernel_asce; \ |
48 | asm volatile ("lctlg 7,7,%0" : : "m" (__pto) ); \ | 48 | asm volatile ("lctlg 7,7,%0" : : "m" (__pto) ); \ |
49 | }) | 49 | }) |
50 | #else | 50 | #else /* __s390x__ */ |
51 | #define set_fs(x) \ | 51 | #define set_fs(x) \ |
52 | ({ \ | 52 | ({ \ |
53 | unsigned long __pto; \ | 53 | unsigned long __pto; \ |
@@ -56,7 +56,7 @@ | |||
56 | S390_lowcore.user_asce : S390_lowcore.kernel_asce; \ | 56 | S390_lowcore.user_asce : S390_lowcore.kernel_asce; \ |
57 | asm volatile ("lctl 7,7,%0" : : "m" (__pto) ); \ | 57 | asm volatile ("lctl 7,7,%0" : : "m" (__pto) ); \ |
58 | }) | 58 | }) |
59 | #endif | 59 | #endif /* __s390x__ */ |
60 | 60 | ||
61 | #define segment_eq(a,b) ((a).ar4 == (b).ar4) | 61 | #define segment_eq(a,b) ((a).ar4 == (b).ar4) |
62 | 62 | ||
@@ -85,76 +85,51 @@ struct exception_table_entry | |||
85 | unsigned long insn, fixup; | 85 | unsigned long insn, fixup; |
86 | }; | 86 | }; |
87 | 87 | ||
88 | #ifndef __s390x__ | 88 | struct uaccess_ops { |
89 | #define __uaccess_fixup \ | 89 | size_t (*copy_from_user)(size_t, const void __user *, void *); |
90 | ".section .fixup,\"ax\"\n" \ | 90 | size_t (*copy_from_user_small)(size_t, const void __user *, void *); |
91 | "2: lhi %0,%4\n" \ | 91 | size_t (*copy_to_user)(size_t, void __user *, const void *); |
92 | " bras 1,3f\n" \ | 92 | size_t (*copy_to_user_small)(size_t, void __user *, const void *); |
93 | " .long 1b\n" \ | 93 | size_t (*copy_in_user)(size_t, void __user *, const void __user *); |
94 | "3: l 1,0(1)\n" \ | 94 | size_t (*clear_user)(size_t, void __user *); |
95 | " br 1\n" \ | 95 | size_t (*strnlen_user)(size_t, const char __user *); |
96 | ".previous\n" \ | 96 | size_t (*strncpy_from_user)(size_t, const char __user *, char *); |
97 | ".section __ex_table,\"a\"\n" \ | 97 | int (*futex_atomic_op)(int op, int __user *, int oparg, int *old); |
98 | " .align 4\n" \ | 98 | int (*futex_atomic_cmpxchg)(int __user *, int old, int new); |
99 | " .long 0b,2b\n" \ | 99 | }; |
100 | ".previous" | 100 | |
101 | #define __uaccess_clobber "cc", "1" | 101 | extern struct uaccess_ops uaccess; |
102 | #else /* __s390x__ */ | 102 | extern struct uaccess_ops uaccess_std; |
103 | #define __uaccess_fixup \ | 103 | extern struct uaccess_ops uaccess_mvcos; |
104 | ".section .fixup,\"ax\"\n" \ | 104 | |
105 | "2: lghi %0,%4\n" \ | 105 | static inline int __put_user_fn(size_t size, void __user *ptr, void *x) |
106 | " jg 1b\n" \ | 106 | { |
107 | ".previous\n" \ | 107 | size = uaccess.copy_to_user_small(size, ptr, x); |
108 | ".section __ex_table,\"a\"\n" \ | 108 | return size ? -EFAULT : size; |
109 | " .align 8\n" \ | 109 | } |
110 | " .quad 0b,2b\n" \ | 110 | |
111 | ".previous" | 111 | static inline int __get_user_fn(size_t size, const void __user *ptr, void *x) |
112 | #define __uaccess_clobber "cc" | 112 | { |
113 | #endif /* __s390x__ */ | 113 | size = uaccess.copy_from_user_small(size, ptr, x); |
114 | return size ? -EFAULT : size; | ||
115 | } | ||
114 | 116 | ||
115 | /* | 117 | /* |
116 | * These are the main single-value transfer routines. They automatically | 118 | * These are the main single-value transfer routines. They automatically |
117 | * use the right size if we just have the right pointer type. | 119 | * use the right size if we just have the right pointer type. |
118 | */ | 120 | */ |
119 | #if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ > 2) | ||
120 | #define __put_user_asm(x, ptr, err) \ | ||
121 | ({ \ | ||
122 | err = 0; \ | ||
123 | asm volatile( \ | ||
124 | "0: mvcs 0(%1,%2),%3,%0\n" \ | ||
125 | "1:\n" \ | ||
126 | __uaccess_fixup \ | ||
127 | : "+&d" (err) \ | ||
128 | : "d" (sizeof(*(ptr))), "a" (ptr), "Q" (x), \ | ||
129 | "K" (-EFAULT) \ | ||
130 | : __uaccess_clobber ); \ | ||
131 | }) | ||
132 | #else | ||
133 | #define __put_user_asm(x, ptr, err) \ | ||
134 | ({ \ | ||
135 | err = 0; \ | ||
136 | asm volatile( \ | ||
137 | "0: mvcs 0(%1,%2),0(%3),%0\n" \ | ||
138 | "1:\n" \ | ||
139 | __uaccess_fixup \ | ||
140 | : "+&d" (err) \ | ||
141 | : "d" (sizeof(*(ptr))), "a" (ptr), "a" (&(x)), \ | ||
142 | "K" (-EFAULT), "m" (x) \ | ||
143 | : __uaccess_clobber ); \ | ||
144 | }) | ||
145 | #endif | ||
146 | |||
147 | #define __put_user(x, ptr) \ | 121 | #define __put_user(x, ptr) \ |
148 | ({ \ | 122 | ({ \ |
149 | __typeof__(*(ptr)) __x = (x); \ | 123 | __typeof__(*(ptr)) __x = (x); \ |
150 | int __pu_err; \ | 124 | int __pu_err = -EFAULT; \ |
151 | __chk_user_ptr(ptr); \ | 125 | __chk_user_ptr(ptr); \ |
152 | switch (sizeof (*(ptr))) { \ | 126 | switch (sizeof (*(ptr))) { \ |
153 | case 1: \ | 127 | case 1: \ |
154 | case 2: \ | 128 | case 2: \ |
155 | case 4: \ | 129 | case 4: \ |
156 | case 8: \ | 130 | case 8: \ |
157 | __put_user_asm(__x, ptr, __pu_err); \ | 131 | __pu_err = __put_user_fn(sizeof (*(ptr)), \ |
132 | ptr, &__x); \ | ||
158 | break; \ | 133 | break; \ |
159 | default: \ | 134 | default: \ |
160 | __put_user_bad(); \ | 135 | __put_user_bad(); \ |
@@ -172,60 +147,36 @@ struct exception_table_entry | |||
172 | 147 | ||
173 | extern int __put_user_bad(void) __attribute__((noreturn)); | 148 | extern int __put_user_bad(void) __attribute__((noreturn)); |
174 | 149 | ||
175 | #if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ > 2) | ||
176 | #define __get_user_asm(x, ptr, err) \ | ||
177 | ({ \ | ||
178 | err = 0; \ | ||
179 | asm volatile ( \ | ||
180 | "0: mvcp %O1(%2,%R1),0(%3),%0\n" \ | ||
181 | "1:\n" \ | ||
182 | __uaccess_fixup \ | ||
183 | : "+&d" (err), "=Q" (x) \ | ||
184 | : "d" (sizeof(*(ptr))), "a" (ptr), \ | ||
185 | "K" (-EFAULT) \ | ||
186 | : __uaccess_clobber ); \ | ||
187 | }) | ||
188 | #else | ||
189 | #define __get_user_asm(x, ptr, err) \ | ||
190 | ({ \ | ||
191 | err = 0; \ | ||
192 | asm volatile ( \ | ||
193 | "0: mvcp 0(%2,%5),0(%3),%0\n" \ | ||
194 | "1:\n" \ | ||
195 | __uaccess_fixup \ | ||
196 | : "+&d" (err), "=m" (x) \ | ||
197 | : "d" (sizeof(*(ptr))), "a" (ptr), \ | ||
198 | "K" (-EFAULT), "a" (&(x)) \ | ||
199 | : __uaccess_clobber ); \ | ||
200 | }) | ||
201 | #endif | ||
202 | |||
203 | #define __get_user(x, ptr) \ | 150 | #define __get_user(x, ptr) \ |
204 | ({ \ | 151 | ({ \ |
205 | int __gu_err; \ | 152 | int __gu_err = -EFAULT; \ |
206 | __chk_user_ptr(ptr); \ | 153 | __chk_user_ptr(ptr); \ |
207 | switch (sizeof(*(ptr))) { \ | 154 | switch (sizeof(*(ptr))) { \ |
208 | case 1: { \ | 155 | case 1: { \ |
209 | unsigned char __x; \ | 156 | unsigned char __x; \ |
210 | __get_user_asm(__x, ptr, __gu_err); \ | 157 | __gu_err = __get_user_fn(sizeof (*(ptr)), \ |
158 | ptr, &__x); \ | ||
211 | (x) = *(__force __typeof__(*(ptr)) *) &__x; \ | 159 | (x) = *(__force __typeof__(*(ptr)) *) &__x; \ |
212 | break; \ | 160 | break; \ |
213 | }; \ | 161 | }; \ |
214 | case 2: { \ | 162 | case 2: { \ |
215 | unsigned short __x; \ | 163 | unsigned short __x; \ |
216 | __get_user_asm(__x, ptr, __gu_err); \ | 164 | __gu_err = __get_user_fn(sizeof (*(ptr)), \ |
165 | ptr, &__x); \ | ||
217 | (x) = *(__force __typeof__(*(ptr)) *) &__x; \ | 166 | (x) = *(__force __typeof__(*(ptr)) *) &__x; \ |
218 | break; \ | 167 | break; \ |
219 | }; \ | 168 | }; \ |
220 | case 4: { \ | 169 | case 4: { \ |
221 | unsigned int __x; \ | 170 | unsigned int __x; \ |
222 | __get_user_asm(__x, ptr, __gu_err); \ | 171 | __gu_err = __get_user_fn(sizeof (*(ptr)), \ |
172 | ptr, &__x); \ | ||
223 | (x) = *(__force __typeof__(*(ptr)) *) &__x; \ | 173 | (x) = *(__force __typeof__(*(ptr)) *) &__x; \ |
224 | break; \ | 174 | break; \ |
225 | }; \ | 175 | }; \ |
226 | case 8: { \ | 176 | case 8: { \ |
227 | unsigned long long __x; \ | 177 | unsigned long long __x; \ |
228 | __get_user_asm(__x, ptr, __gu_err); \ | 178 | __gu_err = __get_user_fn(sizeof (*(ptr)), \ |
179 | ptr, &__x); \ | ||
229 | (x) = *(__force __typeof__(*(ptr)) *) &__x; \ | 180 | (x) = *(__force __typeof__(*(ptr)) *) &__x; \ |
230 | break; \ | 181 | break; \ |
231 | }; \ | 182 | }; \ |
@@ -247,8 +198,6 @@ extern int __get_user_bad(void) __attribute__((noreturn)); | |||
247 | #define __put_user_unaligned __put_user | 198 | #define __put_user_unaligned __put_user |
248 | #define __get_user_unaligned __get_user | 199 | #define __get_user_unaligned __get_user |
249 | 200 | ||
250 | extern long __copy_to_user_asm(const void *from, long n, void __user *to); | ||
251 | |||
252 | /** | 201 | /** |
253 | * __copy_to_user: - Copy a block of data into user space, with less checking. | 202 | * __copy_to_user: - Copy a block of data into user space, with less checking. |
254 | * @to: Destination address, in user space. | 203 | * @to: Destination address, in user space. |
@@ -266,7 +215,10 @@ extern long __copy_to_user_asm(const void *from, long n, void __user *to); | |||
266 | static inline unsigned long | 215 | static inline unsigned long |
267 | __copy_to_user(void __user *to, const void *from, unsigned long n) | 216 | __copy_to_user(void __user *to, const void *from, unsigned long n) |
268 | { | 217 | { |
269 | return __copy_to_user_asm(from, n, to); | 218 | if (__builtin_constant_p(n) && (n <= 256)) |
219 | return uaccess.copy_to_user_small(n, to, from); | ||
220 | else | ||
221 | return uaccess.copy_to_user(n, to, from); | ||
270 | } | 222 | } |
271 | 223 | ||
272 | #define __copy_to_user_inatomic __copy_to_user | 224 | #define __copy_to_user_inatomic __copy_to_user |
@@ -294,8 +246,6 @@ copy_to_user(void __user *to, const void *from, unsigned long n) | |||
294 | return n; | 246 | return n; |
295 | } | 247 | } |
296 | 248 | ||
297 | extern long __copy_from_user_asm(void *to, long n, const void __user *from); | ||
298 | |||
299 | /** | 249 | /** |
300 | * __copy_from_user: - Copy a block of data from user space, with less checking. | 250 | * __copy_from_user: - Copy a block of data from user space, with less checking. |
301 | * @to: Destination address, in kernel space. | 251 | * @to: Destination address, in kernel space. |
@@ -316,7 +266,10 @@ extern long __copy_from_user_asm(void *to, long n, const void __user *from); | |||
316 | static inline unsigned long | 266 | static inline unsigned long |
317 | __copy_from_user(void *to, const void __user *from, unsigned long n) | 267 | __copy_from_user(void *to, const void __user *from, unsigned long n) |
318 | { | 268 | { |
319 | return __copy_from_user_asm(to, n, from); | 269 | if (__builtin_constant_p(n) && (n <= 256)) |
270 | return uaccess.copy_from_user_small(n, from, to); | ||
271 | else | ||
272 | return uaccess.copy_from_user(n, from, to); | ||
320 | } | 273 | } |
321 | 274 | ||
322 | /** | 275 | /** |
@@ -346,13 +299,10 @@ copy_from_user(void *to, const void __user *from, unsigned long n) | |||
346 | return n; | 299 | return n; |
347 | } | 300 | } |
348 | 301 | ||
349 | extern unsigned long __copy_in_user_asm(const void __user *from, long n, | ||
350 | void __user *to); | ||
351 | |||
352 | static inline unsigned long | 302 | static inline unsigned long |
353 | __copy_in_user(void __user *to, const void __user *from, unsigned long n) | 303 | __copy_in_user(void __user *to, const void __user *from, unsigned long n) |
354 | { | 304 | { |
355 | return __copy_in_user_asm(from, n, to); | 305 | return uaccess.copy_in_user(n, to, from); |
356 | } | 306 | } |
357 | 307 | ||
358 | static inline unsigned long | 308 | static inline unsigned long |
@@ -360,34 +310,28 @@ copy_in_user(void __user *to, const void __user *from, unsigned long n) | |||
360 | { | 310 | { |
361 | might_sleep(); | 311 | might_sleep(); |
362 | if (__access_ok(from,n) && __access_ok(to,n)) | 312 | if (__access_ok(from,n) && __access_ok(to,n)) |
363 | n = __copy_in_user_asm(from, n, to); | 313 | n = __copy_in_user(to, from, n); |
364 | return n; | 314 | return n; |
365 | } | 315 | } |
366 | 316 | ||
367 | /* | 317 | /* |
368 | * Copy a null terminated string from userspace. | 318 | * Copy a null terminated string from userspace. |
369 | */ | 319 | */ |
370 | extern long __strncpy_from_user_asm(long count, char *dst, | ||
371 | const char __user *src); | ||
372 | |||
373 | static inline long | 320 | static inline long |
374 | strncpy_from_user(char *dst, const char __user *src, long count) | 321 | strncpy_from_user(char *dst, const char __user *src, long count) |
375 | { | 322 | { |
376 | long res = -EFAULT; | 323 | long res = -EFAULT; |
377 | might_sleep(); | 324 | might_sleep(); |
378 | if (access_ok(VERIFY_READ, src, 1)) | 325 | if (access_ok(VERIFY_READ, src, 1)) |
379 | res = __strncpy_from_user_asm(count, dst, src); | 326 | res = uaccess.strncpy_from_user(count, src, dst); |
380 | return res; | 327 | return res; |
381 | } | 328 | } |
382 | 329 | ||
383 | |||
384 | extern long __strnlen_user_asm(long count, const char __user *src); | ||
385 | |||
386 | static inline unsigned long | 330 | static inline unsigned long |
387 | strnlen_user(const char __user * src, unsigned long n) | 331 | strnlen_user(const char __user * src, unsigned long n) |
388 | { | 332 | { |
389 | might_sleep(); | 333 | might_sleep(); |
390 | return __strnlen_user_asm(n, src); | 334 | return uaccess.strnlen_user(n, src); |
391 | } | 335 | } |
392 | 336 | ||
393 | /** | 337 | /** |
@@ -410,12 +354,10 @@ strnlen_user(const char __user * src, unsigned long n) | |||
410 | * Zero Userspace | 354 | * Zero Userspace |
411 | */ | 355 | */ |
412 | 356 | ||
413 | extern long __clear_user_asm(void __user *to, long n); | ||
414 | |||
415 | static inline unsigned long | 357 | static inline unsigned long |
416 | __clear_user(void __user *to, unsigned long n) | 358 | __clear_user(void __user *to, unsigned long n) |
417 | { | 359 | { |
418 | return __clear_user_asm(to, n); | 360 | return uaccess.clear_user(n, to); |
419 | } | 361 | } |
420 | 362 | ||
421 | static inline unsigned long | 363 | static inline unsigned long |
@@ -423,7 +365,7 @@ clear_user(void __user *to, unsigned long n) | |||
423 | { | 365 | { |
424 | might_sleep(); | 366 | might_sleep(); |
425 | if (access_ok(VERIFY_WRITE, to, n)) | 367 | if (access_ok(VERIFY_WRITE, to, n)) |
426 | n = __clear_user_asm(to, n); | 368 | n = uaccess.clear_user(n, to); |
427 | return n; | 369 | return n; |
428 | } | 370 | } |
429 | 371 | ||
diff --git a/include/asm-s390/unistd.h b/include/asm-s390/unistd.h index aa7a243862e1..02b942d85c37 100644 --- a/include/asm-s390/unistd.h +++ b/include/asm-s390/unistd.h | |||
@@ -25,17 +25,12 @@ | |||
25 | #define __NR_unlink 10 | 25 | #define __NR_unlink 10 |
26 | #define __NR_execve 11 | 26 | #define __NR_execve 11 |
27 | #define __NR_chdir 12 | 27 | #define __NR_chdir 12 |
28 | #define __NR_time 13 | ||
29 | #define __NR_mknod 14 | 28 | #define __NR_mknod 14 |
30 | #define __NR_chmod 15 | 29 | #define __NR_chmod 15 |
31 | #define __NR_lchown 16 | ||
32 | #define __NR_lseek 19 | 30 | #define __NR_lseek 19 |
33 | #define __NR_getpid 20 | 31 | #define __NR_getpid 20 |
34 | #define __NR_mount 21 | 32 | #define __NR_mount 21 |
35 | #define __NR_umount 22 | 33 | #define __NR_umount 22 |
36 | #define __NR_setuid 23 | ||
37 | #define __NR_getuid 24 | ||
38 | #define __NR_stime 25 | ||
39 | #define __NR_ptrace 26 | 34 | #define __NR_ptrace 26 |
40 | #define __NR_alarm 27 | 35 | #define __NR_alarm 27 |
41 | #define __NR_pause 29 | 36 | #define __NR_pause 29 |
@@ -51,11 +46,7 @@ | |||
51 | #define __NR_pipe 42 | 46 | #define __NR_pipe 42 |
52 | #define __NR_times 43 | 47 | #define __NR_times 43 |
53 | #define __NR_brk 45 | 48 | #define __NR_brk 45 |
54 | #define __NR_setgid 46 | ||
55 | #define __NR_getgid 47 | ||
56 | #define __NR_signal 48 | 49 | #define __NR_signal 48 |
57 | #define __NR_geteuid 49 | ||
58 | #define __NR_getegid 50 | ||
59 | #define __NR_acct 51 | 50 | #define __NR_acct 51 |
60 | #define __NR_umount2 52 | 51 | #define __NR_umount2 52 |
61 | #define __NR_ioctl 54 | 52 | #define __NR_ioctl 54 |
@@ -69,18 +60,13 @@ | |||
69 | #define __NR_getpgrp 65 | 60 | #define __NR_getpgrp 65 |
70 | #define __NR_setsid 66 | 61 | #define __NR_setsid 66 |
71 | #define __NR_sigaction 67 | 62 | #define __NR_sigaction 67 |
72 | #define __NR_setreuid 70 | ||
73 | #define __NR_setregid 71 | ||
74 | #define __NR_sigsuspend 72 | 63 | #define __NR_sigsuspend 72 |
75 | #define __NR_sigpending 73 | 64 | #define __NR_sigpending 73 |
76 | #define __NR_sethostname 74 | 65 | #define __NR_sethostname 74 |
77 | #define __NR_setrlimit 75 | 66 | #define __NR_setrlimit 75 |
78 | #define __NR_getrlimit 76 | ||
79 | #define __NR_getrusage 77 | 67 | #define __NR_getrusage 77 |
80 | #define __NR_gettimeofday 78 | 68 | #define __NR_gettimeofday 78 |
81 | #define __NR_settimeofday 79 | 69 | #define __NR_settimeofday 79 |
82 | #define __NR_getgroups 80 | ||
83 | #define __NR_setgroups 81 | ||
84 | #define __NR_symlink 83 | 70 | #define __NR_symlink 83 |
85 | #define __NR_readlink 85 | 71 | #define __NR_readlink 85 |
86 | #define __NR_uselib 86 | 72 | #define __NR_uselib 86 |
@@ -92,12 +78,10 @@ | |||
92 | #define __NR_truncate 92 | 78 | #define __NR_truncate 92 |
93 | #define __NR_ftruncate 93 | 79 | #define __NR_ftruncate 93 |
94 | #define __NR_fchmod 94 | 80 | #define __NR_fchmod 94 |
95 | #define __NR_fchown 95 | ||
96 | #define __NR_getpriority 96 | 81 | #define __NR_getpriority 96 |
97 | #define __NR_setpriority 97 | 82 | #define __NR_setpriority 97 |
98 | #define __NR_statfs 99 | 83 | #define __NR_statfs 99 |
99 | #define __NR_fstatfs 100 | 84 | #define __NR_fstatfs 100 |
100 | #define __NR_ioperm 101 | ||
101 | #define __NR_socketcall 102 | 85 | #define __NR_socketcall 102 |
102 | #define __NR_syslog 103 | 86 | #define __NR_syslog 103 |
103 | #define __NR_setitimer 104 | 87 | #define __NR_setitimer 104 |
@@ -131,11 +115,7 @@ | |||
131 | #define __NR_sysfs 135 | 115 | #define __NR_sysfs 135 |
132 | #define __NR_personality 136 | 116 | #define __NR_personality 136 |
133 | #define __NR_afs_syscall 137 /* Syscall for Andrew File System */ | 117 | #define __NR_afs_syscall 137 /* Syscall for Andrew File System */ |
134 | #define __NR_setfsuid 138 | ||
135 | #define __NR_setfsgid 139 | ||
136 | #define __NR__llseek 140 | ||
137 | #define __NR_getdents 141 | 118 | #define __NR_getdents 141 |
138 | #define __NR__newselect 142 | ||
139 | #define __NR_flock 143 | 119 | #define __NR_flock 143 |
140 | #define __NR_msync 144 | 120 | #define __NR_msync 144 |
141 | #define __NR_readv 145 | 121 | #define __NR_readv 145 |
@@ -157,13 +137,9 @@ | |||
157 | #define __NR_sched_rr_get_interval 161 | 137 | #define __NR_sched_rr_get_interval 161 |
158 | #define __NR_nanosleep 162 | 138 | #define __NR_nanosleep 162 |
159 | #define __NR_mremap 163 | 139 | #define __NR_mremap 163 |
160 | #define __NR_setresuid 164 | ||
161 | #define __NR_getresuid 165 | ||
162 | #define __NR_query_module 167 | 140 | #define __NR_query_module 167 |
163 | #define __NR_poll 168 | 141 | #define __NR_poll 168 |
164 | #define __NR_nfsservctl 169 | 142 | #define __NR_nfsservctl 169 |
165 | #define __NR_setresgid 170 | ||
166 | #define __NR_getresgid 171 | ||
167 | #define __NR_prctl 172 | 143 | #define __NR_prctl 172 |
168 | #define __NR_rt_sigreturn 173 | 144 | #define __NR_rt_sigreturn 173 |
169 | #define __NR_rt_sigaction 174 | 145 | #define __NR_rt_sigaction 174 |
@@ -174,7 +150,6 @@ | |||
174 | #define __NR_rt_sigsuspend 179 | 150 | #define __NR_rt_sigsuspend 179 |
175 | #define __NR_pread64 180 | 151 | #define __NR_pread64 180 |
176 | #define __NR_pwrite64 181 | 152 | #define __NR_pwrite64 181 |
177 | #define __NR_chown 182 | ||
178 | #define __NR_getcwd 183 | 153 | #define __NR_getcwd 183 |
179 | #define __NR_capget 184 | 154 | #define __NR_capget 184 |
180 | #define __NR_capset 185 | 155 | #define __NR_capset 185 |
@@ -183,39 +158,11 @@ | |||
183 | #define __NR_getpmsg 188 | 158 | #define __NR_getpmsg 188 |
184 | #define __NR_putpmsg 189 | 159 | #define __NR_putpmsg 189 |
185 | #define __NR_vfork 190 | 160 | #define __NR_vfork 190 |
186 | #define __NR_ugetrlimit 191 /* SuS compliant getrlimit */ | ||
187 | #define __NR_mmap2 192 | ||
188 | #define __NR_truncate64 193 | ||
189 | #define __NR_ftruncate64 194 | ||
190 | #define __NR_stat64 195 | ||
191 | #define __NR_lstat64 196 | ||
192 | #define __NR_fstat64 197 | ||
193 | #define __NR_lchown32 198 | ||
194 | #define __NR_getuid32 199 | ||
195 | #define __NR_getgid32 200 | ||
196 | #define __NR_geteuid32 201 | ||
197 | #define __NR_getegid32 202 | ||
198 | #define __NR_setreuid32 203 | ||
199 | #define __NR_setregid32 204 | ||
200 | #define __NR_getgroups32 205 | ||
201 | #define __NR_setgroups32 206 | ||
202 | #define __NR_fchown32 207 | ||
203 | #define __NR_setresuid32 208 | ||
204 | #define __NR_getresuid32 209 | ||
205 | #define __NR_setresgid32 210 | ||
206 | #define __NR_getresgid32 211 | ||
207 | #define __NR_chown32 212 | ||
208 | #define __NR_setuid32 213 | ||
209 | #define __NR_setgid32 214 | ||
210 | #define __NR_setfsuid32 215 | ||
211 | #define __NR_setfsgid32 216 | ||
212 | #define __NR_pivot_root 217 | 161 | #define __NR_pivot_root 217 |
213 | #define __NR_mincore 218 | 162 | #define __NR_mincore 218 |
214 | #define __NR_madvise 219 | 163 | #define __NR_madvise 219 |
215 | #define __NR_getdents64 220 | 164 | #define __NR_getdents64 220 |
216 | #define __NR_fcntl64 221 | ||
217 | #define __NR_readahead 222 | 165 | #define __NR_readahead 222 |
218 | #define __NR_sendfile64 223 | ||
219 | #define __NR_setxattr 224 | 166 | #define __NR_setxattr 224 |
220 | #define __NR_lsetxattr 225 | 167 | #define __NR_lsetxattr 225 |
221 | #define __NR_fsetxattr 226 | 168 | #define __NR_fsetxattr 226 |
@@ -256,7 +203,6 @@ | |||
256 | #define __NR_clock_getres (__NR_timer_create+7) | 203 | #define __NR_clock_getres (__NR_timer_create+7) |
257 | #define __NR_clock_nanosleep (__NR_timer_create+8) | 204 | #define __NR_clock_nanosleep (__NR_timer_create+8) |
258 | /* Number 263 is reserved for vserver */ | 205 | /* Number 263 is reserved for vserver */ |
259 | #define __NR_fadvise64_64 264 | ||
260 | #define __NR_statfs64 265 | 206 | #define __NR_statfs64 265 |
261 | #define __NR_fstatfs64 266 | 207 | #define __NR_fstatfs64 266 |
262 | #define __NR_remap_file_pages 267 | 208 | #define __NR_remap_file_pages 267 |
@@ -285,7 +231,6 @@ | |||
285 | #define __NR_mknodat 290 | 231 | #define __NR_mknodat 290 |
286 | #define __NR_fchownat 291 | 232 | #define __NR_fchownat 291 |
287 | #define __NR_futimesat 292 | 233 | #define __NR_futimesat 292 |
288 | #define __NR_fstatat64 293 | ||
289 | #define __NR_unlinkat 294 | 234 | #define __NR_unlinkat 294 |
290 | #define __NR_renameat 295 | 235 | #define __NR_renameat 295 |
291 | #define __NR_linkat 296 | 236 | #define __NR_linkat 296 |
@@ -310,62 +255,65 @@ | |||
310 | * have a different name although they do the same (e.g. __NR_chown32 | 255 | * have a different name although they do the same (e.g. __NR_chown32 |
311 | * is __NR_chown on 64 bit). | 256 | * is __NR_chown on 64 bit). |
312 | */ | 257 | */ |
313 | #ifdef __s390x__ | 258 | #ifndef __s390x__ |
314 | #undef __NR_time | 259 | |
315 | #undef __NR_lchown | 260 | #define __NR_time 13 |
316 | #undef __NR_setuid | 261 | #define __NR_lchown 16 |
317 | #undef __NR_getuid | 262 | #define __NR_setuid 23 |
318 | #undef __NR_stime | 263 | #define __NR_getuid 24 |
319 | #undef __NR_setgid | 264 | #define __NR_stime 25 |
320 | #undef __NR_getgid | 265 | #define __NR_setgid 46 |
321 | #undef __NR_geteuid | 266 | #define __NR_getgid 47 |
322 | #undef __NR_getegid | 267 | #define __NR_geteuid 49 |
323 | #undef __NR_setreuid | 268 | #define __NR_getegid 50 |
324 | #undef __NR_setregid | 269 | #define __NR_setreuid 70 |
325 | #undef __NR_getrlimit | 270 | #define __NR_setregid 71 |
326 | #undef __NR_getgroups | 271 | #define __NR_getrlimit 76 |
327 | #undef __NR_setgroups | 272 | #define __NR_getgroups 80 |
328 | #undef __NR_fchown | 273 | #define __NR_setgroups 81 |
329 | #undef __NR_ioperm | 274 | #define __NR_fchown 95 |
330 | #undef __NR_setfsuid | 275 | #define __NR_ioperm 101 |
331 | #undef __NR_setfsgid | 276 | #define __NR_setfsuid 138 |
332 | #undef __NR__llseek | 277 | #define __NR_setfsgid 139 |
333 | #undef __NR__newselect | 278 | #define __NR__llseek 140 |
334 | #undef __NR_setresuid | 279 | #define __NR__newselect 142 |
335 | #undef __NR_getresuid | 280 | #define __NR_setresuid 164 |
336 | #undef __NR_setresgid | 281 | #define __NR_getresuid 165 |
337 | #undef __NR_getresgid | 282 | #define __NR_setresgid 170 |
338 | #undef __NR_chown | 283 | #define __NR_getresgid 171 |
339 | #undef __NR_ugetrlimit | 284 | #define __NR_chown 182 |
340 | #undef __NR_mmap2 | 285 | #define __NR_ugetrlimit 191 /* SuS compliant getrlimit */ |
341 | #undef __NR_truncate64 | 286 | #define __NR_mmap2 192 |
342 | #undef __NR_ftruncate64 | 287 | #define __NR_truncate64 193 |
343 | #undef __NR_stat64 | 288 | #define __NR_ftruncate64 194 |
344 | #undef __NR_lstat64 | 289 | #define __NR_stat64 195 |
345 | #undef __NR_fstat64 | 290 | #define __NR_lstat64 196 |
346 | #undef __NR_lchown32 | 291 | #define __NR_fstat64 197 |
347 | #undef __NR_getuid32 | 292 | #define __NR_lchown32 198 |
348 | #undef __NR_getgid32 | 293 | #define __NR_getuid32 199 |
349 | #undef __NR_geteuid32 | 294 | #define __NR_getgid32 200 |
350 | #undef __NR_getegid32 | 295 | #define __NR_geteuid32 201 |
351 | #undef __NR_setreuid32 | 296 | #define __NR_getegid32 202 |
352 | #undef __NR_setregid32 | 297 | #define __NR_setreuid32 203 |
353 | #undef __NR_getgroups32 | 298 | #define __NR_setregid32 204 |
354 | #undef __NR_setgroups32 | 299 | #define __NR_getgroups32 205 |
355 | #undef __NR_fchown32 | 300 | #define __NR_setgroups32 206 |
356 | #undef __NR_setresuid32 | 301 | #define __NR_fchown32 207 |
357 | #undef __NR_getresuid32 | 302 | #define __NR_setresuid32 208 |
358 | #undef __NR_setresgid32 | 303 | #define __NR_getresuid32 209 |
359 | #undef __NR_getresgid32 | 304 | #define __NR_setresgid32 210 |
360 | #undef __NR_chown32 | 305 | #define __NR_getresgid32 211 |
361 | #undef __NR_setuid32 | 306 | #define __NR_chown32 212 |
362 | #undef __NR_setgid32 | 307 | #define __NR_setuid32 213 |
363 | #undef __NR_setfsuid32 | 308 | #define __NR_setgid32 214 |
364 | #undef __NR_setfsgid32 | 309 | #define __NR_setfsuid32 215 |
365 | #undef __NR_fcntl64 | 310 | #define __NR_setfsgid32 216 |
366 | #undef __NR_sendfile64 | 311 | #define __NR_fcntl64 221 |
367 | #undef __NR_fadvise64_64 | 312 | #define __NR_sendfile64 223 |
368 | #undef __NR_fstatat64 | 313 | #define __NR_fadvise64_64 264 |
314 | #define __NR_fstatat64 293 | ||
315 | |||
316 | #else | ||
369 | 317 | ||
370 | #define __NR_select 142 | 318 | #define __NR_select 142 |
371 | #define __NR_getrlimit 191 /* SuS compliant getrlimit */ | 319 | #define __NR_getrlimit 191 /* SuS compliant getrlimit */ |
diff --git a/include/asm-s390/z90crypt.h b/include/asm-s390/z90crypt.h deleted file mode 100644 index 31a2439b07bd..000000000000 --- a/include/asm-s390/z90crypt.h +++ /dev/null | |||
@@ -1,212 +0,0 @@ | |||
1 | /* | ||
2 | * include/asm-s390/z90crypt.h | ||
3 | * | ||
4 | * z90crypt 1.3.3 (user-visible header) | ||
5 | * | ||
6 | * Copyright (C) 2001, 2005 IBM Corporation | ||
7 | * Author(s): Robert Burroughs | ||
8 | * Eric Rossman (edrossma@us.ibm.com) | ||
9 | * | ||
10 | * Hotplug & misc device support: Jochen Roehrig (roehrig@de.ibm.com) | ||
11 | * | ||
12 | * This program is free software; you can redistribute it and/or modify | ||
13 | * it under the terms of the GNU General Public License as published by | ||
14 | * the Free Software Foundation; either version 2, or (at your option) | ||
15 | * any later version. | ||
16 | * | ||
17 | * This program is distributed in the hope that it will be useful, | ||
18 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
19 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
20 | * GNU General Public License for more details. | ||
21 | * | ||
22 | * You should have received a copy of the GNU General Public License | ||
23 | * along with this program; if not, write to the Free Software | ||
24 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | ||
25 | */ | ||
26 | |||
27 | #ifndef __ASM_S390_Z90CRYPT_H | ||
28 | #define __ASM_S390_Z90CRYPT_H | ||
29 | #include <linux/ioctl.h> | ||
30 | |||
31 | #define z90crypt_VERSION 1 | ||
32 | #define z90crypt_RELEASE 3 // 2 = PCIXCC, 3 = rewrite for coding standards | ||
33 | #define z90crypt_VARIANT 3 // 3 = CEX2A support | ||
34 | |||
35 | /** | ||
36 | * struct ica_rsa_modexpo | ||
37 | * | ||
38 | * Requirements: | ||
39 | * - outputdatalength is at least as large as inputdatalength. | ||
40 | * - All key parts are right justified in their fields, padded on | ||
41 | * the left with zeroes. | ||
42 | * - length(b_key) = inputdatalength | ||
43 | * - length(n_modulus) = inputdatalength | ||
44 | */ | ||
45 | struct ica_rsa_modexpo { | ||
46 | char __user * inputdata; | ||
47 | unsigned int inputdatalength; | ||
48 | char __user * outputdata; | ||
49 | unsigned int outputdatalength; | ||
50 | char __user * b_key; | ||
51 | char __user * n_modulus; | ||
52 | }; | ||
53 | |||
54 | /** | ||
55 | * struct ica_rsa_modexpo_crt | ||
56 | * | ||
57 | * Requirements: | ||
58 | * - inputdatalength is even. | ||
59 | * - outputdatalength is at least as large as inputdatalength. | ||
60 | * - All key parts are right justified in their fields, padded on | ||
61 | * the left with zeroes. | ||
62 | * - length(bp_key) = inputdatalength/2 + 8 | ||
63 | * - length(bq_key) = inputdatalength/2 | ||
64 | * - length(np_key) = inputdatalength/2 + 8 | ||
65 | * - length(nq_key) = inputdatalength/2 | ||
66 | * - length(u_mult_inv) = inputdatalength/2 + 8 | ||
67 | */ | ||
68 | struct ica_rsa_modexpo_crt { | ||
69 | char __user * inputdata; | ||
70 | unsigned int inputdatalength; | ||
71 | char __user * outputdata; | ||
72 | unsigned int outputdatalength; | ||
73 | char __user * bp_key; | ||
74 | char __user * bq_key; | ||
75 | char __user * np_prime; | ||
76 | char __user * nq_prime; | ||
77 | char __user * u_mult_inv; | ||
78 | }; | ||
79 | |||
80 | #define Z90_IOCTL_MAGIC 'z' // NOTE: Need to allocate from linux folks | ||
81 | |||
82 | /** | ||
83 | * Interface notes: | ||
84 | * | ||
85 | * The ioctl()s which are implemented (along with relevant details) | ||
86 | * are: | ||
87 | * | ||
88 | * ICARSAMODEXPO | ||
89 | * Perform an RSA operation using a Modulus-Exponent pair | ||
90 | * This takes an ica_rsa_modexpo struct as its arg. | ||
91 | * | ||
92 | * NOTE: please refer to the comments preceding this structure | ||
93 | * for the implementation details for the contents of the | ||
94 | * block | ||
95 | * | ||
96 | * ICARSACRT | ||
97 | * Perform an RSA operation using a Chinese-Remainder Theorem key | ||
98 | * This takes an ica_rsa_modexpo_crt struct as its arg. | ||
99 | * | ||
100 | * NOTE: please refer to the comments preceding this structure | ||
101 | * for the implementation details for the contents of the | ||
102 | * block | ||
103 | * | ||
104 | * Z90STAT_TOTALCOUNT | ||
105 | * Return an integer count of all device types together. | ||
106 | * | ||
107 | * Z90STAT_PCICACOUNT | ||
108 | * Return an integer count of all PCICAs. | ||
109 | * | ||
110 | * Z90STAT_PCICCCOUNT | ||
111 | * Return an integer count of all PCICCs. | ||
112 | * | ||
113 | * Z90STAT_PCIXCCMCL2COUNT | ||
114 | * Return an integer count of all MCL2 PCIXCCs. | ||
115 | * | ||
116 | * Z90STAT_PCIXCCMCL3COUNT | ||
117 | * Return an integer count of all MCL3 PCIXCCs. | ||
118 | * | ||
119 | * Z90STAT_CEX2CCOUNT | ||
120 | * Return an integer count of all CEX2Cs. | ||
121 | * | ||
122 | * Z90STAT_CEX2ACOUNT | ||
123 | * Return an integer count of all CEX2As. | ||
124 | * | ||
125 | * Z90STAT_REQUESTQ_COUNT | ||
126 | * Return an integer count of the number of entries waiting to be | ||
127 | * sent to a device. | ||
128 | * | ||
129 | * Z90STAT_PENDINGQ_COUNT | ||
130 | * Return an integer count of the number of entries sent to a | ||
131 | * device awaiting the reply. | ||
132 | * | ||
133 | * Z90STAT_TOTALOPEN_COUNT | ||
134 | * Return an integer count of the number of open file handles. | ||
135 | * | ||
136 | * Z90STAT_DOMAIN_INDEX | ||
137 | * Return the integer value of the Cryptographic Domain. | ||
138 | * | ||
139 | * Z90STAT_STATUS_MASK | ||
140 | * Return an 64 element array of unsigned chars for the status of | ||
141 | * all devices. | ||
142 | * 0x01: PCICA | ||
143 | * 0x02: PCICC | ||
144 | * 0x03: PCIXCC_MCL2 | ||
145 | * 0x04: PCIXCC_MCL3 | ||
146 | * 0x05: CEX2C | ||
147 | * 0x06: CEX2A | ||
148 | * 0x0d: device is disabled via the proc filesystem | ||
149 | * | ||
150 | * Z90STAT_QDEPTH_MASK | ||
151 | * Return an 64 element array of unsigned chars for the queue | ||
152 | * depth of all devices. | ||
153 | * | ||
154 | * Z90STAT_PERDEV_REQCNT | ||
155 | * Return an 64 element array of unsigned integers for the number | ||
156 | * of successfully completed requests per device since the device | ||
157 | * was detected and made available. | ||
158 | * | ||
159 | * ICAZ90STATUS (deprecated) | ||
160 | * Return some device driver status in a ica_z90_status struct | ||
161 | * This takes an ica_z90_status struct as its arg. | ||
162 | * | ||
163 | * NOTE: this ioctl() is deprecated, and has been replaced with | ||
164 | * single ioctl()s for each type of status being requested | ||
165 | * | ||
166 | * Z90STAT_PCIXCCCOUNT (deprecated) | ||
167 | * Return an integer count of all PCIXCCs (MCL2 + MCL3). | ||
168 | * This is DEPRECATED now that MCL3 PCIXCCs are treated differently from | ||
169 | * MCL2 PCIXCCs. | ||
170 | * | ||
171 | * Z90QUIESCE (not recommended) | ||
172 | * Quiesce the driver. This is intended to stop all new | ||
173 | * requests from being processed. Its use is NOT recommended, | ||
174 | * except in circumstances where there is no other way to stop | ||
175 | * callers from accessing the driver. Its original use was to | ||
176 | * allow the driver to be "drained" of work in preparation for | ||
177 | * a system shutdown. | ||
178 | * | ||
179 | * NOTE: once issued, this ban on new work cannot be undone | ||
180 | * except by unloading and reloading the driver. | ||
181 | */ | ||
182 | |||
183 | /** | ||
184 | * Supported ioctl calls | ||
185 | */ | ||
186 | #define ICARSAMODEXPO _IOC(_IOC_READ|_IOC_WRITE, Z90_IOCTL_MAGIC, 0x05, 0) | ||
187 | #define ICARSACRT _IOC(_IOC_READ|_IOC_WRITE, Z90_IOCTL_MAGIC, 0x06, 0) | ||
188 | |||
189 | /* DEPRECATED status calls (bound for removal at some point) */ | ||
190 | #define ICAZ90STATUS _IOR(Z90_IOCTL_MAGIC, 0x10, struct ica_z90_status) | ||
191 | #define Z90STAT_PCIXCCCOUNT _IOR(Z90_IOCTL_MAGIC, 0x43, int) | ||
192 | |||
193 | /* unrelated to ICA callers */ | ||
194 | #define Z90QUIESCE _IO(Z90_IOCTL_MAGIC, 0x11) | ||
195 | |||
196 | /* New status calls */ | ||
197 | #define Z90STAT_TOTALCOUNT _IOR(Z90_IOCTL_MAGIC, 0x40, int) | ||
198 | #define Z90STAT_PCICACOUNT _IOR(Z90_IOCTL_MAGIC, 0x41, int) | ||
199 | #define Z90STAT_PCICCCOUNT _IOR(Z90_IOCTL_MAGIC, 0x42, int) | ||
200 | #define Z90STAT_PCIXCCMCL2COUNT _IOR(Z90_IOCTL_MAGIC, 0x4b, int) | ||
201 | #define Z90STAT_PCIXCCMCL3COUNT _IOR(Z90_IOCTL_MAGIC, 0x4c, int) | ||
202 | #define Z90STAT_CEX2CCOUNT _IOR(Z90_IOCTL_MAGIC, 0x4d, int) | ||
203 | #define Z90STAT_CEX2ACOUNT _IOR(Z90_IOCTL_MAGIC, 0x4e, int) | ||
204 | #define Z90STAT_REQUESTQ_COUNT _IOR(Z90_IOCTL_MAGIC, 0x44, int) | ||
205 | #define Z90STAT_PENDINGQ_COUNT _IOR(Z90_IOCTL_MAGIC, 0x45, int) | ||
206 | #define Z90STAT_TOTALOPEN_COUNT _IOR(Z90_IOCTL_MAGIC, 0x46, int) | ||
207 | #define Z90STAT_DOMAIN_INDEX _IOR(Z90_IOCTL_MAGIC, 0x47, int) | ||
208 | #define Z90STAT_STATUS_MASK _IOR(Z90_IOCTL_MAGIC, 0x48, char[64]) | ||
209 | #define Z90STAT_QDEPTH_MASK _IOR(Z90_IOCTL_MAGIC, 0x49, char[64]) | ||
210 | #define Z90STAT_PERDEV_REQCNT _IOR(Z90_IOCTL_MAGIC, 0x4a, int[64]) | ||
211 | |||
212 | #endif /* __ASM_S390_Z90CRYPT_H */ | ||
diff --git a/include/asm-s390/zcrypt.h b/include/asm-s390/zcrypt.h new file mode 100644 index 000000000000..7244c68464f2 --- /dev/null +++ b/include/asm-s390/zcrypt.h | |||
@@ -0,0 +1,285 @@ | |||
1 | /* | ||
2 | * include/asm-s390/zcrypt.h | ||
3 | * | ||
4 | * zcrypt 2.1.0 (user-visible header) | ||
5 | * | ||
6 | * Copyright (C) 2001, 2006 IBM Corporation | ||
7 | * Author(s): Robert Burroughs | ||
8 | * Eric Rossman (edrossma@us.ibm.com) | ||
9 | * | ||
10 | * Hotplug & misc device support: Jochen Roehrig (roehrig@de.ibm.com) | ||
11 | * | ||
12 | * This program is free software; you can redistribute it and/or modify | ||
13 | * it under the terms of the GNU General Public License as published by | ||
14 | * the Free Software Foundation; either version 2, or (at your option) | ||
15 | * any later version. | ||
16 | * | ||
17 | * This program is distributed in the hope that it will be useful, | ||
18 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
19 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
20 | * GNU General Public License for more details. | ||
21 | * | ||
22 | * You should have received a copy of the GNU General Public License | ||
23 | * along with this program; if not, write to the Free Software | ||
24 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | ||
25 | */ | ||
26 | |||
27 | #ifndef __ASM_S390_ZCRYPT_H | ||
28 | #define __ASM_S390_ZCRYPT_H | ||
29 | |||
30 | #define ZCRYPT_VERSION 2 | ||
31 | #define ZCRYPT_RELEASE 1 | ||
32 | #define ZCRYPT_VARIANT 0 | ||
33 | |||
34 | #include <linux/ioctl.h> | ||
35 | #include <linux/compiler.h> | ||
36 | |||
37 | /** | ||
38 | * struct ica_rsa_modexpo | ||
39 | * | ||
40 | * Requirements: | ||
41 | * - outputdatalength is at least as large as inputdatalength. | ||
42 | * - All key parts are right justified in their fields, padded on | ||
43 | * the left with zeroes. | ||
44 | * - length(b_key) = inputdatalength | ||
45 | * - length(n_modulus) = inputdatalength | ||
46 | */ | ||
47 | struct ica_rsa_modexpo { | ||
48 | char __user * inputdata; | ||
49 | unsigned int inputdatalength; | ||
50 | char __user * outputdata; | ||
51 | unsigned int outputdatalength; | ||
52 | char __user * b_key; | ||
53 | char __user * n_modulus; | ||
54 | }; | ||
55 | |||
56 | /** | ||
57 | * struct ica_rsa_modexpo_crt | ||
58 | * | ||
59 | * Requirements: | ||
60 | * - inputdatalength is even. | ||
61 | * - outputdatalength is at least as large as inputdatalength. | ||
62 | * - All key parts are right justified in their fields, padded on | ||
63 | * the left with zeroes. | ||
64 | * - length(bp_key) = inputdatalength/2 + 8 | ||
65 | * - length(bq_key) = inputdatalength/2 | ||
66 | * - length(np_key) = inputdatalength/2 + 8 | ||
67 | * - length(nq_key) = inputdatalength/2 | ||
68 | * - length(u_mult_inv) = inputdatalength/2 + 8 | ||
69 | */ | ||
70 | struct ica_rsa_modexpo_crt { | ||
71 | char __user * inputdata; | ||
72 | unsigned int inputdatalength; | ||
73 | char __user * outputdata; | ||
74 | unsigned int outputdatalength; | ||
75 | char __user * bp_key; | ||
76 | char __user * bq_key; | ||
77 | char __user * np_prime; | ||
78 | char __user * nq_prime; | ||
79 | char __user * u_mult_inv; | ||
80 | }; | ||
81 | |||
82 | /** | ||
83 | * CPRBX | ||
84 | * Note that all shorts and ints are big-endian. | ||
85 | * All pointer fields are 16 bytes long, and mean nothing. | ||
86 | * | ||
87 | * A request CPRB is followed by a request_parameter_block. | ||
88 | * | ||
89 | * The request (or reply) parameter block is organized thus: | ||
90 | * function code | ||
91 | * VUD block | ||
92 | * key block | ||
93 | */ | ||
94 | struct ica_CPRBX { | ||
95 | unsigned short cprb_len; /* CPRB length 220 */ | ||
96 | unsigned char cprb_ver_id; /* CPRB version id. 0x02 */ | ||
97 | unsigned char pad_000[3]; /* Alignment pad bytes */ | ||
98 | unsigned char func_id[2]; /* function id 0x5432 */ | ||
99 | unsigned char cprb_flags[4]; /* Flags */ | ||
100 | unsigned int req_parml; /* request parameter buffer len */ | ||
101 | unsigned int req_datal; /* request data buffer */ | ||
102 | unsigned int rpl_msgbl; /* reply message block length */ | ||
103 | unsigned int rpld_parml; /* replied parameter block len */ | ||
104 | unsigned int rpl_datal; /* reply data block len */ | ||
105 | unsigned int rpld_datal; /* replied data block len */ | ||
106 | unsigned int req_extbl; /* request extension block len */ | ||
107 | unsigned char pad_001[4]; /* reserved */ | ||
108 | unsigned int rpld_extbl; /* replied extension block len */ | ||
109 | unsigned char padx000[16 - sizeof (char *)]; | ||
110 | unsigned char * req_parmb; /* request parm block 'address' */ | ||
111 | unsigned char padx001[16 - sizeof (char *)]; | ||
112 | unsigned char * req_datab; /* request data block 'address' */ | ||
113 | unsigned char padx002[16 - sizeof (char *)]; | ||
114 | unsigned char * rpl_parmb; /* reply parm block 'address' */ | ||
115 | unsigned char padx003[16 - sizeof (char *)]; | ||
116 | unsigned char * rpl_datab; /* reply data block 'address' */ | ||
117 | unsigned char padx004[16 - sizeof (char *)]; | ||
118 | unsigned char * req_extb; /* request extension block 'addr'*/ | ||
119 | unsigned char padx005[16 - sizeof (char *)]; | ||
120 | unsigned char * rpl_extb; /* reply extension block 'addres'*/ | ||
121 | unsigned short ccp_rtcode; /* server return code */ | ||
122 | unsigned short ccp_rscode; /* server reason code */ | ||
123 | unsigned int mac_data_len; /* Mac Data Length */ | ||
124 | unsigned char logon_id[8]; /* Logon Identifier */ | ||
125 | unsigned char mac_value[8]; /* Mac Value */ | ||
126 | unsigned char mac_content_flgs;/* Mac content flag byte */ | ||
127 | unsigned char pad_002; /* Alignment */ | ||
128 | unsigned short domain; /* Domain */ | ||
129 | unsigned char usage_domain[4];/* Usage domain */ | ||
130 | unsigned char cntrl_domain[4];/* Control domain */ | ||
131 | unsigned char S390enf_mask[4];/* S/390 enforcement mask */ | ||
132 | unsigned char pad_004[36]; /* reserved */ | ||
133 | }; | ||
134 | |||
135 | /** | ||
136 | * xcRB | ||
137 | */ | ||
138 | struct ica_xcRB { | ||
139 | unsigned short agent_ID; | ||
140 | unsigned int user_defined; | ||
141 | unsigned short request_ID; | ||
142 | unsigned int request_control_blk_length; | ||
143 | unsigned char padding1[16 - sizeof (char *)]; | ||
144 | char __user * request_control_blk_addr; | ||
145 | unsigned int request_data_length; | ||
146 | char padding2[16 - sizeof (char *)]; | ||
147 | char __user * request_data_address; | ||
148 | unsigned int reply_control_blk_length; | ||
149 | char padding3[16 - sizeof (char *)]; | ||
150 | char __user * reply_control_blk_addr; | ||
151 | unsigned int reply_data_length; | ||
152 | char padding4[16 - sizeof (char *)]; | ||
153 | char __user * reply_data_addr; | ||
154 | unsigned short priority_window; | ||
155 | unsigned int status; | ||
156 | } __attribute__((packed)); | ||
157 | #define AUTOSELECT ((unsigned int)0xFFFFFFFF) | ||
158 | |||
159 | #define ZCRYPT_IOCTL_MAGIC 'z' | ||
160 | |||
161 | /** | ||
162 | * Interface notes: | ||
163 | * | ||
164 | * The ioctl()s which are implemented (along with relevant details) | ||
165 | * are: | ||
166 | * | ||
167 | * ICARSAMODEXPO | ||
168 | * Perform an RSA operation using a Modulus-Exponent pair | ||
169 | * This takes an ica_rsa_modexpo struct as its arg. | ||
170 | * | ||
171 | * NOTE: please refer to the comments preceding this structure | ||
172 | * for the implementation details for the contents of the | ||
173 | * block | ||
174 | * | ||
175 | * ICARSACRT | ||
176 | * Perform an RSA operation using a Chinese-Remainder Theorem key | ||
177 | * This takes an ica_rsa_modexpo_crt struct as its arg. | ||
178 | * | ||
179 | * NOTE: please refer to the comments preceding this structure | ||
180 | * for the implementation details for the contents of the | ||
181 | * block | ||
182 | * | ||
183 | * Z90STAT_TOTALCOUNT | ||
184 | * Return an integer count of all device types together. | ||
185 | * | ||
186 | * Z90STAT_PCICACOUNT | ||
187 | * Return an integer count of all PCICAs. | ||
188 | * | ||
189 | * Z90STAT_PCICCCOUNT | ||
190 | * Return an integer count of all PCICCs. | ||
191 | * | ||
192 | * Z90STAT_PCIXCCMCL2COUNT | ||
193 | * Return an integer count of all MCL2 PCIXCCs. | ||
194 | * | ||
195 | * Z90STAT_PCIXCCMCL3COUNT | ||
196 | * Return an integer count of all MCL3 PCIXCCs. | ||
197 | * | ||
198 | * Z90STAT_CEX2CCOUNT | ||
199 | * Return an integer count of all CEX2Cs. | ||
200 | * | ||
201 | * Z90STAT_CEX2ACOUNT | ||
202 | * Return an integer count of all CEX2As. | ||
203 | * | ||
204 | * Z90STAT_REQUESTQ_COUNT | ||
205 | * Return an integer count of the number of entries waiting to be | ||
206 | * sent to a device. | ||
207 | * | ||
208 | * Z90STAT_PENDINGQ_COUNT | ||
209 | * Return an integer count of the number of entries sent to a | ||
210 | * device awaiting the reply. | ||
211 | * | ||
212 | * Z90STAT_TOTALOPEN_COUNT | ||
213 | * Return an integer count of the number of open file handles. | ||
214 | * | ||
215 | * Z90STAT_DOMAIN_INDEX | ||
216 | * Return the integer value of the Cryptographic Domain. | ||
217 | * | ||
218 | * Z90STAT_STATUS_MASK | ||
219 | * Return an 64 element array of unsigned chars for the status of | ||
220 | * all devices. | ||
221 | * 0x01: PCICA | ||
222 | * 0x02: PCICC | ||
223 | * 0x03: PCIXCC_MCL2 | ||
224 | * 0x04: PCIXCC_MCL3 | ||
225 | * 0x05: CEX2C | ||
226 | * 0x06: CEX2A | ||
227 | * 0x0d: device is disabled via the proc filesystem | ||
228 | * | ||
229 | * Z90STAT_QDEPTH_MASK | ||
230 | * Return an 64 element array of unsigned chars for the queue | ||
231 | * depth of all devices. | ||
232 | * | ||
233 | * Z90STAT_PERDEV_REQCNT | ||
234 | * Return an 64 element array of unsigned integers for the number | ||
235 | * of successfully completed requests per device since the device | ||
236 | * was detected and made available. | ||
237 | * | ||
238 | * ICAZ90STATUS (deprecated) | ||
239 | * Return some device driver status in a ica_z90_status struct | ||
240 | * This takes an ica_z90_status struct as its arg. | ||
241 | * | ||
242 | * NOTE: this ioctl() is deprecated, and has been replaced with | ||
243 | * single ioctl()s for each type of status being requested | ||
244 | * | ||
245 | * Z90STAT_PCIXCCCOUNT (deprecated) | ||
246 | * Return an integer count of all PCIXCCs (MCL2 + MCL3). | ||
247 | * This is DEPRECATED now that MCL3 PCIXCCs are treated differently from | ||
248 | * MCL2 PCIXCCs. | ||
249 | * | ||
250 | * Z90QUIESCE (not recommended) | ||
251 | * Quiesce the driver. This is intended to stop all new | ||
252 | * requests from being processed. Its use is NOT recommended, | ||
253 | * except in circumstances where there is no other way to stop | ||
254 | * callers from accessing the driver. Its original use was to | ||
255 | * allow the driver to be "drained" of work in preparation for | ||
256 | * a system shutdown. | ||
257 | * | ||
258 | * NOTE: once issued, this ban on new work cannot be undone | ||
259 | * except by unloading and reloading the driver. | ||
260 | */ | ||
261 | |||
262 | /** | ||
263 | * Supported ioctl calls | ||
264 | */ | ||
265 | #define ICARSAMODEXPO _IOC(_IOC_READ|_IOC_WRITE, ZCRYPT_IOCTL_MAGIC, 0x05, 0) | ||
266 | #define ICARSACRT _IOC(_IOC_READ|_IOC_WRITE, ZCRYPT_IOCTL_MAGIC, 0x06, 0) | ||
267 | #define ZSECSENDCPRB _IOC(_IOC_READ|_IOC_WRITE, ZCRYPT_IOCTL_MAGIC, 0x81, 0) | ||
268 | |||
269 | /* New status calls */ | ||
270 | #define Z90STAT_TOTALCOUNT _IOR(ZCRYPT_IOCTL_MAGIC, 0x40, int) | ||
271 | #define Z90STAT_PCICACOUNT _IOR(ZCRYPT_IOCTL_MAGIC, 0x41, int) | ||
272 | #define Z90STAT_PCICCCOUNT _IOR(ZCRYPT_IOCTL_MAGIC, 0x42, int) | ||
273 | #define Z90STAT_PCIXCCMCL2COUNT _IOR(ZCRYPT_IOCTL_MAGIC, 0x4b, int) | ||
274 | #define Z90STAT_PCIXCCMCL3COUNT _IOR(ZCRYPT_IOCTL_MAGIC, 0x4c, int) | ||
275 | #define Z90STAT_CEX2CCOUNT _IOR(ZCRYPT_IOCTL_MAGIC, 0x4d, int) | ||
276 | #define Z90STAT_CEX2ACOUNT _IOR(ZCRYPT_IOCTL_MAGIC, 0x4e, int) | ||
277 | #define Z90STAT_REQUESTQ_COUNT _IOR(ZCRYPT_IOCTL_MAGIC, 0x44, int) | ||
278 | #define Z90STAT_PENDINGQ_COUNT _IOR(ZCRYPT_IOCTL_MAGIC, 0x45, int) | ||
279 | #define Z90STAT_TOTALOPEN_COUNT _IOR(ZCRYPT_IOCTL_MAGIC, 0x46, int) | ||
280 | #define Z90STAT_DOMAIN_INDEX _IOR(ZCRYPT_IOCTL_MAGIC, 0x47, int) | ||
281 | #define Z90STAT_STATUS_MASK _IOR(ZCRYPT_IOCTL_MAGIC, 0x48, char[64]) | ||
282 | #define Z90STAT_QDEPTH_MASK _IOR(ZCRYPT_IOCTL_MAGIC, 0x49, char[64]) | ||
283 | #define Z90STAT_PERDEV_REQCNT _IOR(ZCRYPT_IOCTL_MAGIC, 0x4a, int[64]) | ||
284 | |||
285 | #endif /* __ASM_S390_ZCRYPT_H */ | ||
diff --git a/include/asm-sparc/libata-portmap.h b/include/asm-sparc/libata-portmap.h new file mode 100644 index 000000000000..75484ef0c743 --- /dev/null +++ b/include/asm-sparc/libata-portmap.h | |||
@@ -0,0 +1 @@ | |||
#include <asm-generic/libata-portmap.h> | |||
diff --git a/include/asm-sparc64/libata-portmap.h b/include/asm-sparc64/libata-portmap.h new file mode 100644 index 000000000000..75484ef0c743 --- /dev/null +++ b/include/asm-sparc64/libata-portmap.h | |||
@@ -0,0 +1 @@ | |||
#include <asm-generic/libata-portmap.h> | |||
diff --git a/include/asm-x86_64/libata-portmap.h b/include/asm-x86_64/libata-portmap.h new file mode 100644 index 000000000000..75484ef0c743 --- /dev/null +++ b/include/asm-x86_64/libata-portmap.h | |||
@@ -0,0 +1 @@ | |||
#include <asm-generic/libata-portmap.h> | |||
diff --git a/include/crypto/algapi.h b/include/crypto/algapi.h new file mode 100644 index 000000000000..5748aecdb414 --- /dev/null +++ b/include/crypto/algapi.h | |||
@@ -0,0 +1,156 @@ | |||
1 | /* | ||
2 | * Cryptographic API for algorithms (i.e., low-level API). | ||
3 | * | ||
4 | * Copyright (c) 2006 Herbert Xu <herbert@gondor.apana.org.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) | ||
9 | * any later version. | ||
10 | * | ||
11 | */ | ||
12 | #ifndef _CRYPTO_ALGAPI_H | ||
13 | #define _CRYPTO_ALGAPI_H | ||
14 | |||
15 | #include <linux/crypto.h> | ||
16 | |||
17 | struct module; | ||
18 | struct seq_file; | ||
19 | |||
20 | struct crypto_type { | ||
21 | unsigned int (*ctxsize)(struct crypto_alg *alg); | ||
22 | int (*init)(struct crypto_tfm *tfm); | ||
23 | void (*exit)(struct crypto_tfm *tfm); | ||
24 | void (*show)(struct seq_file *m, struct crypto_alg *alg); | ||
25 | }; | ||
26 | |||
27 | struct crypto_instance { | ||
28 | struct crypto_alg alg; | ||
29 | |||
30 | struct crypto_template *tmpl; | ||
31 | struct hlist_node list; | ||
32 | |||
33 | void *__ctx[] CRYPTO_MINALIGN_ATTR; | ||
34 | }; | ||
35 | |||
36 | struct crypto_template { | ||
37 | struct list_head list; | ||
38 | struct hlist_head instances; | ||
39 | struct module *module; | ||
40 | |||
41 | struct crypto_instance *(*alloc)(void *param, unsigned int len); | ||
42 | void (*free)(struct crypto_instance *inst); | ||
43 | |||
44 | char name[CRYPTO_MAX_ALG_NAME]; | ||
45 | }; | ||
46 | |||
47 | struct crypto_spawn { | ||
48 | struct list_head list; | ||
49 | struct crypto_alg *alg; | ||
50 | struct crypto_instance *inst; | ||
51 | }; | ||
52 | |||
53 | struct scatter_walk { | ||
54 | struct scatterlist *sg; | ||
55 | unsigned int offset; | ||
56 | }; | ||
57 | |||
58 | struct blkcipher_walk { | ||
59 | union { | ||
60 | struct { | ||
61 | struct page *page; | ||
62 | unsigned long offset; | ||
63 | } phys; | ||
64 | |||
65 | struct { | ||
66 | u8 *page; | ||
67 | u8 *addr; | ||
68 | } virt; | ||
69 | } src, dst; | ||
70 | |||
71 | struct scatter_walk in; | ||
72 | unsigned int nbytes; | ||
73 | |||
74 | struct scatter_walk out; | ||
75 | unsigned int total; | ||
76 | |||
77 | void *page; | ||
78 | u8 *buffer; | ||
79 | u8 *iv; | ||
80 | |||
81 | int flags; | ||
82 | }; | ||
83 | |||
84 | extern const struct crypto_type crypto_blkcipher_type; | ||
85 | extern const struct crypto_type crypto_hash_type; | ||
86 | |||
87 | void crypto_mod_put(struct crypto_alg *alg); | ||
88 | |||
89 | int crypto_register_template(struct crypto_template *tmpl); | ||
90 | void crypto_unregister_template(struct crypto_template *tmpl); | ||
91 | struct crypto_template *crypto_lookup_template(const char *name); | ||
92 | |||
93 | int crypto_init_spawn(struct crypto_spawn *spawn, struct crypto_alg *alg, | ||
94 | struct crypto_instance *inst); | ||
95 | void crypto_drop_spawn(struct crypto_spawn *spawn); | ||
96 | struct crypto_tfm *crypto_spawn_tfm(struct crypto_spawn *spawn); | ||
97 | |||
98 | struct crypto_alg *crypto_get_attr_alg(void *param, unsigned int len, | ||
99 | u32 type, u32 mask); | ||
100 | struct crypto_instance *crypto_alloc_instance(const char *name, | ||
101 | struct crypto_alg *alg); | ||
102 | |||
103 | int blkcipher_walk_done(struct blkcipher_desc *desc, | ||
104 | struct blkcipher_walk *walk, int err); | ||
105 | int blkcipher_walk_virt(struct blkcipher_desc *desc, | ||
106 | struct blkcipher_walk *walk); | ||
107 | int blkcipher_walk_phys(struct blkcipher_desc *desc, | ||
108 | struct blkcipher_walk *walk); | ||
109 | |||
110 | static inline void *crypto_tfm_ctx_aligned(struct crypto_tfm *tfm) | ||
111 | { | ||
112 | unsigned long addr = (unsigned long)crypto_tfm_ctx(tfm); | ||
113 | unsigned long align = crypto_tfm_alg_alignmask(tfm); | ||
114 | |||
115 | if (align <= crypto_tfm_ctx_alignment()) | ||
116 | align = 1; | ||
117 | return (void *)ALIGN(addr, align); | ||
118 | } | ||
119 | |||
120 | static inline void *crypto_instance_ctx(struct crypto_instance *inst) | ||
121 | { | ||
122 | return inst->__ctx; | ||
123 | } | ||
124 | |||
125 | static inline void *crypto_blkcipher_ctx(struct crypto_blkcipher *tfm) | ||
126 | { | ||
127 | return crypto_tfm_ctx(&tfm->base); | ||
128 | } | ||
129 | |||
130 | static inline void *crypto_blkcipher_ctx_aligned(struct crypto_blkcipher *tfm) | ||
131 | { | ||
132 | return crypto_tfm_ctx_aligned(&tfm->base); | ||
133 | } | ||
134 | |||
135 | static inline struct cipher_alg *crypto_cipher_alg(struct crypto_cipher *tfm) | ||
136 | { | ||
137 | return &crypto_cipher_tfm(tfm)->__crt_alg->cra_cipher; | ||
138 | } | ||
139 | |||
140 | static inline void *crypto_hash_ctx_aligned(struct crypto_hash *tfm) | ||
141 | { | ||
142 | return crypto_tfm_ctx_aligned(&tfm->base); | ||
143 | } | ||
144 | |||
145 | static inline void blkcipher_walk_init(struct blkcipher_walk *walk, | ||
146 | struct scatterlist *dst, | ||
147 | struct scatterlist *src, | ||
148 | unsigned int nbytes) | ||
149 | { | ||
150 | walk->in.sg = src; | ||
151 | walk->out.sg = dst; | ||
152 | walk->total = nbytes; | ||
153 | } | ||
154 | |||
155 | #endif /* _CRYPTO_ALGAPI_H */ | ||
156 | |||
diff --git a/include/crypto/twofish.h b/include/crypto/twofish.h new file mode 100644 index 000000000000..c408522595c6 --- /dev/null +++ b/include/crypto/twofish.h | |||
@@ -0,0 +1,22 @@ | |||
1 | #ifndef _CRYPTO_TWOFISH_H | ||
2 | #define _CRYPTO_TWOFISH_H | ||
3 | |||
4 | #include <linux/types.h> | ||
5 | |||
6 | #define TF_MIN_KEY_SIZE 16 | ||
7 | #define TF_MAX_KEY_SIZE 32 | ||
8 | #define TF_BLOCK_SIZE 16 | ||
9 | |||
10 | struct crypto_tfm; | ||
11 | |||
12 | /* Structure for an expanded Twofish key. s contains the key-dependent | ||
13 | * S-boxes composed with the MDS matrix; w contains the eight "whitening" | ||
14 | * subkeys, K[0] through K[7]. k holds the remaining, "round" subkeys. Note | ||
15 | * that k[i] corresponds to what the Twofish paper calls K[i+8]. */ | ||
16 | struct twofish_ctx { | ||
17 | u32 s[4][256], w[8], k[32]; | ||
18 | }; | ||
19 | |||
20 | int twofish_setkey(struct crypto_tfm *tfm, const u8 *key, unsigned int key_len); | ||
21 | |||
22 | #endif | ||
diff --git a/include/linux/Kbuild b/include/linux/Kbuild index 10d2ca07562a..19a3664f1dfe 100644 --- a/include/linux/Kbuild +++ b/include/linux/Kbuild | |||
@@ -12,7 +12,6 @@ header-y += netfilter_bridge/ | |||
12 | header-y += netfilter_ipv4/ | 12 | header-y += netfilter_ipv4/ |
13 | header-y += netfilter_ipv6/ | 13 | header-y += netfilter_ipv6/ |
14 | 14 | ||
15 | header-y += affs_fs.h | ||
16 | header-y += affs_hardblocks.h | 15 | header-y += affs_hardblocks.h |
17 | header-y += aio_abi.h | 16 | header-y += aio_abi.h |
18 | header-y += a.out.h | 17 | header-y += a.out.h |
@@ -67,7 +66,6 @@ header-y += genetlink.h | |||
67 | header-y += gen_stats.h | 66 | header-y += gen_stats.h |
68 | header-y += gigaset_dev.h | 67 | header-y += gigaset_dev.h |
69 | header-y += hdsmart.h | 68 | header-y += hdsmart.h |
70 | header-y += hpfs_fs.h | ||
71 | header-y += hysdn_if.h | 69 | header-y += hysdn_if.h |
72 | header-y += i2c-dev.h | 70 | header-y += i2c-dev.h |
73 | header-y += i8k.h | 71 | header-y += i8k.h |
@@ -103,6 +101,7 @@ header-y += ixjuser.h | |||
103 | header-y += jffs2.h | 101 | header-y += jffs2.h |
104 | header-y += keyctl.h | 102 | header-y += keyctl.h |
105 | header-y += limits.h | 103 | header-y += limits.h |
104 | header-y += magic.h | ||
106 | header-y += major.h | 105 | header-y += major.h |
107 | header-y += matroxfb.h | 106 | header-y += matroxfb.h |
108 | header-y += meye.h | 107 | header-y += meye.h |
@@ -116,7 +115,6 @@ header-y += netrom.h | |||
116 | header-y += nfs2.h | 115 | header-y += nfs2.h |
117 | header-y += nfs4_mount.h | 116 | header-y += nfs4_mount.h |
118 | header-y += nfs_mount.h | 117 | header-y += nfs_mount.h |
119 | header-y += openprom_fs.h | ||
120 | header-y += param.h | 118 | header-y += param.h |
121 | header-y += pci_ids.h | 119 | header-y += pci_ids.h |
122 | header-y += pci_regs.h | 120 | header-y += pci_regs.h |
diff --git a/include/linux/adfs_fs.h b/include/linux/adfs_fs.h index 4a5d50c2bdbf..ef788c2085a1 100644 --- a/include/linux/adfs_fs.h +++ b/include/linux/adfs_fs.h | |||
@@ -2,6 +2,7 @@ | |||
2 | #define _ADFS_FS_H | 2 | #define _ADFS_FS_H |
3 | 3 | ||
4 | #include <linux/types.h> | 4 | #include <linux/types.h> |
5 | #include <linux/magic.h> | ||
5 | 6 | ||
6 | /* | 7 | /* |
7 | * Disc Record at disc address 0xc00 | 8 | * Disc Record at disc address 0xc00 |
@@ -38,7 +39,6 @@ struct adfs_discrecord { | |||
38 | #define ADFS_DR_OFFSET (0x1c0) | 39 | #define ADFS_DR_OFFSET (0x1c0) |
39 | #define ADFS_DR_SIZE 60 | 40 | #define ADFS_DR_SIZE 60 |
40 | #define ADFS_DR_SIZE_BITS (ADFS_DR_SIZE << 3) | 41 | #define ADFS_DR_SIZE_BITS (ADFS_DR_SIZE << 3) |
41 | #define ADFS_SUPER_MAGIC 0xadf5 | ||
42 | 42 | ||
43 | #ifdef __KERNEL__ | 43 | #ifdef __KERNEL__ |
44 | #include <linux/adfs_fs_i.h> | 44 | #include <linux/adfs_fs_i.h> |
diff --git a/include/linux/affs_fs.h b/include/linux/affs_fs.h deleted file mode 100644 index c57b5ee87d55..000000000000 --- a/include/linux/affs_fs.h +++ /dev/null | |||
@@ -1,7 +0,0 @@ | |||
1 | #ifndef _AFFS_FS_H | ||
2 | #define _AFFS_FS_H | ||
3 | /* | ||
4 | * The affs filesystem constants/structures | ||
5 | */ | ||
6 | #define AFFS_SUPER_MAGIC 0xadff | ||
7 | #endif | ||
diff --git a/include/linux/ata.h b/include/linux/ata.h index 3671af869696..d89441907024 100644 --- a/include/linux/ata.h +++ b/include/linux/ata.h | |||
@@ -40,6 +40,8 @@ enum { | |||
40 | ATA_MAX_DEVICES = 2, /* per bus/port */ | 40 | ATA_MAX_DEVICES = 2, /* per bus/port */ |
41 | ATA_MAX_PRD = 256, /* we could make these 256/256 */ | 41 | ATA_MAX_PRD = 256, /* we could make these 256/256 */ |
42 | ATA_SECT_SIZE = 512, | 42 | ATA_SECT_SIZE = 512, |
43 | ATA_MAX_SECTORS = 256, | ||
44 | ATA_MAX_SECTORS_LBA48 = 65535,/* TODO: 65536? */ | ||
43 | 45 | ||
44 | ATA_ID_WORDS = 256, | 46 | ATA_ID_WORDS = 256, |
45 | ATA_ID_SERNO_OFS = 10, | 47 | ATA_ID_SERNO_OFS = 10, |
@@ -168,12 +170,16 @@ enum { | |||
168 | XFER_UDMA_2 = 0x42, | 170 | XFER_UDMA_2 = 0x42, |
169 | XFER_UDMA_1 = 0x41, | 171 | XFER_UDMA_1 = 0x41, |
170 | XFER_UDMA_0 = 0x40, | 172 | XFER_UDMA_0 = 0x40, |
173 | XFER_MW_DMA_4 = 0x24, /* CFA only */ | ||
174 | XFER_MW_DMA_3 = 0x23, /* CFA only */ | ||
171 | XFER_MW_DMA_2 = 0x22, | 175 | XFER_MW_DMA_2 = 0x22, |
172 | XFER_MW_DMA_1 = 0x21, | 176 | XFER_MW_DMA_1 = 0x21, |
173 | XFER_MW_DMA_0 = 0x20, | 177 | XFER_MW_DMA_0 = 0x20, |
174 | XFER_SW_DMA_2 = 0x12, | 178 | XFER_SW_DMA_2 = 0x12, |
175 | XFER_SW_DMA_1 = 0x11, | 179 | XFER_SW_DMA_1 = 0x11, |
176 | XFER_SW_DMA_0 = 0x10, | 180 | XFER_SW_DMA_0 = 0x10, |
181 | XFER_PIO_6 = 0x0E, /* CFA only */ | ||
182 | XFER_PIO_5 = 0x0D, /* CFA only */ | ||
177 | XFER_PIO_4 = 0x0C, | 183 | XFER_PIO_4 = 0x0C, |
178 | XFER_PIO_3 = 0x0B, | 184 | XFER_PIO_3 = 0x0B, |
179 | XFER_PIO_2 = 0x0A, | 185 | XFER_PIO_2 = 0x0A, |
@@ -272,7 +278,6 @@ struct ata_taskfile { | |||
272 | }; | 278 | }; |
273 | 279 | ||
274 | #define ata_id_is_ata(id) (((id)[0] & (1 << 15)) == 0) | 280 | #define ata_id_is_ata(id) (((id)[0] & (1 << 15)) == 0) |
275 | #define ata_id_is_cfa(id) ((id)[0] == 0x848A) | ||
276 | #define ata_id_is_sata(id) ((id)[93] == 0) | 281 | #define ata_id_is_sata(id) ((id)[93] == 0) |
277 | #define ata_id_rahead_enabled(id) ((id)[85] & (1 << 6)) | 282 | #define ata_id_rahead_enabled(id) ((id)[85] & (1 << 6)) |
278 | #define ata_id_wcache_enabled(id) ((id)[85] & (1 << 5)) | 283 | #define ata_id_wcache_enabled(id) ((id)[85] & (1 << 5)) |
@@ -304,6 +309,9 @@ static inline unsigned int ata_id_major_version(const u16 *id) | |||
304 | { | 309 | { |
305 | unsigned int mver; | 310 | unsigned int mver; |
306 | 311 | ||
312 | if (id[ATA_ID_MAJOR_VER] == 0xFFFF) | ||
313 | return 0; | ||
314 | |||
307 | for (mver = 14; mver >= 1; mver--) | 315 | for (mver = 14; mver >= 1; mver--) |
308 | if (id[ATA_ID_MAJOR_VER] & (1 << mver)) | 316 | if (id[ATA_ID_MAJOR_VER] & (1 << mver)) |
309 | break; | 317 | break; |
@@ -312,8 +320,8 @@ static inline unsigned int ata_id_major_version(const u16 *id) | |||
312 | 320 | ||
313 | static inline int ata_id_current_chs_valid(const u16 *id) | 321 | static inline int ata_id_current_chs_valid(const u16 *id) |
314 | { | 322 | { |
315 | /* For ATA-1 devices, if the INITIALIZE DEVICE PARAMETERS command | 323 | /* For ATA-1 devices, if the INITIALIZE DEVICE PARAMETERS command |
316 | has not been issued to the device then the values of | 324 | has not been issued to the device then the values of |
317 | id[54] to id[56] are vendor specific. */ | 325 | id[54] to id[56] are vendor specific. */ |
318 | return (id[53] & 0x01) && /* Current translation valid */ | 326 | return (id[53] & 0x01) && /* Current translation valid */ |
319 | id[54] && /* cylinders in current translation */ | 327 | id[54] && /* cylinders in current translation */ |
@@ -322,6 +330,18 @@ static inline int ata_id_current_chs_valid(const u16 *id) | |||
322 | id[56]; /* sectors in current translation */ | 330 | id[56]; /* sectors in current translation */ |
323 | } | 331 | } |
324 | 332 | ||
333 | static inline int ata_id_is_cfa(const u16 *id) | ||
334 | { | ||
335 | u16 v = id[0]; | ||
336 | if (v == 0x848A) /* Standard CF */ | ||
337 | return 1; | ||
338 | /* Could be CF hiding as standard ATA */ | ||
339 | if (ata_id_major_version(id) >= 3 && id[82] != 0xFFFF && | ||
340 | (id[82] & ( 1 << 2))) | ||
341 | return 1; | ||
342 | return 0; | ||
343 | } | ||
344 | |||
325 | static inline int atapi_cdb_len(const u16 *dev_id) | 345 | static inline int atapi_cdb_len(const u16 *dev_id) |
326 | { | 346 | { |
327 | u16 tmp = dev_id[0] & 0x3; | 347 | u16 tmp = dev_id[0] & 0x3; |
diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h index aafe82788b4e..c773ee545ebd 100644 --- a/include/linux/blkdev.h +++ b/include/linux/blkdev.h | |||
@@ -746,6 +746,9 @@ extern void blk_queue_free_tags(request_queue_t *); | |||
746 | extern int blk_queue_resize_tags(request_queue_t *, int); | 746 | extern int blk_queue_resize_tags(request_queue_t *, int); |
747 | extern void blk_queue_invalidate_tags(request_queue_t *); | 747 | extern void blk_queue_invalidate_tags(request_queue_t *); |
748 | extern long blk_congestion_wait(int rw, long timeout); | 748 | extern long blk_congestion_wait(int rw, long timeout); |
749 | extern struct blk_queue_tag *blk_init_tags(int); | ||
750 | extern void blk_free_tags(struct blk_queue_tag *); | ||
751 | extern void blk_congestion_end(int rw); | ||
749 | 752 | ||
750 | extern void blk_rq_bio_prep(request_queue_t *, struct request *, struct bio *); | 753 | extern void blk_rq_bio_prep(request_queue_t *, struct request *, struct bio *); |
751 | extern int blkdev_issue_flush(struct block_device *, sector_t *); | 754 | extern int blkdev_issue_flush(struct block_device *, sector_t *); |
diff --git a/include/linux/bootmem.h b/include/linux/bootmem.h index 1021f508d82c..e319c649e4fd 100644 --- a/include/linux/bootmem.h +++ b/include/linux/bootmem.h | |||
@@ -114,7 +114,7 @@ extern void *__init alloc_large_system_hash(const char *tablename, | |||
114 | #else | 114 | #else |
115 | #define HASHDIST_DEFAULT 0 | 115 | #define HASHDIST_DEFAULT 0 |
116 | #endif | 116 | #endif |
117 | extern int __initdata hashdist; /* Distribute hashes across NUMA nodes? */ | 117 | extern int hashdist; /* Distribute hashes across NUMA nodes? */ |
118 | 118 | ||
119 | 119 | ||
120 | #endif /* _LINUX_BOOTMEM_H */ | 120 | #endif /* _LINUX_BOOTMEM_H */ |
diff --git a/include/linux/coda_psdev.h b/include/linux/coda_psdev.h index 98f6c52c152b..b541bb3d1f4b 100644 --- a/include/linux/coda_psdev.h +++ b/include/linux/coda_psdev.h | |||
@@ -1,11 +1,11 @@ | |||
1 | #ifndef __CODA_PSDEV_H | 1 | #ifndef __CODA_PSDEV_H |
2 | #define __CODA_PSDEV_H | 2 | #define __CODA_PSDEV_H |
3 | 3 | ||
4 | #include <linux/magic.h> | ||
5 | |||
4 | #define CODA_PSDEV_MAJOR 67 | 6 | #define CODA_PSDEV_MAJOR 67 |
5 | #define MAX_CODADEVS 5 /* how many do we allow */ | 7 | #define MAX_CODADEVS 5 /* how many do we allow */ |
6 | 8 | ||
7 | #define CODA_SUPER_MAGIC 0x73757245 | ||
8 | |||
9 | struct kstatfs; | 9 | struct kstatfs; |
10 | 10 | ||
11 | struct coda_sb_info | 11 | struct coda_sb_info |
diff --git a/include/linux/crypto.h b/include/linux/crypto.h index 7f946241b879..8f2ffa4caabf 100644 --- a/include/linux/crypto.h +++ b/include/linux/crypto.h | |||
@@ -17,20 +17,36 @@ | |||
17 | #ifndef _LINUX_CRYPTO_H | 17 | #ifndef _LINUX_CRYPTO_H |
18 | #define _LINUX_CRYPTO_H | 18 | #define _LINUX_CRYPTO_H |
19 | 19 | ||
20 | #include <asm/atomic.h> | ||
20 | #include <linux/module.h> | 21 | #include <linux/module.h> |
21 | #include <linux/kernel.h> | 22 | #include <linux/kernel.h> |
22 | #include <linux/types.h> | ||
23 | #include <linux/list.h> | 23 | #include <linux/list.h> |
24 | #include <linux/slab.h> | ||
24 | #include <linux/string.h> | 25 | #include <linux/string.h> |
25 | #include <asm/page.h> | 26 | #include <linux/uaccess.h> |
26 | 27 | ||
27 | /* | 28 | /* |
28 | * Algorithm masks and types. | 29 | * Algorithm masks and types. |
29 | */ | 30 | */ |
30 | #define CRYPTO_ALG_TYPE_MASK 0x000000ff | 31 | #define CRYPTO_ALG_TYPE_MASK 0x0000000f |
31 | #define CRYPTO_ALG_TYPE_CIPHER 0x00000001 | 32 | #define CRYPTO_ALG_TYPE_CIPHER 0x00000001 |
32 | #define CRYPTO_ALG_TYPE_DIGEST 0x00000002 | 33 | #define CRYPTO_ALG_TYPE_DIGEST 0x00000002 |
33 | #define CRYPTO_ALG_TYPE_COMPRESS 0x00000004 | 34 | #define CRYPTO_ALG_TYPE_HASH 0x00000003 |
35 | #define CRYPTO_ALG_TYPE_BLKCIPHER 0x00000004 | ||
36 | #define CRYPTO_ALG_TYPE_COMPRESS 0x00000005 | ||
37 | |||
38 | #define CRYPTO_ALG_TYPE_HASH_MASK 0x0000000e | ||
39 | |||
40 | #define CRYPTO_ALG_LARVAL 0x00000010 | ||
41 | #define CRYPTO_ALG_DEAD 0x00000020 | ||
42 | #define CRYPTO_ALG_DYING 0x00000040 | ||
43 | #define CRYPTO_ALG_ASYNC 0x00000080 | ||
44 | |||
45 | /* | ||
46 | * Set this bit if and only if the algorithm requires another algorithm of | ||
47 | * the same type to handle corner cases. | ||
48 | */ | ||
49 | #define CRYPTO_ALG_NEED_FALLBACK 0x00000100 | ||
34 | 50 | ||
35 | /* | 51 | /* |
36 | * Transform masks and values (for crt_flags). | 52 | * Transform masks and values (for crt_flags). |
@@ -61,8 +77,37 @@ | |||
61 | #define CRYPTO_DIR_ENCRYPT 1 | 77 | #define CRYPTO_DIR_ENCRYPT 1 |
62 | #define CRYPTO_DIR_DECRYPT 0 | 78 | #define CRYPTO_DIR_DECRYPT 0 |
63 | 79 | ||
80 | /* | ||
81 | * The macro CRYPTO_MINALIGN_ATTR (along with the void * type in the actual | ||
82 | * declaration) is used to ensure that the crypto_tfm context structure is | ||
83 | * aligned correctly for the given architecture so that there are no alignment | ||
84 | * faults for C data types. In particular, this is required on platforms such | ||
85 | * as arm where pointers are 32-bit aligned but there are data types such as | ||
86 | * u64 which require 64-bit alignment. | ||
87 | */ | ||
88 | #if defined(ARCH_KMALLOC_MINALIGN) | ||
89 | #define CRYPTO_MINALIGN ARCH_KMALLOC_MINALIGN | ||
90 | #elif defined(ARCH_SLAB_MINALIGN) | ||
91 | #define CRYPTO_MINALIGN ARCH_SLAB_MINALIGN | ||
92 | #endif | ||
93 | |||
94 | #ifdef CRYPTO_MINALIGN | ||
95 | #define CRYPTO_MINALIGN_ATTR __attribute__ ((__aligned__(CRYPTO_MINALIGN))) | ||
96 | #else | ||
97 | #define CRYPTO_MINALIGN_ATTR | ||
98 | #endif | ||
99 | |||
64 | struct scatterlist; | 100 | struct scatterlist; |
101 | struct crypto_blkcipher; | ||
102 | struct crypto_hash; | ||
65 | struct crypto_tfm; | 103 | struct crypto_tfm; |
104 | struct crypto_type; | ||
105 | |||
106 | struct blkcipher_desc { | ||
107 | struct crypto_blkcipher *tfm; | ||
108 | void *info; | ||
109 | u32 flags; | ||
110 | }; | ||
66 | 111 | ||
67 | struct cipher_desc { | 112 | struct cipher_desc { |
68 | struct crypto_tfm *tfm; | 113 | struct crypto_tfm *tfm; |
@@ -72,30 +117,50 @@ struct cipher_desc { | |||
72 | void *info; | 117 | void *info; |
73 | }; | 118 | }; |
74 | 119 | ||
120 | struct hash_desc { | ||
121 | struct crypto_hash *tfm; | ||
122 | u32 flags; | ||
123 | }; | ||
124 | |||
75 | /* | 125 | /* |
76 | * Algorithms: modular crypto algorithm implementations, managed | 126 | * Algorithms: modular crypto algorithm implementations, managed |
77 | * via crypto_register_alg() and crypto_unregister_alg(). | 127 | * via crypto_register_alg() and crypto_unregister_alg(). |
78 | */ | 128 | */ |
129 | struct blkcipher_alg { | ||
130 | int (*setkey)(struct crypto_tfm *tfm, const u8 *key, | ||
131 | unsigned int keylen); | ||
132 | int (*encrypt)(struct blkcipher_desc *desc, | ||
133 | struct scatterlist *dst, struct scatterlist *src, | ||
134 | unsigned int nbytes); | ||
135 | int (*decrypt)(struct blkcipher_desc *desc, | ||
136 | struct scatterlist *dst, struct scatterlist *src, | ||
137 | unsigned int nbytes); | ||
138 | |||
139 | unsigned int min_keysize; | ||
140 | unsigned int max_keysize; | ||
141 | unsigned int ivsize; | ||
142 | }; | ||
143 | |||
79 | struct cipher_alg { | 144 | struct cipher_alg { |
80 | unsigned int cia_min_keysize; | 145 | unsigned int cia_min_keysize; |
81 | unsigned int cia_max_keysize; | 146 | unsigned int cia_max_keysize; |
82 | int (*cia_setkey)(struct crypto_tfm *tfm, const u8 *key, | 147 | int (*cia_setkey)(struct crypto_tfm *tfm, const u8 *key, |
83 | unsigned int keylen, u32 *flags); | 148 | unsigned int keylen); |
84 | void (*cia_encrypt)(struct crypto_tfm *tfm, u8 *dst, const u8 *src); | 149 | void (*cia_encrypt)(struct crypto_tfm *tfm, u8 *dst, const u8 *src); |
85 | void (*cia_decrypt)(struct crypto_tfm *tfm, u8 *dst, const u8 *src); | 150 | void (*cia_decrypt)(struct crypto_tfm *tfm, u8 *dst, const u8 *src); |
86 | 151 | ||
87 | unsigned int (*cia_encrypt_ecb)(const struct cipher_desc *desc, | 152 | unsigned int (*cia_encrypt_ecb)(const struct cipher_desc *desc, |
88 | u8 *dst, const u8 *src, | 153 | u8 *dst, const u8 *src, |
89 | unsigned int nbytes); | 154 | unsigned int nbytes) __deprecated; |
90 | unsigned int (*cia_decrypt_ecb)(const struct cipher_desc *desc, | 155 | unsigned int (*cia_decrypt_ecb)(const struct cipher_desc *desc, |
91 | u8 *dst, const u8 *src, | 156 | u8 *dst, const u8 *src, |
92 | unsigned int nbytes); | 157 | unsigned int nbytes) __deprecated; |
93 | unsigned int (*cia_encrypt_cbc)(const struct cipher_desc *desc, | 158 | unsigned int (*cia_encrypt_cbc)(const struct cipher_desc *desc, |
94 | u8 *dst, const u8 *src, | 159 | u8 *dst, const u8 *src, |
95 | unsigned int nbytes); | 160 | unsigned int nbytes) __deprecated; |
96 | unsigned int (*cia_decrypt_cbc)(const struct cipher_desc *desc, | 161 | unsigned int (*cia_decrypt_cbc)(const struct cipher_desc *desc, |
97 | u8 *dst, const u8 *src, | 162 | u8 *dst, const u8 *src, |
98 | unsigned int nbytes); | 163 | unsigned int nbytes) __deprecated; |
99 | }; | 164 | }; |
100 | 165 | ||
101 | struct digest_alg { | 166 | struct digest_alg { |
@@ -105,7 +170,20 @@ struct digest_alg { | |||
105 | unsigned int len); | 170 | unsigned int len); |
106 | void (*dia_final)(struct crypto_tfm *tfm, u8 *out); | 171 | void (*dia_final)(struct crypto_tfm *tfm, u8 *out); |
107 | int (*dia_setkey)(struct crypto_tfm *tfm, const u8 *key, | 172 | int (*dia_setkey)(struct crypto_tfm *tfm, const u8 *key, |
108 | unsigned int keylen, u32 *flags); | 173 | unsigned int keylen); |
174 | }; | ||
175 | |||
176 | struct hash_alg { | ||
177 | int (*init)(struct hash_desc *desc); | ||
178 | int (*update)(struct hash_desc *desc, struct scatterlist *sg, | ||
179 | unsigned int nbytes); | ||
180 | int (*final)(struct hash_desc *desc, u8 *out); | ||
181 | int (*digest)(struct hash_desc *desc, struct scatterlist *sg, | ||
182 | unsigned int nbytes, u8 *out); | ||
183 | int (*setkey)(struct crypto_hash *tfm, const u8 *key, | ||
184 | unsigned int keylen); | ||
185 | |||
186 | unsigned int digestsize; | ||
109 | }; | 187 | }; |
110 | 188 | ||
111 | struct compress_alg { | 189 | struct compress_alg { |
@@ -115,30 +193,40 @@ struct compress_alg { | |||
115 | unsigned int slen, u8 *dst, unsigned int *dlen); | 193 | unsigned int slen, u8 *dst, unsigned int *dlen); |
116 | }; | 194 | }; |
117 | 195 | ||
196 | #define cra_blkcipher cra_u.blkcipher | ||
118 | #define cra_cipher cra_u.cipher | 197 | #define cra_cipher cra_u.cipher |
119 | #define cra_digest cra_u.digest | 198 | #define cra_digest cra_u.digest |
199 | #define cra_hash cra_u.hash | ||
120 | #define cra_compress cra_u.compress | 200 | #define cra_compress cra_u.compress |
121 | 201 | ||
122 | struct crypto_alg { | 202 | struct crypto_alg { |
123 | struct list_head cra_list; | 203 | struct list_head cra_list; |
204 | struct list_head cra_users; | ||
205 | |||
124 | u32 cra_flags; | 206 | u32 cra_flags; |
125 | unsigned int cra_blocksize; | 207 | unsigned int cra_blocksize; |
126 | unsigned int cra_ctxsize; | 208 | unsigned int cra_ctxsize; |
127 | unsigned int cra_alignmask; | 209 | unsigned int cra_alignmask; |
128 | 210 | ||
129 | int cra_priority; | 211 | int cra_priority; |
212 | atomic_t cra_refcnt; | ||
130 | 213 | ||
131 | char cra_name[CRYPTO_MAX_ALG_NAME]; | 214 | char cra_name[CRYPTO_MAX_ALG_NAME]; |
132 | char cra_driver_name[CRYPTO_MAX_ALG_NAME]; | 215 | char cra_driver_name[CRYPTO_MAX_ALG_NAME]; |
133 | 216 | ||
217 | const struct crypto_type *cra_type; | ||
218 | |||
134 | union { | 219 | union { |
220 | struct blkcipher_alg blkcipher; | ||
135 | struct cipher_alg cipher; | 221 | struct cipher_alg cipher; |
136 | struct digest_alg digest; | 222 | struct digest_alg digest; |
223 | struct hash_alg hash; | ||
137 | struct compress_alg compress; | 224 | struct compress_alg compress; |
138 | } cra_u; | 225 | } cra_u; |
139 | 226 | ||
140 | int (*cra_init)(struct crypto_tfm *tfm); | 227 | int (*cra_init)(struct crypto_tfm *tfm); |
141 | void (*cra_exit)(struct crypto_tfm *tfm); | 228 | void (*cra_exit)(struct crypto_tfm *tfm); |
229 | void (*cra_destroy)(struct crypto_alg *alg); | ||
142 | 230 | ||
143 | struct module *cra_module; | 231 | struct module *cra_module; |
144 | }; | 232 | }; |
@@ -153,20 +241,39 @@ int crypto_unregister_alg(struct crypto_alg *alg); | |||
153 | * Algorithm query interface. | 241 | * Algorithm query interface. |
154 | */ | 242 | */ |
155 | #ifdef CONFIG_CRYPTO | 243 | #ifdef CONFIG_CRYPTO |
156 | int crypto_alg_available(const char *name, u32 flags); | 244 | int crypto_alg_available(const char *name, u32 flags) |
245 | __deprecated_for_modules; | ||
246 | int crypto_has_alg(const char *name, u32 type, u32 mask); | ||
157 | #else | 247 | #else |
248 | static int crypto_alg_available(const char *name, u32 flags); | ||
249 | __deprecated_for_modules; | ||
158 | static inline int crypto_alg_available(const char *name, u32 flags) | 250 | static inline int crypto_alg_available(const char *name, u32 flags) |
159 | { | 251 | { |
160 | return 0; | 252 | return 0; |
161 | } | 253 | } |
254 | |||
255 | static inline int crypto_has_alg(const char *name, u32 type, u32 mask) | ||
256 | { | ||
257 | return 0; | ||
258 | } | ||
162 | #endif | 259 | #endif |
163 | 260 | ||
164 | /* | 261 | /* |
165 | * Transforms: user-instantiated objects which encapsulate algorithms | 262 | * Transforms: user-instantiated objects which encapsulate algorithms |
166 | * and core processing logic. Managed via crypto_alloc_tfm() and | 263 | * and core processing logic. Managed via crypto_alloc_*() and |
167 | * crypto_free_tfm(), as well as the various helpers below. | 264 | * crypto_free_*(), as well as the various helpers below. |
168 | */ | 265 | */ |
169 | 266 | ||
267 | struct blkcipher_tfm { | ||
268 | void *iv; | ||
269 | int (*setkey)(struct crypto_tfm *tfm, const u8 *key, | ||
270 | unsigned int keylen); | ||
271 | int (*encrypt)(struct blkcipher_desc *desc, struct scatterlist *dst, | ||
272 | struct scatterlist *src, unsigned int nbytes); | ||
273 | int (*decrypt)(struct blkcipher_desc *desc, struct scatterlist *dst, | ||
274 | struct scatterlist *src, unsigned int nbytes); | ||
275 | }; | ||
276 | |||
170 | struct cipher_tfm { | 277 | struct cipher_tfm { |
171 | void *cit_iv; | 278 | void *cit_iv; |
172 | unsigned int cit_ivsize; | 279 | unsigned int cit_ivsize; |
@@ -190,20 +297,20 @@ struct cipher_tfm { | |||
190 | struct scatterlist *src, | 297 | struct scatterlist *src, |
191 | unsigned int nbytes, u8 *iv); | 298 | unsigned int nbytes, u8 *iv); |
192 | void (*cit_xor_block)(u8 *dst, const u8 *src); | 299 | void (*cit_xor_block)(u8 *dst, const u8 *src); |
300 | void (*cit_encrypt_one)(struct crypto_tfm *tfm, u8 *dst, const u8 *src); | ||
301 | void (*cit_decrypt_one)(struct crypto_tfm *tfm, u8 *dst, const u8 *src); | ||
193 | }; | 302 | }; |
194 | 303 | ||
195 | struct digest_tfm { | 304 | struct hash_tfm { |
196 | void (*dit_init)(struct crypto_tfm *tfm); | 305 | int (*init)(struct hash_desc *desc); |
197 | void (*dit_update)(struct crypto_tfm *tfm, | 306 | int (*update)(struct hash_desc *desc, |
198 | struct scatterlist *sg, unsigned int nsg); | 307 | struct scatterlist *sg, unsigned int nsg); |
199 | void (*dit_final)(struct crypto_tfm *tfm, u8 *out); | 308 | int (*final)(struct hash_desc *desc, u8 *out); |
200 | void (*dit_digest)(struct crypto_tfm *tfm, struct scatterlist *sg, | 309 | int (*digest)(struct hash_desc *desc, struct scatterlist *sg, |
201 | unsigned int nsg, u8 *out); | 310 | unsigned int nsg, u8 *out); |
202 | int (*dit_setkey)(struct crypto_tfm *tfm, | 311 | int (*setkey)(struct crypto_hash *tfm, const u8 *key, |
203 | const u8 *key, unsigned int keylen); | 312 | unsigned int keylen); |
204 | #ifdef CONFIG_CRYPTO_HMAC | 313 | unsigned int digestsize; |
205 | void *dit_hmac_block; | ||
206 | #endif | ||
207 | }; | 314 | }; |
208 | 315 | ||
209 | struct compress_tfm { | 316 | struct compress_tfm { |
@@ -215,8 +322,9 @@ struct compress_tfm { | |||
215 | u8 *dst, unsigned int *dlen); | 322 | u8 *dst, unsigned int *dlen); |
216 | }; | 323 | }; |
217 | 324 | ||
325 | #define crt_blkcipher crt_u.blkcipher | ||
218 | #define crt_cipher crt_u.cipher | 326 | #define crt_cipher crt_u.cipher |
219 | #define crt_digest crt_u.digest | 327 | #define crt_hash crt_u.hash |
220 | #define crt_compress crt_u.compress | 328 | #define crt_compress crt_u.compress |
221 | 329 | ||
222 | struct crypto_tfm { | 330 | struct crypto_tfm { |
@@ -224,30 +332,43 @@ struct crypto_tfm { | |||
224 | u32 crt_flags; | 332 | u32 crt_flags; |
225 | 333 | ||
226 | union { | 334 | union { |
335 | struct blkcipher_tfm blkcipher; | ||
227 | struct cipher_tfm cipher; | 336 | struct cipher_tfm cipher; |
228 | struct digest_tfm digest; | 337 | struct hash_tfm hash; |
229 | struct compress_tfm compress; | 338 | struct compress_tfm compress; |
230 | } crt_u; | 339 | } crt_u; |
231 | 340 | ||
232 | struct crypto_alg *__crt_alg; | 341 | struct crypto_alg *__crt_alg; |
233 | 342 | ||
234 | char __crt_ctx[] __attribute__ ((__aligned__)); | 343 | void *__crt_ctx[] CRYPTO_MINALIGN_ATTR; |
344 | }; | ||
345 | |||
346 | #define crypto_cipher crypto_tfm | ||
347 | #define crypto_comp crypto_tfm | ||
348 | |||
349 | struct crypto_blkcipher { | ||
350 | struct crypto_tfm base; | ||
351 | }; | ||
352 | |||
353 | struct crypto_hash { | ||
354 | struct crypto_tfm base; | ||
355 | }; | ||
356 | |||
357 | enum { | ||
358 | CRYPTOA_UNSPEC, | ||
359 | CRYPTOA_ALG, | ||
360 | }; | ||
361 | |||
362 | struct crypto_attr_alg { | ||
363 | char name[CRYPTO_MAX_ALG_NAME]; | ||
235 | }; | 364 | }; |
236 | 365 | ||
237 | /* | 366 | /* |
238 | * Transform user interface. | 367 | * Transform user interface. |
239 | */ | 368 | */ |
240 | 369 | ||
241 | /* | ||
242 | * crypto_alloc_tfm() will first attempt to locate an already loaded algorithm. | ||
243 | * If that fails and the kernel supports dynamically loadable modules, it | ||
244 | * will then attempt to load a module of the same name or alias. A refcount | ||
245 | * is grabbed on the algorithm which is then associated with the new transform. | ||
246 | * | ||
247 | * crypto_free_tfm() frees up the transform and any associated resources, | ||
248 | * then drops the refcount on the associated algorithm. | ||
249 | */ | ||
250 | struct crypto_tfm *crypto_alloc_tfm(const char *alg_name, u32 tfm_flags); | 370 | struct crypto_tfm *crypto_alloc_tfm(const char *alg_name, u32 tfm_flags); |
371 | struct crypto_tfm *crypto_alloc_base(const char *alg_name, u32 type, u32 mask); | ||
251 | void crypto_free_tfm(struct crypto_tfm *tfm); | 372 | void crypto_free_tfm(struct crypto_tfm *tfm); |
252 | 373 | ||
253 | /* | 374 | /* |
@@ -258,6 +379,16 @@ static inline const char *crypto_tfm_alg_name(struct crypto_tfm *tfm) | |||
258 | return tfm->__crt_alg->cra_name; | 379 | return tfm->__crt_alg->cra_name; |
259 | } | 380 | } |
260 | 381 | ||
382 | static inline const char *crypto_tfm_alg_driver_name(struct crypto_tfm *tfm) | ||
383 | { | ||
384 | return tfm->__crt_alg->cra_driver_name; | ||
385 | } | ||
386 | |||
387 | static inline int crypto_tfm_alg_priority(struct crypto_tfm *tfm) | ||
388 | { | ||
389 | return tfm->__crt_alg->cra_priority; | ||
390 | } | ||
391 | |||
261 | static inline const char *crypto_tfm_alg_modname(struct crypto_tfm *tfm) | 392 | static inline const char *crypto_tfm_alg_modname(struct crypto_tfm *tfm) |
262 | { | 393 | { |
263 | return module_name(tfm->__crt_alg->cra_module); | 394 | return module_name(tfm->__crt_alg->cra_module); |
@@ -268,18 +399,23 @@ static inline u32 crypto_tfm_alg_type(struct crypto_tfm *tfm) | |||
268 | return tfm->__crt_alg->cra_flags & CRYPTO_ALG_TYPE_MASK; | 399 | return tfm->__crt_alg->cra_flags & CRYPTO_ALG_TYPE_MASK; |
269 | } | 400 | } |
270 | 401 | ||
402 | static unsigned int crypto_tfm_alg_min_keysize(struct crypto_tfm *tfm) | ||
403 | __deprecated; | ||
271 | static inline unsigned int crypto_tfm_alg_min_keysize(struct crypto_tfm *tfm) | 404 | static inline unsigned int crypto_tfm_alg_min_keysize(struct crypto_tfm *tfm) |
272 | { | 405 | { |
273 | BUG_ON(crypto_tfm_alg_type(tfm) != CRYPTO_ALG_TYPE_CIPHER); | 406 | BUG_ON(crypto_tfm_alg_type(tfm) != CRYPTO_ALG_TYPE_CIPHER); |
274 | return tfm->__crt_alg->cra_cipher.cia_min_keysize; | 407 | return tfm->__crt_alg->cra_cipher.cia_min_keysize; |
275 | } | 408 | } |
276 | 409 | ||
410 | static unsigned int crypto_tfm_alg_max_keysize(struct crypto_tfm *tfm) | ||
411 | __deprecated; | ||
277 | static inline unsigned int crypto_tfm_alg_max_keysize(struct crypto_tfm *tfm) | 412 | static inline unsigned int crypto_tfm_alg_max_keysize(struct crypto_tfm *tfm) |
278 | { | 413 | { |
279 | BUG_ON(crypto_tfm_alg_type(tfm) != CRYPTO_ALG_TYPE_CIPHER); | 414 | BUG_ON(crypto_tfm_alg_type(tfm) != CRYPTO_ALG_TYPE_CIPHER); |
280 | return tfm->__crt_alg->cra_cipher.cia_max_keysize; | 415 | return tfm->__crt_alg->cra_cipher.cia_max_keysize; |
281 | } | 416 | } |
282 | 417 | ||
418 | static unsigned int crypto_tfm_alg_ivsize(struct crypto_tfm *tfm) __deprecated; | ||
283 | static inline unsigned int crypto_tfm_alg_ivsize(struct crypto_tfm *tfm) | 419 | static inline unsigned int crypto_tfm_alg_ivsize(struct crypto_tfm *tfm) |
284 | { | 420 | { |
285 | BUG_ON(crypto_tfm_alg_type(tfm) != CRYPTO_ALG_TYPE_CIPHER); | 421 | BUG_ON(crypto_tfm_alg_type(tfm) != CRYPTO_ALG_TYPE_CIPHER); |
@@ -302,6 +438,21 @@ static inline unsigned int crypto_tfm_alg_alignmask(struct crypto_tfm *tfm) | |||
302 | return tfm->__crt_alg->cra_alignmask; | 438 | return tfm->__crt_alg->cra_alignmask; |
303 | } | 439 | } |
304 | 440 | ||
441 | static inline u32 crypto_tfm_get_flags(struct crypto_tfm *tfm) | ||
442 | { | ||
443 | return tfm->crt_flags; | ||
444 | } | ||
445 | |||
446 | static inline void crypto_tfm_set_flags(struct crypto_tfm *tfm, u32 flags) | ||
447 | { | ||
448 | tfm->crt_flags |= flags; | ||
449 | } | ||
450 | |||
451 | static inline void crypto_tfm_clear_flags(struct crypto_tfm *tfm, u32 flags) | ||
452 | { | ||
453 | tfm->crt_flags &= ~flags; | ||
454 | } | ||
455 | |||
305 | static inline void *crypto_tfm_ctx(struct crypto_tfm *tfm) | 456 | static inline void *crypto_tfm_ctx(struct crypto_tfm *tfm) |
306 | { | 457 | { |
307 | return tfm->__crt_ctx; | 458 | return tfm->__crt_ctx; |
@@ -316,50 +467,374 @@ static inline unsigned int crypto_tfm_ctx_alignment(void) | |||
316 | /* | 467 | /* |
317 | * API wrappers. | 468 | * API wrappers. |
318 | */ | 469 | */ |
319 | static inline void crypto_digest_init(struct crypto_tfm *tfm) | 470 | static inline struct crypto_blkcipher *__crypto_blkcipher_cast( |
471 | struct crypto_tfm *tfm) | ||
320 | { | 472 | { |
321 | BUG_ON(crypto_tfm_alg_type(tfm) != CRYPTO_ALG_TYPE_DIGEST); | 473 | return (struct crypto_blkcipher *)tfm; |
322 | tfm->crt_digest.dit_init(tfm); | ||
323 | } | 474 | } |
324 | 475 | ||
325 | static inline void crypto_digest_update(struct crypto_tfm *tfm, | 476 | static inline struct crypto_blkcipher *crypto_blkcipher_cast( |
326 | struct scatterlist *sg, | 477 | struct crypto_tfm *tfm) |
327 | unsigned int nsg) | ||
328 | { | 478 | { |
329 | BUG_ON(crypto_tfm_alg_type(tfm) != CRYPTO_ALG_TYPE_DIGEST); | 479 | BUG_ON(crypto_tfm_alg_type(tfm) != CRYPTO_ALG_TYPE_BLKCIPHER); |
330 | tfm->crt_digest.dit_update(tfm, sg, nsg); | 480 | return __crypto_blkcipher_cast(tfm); |
331 | } | 481 | } |
332 | 482 | ||
333 | static inline void crypto_digest_final(struct crypto_tfm *tfm, u8 *out) | 483 | static inline struct crypto_blkcipher *crypto_alloc_blkcipher( |
484 | const char *alg_name, u32 type, u32 mask) | ||
334 | { | 485 | { |
335 | BUG_ON(crypto_tfm_alg_type(tfm) != CRYPTO_ALG_TYPE_DIGEST); | 486 | type &= ~CRYPTO_ALG_TYPE_MASK; |
336 | tfm->crt_digest.dit_final(tfm, out); | 487 | type |= CRYPTO_ALG_TYPE_BLKCIPHER; |
488 | mask |= CRYPTO_ALG_TYPE_MASK; | ||
489 | |||
490 | return __crypto_blkcipher_cast(crypto_alloc_base(alg_name, type, mask)); | ||
337 | } | 491 | } |
338 | 492 | ||
339 | static inline void crypto_digest_digest(struct crypto_tfm *tfm, | 493 | static inline struct crypto_tfm *crypto_blkcipher_tfm( |
340 | struct scatterlist *sg, | 494 | struct crypto_blkcipher *tfm) |
341 | unsigned int nsg, u8 *out) | ||
342 | { | 495 | { |
343 | BUG_ON(crypto_tfm_alg_type(tfm) != CRYPTO_ALG_TYPE_DIGEST); | 496 | return &tfm->base; |
344 | tfm->crt_digest.dit_digest(tfm, sg, nsg, out); | ||
345 | } | 497 | } |
346 | 498 | ||
347 | static inline int crypto_digest_setkey(struct crypto_tfm *tfm, | 499 | static inline void crypto_free_blkcipher(struct crypto_blkcipher *tfm) |
500 | { | ||
501 | crypto_free_tfm(crypto_blkcipher_tfm(tfm)); | ||
502 | } | ||
503 | |||
504 | static inline int crypto_has_blkcipher(const char *alg_name, u32 type, u32 mask) | ||
505 | { | ||
506 | type &= ~CRYPTO_ALG_TYPE_MASK; | ||
507 | type |= CRYPTO_ALG_TYPE_BLKCIPHER; | ||
508 | mask |= CRYPTO_ALG_TYPE_MASK; | ||
509 | |||
510 | return crypto_has_alg(alg_name, type, mask); | ||
511 | } | ||
512 | |||
513 | static inline const char *crypto_blkcipher_name(struct crypto_blkcipher *tfm) | ||
514 | { | ||
515 | return crypto_tfm_alg_name(crypto_blkcipher_tfm(tfm)); | ||
516 | } | ||
517 | |||
518 | static inline struct blkcipher_tfm *crypto_blkcipher_crt( | ||
519 | struct crypto_blkcipher *tfm) | ||
520 | { | ||
521 | return &crypto_blkcipher_tfm(tfm)->crt_blkcipher; | ||
522 | } | ||
523 | |||
524 | static inline struct blkcipher_alg *crypto_blkcipher_alg( | ||
525 | struct crypto_blkcipher *tfm) | ||
526 | { | ||
527 | return &crypto_blkcipher_tfm(tfm)->__crt_alg->cra_blkcipher; | ||
528 | } | ||
529 | |||
530 | static inline unsigned int crypto_blkcipher_ivsize(struct crypto_blkcipher *tfm) | ||
531 | { | ||
532 | return crypto_blkcipher_alg(tfm)->ivsize; | ||
533 | } | ||
534 | |||
535 | static inline unsigned int crypto_blkcipher_blocksize( | ||
536 | struct crypto_blkcipher *tfm) | ||
537 | { | ||
538 | return crypto_tfm_alg_blocksize(crypto_blkcipher_tfm(tfm)); | ||
539 | } | ||
540 | |||
541 | static inline unsigned int crypto_blkcipher_alignmask( | ||
542 | struct crypto_blkcipher *tfm) | ||
543 | { | ||
544 | return crypto_tfm_alg_alignmask(crypto_blkcipher_tfm(tfm)); | ||
545 | } | ||
546 | |||
547 | static inline u32 crypto_blkcipher_get_flags(struct crypto_blkcipher *tfm) | ||
548 | { | ||
549 | return crypto_tfm_get_flags(crypto_blkcipher_tfm(tfm)); | ||
550 | } | ||
551 | |||
552 | static inline void crypto_blkcipher_set_flags(struct crypto_blkcipher *tfm, | ||
553 | u32 flags) | ||
554 | { | ||
555 | crypto_tfm_set_flags(crypto_blkcipher_tfm(tfm), flags); | ||
556 | } | ||
557 | |||
558 | static inline void crypto_blkcipher_clear_flags(struct crypto_blkcipher *tfm, | ||
559 | u32 flags) | ||
560 | { | ||
561 | crypto_tfm_clear_flags(crypto_blkcipher_tfm(tfm), flags); | ||
562 | } | ||
563 | |||
564 | static inline int crypto_blkcipher_setkey(struct crypto_blkcipher *tfm, | ||
565 | const u8 *key, unsigned int keylen) | ||
566 | { | ||
567 | return crypto_blkcipher_crt(tfm)->setkey(crypto_blkcipher_tfm(tfm), | ||
568 | key, keylen); | ||
569 | } | ||
570 | |||
571 | static inline int crypto_blkcipher_encrypt(struct blkcipher_desc *desc, | ||
572 | struct scatterlist *dst, | ||
573 | struct scatterlist *src, | ||
574 | unsigned int nbytes) | ||
575 | { | ||
576 | desc->info = crypto_blkcipher_crt(desc->tfm)->iv; | ||
577 | return crypto_blkcipher_crt(desc->tfm)->encrypt(desc, dst, src, nbytes); | ||
578 | } | ||
579 | |||
580 | static inline int crypto_blkcipher_encrypt_iv(struct blkcipher_desc *desc, | ||
581 | struct scatterlist *dst, | ||
582 | struct scatterlist *src, | ||
583 | unsigned int nbytes) | ||
584 | { | ||
585 | return crypto_blkcipher_crt(desc->tfm)->encrypt(desc, dst, src, nbytes); | ||
586 | } | ||
587 | |||
588 | static inline int crypto_blkcipher_decrypt(struct blkcipher_desc *desc, | ||
589 | struct scatterlist *dst, | ||
590 | struct scatterlist *src, | ||
591 | unsigned int nbytes) | ||
592 | { | ||
593 | desc->info = crypto_blkcipher_crt(desc->tfm)->iv; | ||
594 | return crypto_blkcipher_crt(desc->tfm)->decrypt(desc, dst, src, nbytes); | ||
595 | } | ||
596 | |||
597 | static inline int crypto_blkcipher_decrypt_iv(struct blkcipher_desc *desc, | ||
598 | struct scatterlist *dst, | ||
599 | struct scatterlist *src, | ||
600 | unsigned int nbytes) | ||
601 | { | ||
602 | return crypto_blkcipher_crt(desc->tfm)->decrypt(desc, dst, src, nbytes); | ||
603 | } | ||
604 | |||
605 | static inline void crypto_blkcipher_set_iv(struct crypto_blkcipher *tfm, | ||
606 | const u8 *src, unsigned int len) | ||
607 | { | ||
608 | memcpy(crypto_blkcipher_crt(tfm)->iv, src, len); | ||
609 | } | ||
610 | |||
611 | static inline void crypto_blkcipher_get_iv(struct crypto_blkcipher *tfm, | ||
612 | u8 *dst, unsigned int len) | ||
613 | { | ||
614 | memcpy(dst, crypto_blkcipher_crt(tfm)->iv, len); | ||
615 | } | ||
616 | |||
617 | static inline struct crypto_cipher *__crypto_cipher_cast(struct crypto_tfm *tfm) | ||
618 | { | ||
619 | return (struct crypto_cipher *)tfm; | ||
620 | } | ||
621 | |||
622 | static inline struct crypto_cipher *crypto_cipher_cast(struct crypto_tfm *tfm) | ||
623 | { | ||
624 | BUG_ON(crypto_tfm_alg_type(tfm) != CRYPTO_ALG_TYPE_CIPHER); | ||
625 | return __crypto_cipher_cast(tfm); | ||
626 | } | ||
627 | |||
628 | static inline struct crypto_cipher *crypto_alloc_cipher(const char *alg_name, | ||
629 | u32 type, u32 mask) | ||
630 | { | ||
631 | type &= ~CRYPTO_ALG_TYPE_MASK; | ||
632 | type |= CRYPTO_ALG_TYPE_CIPHER; | ||
633 | mask |= CRYPTO_ALG_TYPE_MASK; | ||
634 | |||
635 | return __crypto_cipher_cast(crypto_alloc_base(alg_name, type, mask)); | ||
636 | } | ||
637 | |||
638 | static inline struct crypto_tfm *crypto_cipher_tfm(struct crypto_cipher *tfm) | ||
639 | { | ||
640 | return tfm; | ||
641 | } | ||
642 | |||
643 | static inline void crypto_free_cipher(struct crypto_cipher *tfm) | ||
644 | { | ||
645 | crypto_free_tfm(crypto_cipher_tfm(tfm)); | ||
646 | } | ||
647 | |||
648 | static inline int crypto_has_cipher(const char *alg_name, u32 type, u32 mask) | ||
649 | { | ||
650 | type &= ~CRYPTO_ALG_TYPE_MASK; | ||
651 | type |= CRYPTO_ALG_TYPE_CIPHER; | ||
652 | mask |= CRYPTO_ALG_TYPE_MASK; | ||
653 | |||
654 | return crypto_has_alg(alg_name, type, mask); | ||
655 | } | ||
656 | |||
657 | static inline struct cipher_tfm *crypto_cipher_crt(struct crypto_cipher *tfm) | ||
658 | { | ||
659 | return &crypto_cipher_tfm(tfm)->crt_cipher; | ||
660 | } | ||
661 | |||
662 | static inline unsigned int crypto_cipher_blocksize(struct crypto_cipher *tfm) | ||
663 | { | ||
664 | return crypto_tfm_alg_blocksize(crypto_cipher_tfm(tfm)); | ||
665 | } | ||
666 | |||
667 | static inline unsigned int crypto_cipher_alignmask(struct crypto_cipher *tfm) | ||
668 | { | ||
669 | return crypto_tfm_alg_alignmask(crypto_cipher_tfm(tfm)); | ||
670 | } | ||
671 | |||
672 | static inline u32 crypto_cipher_get_flags(struct crypto_cipher *tfm) | ||
673 | { | ||
674 | return crypto_tfm_get_flags(crypto_cipher_tfm(tfm)); | ||
675 | } | ||
676 | |||
677 | static inline void crypto_cipher_set_flags(struct crypto_cipher *tfm, | ||
678 | u32 flags) | ||
679 | { | ||
680 | crypto_tfm_set_flags(crypto_cipher_tfm(tfm), flags); | ||
681 | } | ||
682 | |||
683 | static inline void crypto_cipher_clear_flags(struct crypto_cipher *tfm, | ||
684 | u32 flags) | ||
685 | { | ||
686 | crypto_tfm_clear_flags(crypto_cipher_tfm(tfm), flags); | ||
687 | } | ||
688 | |||
689 | static inline int crypto_cipher_setkey(struct crypto_cipher *tfm, | ||
348 | const u8 *key, unsigned int keylen) | 690 | const u8 *key, unsigned int keylen) |
349 | { | 691 | { |
350 | BUG_ON(crypto_tfm_alg_type(tfm) != CRYPTO_ALG_TYPE_DIGEST); | 692 | return crypto_cipher_crt(tfm)->cit_setkey(crypto_cipher_tfm(tfm), |
351 | if (tfm->crt_digest.dit_setkey == NULL) | 693 | key, keylen); |
352 | return -ENOSYS; | 694 | } |
353 | return tfm->crt_digest.dit_setkey(tfm, key, keylen); | 695 | |
696 | static inline void crypto_cipher_encrypt_one(struct crypto_cipher *tfm, | ||
697 | u8 *dst, const u8 *src) | ||
698 | { | ||
699 | crypto_cipher_crt(tfm)->cit_encrypt_one(crypto_cipher_tfm(tfm), | ||
700 | dst, src); | ||
701 | } | ||
702 | |||
703 | static inline void crypto_cipher_decrypt_one(struct crypto_cipher *tfm, | ||
704 | u8 *dst, const u8 *src) | ||
705 | { | ||
706 | crypto_cipher_crt(tfm)->cit_decrypt_one(crypto_cipher_tfm(tfm), | ||
707 | dst, src); | ||
708 | } | ||
709 | |||
710 | void crypto_digest_init(struct crypto_tfm *tfm) __deprecated_for_modules; | ||
711 | void crypto_digest_update(struct crypto_tfm *tfm, | ||
712 | struct scatterlist *sg, unsigned int nsg) | ||
713 | __deprecated_for_modules; | ||
714 | void crypto_digest_final(struct crypto_tfm *tfm, u8 *out) | ||
715 | __deprecated_for_modules; | ||
716 | void crypto_digest_digest(struct crypto_tfm *tfm, | ||
717 | struct scatterlist *sg, unsigned int nsg, u8 *out) | ||
718 | __deprecated_for_modules; | ||
719 | |||
720 | static inline struct crypto_hash *__crypto_hash_cast(struct crypto_tfm *tfm) | ||
721 | { | ||
722 | return (struct crypto_hash *)tfm; | ||
723 | } | ||
724 | |||
725 | static inline struct crypto_hash *crypto_hash_cast(struct crypto_tfm *tfm) | ||
726 | { | ||
727 | BUG_ON((crypto_tfm_alg_type(tfm) ^ CRYPTO_ALG_TYPE_HASH) & | ||
728 | CRYPTO_ALG_TYPE_HASH_MASK); | ||
729 | return __crypto_hash_cast(tfm); | ||
354 | } | 730 | } |
355 | 731 | ||
356 | static inline int crypto_cipher_setkey(struct crypto_tfm *tfm, | 732 | static int crypto_digest_setkey(struct crypto_tfm *tfm, const u8 *key, |
733 | unsigned int keylen) __deprecated; | ||
734 | static inline int crypto_digest_setkey(struct crypto_tfm *tfm, | ||
357 | const u8 *key, unsigned int keylen) | 735 | const u8 *key, unsigned int keylen) |
358 | { | 736 | { |
359 | BUG_ON(crypto_tfm_alg_type(tfm) != CRYPTO_ALG_TYPE_CIPHER); | 737 | return tfm->crt_hash.setkey(crypto_hash_cast(tfm), key, keylen); |
360 | return tfm->crt_cipher.cit_setkey(tfm, key, keylen); | 738 | } |
739 | |||
740 | static inline struct crypto_hash *crypto_alloc_hash(const char *alg_name, | ||
741 | u32 type, u32 mask) | ||
742 | { | ||
743 | type &= ~CRYPTO_ALG_TYPE_MASK; | ||
744 | type |= CRYPTO_ALG_TYPE_HASH; | ||
745 | mask |= CRYPTO_ALG_TYPE_HASH_MASK; | ||
746 | |||
747 | return __crypto_hash_cast(crypto_alloc_base(alg_name, type, mask)); | ||
748 | } | ||
749 | |||
750 | static inline struct crypto_tfm *crypto_hash_tfm(struct crypto_hash *tfm) | ||
751 | { | ||
752 | return &tfm->base; | ||
753 | } | ||
754 | |||
755 | static inline void crypto_free_hash(struct crypto_hash *tfm) | ||
756 | { | ||
757 | crypto_free_tfm(crypto_hash_tfm(tfm)); | ||
758 | } | ||
759 | |||
760 | static inline int crypto_has_hash(const char *alg_name, u32 type, u32 mask) | ||
761 | { | ||
762 | type &= ~CRYPTO_ALG_TYPE_MASK; | ||
763 | type |= CRYPTO_ALG_TYPE_HASH; | ||
764 | mask |= CRYPTO_ALG_TYPE_HASH_MASK; | ||
765 | |||
766 | return crypto_has_alg(alg_name, type, mask); | ||
767 | } | ||
768 | |||
769 | static inline struct hash_tfm *crypto_hash_crt(struct crypto_hash *tfm) | ||
770 | { | ||
771 | return &crypto_hash_tfm(tfm)->crt_hash; | ||
772 | } | ||
773 | |||
774 | static inline unsigned int crypto_hash_blocksize(struct crypto_hash *tfm) | ||
775 | { | ||
776 | return crypto_tfm_alg_blocksize(crypto_hash_tfm(tfm)); | ||
777 | } | ||
778 | |||
779 | static inline unsigned int crypto_hash_alignmask(struct crypto_hash *tfm) | ||
780 | { | ||
781 | return crypto_tfm_alg_alignmask(crypto_hash_tfm(tfm)); | ||
782 | } | ||
783 | |||
784 | static inline unsigned int crypto_hash_digestsize(struct crypto_hash *tfm) | ||
785 | { | ||
786 | return crypto_hash_crt(tfm)->digestsize; | ||
787 | } | ||
788 | |||
789 | static inline u32 crypto_hash_get_flags(struct crypto_hash *tfm) | ||
790 | { | ||
791 | return crypto_tfm_get_flags(crypto_hash_tfm(tfm)); | ||
792 | } | ||
793 | |||
794 | static inline void crypto_hash_set_flags(struct crypto_hash *tfm, u32 flags) | ||
795 | { | ||
796 | crypto_tfm_set_flags(crypto_hash_tfm(tfm), flags); | ||
361 | } | 797 | } |
362 | 798 | ||
799 | static inline void crypto_hash_clear_flags(struct crypto_hash *tfm, u32 flags) | ||
800 | { | ||
801 | crypto_tfm_clear_flags(crypto_hash_tfm(tfm), flags); | ||
802 | } | ||
803 | |||
804 | static inline int crypto_hash_init(struct hash_desc *desc) | ||
805 | { | ||
806 | return crypto_hash_crt(desc->tfm)->init(desc); | ||
807 | } | ||
808 | |||
809 | static inline int crypto_hash_update(struct hash_desc *desc, | ||
810 | struct scatterlist *sg, | ||
811 | unsigned int nbytes) | ||
812 | { | ||
813 | return crypto_hash_crt(desc->tfm)->update(desc, sg, nbytes); | ||
814 | } | ||
815 | |||
816 | static inline int crypto_hash_final(struct hash_desc *desc, u8 *out) | ||
817 | { | ||
818 | return crypto_hash_crt(desc->tfm)->final(desc, out); | ||
819 | } | ||
820 | |||
821 | static inline int crypto_hash_digest(struct hash_desc *desc, | ||
822 | struct scatterlist *sg, | ||
823 | unsigned int nbytes, u8 *out) | ||
824 | { | ||
825 | return crypto_hash_crt(desc->tfm)->digest(desc, sg, nbytes, out); | ||
826 | } | ||
827 | |||
828 | static inline int crypto_hash_setkey(struct crypto_hash *hash, | ||
829 | const u8 *key, unsigned int keylen) | ||
830 | { | ||
831 | return crypto_hash_crt(hash)->setkey(hash, key, keylen); | ||
832 | } | ||
833 | |||
834 | static int crypto_cipher_encrypt(struct crypto_tfm *tfm, | ||
835 | struct scatterlist *dst, | ||
836 | struct scatterlist *src, | ||
837 | unsigned int nbytes) __deprecated; | ||
363 | static inline int crypto_cipher_encrypt(struct crypto_tfm *tfm, | 838 | static inline int crypto_cipher_encrypt(struct crypto_tfm *tfm, |
364 | struct scatterlist *dst, | 839 | struct scatterlist *dst, |
365 | struct scatterlist *src, | 840 | struct scatterlist *src, |
@@ -369,16 +844,23 @@ static inline int crypto_cipher_encrypt(struct crypto_tfm *tfm, | |||
369 | return tfm->crt_cipher.cit_encrypt(tfm, dst, src, nbytes); | 844 | return tfm->crt_cipher.cit_encrypt(tfm, dst, src, nbytes); |
370 | } | 845 | } |
371 | 846 | ||
847 | static int crypto_cipher_encrypt_iv(struct crypto_tfm *tfm, | ||
848 | struct scatterlist *dst, | ||
849 | struct scatterlist *src, | ||
850 | unsigned int nbytes, u8 *iv) __deprecated; | ||
372 | static inline int crypto_cipher_encrypt_iv(struct crypto_tfm *tfm, | 851 | static inline int crypto_cipher_encrypt_iv(struct crypto_tfm *tfm, |
373 | struct scatterlist *dst, | 852 | struct scatterlist *dst, |
374 | struct scatterlist *src, | 853 | struct scatterlist *src, |
375 | unsigned int nbytes, u8 *iv) | 854 | unsigned int nbytes, u8 *iv) |
376 | { | 855 | { |
377 | BUG_ON(crypto_tfm_alg_type(tfm) != CRYPTO_ALG_TYPE_CIPHER); | 856 | BUG_ON(crypto_tfm_alg_type(tfm) != CRYPTO_ALG_TYPE_CIPHER); |
378 | BUG_ON(tfm->crt_cipher.cit_mode == CRYPTO_TFM_MODE_ECB); | ||
379 | return tfm->crt_cipher.cit_encrypt_iv(tfm, dst, src, nbytes, iv); | 857 | return tfm->crt_cipher.cit_encrypt_iv(tfm, dst, src, nbytes, iv); |
380 | } | 858 | } |
381 | 859 | ||
860 | static int crypto_cipher_decrypt(struct crypto_tfm *tfm, | ||
861 | struct scatterlist *dst, | ||
862 | struct scatterlist *src, | ||
863 | unsigned int nbytes) __deprecated; | ||
382 | static inline int crypto_cipher_decrypt(struct crypto_tfm *tfm, | 864 | static inline int crypto_cipher_decrypt(struct crypto_tfm *tfm, |
383 | struct scatterlist *dst, | 865 | struct scatterlist *dst, |
384 | struct scatterlist *src, | 866 | struct scatterlist *src, |
@@ -388,16 +870,21 @@ static inline int crypto_cipher_decrypt(struct crypto_tfm *tfm, | |||
388 | return tfm->crt_cipher.cit_decrypt(tfm, dst, src, nbytes); | 870 | return tfm->crt_cipher.cit_decrypt(tfm, dst, src, nbytes); |
389 | } | 871 | } |
390 | 872 | ||
873 | static int crypto_cipher_decrypt_iv(struct crypto_tfm *tfm, | ||
874 | struct scatterlist *dst, | ||
875 | struct scatterlist *src, | ||
876 | unsigned int nbytes, u8 *iv) __deprecated; | ||
391 | static inline int crypto_cipher_decrypt_iv(struct crypto_tfm *tfm, | 877 | static inline int crypto_cipher_decrypt_iv(struct crypto_tfm *tfm, |
392 | struct scatterlist *dst, | 878 | struct scatterlist *dst, |
393 | struct scatterlist *src, | 879 | struct scatterlist *src, |
394 | unsigned int nbytes, u8 *iv) | 880 | unsigned int nbytes, u8 *iv) |
395 | { | 881 | { |
396 | BUG_ON(crypto_tfm_alg_type(tfm) != CRYPTO_ALG_TYPE_CIPHER); | 882 | BUG_ON(crypto_tfm_alg_type(tfm) != CRYPTO_ALG_TYPE_CIPHER); |
397 | BUG_ON(tfm->crt_cipher.cit_mode == CRYPTO_TFM_MODE_ECB); | ||
398 | return tfm->crt_cipher.cit_decrypt_iv(tfm, dst, src, nbytes, iv); | 883 | return tfm->crt_cipher.cit_decrypt_iv(tfm, dst, src, nbytes, iv); |
399 | } | 884 | } |
400 | 885 | ||
886 | static void crypto_cipher_set_iv(struct crypto_tfm *tfm, | ||
887 | const u8 *src, unsigned int len) __deprecated; | ||
401 | static inline void crypto_cipher_set_iv(struct crypto_tfm *tfm, | 888 | static inline void crypto_cipher_set_iv(struct crypto_tfm *tfm, |
402 | const u8 *src, unsigned int len) | 889 | const u8 *src, unsigned int len) |
403 | { | 890 | { |
@@ -405,6 +892,8 @@ static inline void crypto_cipher_set_iv(struct crypto_tfm *tfm, | |||
405 | memcpy(tfm->crt_cipher.cit_iv, src, len); | 892 | memcpy(tfm->crt_cipher.cit_iv, src, len); |
406 | } | 893 | } |
407 | 894 | ||
895 | static void crypto_cipher_get_iv(struct crypto_tfm *tfm, | ||
896 | u8 *dst, unsigned int len) __deprecated; | ||
408 | static inline void crypto_cipher_get_iv(struct crypto_tfm *tfm, | 897 | static inline void crypto_cipher_get_iv(struct crypto_tfm *tfm, |
409 | u8 *dst, unsigned int len) | 898 | u8 *dst, unsigned int len) |
410 | { | 899 | { |
@@ -412,34 +901,70 @@ static inline void crypto_cipher_get_iv(struct crypto_tfm *tfm, | |||
412 | memcpy(dst, tfm->crt_cipher.cit_iv, len); | 901 | memcpy(dst, tfm->crt_cipher.cit_iv, len); |
413 | } | 902 | } |
414 | 903 | ||
415 | static inline int crypto_comp_compress(struct crypto_tfm *tfm, | 904 | static inline struct crypto_comp *__crypto_comp_cast(struct crypto_tfm *tfm) |
905 | { | ||
906 | return (struct crypto_comp *)tfm; | ||
907 | } | ||
908 | |||
909 | static inline struct crypto_comp *crypto_comp_cast(struct crypto_tfm *tfm) | ||
910 | { | ||
911 | BUG_ON((crypto_tfm_alg_type(tfm) ^ CRYPTO_ALG_TYPE_COMPRESS) & | ||
912 | CRYPTO_ALG_TYPE_MASK); | ||
913 | return __crypto_comp_cast(tfm); | ||
914 | } | ||
915 | |||
916 | static inline struct crypto_comp *crypto_alloc_comp(const char *alg_name, | ||
917 | u32 type, u32 mask) | ||
918 | { | ||
919 | type &= ~CRYPTO_ALG_TYPE_MASK; | ||
920 | type |= CRYPTO_ALG_TYPE_COMPRESS; | ||
921 | mask |= CRYPTO_ALG_TYPE_MASK; | ||
922 | |||
923 | return __crypto_comp_cast(crypto_alloc_base(alg_name, type, mask)); | ||
924 | } | ||
925 | |||
926 | static inline struct crypto_tfm *crypto_comp_tfm(struct crypto_comp *tfm) | ||
927 | { | ||
928 | return tfm; | ||
929 | } | ||
930 | |||
931 | static inline void crypto_free_comp(struct crypto_comp *tfm) | ||
932 | { | ||
933 | crypto_free_tfm(crypto_comp_tfm(tfm)); | ||
934 | } | ||
935 | |||
936 | static inline int crypto_has_comp(const char *alg_name, u32 type, u32 mask) | ||
937 | { | ||
938 | type &= ~CRYPTO_ALG_TYPE_MASK; | ||
939 | type |= CRYPTO_ALG_TYPE_COMPRESS; | ||
940 | mask |= CRYPTO_ALG_TYPE_MASK; | ||
941 | |||
942 | return crypto_has_alg(alg_name, type, mask); | ||
943 | } | ||
944 | |||
945 | static inline const char *crypto_comp_name(struct crypto_comp *tfm) | ||
946 | { | ||
947 | return crypto_tfm_alg_name(crypto_comp_tfm(tfm)); | ||
948 | } | ||
949 | |||
950 | static inline struct compress_tfm *crypto_comp_crt(struct crypto_comp *tfm) | ||
951 | { | ||
952 | return &crypto_comp_tfm(tfm)->crt_compress; | ||
953 | } | ||
954 | |||
955 | static inline int crypto_comp_compress(struct crypto_comp *tfm, | ||
416 | const u8 *src, unsigned int slen, | 956 | const u8 *src, unsigned int slen, |
417 | u8 *dst, unsigned int *dlen) | 957 | u8 *dst, unsigned int *dlen) |
418 | { | 958 | { |
419 | BUG_ON(crypto_tfm_alg_type(tfm) != CRYPTO_ALG_TYPE_COMPRESS); | 959 | return crypto_comp_crt(tfm)->cot_compress(tfm, src, slen, dst, dlen); |
420 | return tfm->crt_compress.cot_compress(tfm, src, slen, dst, dlen); | ||
421 | } | 960 | } |
422 | 961 | ||
423 | static inline int crypto_comp_decompress(struct crypto_tfm *tfm, | 962 | static inline int crypto_comp_decompress(struct crypto_comp *tfm, |
424 | const u8 *src, unsigned int slen, | 963 | const u8 *src, unsigned int slen, |
425 | u8 *dst, unsigned int *dlen) | 964 | u8 *dst, unsigned int *dlen) |
426 | { | 965 | { |
427 | BUG_ON(crypto_tfm_alg_type(tfm) != CRYPTO_ALG_TYPE_COMPRESS); | 966 | return crypto_comp_crt(tfm)->cot_decompress(tfm, src, slen, dst, dlen); |
428 | return tfm->crt_compress.cot_decompress(tfm, src, slen, dst, dlen); | ||
429 | } | 967 | } |
430 | 968 | ||
431 | /* | ||
432 | * HMAC support. | ||
433 | */ | ||
434 | #ifdef CONFIG_CRYPTO_HMAC | ||
435 | void crypto_hmac_init(struct crypto_tfm *tfm, u8 *key, unsigned int *keylen); | ||
436 | void crypto_hmac_update(struct crypto_tfm *tfm, | ||
437 | struct scatterlist *sg, unsigned int nsg); | ||
438 | void crypto_hmac_final(struct crypto_tfm *tfm, u8 *key, | ||
439 | unsigned int *keylen, u8 *out); | ||
440 | void crypto_hmac(struct crypto_tfm *tfm, u8 *key, unsigned int *keylen, | ||
441 | struct scatterlist *sg, unsigned int nsg, u8 *out); | ||
442 | #endif /* CONFIG_CRYPTO_HMAC */ | ||
443 | |||
444 | #endif /* _LINUX_CRYPTO_H */ | 969 | #endif /* _LINUX_CRYPTO_H */ |
445 | 970 | ||
diff --git a/include/linux/dcache.h b/include/linux/dcache.h index 471781ffeab1..44605be59409 100644 --- a/include/linux/dcache.h +++ b/include/linux/dcache.h | |||
@@ -221,6 +221,7 @@ static inline int dname_external(struct dentry *dentry) | |||
221 | */ | 221 | */ |
222 | extern void d_instantiate(struct dentry *, struct inode *); | 222 | extern void d_instantiate(struct dentry *, struct inode *); |
223 | extern struct dentry * d_instantiate_unique(struct dentry *, struct inode *); | 223 | extern struct dentry * d_instantiate_unique(struct dentry *, struct inode *); |
224 | extern struct dentry * d_materialise_unique(struct dentry *, struct inode *); | ||
224 | extern void d_delete(struct dentry *); | 225 | extern void d_delete(struct dentry *); |
225 | 226 | ||
226 | /* allocate/de-allocate */ | 227 | /* allocate/de-allocate */ |
diff --git a/include/linux/dccp.h b/include/linux/dccp.h index 676333b9fad0..2d7671c92c0b 100644 --- a/include/linux/dccp.h +++ b/include/linux/dccp.h | |||
@@ -438,6 +438,7 @@ struct dccp_ackvec; | |||
438 | * @dccps_role - Role of this sock, one of %dccp_role | 438 | * @dccps_role - Role of this sock, one of %dccp_role |
439 | * @dccps_ndp_count - number of Non Data Packets since last data packet | 439 | * @dccps_ndp_count - number of Non Data Packets since last data packet |
440 | * @dccps_hc_rx_ackvec - rx half connection ack vector | 440 | * @dccps_hc_rx_ackvec - rx half connection ack vector |
441 | * @dccps_xmit_timer - timer for when CCID is not ready to send | ||
441 | */ | 442 | */ |
442 | struct dccp_sock { | 443 | struct dccp_sock { |
443 | /* inet_connection_sock has to be the first member of dccp_sock */ | 444 | /* inet_connection_sock has to be the first member of dccp_sock */ |
@@ -470,6 +471,7 @@ struct dccp_sock { | |||
470 | enum dccp_role dccps_role:2; | 471 | enum dccp_role dccps_role:2; |
471 | __u8 dccps_hc_rx_insert_options:1; | 472 | __u8 dccps_hc_rx_insert_options:1; |
472 | __u8 dccps_hc_tx_insert_options:1; | 473 | __u8 dccps_hc_tx_insert_options:1; |
474 | struct timer_list dccps_xmit_timer; | ||
473 | }; | 475 | }; |
474 | 476 | ||
475 | static inline struct dccp_sock *dccp_sk(const struct sock *sk) | 477 | static inline struct dccp_sock *dccp_sk(const struct sock *sk) |
diff --git a/include/linux/efs_fs_sb.h b/include/linux/efs_fs_sb.h index c76088baef28..ff1945e37790 100644 --- a/include/linux/efs_fs_sb.h +++ b/include/linux/efs_fs_sb.h | |||
@@ -9,8 +9,7 @@ | |||
9 | #ifndef __EFS_FS_SB_H__ | 9 | #ifndef __EFS_FS_SB_H__ |
10 | #define __EFS_FS_SB_H__ | 10 | #define __EFS_FS_SB_H__ |
11 | 11 | ||
12 | /* statfs() magic number for EFS */ | 12 | #include <linux/magic.h> |
13 | #define EFS_SUPER_MAGIC 0x414A53 | ||
14 | 13 | ||
15 | /* EFS superblock magic numbers */ | 14 | /* EFS superblock magic numbers */ |
16 | #define EFS_MAGIC 0x072959 | 15 | #define EFS_MAGIC 0x072959 |
diff --git a/include/linux/ext2_fs.h b/include/linux/ext2_fs.h index facf34e98954..33a1aa107329 100644 --- a/include/linux/ext2_fs.h +++ b/include/linux/ext2_fs.h | |||
@@ -17,6 +17,7 @@ | |||
17 | #define _LINUX_EXT2_FS_H | 17 | #define _LINUX_EXT2_FS_H |
18 | 18 | ||
19 | #include <linux/types.h> | 19 | #include <linux/types.h> |
20 | #include <linux/magic.h> | ||
20 | 21 | ||
21 | /* | 22 | /* |
22 | * The second extended filesystem constants/structures | 23 | * The second extended filesystem constants/structures |
@@ -63,11 +64,6 @@ | |||
63 | /* First non-reserved inode for old ext2 filesystems */ | 64 | /* First non-reserved inode for old ext2 filesystems */ |
64 | #define EXT2_GOOD_OLD_FIRST_INO 11 | 65 | #define EXT2_GOOD_OLD_FIRST_INO 11 |
65 | 66 | ||
66 | /* | ||
67 | * The second extended file system magic number | ||
68 | */ | ||
69 | #define EXT2_SUPER_MAGIC 0xEF53 | ||
70 | |||
71 | #ifdef __KERNEL__ | 67 | #ifdef __KERNEL__ |
72 | #include <linux/ext2_fs_sb.h> | 68 | #include <linux/ext2_fs_sb.h> |
73 | static inline struct ext2_sb_info *EXT2_SB(struct super_block *sb) | 69 | static inline struct ext2_sb_info *EXT2_SB(struct super_block *sb) |
diff --git a/include/linux/ext3_fs.h b/include/linux/ext3_fs.h index 9f9cce7bd86d..0eed918b3816 100644 --- a/include/linux/ext3_fs.h +++ b/include/linux/ext3_fs.h | |||
@@ -17,6 +17,7 @@ | |||
17 | #define _LINUX_EXT3_FS_H | 17 | #define _LINUX_EXT3_FS_H |
18 | 18 | ||
19 | #include <linux/types.h> | 19 | #include <linux/types.h> |
20 | #include <linux/magic.h> | ||
20 | 21 | ||
21 | /* | 22 | /* |
22 | * The second extended filesystem constants/structures | 23 | * The second extended filesystem constants/structures |
@@ -67,11 +68,6 @@ | |||
67 | #define EXT3_GOOD_OLD_FIRST_INO 11 | 68 | #define EXT3_GOOD_OLD_FIRST_INO 11 |
68 | 69 | ||
69 | /* | 70 | /* |
70 | * The second extended file system magic number | ||
71 | */ | ||
72 | #define EXT3_SUPER_MAGIC 0xEF53 | ||
73 | |||
74 | /* | ||
75 | * Maximal count of links to a file | 71 | * Maximal count of links to a file |
76 | */ | 72 | */ |
77 | #define EXT3_LINK_MAX 32000 | 73 | #define EXT3_LINK_MAX 32000 |
diff --git a/include/linux/fib_rules.h b/include/linux/fib_rules.h new file mode 100644 index 000000000000..4418c8d9d479 --- /dev/null +++ b/include/linux/fib_rules.h | |||
@@ -0,0 +1,65 @@ | |||
1 | #ifndef __LINUX_FIB_RULES_H | ||
2 | #define __LINUX_FIB_RULES_H | ||
3 | |||
4 | #include <linux/types.h> | ||
5 | #include <linux/rtnetlink.h> | ||
6 | |||
7 | /* rule is permanent, and cannot be deleted */ | ||
8 | #define FIB_RULE_PERMANENT 1 | ||
9 | |||
10 | struct fib_rule_hdr | ||
11 | { | ||
12 | __u8 family; | ||
13 | __u8 dst_len; | ||
14 | __u8 src_len; | ||
15 | __u8 tos; | ||
16 | |||
17 | __u8 table; | ||
18 | __u8 res1; /* reserved */ | ||
19 | __u8 res2; /* reserved */ | ||
20 | __u8 action; | ||
21 | |||
22 | __u32 flags; | ||
23 | }; | ||
24 | |||
25 | enum | ||
26 | { | ||
27 | FRA_UNSPEC, | ||
28 | FRA_DST, /* destination address */ | ||
29 | FRA_SRC, /* source address */ | ||
30 | FRA_IFNAME, /* interface name */ | ||
31 | FRA_UNUSED1, | ||
32 | FRA_UNUSED2, | ||
33 | FRA_PRIORITY, /* priority/preference */ | ||
34 | FRA_UNUSED3, | ||
35 | FRA_UNUSED4, | ||
36 | FRA_UNUSED5, | ||
37 | FRA_FWMARK, /* netfilter mark */ | ||
38 | FRA_FLOW, /* flow/class id */ | ||
39 | FRA_UNUSED6, | ||
40 | FRA_UNUSED7, | ||
41 | FRA_UNUSED8, | ||
42 | FRA_TABLE, /* Extended table id */ | ||
43 | FRA_FWMASK, /* mask for netfilter mark */ | ||
44 | __FRA_MAX | ||
45 | }; | ||
46 | |||
47 | #define FRA_MAX (__FRA_MAX - 1) | ||
48 | |||
49 | enum | ||
50 | { | ||
51 | FR_ACT_UNSPEC, | ||
52 | FR_ACT_TO_TBL, /* Pass to fixed table */ | ||
53 | FR_ACT_RES1, | ||
54 | FR_ACT_RES2, | ||
55 | FR_ACT_RES3, | ||
56 | FR_ACT_RES4, | ||
57 | FR_ACT_BLACKHOLE, /* Drop without notification */ | ||
58 | FR_ACT_UNREACHABLE, /* Drop with ENETUNREACH */ | ||
59 | FR_ACT_PROHIBIT, /* Drop with EACCES */ | ||
60 | __FR_ACT_MAX, | ||
61 | }; | ||
62 | |||
63 | #define FR_ACT_MAX (__FR_ACT_MAX - 1) | ||
64 | |||
65 | #endif | ||
diff --git a/include/linux/filter.h b/include/linux/filter.h index c6cb8f095088..91b2e3b9251e 100644 --- a/include/linux/filter.h +++ b/include/linux/filter.h | |||
@@ -25,10 +25,10 @@ | |||
25 | 25 | ||
26 | struct sock_filter /* Filter block */ | 26 | struct sock_filter /* Filter block */ |
27 | { | 27 | { |
28 | __u16 code; /* Actual filter code */ | 28 | __u16 code; /* Actual filter code */ |
29 | __u8 jt; /* Jump true */ | 29 | __u8 jt; /* Jump true */ |
30 | __u8 jf; /* Jump false */ | 30 | __u8 jf; /* Jump false */ |
31 | __u32 k; /* Generic multiuse field */ | 31 | __u32 k; /* Generic multiuse field */ |
32 | }; | 32 | }; |
33 | 33 | ||
34 | struct sock_fprog /* Required for SO_ATTACH_FILTER. */ | 34 | struct sock_fprog /* Required for SO_ATTACH_FILTER. */ |
@@ -41,8 +41,9 @@ struct sock_fprog /* Required for SO_ATTACH_FILTER. */ | |||
41 | struct sk_filter | 41 | struct sk_filter |
42 | { | 42 | { |
43 | atomic_t refcnt; | 43 | atomic_t refcnt; |
44 | unsigned int len; /* Number of filter blocks */ | 44 | unsigned int len; /* Number of filter blocks */ |
45 | struct sock_filter insns[0]; | 45 | struct rcu_head rcu; |
46 | struct sock_filter insns[0]; | ||
46 | }; | 47 | }; |
47 | 48 | ||
48 | static inline unsigned int sk_filter_len(struct sk_filter *fp) | 49 | static inline unsigned int sk_filter_len(struct sk_filter *fp) |
diff --git a/include/linux/genetlink.h b/include/linux/genetlink.h index 84f12a41dc01..9049dc65ae51 100644 --- a/include/linux/genetlink.h +++ b/include/linux/genetlink.h | |||
@@ -16,6 +16,8 @@ struct genlmsghdr { | |||
16 | 16 | ||
17 | #define GENL_HDRLEN NLMSG_ALIGN(sizeof(struct genlmsghdr)) | 17 | #define GENL_HDRLEN NLMSG_ALIGN(sizeof(struct genlmsghdr)) |
18 | 18 | ||
19 | #define GENL_ADMIN_PERM 0x01 | ||
20 | |||
19 | /* | 21 | /* |
20 | * List of reserved static generic netlink identifiers: | 22 | * List of reserved static generic netlink identifiers: |
21 | */ | 23 | */ |
@@ -43,9 +45,25 @@ enum { | |||
43 | CTRL_ATTR_UNSPEC, | 45 | CTRL_ATTR_UNSPEC, |
44 | CTRL_ATTR_FAMILY_ID, | 46 | CTRL_ATTR_FAMILY_ID, |
45 | CTRL_ATTR_FAMILY_NAME, | 47 | CTRL_ATTR_FAMILY_NAME, |
48 | CTRL_ATTR_VERSION, | ||
49 | CTRL_ATTR_HDRSIZE, | ||
50 | CTRL_ATTR_MAXATTR, | ||
51 | CTRL_ATTR_OPS, | ||
46 | __CTRL_ATTR_MAX, | 52 | __CTRL_ATTR_MAX, |
47 | }; | 53 | }; |
48 | 54 | ||
49 | #define CTRL_ATTR_MAX (__CTRL_ATTR_MAX - 1) | 55 | #define CTRL_ATTR_MAX (__CTRL_ATTR_MAX - 1) |
50 | 56 | ||
57 | enum { | ||
58 | CTRL_ATTR_OP_UNSPEC, | ||
59 | CTRL_ATTR_OP_ID, | ||
60 | CTRL_ATTR_OP_FLAGS, | ||
61 | CTRL_ATTR_OP_POLICY, | ||
62 | CTRL_ATTR_OP_DOIT, | ||
63 | CTRL_ATTR_OP_DUMPIT, | ||
64 | __CTRL_ATTR_OP_MAX, | ||
65 | }; | ||
66 | |||
67 | #define CTRL_ATTR_OP_MAX (__CTRL_ATTR_OP_MAX - 1) | ||
68 | |||
51 | #endif /* __LINUX_GENERIC_NETLINK_H */ | 69 | #endif /* __LINUX_GENERIC_NETLINK_H */ |
diff --git a/include/linux/hpfs_fs.h b/include/linux/hpfs_fs.h deleted file mode 100644 index a5028dd94d31..000000000000 --- a/include/linux/hpfs_fs.h +++ /dev/null | |||
@@ -1,8 +0,0 @@ | |||
1 | #ifndef _LINUX_HPFS_FS_H | ||
2 | #define _LINUX_HPFS_FS_H | ||
3 | |||
4 | /* HPFS magic number (word 0 of block 16) */ | ||
5 | |||
6 | #define HPFS_SUPER_MAGIC 0xf995e849 | ||
7 | |||
8 | #endif | ||
diff --git a/include/linux/if.h b/include/linux/if.h index 374e20ad8b0d..cd080d765324 100644 --- a/include/linux/if.h +++ b/include/linux/if.h | |||
@@ -212,5 +212,134 @@ struct ifconf | |||
212 | #define ifc_buf ifc_ifcu.ifcu_buf /* buffer address */ | 212 | #define ifc_buf ifc_ifcu.ifcu_buf /* buffer address */ |
213 | #define ifc_req ifc_ifcu.ifcu_req /* array of structures */ | 213 | #define ifc_req ifc_ifcu.ifcu_req /* array of structures */ |
214 | 214 | ||
215 | /* The struct should be in sync with struct net_device_stats */ | ||
216 | struct rtnl_link_stats | ||
217 | { | ||
218 | __u32 rx_packets; /* total packets received */ | ||
219 | __u32 tx_packets; /* total packets transmitted */ | ||
220 | __u32 rx_bytes; /* total bytes received */ | ||
221 | __u32 tx_bytes; /* total bytes transmitted */ | ||
222 | __u32 rx_errors; /* bad packets received */ | ||
223 | __u32 tx_errors; /* packet transmit problems */ | ||
224 | __u32 rx_dropped; /* no space in linux buffers */ | ||
225 | __u32 tx_dropped; /* no space available in linux */ | ||
226 | __u32 multicast; /* multicast packets received */ | ||
227 | __u32 collisions; | ||
228 | |||
229 | /* detailed rx_errors: */ | ||
230 | __u32 rx_length_errors; | ||
231 | __u32 rx_over_errors; /* receiver ring buff overflow */ | ||
232 | __u32 rx_crc_errors; /* recved pkt with crc error */ | ||
233 | __u32 rx_frame_errors; /* recv'd frame alignment error */ | ||
234 | __u32 rx_fifo_errors; /* recv'r fifo overrun */ | ||
235 | __u32 rx_missed_errors; /* receiver missed packet */ | ||
236 | |||
237 | /* detailed tx_errors */ | ||
238 | __u32 tx_aborted_errors; | ||
239 | __u32 tx_carrier_errors; | ||
240 | __u32 tx_fifo_errors; | ||
241 | __u32 tx_heartbeat_errors; | ||
242 | __u32 tx_window_errors; | ||
243 | |||
244 | /* for cslip etc */ | ||
245 | __u32 rx_compressed; | ||
246 | __u32 tx_compressed; | ||
247 | }; | ||
248 | |||
249 | /* The struct should be in sync with struct ifmap */ | ||
250 | struct rtnl_link_ifmap | ||
251 | { | ||
252 | __u64 mem_start; | ||
253 | __u64 mem_end; | ||
254 | __u64 base_addr; | ||
255 | __u16 irq; | ||
256 | __u8 dma; | ||
257 | __u8 port; | ||
258 | }; | ||
259 | |||
260 | enum | ||
261 | { | ||
262 | IFLA_UNSPEC, | ||
263 | IFLA_ADDRESS, | ||
264 | IFLA_BROADCAST, | ||
265 | IFLA_IFNAME, | ||
266 | IFLA_MTU, | ||
267 | IFLA_LINK, | ||
268 | IFLA_QDISC, | ||
269 | IFLA_STATS, | ||
270 | IFLA_COST, | ||
271 | #define IFLA_COST IFLA_COST | ||
272 | IFLA_PRIORITY, | ||
273 | #define IFLA_PRIORITY IFLA_PRIORITY | ||
274 | IFLA_MASTER, | ||
275 | #define IFLA_MASTER IFLA_MASTER | ||
276 | IFLA_WIRELESS, /* Wireless Extension event - see wireless.h */ | ||
277 | #define IFLA_WIRELESS IFLA_WIRELESS | ||
278 | IFLA_PROTINFO, /* Protocol specific information for a link */ | ||
279 | #define IFLA_PROTINFO IFLA_PROTINFO | ||
280 | IFLA_TXQLEN, | ||
281 | #define IFLA_TXQLEN IFLA_TXQLEN | ||
282 | IFLA_MAP, | ||
283 | #define IFLA_MAP IFLA_MAP | ||
284 | IFLA_WEIGHT, | ||
285 | #define IFLA_WEIGHT IFLA_WEIGHT | ||
286 | IFLA_OPERSTATE, | ||
287 | IFLA_LINKMODE, | ||
288 | __IFLA_MAX | ||
289 | }; | ||
290 | |||
291 | |||
292 | #define IFLA_MAX (__IFLA_MAX - 1) | ||
293 | |||
294 | /* ifi_flags. | ||
295 | |||
296 | IFF_* flags. | ||
297 | |||
298 | The only change is: | ||
299 | IFF_LOOPBACK, IFF_BROADCAST and IFF_POINTOPOINT are | ||
300 | more not changeable by user. They describe link media | ||
301 | characteristics and set by device driver. | ||
302 | |||
303 | Comments: | ||
304 | - Combination IFF_BROADCAST|IFF_POINTOPOINT is invalid | ||
305 | - If neither of these three flags are set; | ||
306 | the interface is NBMA. | ||
307 | |||
308 | - IFF_MULTICAST does not mean anything special: | ||
309 | multicasts can be used on all not-NBMA links. | ||
310 | IFF_MULTICAST means that this media uses special encapsulation | ||
311 | for multicast frames. Apparently, all IFF_POINTOPOINT and | ||
312 | IFF_BROADCAST devices are able to use multicasts too. | ||
313 | */ | ||
314 | |||
315 | /* IFLA_LINK. | ||
316 | For usual devices it is equal ifi_index. | ||
317 | If it is a "virtual interface" (f.e. tunnel), ifi_link | ||
318 | can point to real physical interface (f.e. for bandwidth calculations), | ||
319 | or maybe 0, what means, that real media is unknown (usual | ||
320 | for IPIP tunnels, when route to endpoint is allowed to change) | ||
321 | */ | ||
322 | |||
323 | /* Subtype attributes for IFLA_PROTINFO */ | ||
324 | enum | ||
325 | { | ||
326 | IFLA_INET6_UNSPEC, | ||
327 | IFLA_INET6_FLAGS, /* link flags */ | ||
328 | IFLA_INET6_CONF, /* sysctl parameters */ | ||
329 | IFLA_INET6_STATS, /* statistics */ | ||
330 | IFLA_INET6_MCAST, /* MC things. What of them? */ | ||
331 | IFLA_INET6_CACHEINFO, /* time values and max reasm size */ | ||
332 | __IFLA_INET6_MAX | ||
333 | }; | ||
334 | |||
335 | #define IFLA_INET6_MAX (__IFLA_INET6_MAX - 1) | ||
336 | |||
337 | struct ifla_cacheinfo | ||
338 | { | ||
339 | __u32 max_reasm_len; | ||
340 | __u32 tstamp; /* ipv6InterfaceTable updated timestamp */ | ||
341 | __u32 reachable_time; | ||
342 | __u32 retrans_time; | ||
343 | }; | ||
215 | 344 | ||
216 | #endif /* _LINUX_IF_H */ | 345 | #endif /* _LINUX_IF_H */ |
diff --git a/include/linux/if_addr.h b/include/linux/if_addr.h new file mode 100644 index 000000000000..dbe8f6120a40 --- /dev/null +++ b/include/linux/if_addr.h | |||
@@ -0,0 +1,55 @@ | |||
1 | #ifndef __LINUX_IF_ADDR_H | ||
2 | #define __LINUX_IF_ADDR_H | ||
3 | |||
4 | #include <linux/netlink.h> | ||
5 | |||
6 | struct ifaddrmsg | ||
7 | { | ||
8 | __u8 ifa_family; | ||
9 | __u8 ifa_prefixlen; /* The prefix length */ | ||
10 | __u8 ifa_flags; /* Flags */ | ||
11 | __u8 ifa_scope; /* Address scope */ | ||
12 | __u32 ifa_index; /* Link index */ | ||
13 | }; | ||
14 | |||
15 | /* | ||
16 | * Important comment: | ||
17 | * IFA_ADDRESS is prefix address, rather than local interface address. | ||
18 | * It makes no difference for normally configured broadcast interfaces, | ||
19 | * but for point-to-point IFA_ADDRESS is DESTINATION address, | ||
20 | * local address is supplied in IFA_LOCAL attribute. | ||
21 | */ | ||
22 | enum | ||
23 | { | ||
24 | IFA_UNSPEC, | ||
25 | IFA_ADDRESS, | ||
26 | IFA_LOCAL, | ||
27 | IFA_LABEL, | ||
28 | IFA_BROADCAST, | ||
29 | IFA_ANYCAST, | ||
30 | IFA_CACHEINFO, | ||
31 | IFA_MULTICAST, | ||
32 | __IFA_MAX, | ||
33 | }; | ||
34 | |||
35 | #define IFA_MAX (__IFA_MAX - 1) | ||
36 | |||
37 | /* ifa_flags */ | ||
38 | #define IFA_F_SECONDARY 0x01 | ||
39 | #define IFA_F_TEMPORARY IFA_F_SECONDARY | ||
40 | |||
41 | #define IFA_F_NODAD 0x02 | ||
42 | #define IFA_F_HOMEADDRESS 0x10 | ||
43 | #define IFA_F_DEPRECATED 0x20 | ||
44 | #define IFA_F_TENTATIVE 0x40 | ||
45 | #define IFA_F_PERMANENT 0x80 | ||
46 | |||
47 | struct ifa_cacheinfo | ||
48 | { | ||
49 | __u32 ifa_prefered; | ||
50 | __u32 ifa_valid; | ||
51 | __u32 cstamp; /* created timestamp, hundredths of seconds */ | ||
52 | __u32 tstamp; /* updated timestamp, hundredths of seconds */ | ||
53 | }; | ||
54 | |||
55 | #endif | ||
diff --git a/include/linux/in.h b/include/linux/in.h index 94f557fa4636..bcaca8399aed 100644 --- a/include/linux/in.h +++ b/include/linux/in.h | |||
@@ -52,7 +52,7 @@ enum { | |||
52 | 52 | ||
53 | /* Internet address. */ | 53 | /* Internet address. */ |
54 | struct in_addr { | 54 | struct in_addr { |
55 | __u32 s_addr; | 55 | __be32 s_addr; |
56 | }; | 56 | }; |
57 | 57 | ||
58 | #define IP_TOS 1 | 58 | #define IP_TOS 1 |
@@ -177,7 +177,7 @@ struct in_pktinfo | |||
177 | #define __SOCK_SIZE__ 16 /* sizeof(struct sockaddr) */ | 177 | #define __SOCK_SIZE__ 16 /* sizeof(struct sockaddr) */ |
178 | struct sockaddr_in { | 178 | struct sockaddr_in { |
179 | sa_family_t sin_family; /* Address family */ | 179 | sa_family_t sin_family; /* Address family */ |
180 | unsigned short int sin_port; /* Port number */ | 180 | __be16 sin_port; /* Port number */ |
181 | struct in_addr sin_addr; /* Internet address */ | 181 | struct in_addr sin_addr; /* Internet address */ |
182 | 182 | ||
183 | /* Pad to size of `struct sockaddr'. */ | 183 | /* Pad to size of `struct sockaddr'. */ |
diff --git a/include/linux/in6.h b/include/linux/in6.h index 304aaedea305..d776829b443f 100644 --- a/include/linux/in6.h +++ b/include/linux/in6.h | |||
@@ -134,6 +134,7 @@ struct in6_flowlabel_req | |||
134 | #define IPPROTO_ICMPV6 58 /* ICMPv6 */ | 134 | #define IPPROTO_ICMPV6 58 /* ICMPv6 */ |
135 | #define IPPROTO_NONE 59 /* IPv6 no next header */ | 135 | #define IPPROTO_NONE 59 /* IPv6 no next header */ |
136 | #define IPPROTO_DSTOPTS 60 /* IPv6 destination options */ | 136 | #define IPPROTO_DSTOPTS 60 /* IPv6 destination options */ |
137 | #define IPPROTO_MH 135 /* IPv6 mobility header */ | ||
137 | 138 | ||
138 | /* | 139 | /* |
139 | * IPv6 TLV options. | 140 | * IPv6 TLV options. |
@@ -142,6 +143,7 @@ struct in6_flowlabel_req | |||
142 | #define IPV6_TLV_PADN 1 | 143 | #define IPV6_TLV_PADN 1 |
143 | #define IPV6_TLV_ROUTERALERT 5 | 144 | #define IPV6_TLV_ROUTERALERT 5 |
144 | #define IPV6_TLV_JUMBO 194 | 145 | #define IPV6_TLV_JUMBO 194 |
146 | #define IPV6_TLV_HAO 201 /* home address option */ | ||
145 | 147 | ||
146 | /* | 148 | /* |
147 | * IPV6 socket options | 149 | * IPV6 socket options |
diff --git a/include/linux/inet.h b/include/linux/inet.h index 6c5587af118d..b7c6da7d6d32 100644 --- a/include/linux/inet.h +++ b/include/linux/inet.h | |||
@@ -46,5 +46,7 @@ | |||
46 | #include <linux/types.h> | 46 | #include <linux/types.h> |
47 | 47 | ||
48 | extern __be32 in_aton(const char *str); | 48 | extern __be32 in_aton(const char *str); |
49 | extern int in4_pton(const char *src, int srclen, u8 *dst, char delim, const char **end); | ||
50 | extern int in6_pton(const char *src, int srclen, u8 *dst, char delim, const char **end); | ||
49 | #endif | 51 | #endif |
50 | #endif /* _LINUX_INET_H */ | 52 | #endif /* _LINUX_INET_H */ |
diff --git a/include/linux/ip.h b/include/linux/ip.h index 4b55cf1df732..2f4600146f83 100644 --- a/include/linux/ip.h +++ b/include/linux/ip.h | |||
@@ -57,6 +57,7 @@ | |||
57 | #define IPOPT_SEC (2 |IPOPT_CONTROL|IPOPT_COPY) | 57 | #define IPOPT_SEC (2 |IPOPT_CONTROL|IPOPT_COPY) |
58 | #define IPOPT_LSRR (3 |IPOPT_CONTROL|IPOPT_COPY) | 58 | #define IPOPT_LSRR (3 |IPOPT_CONTROL|IPOPT_COPY) |
59 | #define IPOPT_TIMESTAMP (4 |IPOPT_MEASUREMENT) | 59 | #define IPOPT_TIMESTAMP (4 |IPOPT_MEASUREMENT) |
60 | #define IPOPT_CIPSO (6 |IPOPT_CONTROL|IPOPT_COPY) | ||
60 | #define IPOPT_RR (7 |IPOPT_CONTROL) | 61 | #define IPOPT_RR (7 |IPOPT_CONTROL) |
61 | #define IPOPT_SID (8 |IPOPT_CONTROL|IPOPT_COPY) | 62 | #define IPOPT_SID (8 |IPOPT_CONTROL|IPOPT_COPY) |
62 | #define IPOPT_SSRR (9 |IPOPT_CONTROL|IPOPT_COPY) | 63 | #define IPOPT_SSRR (9 |IPOPT_CONTROL|IPOPT_COPY) |
diff --git a/include/linux/ipv6.h b/include/linux/ipv6.h index 297853c841b4..caca57df0d7d 100644 --- a/include/linux/ipv6.h +++ b/include/linux/ipv6.h | |||
@@ -29,6 +29,7 @@ struct in6_ifreq { | |||
29 | 29 | ||
30 | #define IPV6_SRCRT_STRICT 0x01 /* this hop must be a neighbor */ | 30 | #define IPV6_SRCRT_STRICT 0x01 /* this hop must be a neighbor */ |
31 | #define IPV6_SRCRT_TYPE_0 0 /* IPv6 type 0 Routing Header */ | 31 | #define IPV6_SRCRT_TYPE_0 0 /* IPv6 type 0 Routing Header */ |
32 | #define IPV6_SRCRT_TYPE_2 2 /* IPv6 type 2 Routing Header */ | ||
32 | 33 | ||
33 | /* | 34 | /* |
34 | * routing header | 35 | * routing header |
@@ -73,6 +74,28 @@ struct rt0_hdr { | |||
73 | #define rt0_type rt_hdr.type | 74 | #define rt0_type rt_hdr.type |
74 | }; | 75 | }; |
75 | 76 | ||
77 | /* | ||
78 | * routing header type 2 | ||
79 | */ | ||
80 | |||
81 | struct rt2_hdr { | ||
82 | struct ipv6_rt_hdr rt_hdr; | ||
83 | __u32 reserved; | ||
84 | struct in6_addr addr; | ||
85 | |||
86 | #define rt2_type rt_hdr.type | ||
87 | }; | ||
88 | |||
89 | /* | ||
90 | * home address option in destination options header | ||
91 | */ | ||
92 | |||
93 | struct ipv6_destopt_hao { | ||
94 | __u8 type; | ||
95 | __u8 length; | ||
96 | struct in6_addr addr; | ||
97 | } __attribute__ ((__packed__)); | ||
98 | |||
76 | struct ipv6_auth_hdr { | 99 | struct ipv6_auth_hdr { |
77 | __u8 nexthdr; | 100 | __u8 nexthdr; |
78 | __u8 hdrlen; /* This one is measured in 32 bit units! */ | 101 | __u8 hdrlen; /* This one is measured in 32 bit units! */ |
@@ -153,6 +176,7 @@ struct ipv6_devconf { | |||
153 | __s32 accept_ra_rt_info_max_plen; | 176 | __s32 accept_ra_rt_info_max_plen; |
154 | #endif | 177 | #endif |
155 | #endif | 178 | #endif |
179 | __s32 proxy_ndp; | ||
156 | void *sysctl; | 180 | void *sysctl; |
157 | }; | 181 | }; |
158 | 182 | ||
@@ -180,6 +204,7 @@ enum { | |||
180 | DEVCONF_ACCEPT_RA_RTR_PREF, | 204 | DEVCONF_ACCEPT_RA_RTR_PREF, |
181 | DEVCONF_RTR_PROBE_INTERVAL, | 205 | DEVCONF_RTR_PROBE_INTERVAL, |
182 | DEVCONF_ACCEPT_RA_RT_INFO_MAX_PLEN, | 206 | DEVCONF_ACCEPT_RA_RT_INFO_MAX_PLEN, |
207 | DEVCONF_PROXY_NDP, | ||
183 | DEVCONF_MAX | 208 | DEVCONF_MAX |
184 | }; | 209 | }; |
185 | 210 | ||
@@ -206,6 +231,9 @@ struct inet6_skb_parm { | |||
206 | __u16 lastopt; | 231 | __u16 lastopt; |
207 | __u32 nhoff; | 232 | __u32 nhoff; |
208 | __u16 flags; | 233 | __u16 flags; |
234 | #ifdef CONFIG_IPV6_MIP6 | ||
235 | __u16 dsthao; | ||
236 | #endif | ||
209 | 237 | ||
210 | #define IP6SKB_XFRM_TRANSFORMED 1 | 238 | #define IP6SKB_XFRM_TRANSFORMED 1 |
211 | }; | 239 | }; |
@@ -242,6 +270,9 @@ struct ipv6_pinfo { | |||
242 | struct in6_addr rcv_saddr; | 270 | struct in6_addr rcv_saddr; |
243 | struct in6_addr daddr; | 271 | struct in6_addr daddr; |
244 | struct in6_addr *daddr_cache; | 272 | struct in6_addr *daddr_cache; |
273 | #ifdef CONFIG_IPV6_SUBTREES | ||
274 | struct in6_addr *saddr_cache; | ||
275 | #endif | ||
245 | 276 | ||
246 | __u32 flow_label; | 277 | __u32 flow_label; |
247 | __u32 frag_size; | 278 | __u32 frag_size; |
diff --git a/include/linux/iso_fs.h b/include/linux/iso_fs.h index 47967878bfef..4688ac4284e2 100644 --- a/include/linux/iso_fs.h +++ b/include/linux/iso_fs.h | |||
@@ -2,6 +2,8 @@ | |||
2 | #define _ISOFS_FS_H | 2 | #define _ISOFS_FS_H |
3 | 3 | ||
4 | #include <linux/types.h> | 4 | #include <linux/types.h> |
5 | #include <linux/magic.h> | ||
6 | |||
5 | /* | 7 | /* |
6 | * The isofs filesystem constants/structures | 8 | * The isofs filesystem constants/structures |
7 | */ | 9 | */ |
@@ -160,6 +162,4 @@ struct iso_directory_record { | |||
160 | #define ISOFS_BUFFER_SIZE(INODE) ((INODE)->i_sb->s_blocksize) | 162 | #define ISOFS_BUFFER_SIZE(INODE) ((INODE)->i_sb->s_blocksize) |
161 | #define ISOFS_BUFFER_BITS(INODE) ((INODE)->i_sb->s_blocksize_bits) | 163 | #define ISOFS_BUFFER_BITS(INODE) ((INODE)->i_sb->s_blocksize_bits) |
162 | 164 | ||
163 | #define ISOFS_SUPER_MAGIC 0x9660 | 165 | #endif /* _ISOFS_FS_H */ |
164 | |||
165 | #endif | ||
diff --git a/include/linux/jffs2.h b/include/linux/jffs2.h index c9c760700bc3..840631fa5ff1 100644 --- a/include/linux/jffs2.h +++ b/include/linux/jffs2.h | |||
@@ -15,12 +15,12 @@ | |||
15 | #ifndef __LINUX_JFFS2_H__ | 15 | #ifndef __LINUX_JFFS2_H__ |
16 | #define __LINUX_JFFS2_H__ | 16 | #define __LINUX_JFFS2_H__ |
17 | 17 | ||
18 | #include <linux/magic.h> | ||
19 | |||
18 | /* You must include something which defines the C99 uintXX_t types. | 20 | /* You must include something which defines the C99 uintXX_t types. |
19 | We don't do it from here because this file is used in too many | 21 | We don't do it from here because this file is used in too many |
20 | different environments. */ | 22 | different environments. */ |
21 | 23 | ||
22 | #define JFFS2_SUPER_MAGIC 0x72b6 | ||
23 | |||
24 | /* Values we may expect to find in the 'magic' field */ | 24 | /* Values we may expect to find in the 'magic' field */ |
25 | #define JFFS2_OLD_MAGIC_BITMASK 0x1984 | 25 | #define JFFS2_OLD_MAGIC_BITMASK 0x1984 |
26 | #define JFFS2_MAGIC_BITMASK 0x1985 | 26 | #define JFFS2_MAGIC_BITMASK 0x1985 |
diff --git a/include/linux/kernel.h b/include/linux/kernel.h index 851aa1bcfc1a..2b2ae4fdce8b 100644 --- a/include/linux/kernel.h +++ b/include/linux/kernel.h | |||
@@ -31,7 +31,7 @@ extern const char linux_banner[]; | |||
31 | #define STACK_MAGIC 0xdeadbeef | 31 | #define STACK_MAGIC 0xdeadbeef |
32 | 32 | ||
33 | #define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0])) | 33 | #define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0])) |
34 | #define ALIGN(x,a) (((x)+(a)-1)&~((a)-1)) | 34 | #define ALIGN(x,a) (((x)+(a)-1UL)&~((a)-1UL)) |
35 | #define FIELD_SIZEOF(t, f) (sizeof(((t*)0)->f)) | 35 | #define FIELD_SIZEOF(t, f) (sizeof(((t*)0)->f)) |
36 | #define roundup(x, y) ((((x) + ((y) - 1)) / (y)) * (y)) | 36 | #define roundup(x, y) ((((x) + ((y) - 1)) / (y)) * (y)) |
37 | 37 | ||
diff --git a/include/linux/libata.h b/include/linux/libata.h index 66c3100c2b94..1ef3d3901b47 100644 --- a/include/linux/libata.h +++ b/include/linux/libata.h | |||
@@ -36,6 +36,8 @@ | |||
36 | #include <linux/workqueue.h> | 36 | #include <linux/workqueue.h> |
37 | #include <scsi/scsi_host.h> | 37 | #include <scsi/scsi_host.h> |
38 | 38 | ||
39 | #include <asm/libata-portmap.h> | ||
40 | |||
39 | /* | 41 | /* |
40 | * compile-time options: to be removed as soon as all the drivers are | 42 | * compile-time options: to be removed as soon as all the drivers are |
41 | * converted to the new debugging mechanism | 43 | * converted to the new debugging mechanism |
@@ -44,7 +46,7 @@ | |||
44 | #undef ATA_VERBOSE_DEBUG /* yet more debugging output */ | 46 | #undef ATA_VERBOSE_DEBUG /* yet more debugging output */ |
45 | #undef ATA_IRQ_TRAP /* define to ack screaming irqs */ | 47 | #undef ATA_IRQ_TRAP /* define to ack screaming irqs */ |
46 | #undef ATA_NDEBUG /* define to disable quick runtime checks */ | 48 | #undef ATA_NDEBUG /* define to disable quick runtime checks */ |
47 | #undef ATA_ENABLE_PATA /* define to enable PATA support in some | 49 | #define ATA_ENABLE_PATA /* define to enable PATA support in some |
48 | * low-level drivers */ | 50 | * low-level drivers */ |
49 | 51 | ||
50 | 52 | ||
@@ -112,8 +114,6 @@ enum { | |||
112 | /* tag ATA_MAX_QUEUE - 1 is reserved for internal commands */ | 114 | /* tag ATA_MAX_QUEUE - 1 is reserved for internal commands */ |
113 | ATA_MAX_QUEUE = 32, | 115 | ATA_MAX_QUEUE = 32, |
114 | ATA_TAG_INTERNAL = ATA_MAX_QUEUE - 1, | 116 | ATA_TAG_INTERNAL = ATA_MAX_QUEUE - 1, |
115 | ATA_MAX_SECTORS = 200, /* FIXME */ | ||
116 | ATA_MAX_SECTORS_LBA48 = 65535, | ||
117 | ATA_MAX_BUS = 2, | 117 | ATA_MAX_BUS = 2, |
118 | ATA_DEF_BUSY_WAIT = 10000, | 118 | ATA_DEF_BUSY_WAIT = 10000, |
119 | ATA_SHORT_PAUSE = (HZ >> 6) + 1, | 119 | ATA_SHORT_PAUSE = (HZ >> 6) + 1, |
@@ -197,8 +197,8 @@ enum { | |||
197 | ATA_QCFLAG_EH_SCHEDULED = (1 << 18), /* EH scheduled (obsolete) */ | 197 | ATA_QCFLAG_EH_SCHEDULED = (1 << 18), /* EH scheduled (obsolete) */ |
198 | 198 | ||
199 | /* host set flags */ | 199 | /* host set flags */ |
200 | ATA_HOST_SIMPLEX = (1 << 0), /* Host is simplex, one DMA channel per host_set only */ | 200 | ATA_HOST_SIMPLEX = (1 << 0), /* Host is simplex, one DMA channel per host only */ |
201 | 201 | ||
202 | /* various lengths of time */ | 202 | /* various lengths of time */ |
203 | ATA_TMOUT_BOOT = 30 * HZ, /* heuristic */ | 203 | ATA_TMOUT_BOOT = 30 * HZ, /* heuristic */ |
204 | ATA_TMOUT_BOOT_QUICK = 7 * HZ, /* heuristic */ | 204 | ATA_TMOUT_BOOT_QUICK = 7 * HZ, /* heuristic */ |
@@ -225,8 +225,8 @@ enum { | |||
225 | /* encoding various smaller bitmaps into a single | 225 | /* encoding various smaller bitmaps into a single |
226 | * unsigned int bitmap | 226 | * unsigned int bitmap |
227 | */ | 227 | */ |
228 | ATA_BITS_PIO = 5, | 228 | ATA_BITS_PIO = 7, |
229 | ATA_BITS_MWDMA = 3, | 229 | ATA_BITS_MWDMA = 5, |
230 | ATA_BITS_UDMA = 8, | 230 | ATA_BITS_UDMA = 8, |
231 | 231 | ||
232 | ATA_SHIFT_PIO = 0, | 232 | ATA_SHIFT_PIO = 0, |
@@ -289,6 +289,11 @@ enum { | |||
289 | * most devices. | 289 | * most devices. |
290 | */ | 290 | */ |
291 | ATA_SPINUP_WAIT = 8000, | 291 | ATA_SPINUP_WAIT = 8000, |
292 | |||
293 | /* Horkage types. May be set by libata or controller on drives | ||
294 | (some horkage may be drive/controller pair dependant */ | ||
295 | |||
296 | ATA_HORKAGE_DIAGNOSTIC = (1 << 0), /* Failed boot diag */ | ||
292 | }; | 297 | }; |
293 | 298 | ||
294 | enum hsm_task_states { | 299 | enum hsm_task_states { |
@@ -350,23 +355,32 @@ struct ata_probe_ent { | |||
350 | struct scsi_host_template *sht; | 355 | struct scsi_host_template *sht; |
351 | struct ata_ioports port[ATA_MAX_PORTS]; | 356 | struct ata_ioports port[ATA_MAX_PORTS]; |
352 | unsigned int n_ports; | 357 | unsigned int n_ports; |
353 | unsigned int hard_port_no; | 358 | unsigned int dummy_port_mask; |
354 | unsigned int pio_mask; | 359 | unsigned int pio_mask; |
355 | unsigned int mwdma_mask; | 360 | unsigned int mwdma_mask; |
356 | unsigned int udma_mask; | 361 | unsigned int udma_mask; |
357 | unsigned int legacy_mode; | ||
358 | unsigned long irq; | 362 | unsigned long irq; |
363 | unsigned long irq2; | ||
359 | unsigned int irq_flags; | 364 | unsigned int irq_flags; |
360 | unsigned long host_flags; | 365 | unsigned long port_flags; |
361 | unsigned long host_set_flags; | 366 | unsigned long _host_flags; |
362 | void __iomem *mmio_base; | 367 | void __iomem *mmio_base; |
363 | void *private_data; | 368 | void *private_data; |
369 | |||
370 | /* port_info for the secondary port. Together with irq2, it's | ||
371 | * used to implement non-uniform secondary port. Currently, | ||
372 | * the only user is ata_piix combined mode. This workaround | ||
373 | * will be removed together with ata_probe_ent when init model | ||
374 | * is updated. | ||
375 | */ | ||
376 | const struct ata_port_info *pinfo2; | ||
364 | }; | 377 | }; |
365 | 378 | ||
366 | struct ata_host_set { | 379 | struct ata_host { |
367 | spinlock_t lock; | 380 | spinlock_t lock; |
368 | struct device *dev; | 381 | struct device *dev; |
369 | unsigned long irq; | 382 | unsigned long irq; |
383 | unsigned long irq2; | ||
370 | void __iomem *mmio_base; | 384 | void __iomem *mmio_base; |
371 | unsigned int n_ports; | 385 | unsigned int n_ports; |
372 | void *private_data; | 386 | void *private_data; |
@@ -374,7 +388,6 @@ struct ata_host_set { | |||
374 | unsigned long flags; | 388 | unsigned long flags; |
375 | int simplex_claimed; /* Keep seperate in case we | 389 | int simplex_claimed; /* Keep seperate in case we |
376 | ever need to do this locked */ | 390 | ever need to do this locked */ |
377 | struct ata_host_set *next; /* for legacy mode */ | ||
378 | struct ata_port *ports[0]; | 391 | struct ata_port *ports[0]; |
379 | }; | 392 | }; |
380 | 393 | ||
@@ -420,7 +433,7 @@ struct ata_queued_cmd { | |||
420 | void *private_data; | 433 | void *private_data; |
421 | }; | 434 | }; |
422 | 435 | ||
423 | struct ata_host_stats { | 436 | struct ata_port_stats { |
424 | unsigned long unhandled_irq; | 437 | unsigned long unhandled_irq; |
425 | unsigned long idle_irq; | 438 | unsigned long idle_irq; |
426 | unsigned long rw_reqbuf; | 439 | unsigned long rw_reqbuf; |
@@ -468,6 +481,7 @@ struct ata_device { | |||
468 | 481 | ||
469 | /* error history */ | 482 | /* error history */ |
470 | struct ata_ering ering; | 483 | struct ata_ering ering; |
484 | unsigned int horkage; /* List of broken features */ | ||
471 | }; | 485 | }; |
472 | 486 | ||
473 | /* Offset into struct ata_device. Fields above it are maintained | 487 | /* Offset into struct ata_device. Fields above it are maintained |
@@ -498,14 +512,13 @@ struct ata_eh_context { | |||
498 | }; | 512 | }; |
499 | 513 | ||
500 | struct ata_port { | 514 | struct ata_port { |
501 | struct Scsi_Host *host; /* our co-allocated scsi host */ | 515 | struct Scsi_Host *scsi_host; /* our co-allocated scsi host */ |
502 | const struct ata_port_operations *ops; | 516 | const struct ata_port_operations *ops; |
503 | spinlock_t *lock; | 517 | spinlock_t *lock; |
504 | unsigned long flags; /* ATA_FLAG_xxx */ | 518 | unsigned long flags; /* ATA_FLAG_xxx */ |
505 | unsigned int pflags; /* ATA_PFLAG_xxx */ | 519 | unsigned int pflags; /* ATA_PFLAG_xxx */ |
506 | unsigned int id; /* unique id req'd by scsi midlyr */ | 520 | unsigned int id; /* unique id req'd by scsi midlyr */ |
507 | unsigned int port_no; /* unique port #; from zero */ | 521 | unsigned int port_no; /* unique port #; from zero */ |
508 | unsigned int hard_port_no; /* hardware port #; from zero */ | ||
509 | 522 | ||
510 | struct ata_prd *prd; /* our SG list */ | 523 | struct ata_prd *prd; /* our SG list */ |
511 | dma_addr_t prd_dma; /* and its DMA mapping */ | 524 | dma_addr_t prd_dma; /* and its DMA mapping */ |
@@ -524,7 +537,7 @@ struct ata_port { | |||
524 | unsigned int hw_sata_spd_limit; | 537 | unsigned int hw_sata_spd_limit; |
525 | unsigned int sata_spd_limit; /* SATA PHY speed limit */ | 538 | unsigned int sata_spd_limit; /* SATA PHY speed limit */ |
526 | 539 | ||
527 | /* record runtime error info, protected by host_set lock */ | 540 | /* record runtime error info, protected by host lock */ |
528 | struct ata_eh_info eh_info; | 541 | struct ata_eh_info eh_info; |
529 | /* EH context owned by EH */ | 542 | /* EH context owned by EH */ |
530 | struct ata_eh_context eh_context; | 543 | struct ata_eh_context eh_context; |
@@ -538,8 +551,8 @@ struct ata_port { | |||
538 | unsigned int active_tag; | 551 | unsigned int active_tag; |
539 | u32 sactive; | 552 | u32 sactive; |
540 | 553 | ||
541 | struct ata_host_stats stats; | 554 | struct ata_port_stats stats; |
542 | struct ata_host_set *host_set; | 555 | struct ata_host *host; |
543 | struct device *dev; | 556 | struct device *dev; |
544 | 557 | ||
545 | struct work_struct port_task; | 558 | struct work_struct port_task; |
@@ -615,7 +628,7 @@ struct ata_port_operations { | |||
615 | int (*port_start) (struct ata_port *ap); | 628 | int (*port_start) (struct ata_port *ap); |
616 | void (*port_stop) (struct ata_port *ap); | 629 | void (*port_stop) (struct ata_port *ap); |
617 | 630 | ||
618 | void (*host_stop) (struct ata_host_set *host_set); | 631 | void (*host_stop) (struct ata_host *host); |
619 | 632 | ||
620 | void (*bmdma_stop) (struct ata_queued_cmd *qc); | 633 | void (*bmdma_stop) (struct ata_queued_cmd *qc); |
621 | u8 (*bmdma_status) (struct ata_port *ap); | 634 | u8 (*bmdma_status) (struct ata_port *ap); |
@@ -623,7 +636,7 @@ struct ata_port_operations { | |||
623 | 636 | ||
624 | struct ata_port_info { | 637 | struct ata_port_info { |
625 | struct scsi_host_template *sht; | 638 | struct scsi_host_template *sht; |
626 | unsigned long host_flags; | 639 | unsigned long flags; |
627 | unsigned long pio_mask; | 640 | unsigned long pio_mask; |
628 | unsigned long mwdma_mask; | 641 | unsigned long mwdma_mask; |
629 | unsigned long udma_mask; | 642 | unsigned long udma_mask; |
@@ -649,6 +662,8 @@ extern const unsigned long sata_deb_timing_normal[]; | |||
649 | extern const unsigned long sata_deb_timing_hotplug[]; | 662 | extern const unsigned long sata_deb_timing_hotplug[]; |
650 | extern const unsigned long sata_deb_timing_long[]; | 663 | extern const unsigned long sata_deb_timing_long[]; |
651 | 664 | ||
665 | extern const struct ata_port_operations ata_dummy_port_ops; | ||
666 | |||
652 | static inline const unsigned long * | 667 | static inline const unsigned long * |
653 | sata_ehc_deb_timing(struct ata_eh_context *ehc) | 668 | sata_ehc_deb_timing(struct ata_eh_context *ehc) |
654 | { | 669 | { |
@@ -658,6 +673,11 @@ sata_ehc_deb_timing(struct ata_eh_context *ehc) | |||
658 | return sata_deb_timing_normal; | 673 | return sata_deb_timing_normal; |
659 | } | 674 | } |
660 | 675 | ||
676 | static inline int ata_port_is_dummy(struct ata_port *ap) | ||
677 | { | ||
678 | return ap->ops == &ata_dummy_port_ops; | ||
679 | } | ||
680 | |||
661 | extern void ata_port_probe(struct ata_port *); | 681 | extern void ata_port_probe(struct ata_port *); |
662 | extern void __sata_phy_reset(struct ata_port *ap); | 682 | extern void __sata_phy_reset(struct ata_port *ap); |
663 | extern void sata_phy_reset(struct ata_port *ap); | 683 | extern void sata_phy_reset(struct ata_port *ap); |
@@ -676,19 +696,30 @@ extern void ata_std_ports(struct ata_ioports *ioaddr); | |||
676 | extern int ata_pci_init_one (struct pci_dev *pdev, struct ata_port_info **port_info, | 696 | extern int ata_pci_init_one (struct pci_dev *pdev, struct ata_port_info **port_info, |
677 | unsigned int n_ports); | 697 | unsigned int n_ports); |
678 | extern void ata_pci_remove_one (struct pci_dev *pdev); | 698 | extern void ata_pci_remove_one (struct pci_dev *pdev); |
679 | extern void ata_pci_device_do_suspend(struct pci_dev *pdev, pm_message_t state); | 699 | extern void ata_pci_device_do_suspend(struct pci_dev *pdev, pm_message_t mesg); |
680 | extern void ata_pci_device_do_resume(struct pci_dev *pdev); | 700 | extern void ata_pci_device_do_resume(struct pci_dev *pdev); |
681 | extern int ata_pci_device_suspend(struct pci_dev *pdev, pm_message_t state); | 701 | extern int ata_pci_device_suspend(struct pci_dev *pdev, pm_message_t mesg); |
682 | extern int ata_pci_device_resume(struct pci_dev *pdev); | 702 | extern int ata_pci_device_resume(struct pci_dev *pdev); |
683 | extern int ata_pci_clear_simplex(struct pci_dev *pdev); | 703 | extern int ata_pci_clear_simplex(struct pci_dev *pdev); |
684 | #endif /* CONFIG_PCI */ | 704 | #endif /* CONFIG_PCI */ |
685 | extern int ata_device_add(const struct ata_probe_ent *ent); | 705 | extern int ata_device_add(const struct ata_probe_ent *ent); |
686 | extern void ata_port_detach(struct ata_port *ap); | 706 | extern void ata_port_detach(struct ata_port *ap); |
687 | extern void ata_host_set_remove(struct ata_host_set *host_set); | 707 | extern void ata_host_init(struct ata_host *, struct device *, |
708 | unsigned long, const struct ata_port_operations *); | ||
709 | extern void ata_host_remove(struct ata_host *host); | ||
688 | extern int ata_scsi_detect(struct scsi_host_template *sht); | 710 | extern int ata_scsi_detect(struct scsi_host_template *sht); |
689 | extern int ata_scsi_ioctl(struct scsi_device *dev, int cmd, void __user *arg); | 711 | extern int ata_scsi_ioctl(struct scsi_device *dev, int cmd, void __user *arg); |
690 | extern int ata_scsi_queuecmd(struct scsi_cmnd *cmd, void (*done)(struct scsi_cmnd *)); | 712 | extern int ata_scsi_queuecmd(struct scsi_cmnd *cmd, void (*done)(struct scsi_cmnd *)); |
691 | extern int ata_scsi_release(struct Scsi_Host *host); | 713 | extern int ata_scsi_release(struct Scsi_Host *host); |
714 | extern void ata_sas_port_destroy(struct ata_port *); | ||
715 | extern struct ata_port *ata_sas_port_alloc(struct ata_host *, | ||
716 | struct ata_port_info *, struct Scsi_Host *); | ||
717 | extern int ata_sas_port_init(struct ata_port *); | ||
718 | extern int ata_sas_port_start(struct ata_port *ap); | ||
719 | extern void ata_sas_port_stop(struct ata_port *ap); | ||
720 | extern int ata_sas_slave_configure(struct scsi_device *, struct ata_port *); | ||
721 | extern int ata_sas_queuecmd(struct scsi_cmnd *cmd, void (*done)(struct scsi_cmnd *), | ||
722 | struct ata_port *ap); | ||
692 | extern unsigned int ata_host_intr(struct ata_port *ap, struct ata_queued_cmd *qc); | 723 | extern unsigned int ata_host_intr(struct ata_port *ap, struct ata_queued_cmd *qc); |
693 | extern int sata_scr_valid(struct ata_port *ap); | 724 | extern int sata_scr_valid(struct ata_port *ap); |
694 | extern int sata_scr_read(struct ata_port *ap, int reg, u32 *val); | 725 | extern int sata_scr_read(struct ata_port *ap, int reg, u32 *val); |
@@ -697,10 +728,9 @@ extern int sata_scr_write_flush(struct ata_port *ap, int reg, u32 val); | |||
697 | extern int ata_port_online(struct ata_port *ap); | 728 | extern int ata_port_online(struct ata_port *ap); |
698 | extern int ata_port_offline(struct ata_port *ap); | 729 | extern int ata_port_offline(struct ata_port *ap); |
699 | extern int ata_scsi_device_resume(struct scsi_device *); | 730 | extern int ata_scsi_device_resume(struct scsi_device *); |
700 | extern int ata_scsi_device_suspend(struct scsi_device *, pm_message_t state); | 731 | extern int ata_scsi_device_suspend(struct scsi_device *, pm_message_t mesg); |
701 | extern int ata_host_set_suspend(struct ata_host_set *host_set, | 732 | extern int ata_host_suspend(struct ata_host *host, pm_message_t mesg); |
702 | pm_message_t mesg); | 733 | extern void ata_host_resume(struct ata_host *host); |
703 | extern void ata_host_set_resume(struct ata_host_set *host_set); | ||
704 | extern int ata_ratelimit(void); | 734 | extern int ata_ratelimit(void); |
705 | extern unsigned int ata_busy_sleep(struct ata_port *ap, | 735 | extern unsigned int ata_busy_sleep(struct ata_port *ap, |
706 | unsigned long timeout_pat, | 736 | unsigned long timeout_pat, |
@@ -725,7 +755,7 @@ extern u8 ata_altstatus(struct ata_port *ap); | |||
725 | extern void ata_exec_command(struct ata_port *ap, const struct ata_taskfile *tf); | 755 | extern void ata_exec_command(struct ata_port *ap, const struct ata_taskfile *tf); |
726 | extern int ata_port_start (struct ata_port *ap); | 756 | extern int ata_port_start (struct ata_port *ap); |
727 | extern void ata_port_stop (struct ata_port *ap); | 757 | extern void ata_port_stop (struct ata_port *ap); |
728 | extern void ata_host_stop (struct ata_host_set *host_set); | 758 | extern void ata_host_stop (struct ata_host *host); |
729 | extern irqreturn_t ata_interrupt (int irq, void *dev_instance, struct pt_regs *regs); | 759 | extern irqreturn_t ata_interrupt (int irq, void *dev_instance, struct pt_regs *regs); |
730 | extern void ata_mmio_data_xfer(struct ata_device *adev, unsigned char *buf, | 760 | extern void ata_mmio_data_xfer(struct ata_device *adev, unsigned char *buf, |
731 | unsigned int buflen, int write_data); | 761 | unsigned int buflen, int write_data); |
@@ -811,7 +841,7 @@ struct pci_bits { | |||
811 | unsigned long val; | 841 | unsigned long val; |
812 | }; | 842 | }; |
813 | 843 | ||
814 | extern void ata_pci_host_stop (struct ata_host_set *host_set); | 844 | extern void ata_pci_host_stop (struct ata_host *host); |
815 | extern struct ata_probe_ent * | 845 | extern struct ata_probe_ent * |
816 | ata_pci_init_native_mode(struct pci_dev *pdev, struct ata_port_info **port, int portmask); | 846 | ata_pci_init_native_mode(struct pci_dev *pdev, struct ata_port_info **port, int portmask); |
817 | extern int pci_test_config_bits(struct pci_dev *pdev, const struct pci_bits *bits); | 847 | extern int pci_test_config_bits(struct pci_dev *pdev, const struct pci_bits *bits); |
diff --git a/include/linux/magic.h b/include/linux/magic.h new file mode 100644 index 000000000000..22036dd2ba36 --- /dev/null +++ b/include/linux/magic.h | |||
@@ -0,0 +1,37 @@ | |||
1 | #ifndef __LINUX_MAGIC_H__ | ||
2 | #define __LINUX_MAGIC_H__ | ||
3 | |||
4 | #define ADFS_SUPER_MAGIC 0xadf5 | ||
5 | #define AFFS_SUPER_MAGIC 0xadff | ||
6 | #define AUTOFS_SUPER_MAGIC 0x0187 | ||
7 | #define CODA_SUPER_MAGIC 0x73757245 | ||
8 | #define EFS_SUPER_MAGIC 0x414A53 | ||
9 | #define EXT2_SUPER_MAGIC 0xEF53 | ||
10 | #define EXT3_SUPER_MAGIC 0xEF53 | ||
11 | #define HPFS_SUPER_MAGIC 0xf995e849 | ||
12 | #define ISOFS_SUPER_MAGIC 0x9660 | ||
13 | #define JFFS2_SUPER_MAGIC 0x72b6 | ||
14 | |||
15 | #define MINIX_SUPER_MAGIC 0x137F /* original minix fs */ | ||
16 | #define MINIX_SUPER_MAGIC2 0x138F /* minix fs, 30 char names */ | ||
17 | #define MINIX2_SUPER_MAGIC 0x2468 /* minix V2 fs */ | ||
18 | #define MINIX2_SUPER_MAGIC2 0x2478 /* minix V2 fs, 30 char names */ | ||
19 | |||
20 | #define MSDOS_SUPER_MAGIC 0x4d44 /* MD */ | ||
21 | #define NCP_SUPER_MAGIC 0x564c /* Guess, what 0x564c is :-) */ | ||
22 | #define NFS_SUPER_MAGIC 0x6969 | ||
23 | #define OPENPROM_SUPER_MAGIC 0x9fa1 | ||
24 | #define PROC_SUPER_MAGIC 0x9fa0 | ||
25 | #define QNX4_SUPER_MAGIC 0x002f /* qnx4 fs detection */ | ||
26 | |||
27 | #define REISERFS_SUPER_MAGIC 0x52654973 /* used by gcc */ | ||
28 | /* used by file system utilities that | ||
29 | look at the superblock, etc. */ | ||
30 | #define REISERFS_SUPER_MAGIC_STRING "ReIsErFs" | ||
31 | #define REISER2FS_SUPER_MAGIC_STRING "ReIsEr2Fs" | ||
32 | #define REISER2FS_JR_SUPER_MAGIC_STRING "ReIsEr3Fs" | ||
33 | |||
34 | #define SMB_SUPER_MAGIC 0x517B | ||
35 | #define USBDEVICE_SUPER_MAGIC 0x9fa2 | ||
36 | |||
37 | #endif /* __LINUX_MAGIC_H__ */ | ||
diff --git a/include/linux/minix_fs.h b/include/linux/minix_fs.h index 1ecc3cc8cef5..916e8f72c63d 100644 --- a/include/linux/minix_fs.h +++ b/include/linux/minix_fs.h | |||
@@ -1,6 +1,8 @@ | |||
1 | #ifndef _LINUX_MINIX_FS_H | 1 | #ifndef _LINUX_MINIX_FS_H |
2 | #define _LINUX_MINIX_FS_H | 2 | #define _LINUX_MINIX_FS_H |
3 | 3 | ||
4 | #include <linux/magic.h> | ||
5 | |||
4 | /* | 6 | /* |
5 | * The minix filesystem constants/structures | 7 | * The minix filesystem constants/structures |
6 | */ | 8 | */ |
@@ -19,10 +21,6 @@ | |||
19 | 21 | ||
20 | #define MINIX_I_MAP_SLOTS 8 | 22 | #define MINIX_I_MAP_SLOTS 8 |
21 | #define MINIX_Z_MAP_SLOTS 64 | 23 | #define MINIX_Z_MAP_SLOTS 64 |
22 | #define MINIX_SUPER_MAGIC 0x137F /* original minix fs */ | ||
23 | #define MINIX_SUPER_MAGIC2 0x138F /* minix fs, 30 char names */ | ||
24 | #define MINIX2_SUPER_MAGIC 0x2468 /* minix V2 fs */ | ||
25 | #define MINIX2_SUPER_MAGIC2 0x2478 /* minix V2 fs, 30 char names */ | ||
26 | #define MINIX_VALID_FS 0x0001 /* Clean fs. */ | 24 | #define MINIX_VALID_FS 0x0001 /* Clean fs. */ |
27 | #define MINIX_ERROR_FS 0x0002 /* fs has errors. */ | 25 | #define MINIX_ERROR_FS 0x0002 /* fs has errors. */ |
28 | 26 | ||
diff --git a/include/linux/mm.h b/include/linux/mm.h index f0b135cd86da..224178a000d2 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h | |||
@@ -1013,6 +1013,7 @@ static inline unsigned long vma_pages(struct vm_area_struct *vma) | |||
1013 | return (vma->vm_end - vma->vm_start) >> PAGE_SHIFT; | 1013 | return (vma->vm_end - vma->vm_start) >> PAGE_SHIFT; |
1014 | } | 1014 | } |
1015 | 1015 | ||
1016 | pgprot_t vm_get_page_prot(unsigned long vm_flags); | ||
1016 | struct vm_area_struct *find_extend_vma(struct mm_struct *, unsigned long addr); | 1017 | struct vm_area_struct *find_extend_vma(struct mm_struct *, unsigned long addr); |
1017 | struct page *vmalloc_to_page(void *addr); | 1018 | struct page *vmalloc_to_page(void *addr); |
1018 | unsigned long vmalloc_to_pfn(void *addr); | 1019 | unsigned long vmalloc_to_pfn(void *addr); |
diff --git a/include/linux/mod_devicetable.h b/include/linux/mod_devicetable.h index f6977708585c..f7ca0b09075d 100644 --- a/include/linux/mod_devicetable.h +++ b/include/linux/mod_devicetable.h | |||
@@ -148,6 +148,17 @@ struct ccw_device_id { | |||
148 | #define CCW_DEVICE_ID_MATCH_DEVICE_TYPE 0x04 | 148 | #define CCW_DEVICE_ID_MATCH_DEVICE_TYPE 0x04 |
149 | #define CCW_DEVICE_ID_MATCH_DEVICE_MODEL 0x08 | 149 | #define CCW_DEVICE_ID_MATCH_DEVICE_MODEL 0x08 |
150 | 150 | ||
151 | /* s390 AP bus devices */ | ||
152 | struct ap_device_id { | ||
153 | __u16 match_flags; /* which fields to match against */ | ||
154 | __u8 dev_type; /* device type */ | ||
155 | __u8 pad1; | ||
156 | __u32 pad2; | ||
157 | kernel_ulong_t driver_info; | ||
158 | }; | ||
159 | |||
160 | #define AP_DEVICE_ID_MATCH_DEVICE_TYPE 0x01 | ||
161 | |||
151 | 162 | ||
152 | #define PNP_ID_LEN 8 | 163 | #define PNP_ID_LEN 8 |
153 | #define PNP_MAX_DEVICES 8 | 164 | #define PNP_MAX_DEVICES 8 |
diff --git a/include/linux/module.h b/include/linux/module.h index 0dfb794c52d3..d4486cc2e7fe 100644 --- a/include/linux/module.h +++ b/include/linux/module.h | |||
@@ -156,6 +156,11 @@ extern struct module __this_module; | |||
156 | */ | 156 | */ |
157 | #define MODULE_VERSION(_version) MODULE_INFO(version, _version) | 157 | #define MODULE_VERSION(_version) MODULE_INFO(version, _version) |
158 | 158 | ||
159 | /* Optional firmware file (or files) needed by the module | ||
160 | * format is simply firmware file name. Multiple firmware | ||
161 | * files require multiple MODULE_FIRMWARE() specifiers */ | ||
162 | #define MODULE_FIRMWARE(_firmware) MODULE_INFO(firmware, _firmware) | ||
163 | |||
159 | /* Given an address, look for it in the exception tables */ | 164 | /* Given an address, look for it in the exception tables */ |
160 | const struct exception_table_entry *search_exception_tables(unsigned long add); | 165 | const struct exception_table_entry *search_exception_tables(unsigned long add); |
161 | 166 | ||
diff --git a/include/linux/msdos_fs.h b/include/linux/msdos_fs.h index d9035c73e5d1..bae62d62dc3e 100644 --- a/include/linux/msdos_fs.h +++ b/include/linux/msdos_fs.h | |||
@@ -1,6 +1,8 @@ | |||
1 | #ifndef _LINUX_MSDOS_FS_H | 1 | #ifndef _LINUX_MSDOS_FS_H |
2 | #define _LINUX_MSDOS_FS_H | 2 | #define _LINUX_MSDOS_FS_H |
3 | 3 | ||
4 | #include <linux/magic.h> | ||
5 | |||
4 | /* | 6 | /* |
5 | * The MS-DOS filesystem constants/structures | 7 | * The MS-DOS filesystem constants/structures |
6 | */ | 8 | */ |
@@ -18,8 +20,6 @@ | |||
18 | #define CT_LE_L(v) cpu_to_le32(v) | 20 | #define CT_LE_L(v) cpu_to_le32(v) |
19 | 21 | ||
20 | 22 | ||
21 | #define MSDOS_SUPER_MAGIC 0x4d44 /* MD */ | ||
22 | |||
23 | #define MSDOS_ROOT_INO 1 /* == MINIX_ROOT_INO */ | 23 | #define MSDOS_ROOT_INO 1 /* == MINIX_ROOT_INO */ |
24 | #define MSDOS_DIR_BITS 5 /* log2(sizeof(struct msdos_dir_entry)) */ | 24 | #define MSDOS_DIR_BITS 5 /* log2(sizeof(struct msdos_dir_entry)) */ |
25 | 25 | ||
diff --git a/include/linux/ncp_fs.h b/include/linux/ncp_fs.h index b208f0cd556b..02e352be717e 100644 --- a/include/linux/ncp_fs.h +++ b/include/linux/ncp_fs.h | |||
@@ -11,6 +11,7 @@ | |||
11 | #include <linux/fs.h> | 11 | #include <linux/fs.h> |
12 | #include <linux/in.h> | 12 | #include <linux/in.h> |
13 | #include <linux/types.h> | 13 | #include <linux/types.h> |
14 | #include <linux/magic.h> | ||
14 | 15 | ||
15 | #include <linux/ipx.h> | 16 | #include <linux/ipx.h> |
16 | #include <linux/ncp_no.h> | 17 | #include <linux/ncp_no.h> |
@@ -185,10 +186,6 @@ struct ncp_entry_info { | |||
185 | __u8 file_handle[6]; | 186 | __u8 file_handle[6]; |
186 | }; | 187 | }; |
187 | 188 | ||
188 | /* Guess, what 0x564c is :-) */ | ||
189 | #define NCP_SUPER_MAGIC 0x564c | ||
190 | |||
191 | |||
192 | static inline struct ncp_server *NCP_SBP(struct super_block *sb) | 189 | static inline struct ncp_server *NCP_SBP(struct super_block *sb) |
193 | { | 190 | { |
194 | return sb->s_fs_info; | 191 | return sb->s_fs_info; |
diff --git a/include/linux/neighbour.h b/include/linux/neighbour.h new file mode 100644 index 000000000000..bd3bbf668cdb --- /dev/null +++ b/include/linux/neighbour.h | |||
@@ -0,0 +1,159 @@ | |||
1 | #ifndef __LINUX_NEIGHBOUR_H | ||
2 | #define __LINUX_NEIGHBOUR_H | ||
3 | |||
4 | #include <linux/netlink.h> | ||
5 | |||
6 | struct ndmsg | ||
7 | { | ||
8 | __u8 ndm_family; | ||
9 | __u8 ndm_pad1; | ||
10 | __u16 ndm_pad2; | ||
11 | __s32 ndm_ifindex; | ||
12 | __u16 ndm_state; | ||
13 | __u8 ndm_flags; | ||
14 | __u8 ndm_type; | ||
15 | }; | ||
16 | |||
17 | enum | ||
18 | { | ||
19 | NDA_UNSPEC, | ||
20 | NDA_DST, | ||
21 | NDA_LLADDR, | ||
22 | NDA_CACHEINFO, | ||
23 | NDA_PROBES, | ||
24 | __NDA_MAX | ||
25 | }; | ||
26 | |||
27 | #define NDA_MAX (__NDA_MAX - 1) | ||
28 | |||
29 | /* | ||
30 | * Neighbor Cache Entry Flags | ||
31 | */ | ||
32 | |||
33 | #define NTF_PROXY 0x08 /* == ATF_PUBL */ | ||
34 | #define NTF_ROUTER 0x80 | ||
35 | |||
36 | /* | ||
37 | * Neighbor Cache Entry States. | ||
38 | */ | ||
39 | |||
40 | #define NUD_INCOMPLETE 0x01 | ||
41 | #define NUD_REACHABLE 0x02 | ||
42 | #define NUD_STALE 0x04 | ||
43 | #define NUD_DELAY 0x08 | ||
44 | #define NUD_PROBE 0x10 | ||
45 | #define NUD_FAILED 0x20 | ||
46 | |||
47 | /* Dummy states */ | ||
48 | #define NUD_NOARP 0x40 | ||
49 | #define NUD_PERMANENT 0x80 | ||
50 | #define NUD_NONE 0x00 | ||
51 | |||
52 | /* NUD_NOARP & NUD_PERMANENT are pseudostates, they never change | ||
53 | and make no address resolution or NUD. | ||
54 | NUD_PERMANENT is also cannot be deleted by garbage collectors. | ||
55 | */ | ||
56 | |||
57 | struct nda_cacheinfo | ||
58 | { | ||
59 | __u32 ndm_confirmed; | ||
60 | __u32 ndm_used; | ||
61 | __u32 ndm_updated; | ||
62 | __u32 ndm_refcnt; | ||
63 | }; | ||
64 | |||
65 | /***************************************************************** | ||
66 | * Neighbour tables specific messages. | ||
67 | * | ||
68 | * To retrieve the neighbour tables send RTM_GETNEIGHTBL with the | ||
69 | * NLM_F_DUMP flag set. Every neighbour table configuration is | ||
70 | * spread over multiple messages to avoid running into message | ||
71 | * size limits on systems with many interfaces. The first message | ||
72 | * in the sequence transports all not device specific data such as | ||
73 | * statistics, configuration, and the default parameter set. | ||
74 | * This message is followed by 0..n messages carrying device | ||
75 | * specific parameter sets. | ||
76 | * Although the ordering should be sufficient, NDTA_NAME can be | ||
77 | * used to identify sequences. The initial message can be identified | ||
78 | * by checking for NDTA_CONFIG. The device specific messages do | ||
79 | * not contain this TLV but have NDTPA_IFINDEX set to the | ||
80 | * corresponding interface index. | ||
81 | * | ||
82 | * To change neighbour table attributes, send RTM_SETNEIGHTBL | ||
83 | * with NDTA_NAME set. Changeable attribute include NDTA_THRESH[1-3], | ||
84 | * NDTA_GC_INTERVAL, and all TLVs in NDTA_PARMS unless marked | ||
85 | * otherwise. Device specific parameter sets can be changed by | ||
86 | * setting NDTPA_IFINDEX to the interface index of the corresponding | ||
87 | * device. | ||
88 | ****/ | ||
89 | |||
90 | struct ndt_stats | ||
91 | { | ||
92 | __u64 ndts_allocs; | ||
93 | __u64 ndts_destroys; | ||
94 | __u64 ndts_hash_grows; | ||
95 | __u64 ndts_res_failed; | ||
96 | __u64 ndts_lookups; | ||
97 | __u64 ndts_hits; | ||
98 | __u64 ndts_rcv_probes_mcast; | ||
99 | __u64 ndts_rcv_probes_ucast; | ||
100 | __u64 ndts_periodic_gc_runs; | ||
101 | __u64 ndts_forced_gc_runs; | ||
102 | }; | ||
103 | |||
104 | enum { | ||
105 | NDTPA_UNSPEC, | ||
106 | NDTPA_IFINDEX, /* u32, unchangeable */ | ||
107 | NDTPA_REFCNT, /* u32, read-only */ | ||
108 | NDTPA_REACHABLE_TIME, /* u64, read-only, msecs */ | ||
109 | NDTPA_BASE_REACHABLE_TIME, /* u64, msecs */ | ||
110 | NDTPA_RETRANS_TIME, /* u64, msecs */ | ||
111 | NDTPA_GC_STALETIME, /* u64, msecs */ | ||
112 | NDTPA_DELAY_PROBE_TIME, /* u64, msecs */ | ||
113 | NDTPA_QUEUE_LEN, /* u32 */ | ||
114 | NDTPA_APP_PROBES, /* u32 */ | ||
115 | NDTPA_UCAST_PROBES, /* u32 */ | ||
116 | NDTPA_MCAST_PROBES, /* u32 */ | ||
117 | NDTPA_ANYCAST_DELAY, /* u64, msecs */ | ||
118 | NDTPA_PROXY_DELAY, /* u64, msecs */ | ||
119 | NDTPA_PROXY_QLEN, /* u32 */ | ||
120 | NDTPA_LOCKTIME, /* u64, msecs */ | ||
121 | __NDTPA_MAX | ||
122 | }; | ||
123 | #define NDTPA_MAX (__NDTPA_MAX - 1) | ||
124 | |||
125 | struct ndtmsg | ||
126 | { | ||
127 | __u8 ndtm_family; | ||
128 | __u8 ndtm_pad1; | ||
129 | __u16 ndtm_pad2; | ||
130 | }; | ||
131 | |||
132 | struct ndt_config | ||
133 | { | ||
134 | __u16 ndtc_key_len; | ||
135 | __u16 ndtc_entry_size; | ||
136 | __u32 ndtc_entries; | ||
137 | __u32 ndtc_last_flush; /* delta to now in msecs */ | ||
138 | __u32 ndtc_last_rand; /* delta to now in msecs */ | ||
139 | __u32 ndtc_hash_rnd; | ||
140 | __u32 ndtc_hash_mask; | ||
141 | __u32 ndtc_hash_chain_gc; | ||
142 | __u32 ndtc_proxy_qlen; | ||
143 | }; | ||
144 | |||
145 | enum { | ||
146 | NDTA_UNSPEC, | ||
147 | NDTA_NAME, /* char *, unchangeable */ | ||
148 | NDTA_THRESH1, /* u32 */ | ||
149 | NDTA_THRESH2, /* u32 */ | ||
150 | NDTA_THRESH3, /* u32 */ | ||
151 | NDTA_CONFIG, /* struct ndt_config, read-only */ | ||
152 | NDTA_PARMS, /* nested TLV NDTPA_* */ | ||
153 | NDTA_STATS, /* struct ndt_stats, read-only */ | ||
154 | NDTA_GC_INTERVAL, /* u64, msecs */ | ||
155 | __NDTA_MAX | ||
156 | }; | ||
157 | #define NDTA_MAX (__NDTA_MAX - 1) | ||
158 | |||
159 | #endif | ||
diff --git a/include/linux/net.h b/include/linux/net.h index b20c53c74413..c257f716e00f 100644 --- a/include/linux/net.h +++ b/include/linux/net.h | |||
@@ -169,11 +169,6 @@ struct proto_ops { | |||
169 | struct net_proto_family { | 169 | struct net_proto_family { |
170 | int family; | 170 | int family; |
171 | int (*create)(struct socket *sock, int protocol); | 171 | int (*create)(struct socket *sock, int protocol); |
172 | /* These are counters for the number of different methods of | ||
173 | each we support */ | ||
174 | short authentication; | ||
175 | short encryption; | ||
176 | short encrypt_net; | ||
177 | struct module *owner; | 172 | struct module *owner; |
178 | }; | 173 | }; |
179 | 174 | ||
@@ -181,8 +176,8 @@ struct iovec; | |||
181 | struct kvec; | 176 | struct kvec; |
182 | 177 | ||
183 | extern int sock_wake_async(struct socket *sk, int how, int band); | 178 | extern int sock_wake_async(struct socket *sk, int how, int band); |
184 | extern int sock_register(struct net_proto_family *fam); | 179 | extern int sock_register(const struct net_proto_family *fam); |
185 | extern int sock_unregister(int family); | 180 | extern void sock_unregister(int family); |
186 | extern int sock_create(int family, int type, int proto, | 181 | extern int sock_create(int family, int type, int proto, |
187 | struct socket **res); | 182 | struct socket **res); |
188 | extern int sock_create_kern(int family, int type, int proto, | 183 | extern int sock_create_kern(int family, int type, int proto, |
@@ -208,6 +203,25 @@ extern int kernel_recvmsg(struct socket *sock, struct msghdr *msg, | |||
208 | struct kvec *vec, size_t num, | 203 | struct kvec *vec, size_t num, |
209 | size_t len, int flags); | 204 | size_t len, int flags); |
210 | 205 | ||
206 | extern int kernel_bind(struct socket *sock, struct sockaddr *addr, | ||
207 | int addrlen); | ||
208 | extern int kernel_listen(struct socket *sock, int backlog); | ||
209 | extern int kernel_accept(struct socket *sock, struct socket **newsock, | ||
210 | int flags); | ||
211 | extern int kernel_connect(struct socket *sock, struct sockaddr *addr, | ||
212 | int addrlen, int flags); | ||
213 | extern int kernel_getsockname(struct socket *sock, struct sockaddr *addr, | ||
214 | int *addrlen); | ||
215 | extern int kernel_getpeername(struct socket *sock, struct sockaddr *addr, | ||
216 | int *addrlen); | ||
217 | extern int kernel_getsockopt(struct socket *sock, int level, int optname, | ||
218 | char *optval, int *optlen); | ||
219 | extern int kernel_setsockopt(struct socket *sock, int level, int optname, | ||
220 | char *optval, int optlen); | ||
221 | extern int kernel_sendpage(struct socket *sock, struct page *page, int offset, | ||
222 | size_t size, int flags); | ||
223 | extern int kernel_sock_ioctl(struct socket *sock, int cmd, unsigned long arg); | ||
224 | |||
211 | #ifndef CONFIG_SMP | 225 | #ifndef CONFIG_SMP |
212 | #define SOCKOPS_WRAPPED(name) name | 226 | #define SOCKOPS_WRAPPED(name) name |
213 | #define SOCKOPS_WRAP(name, fam) | 227 | #define SOCKOPS_WRAP(name, fam) |
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h index 50a4719512ed..43289127b458 100644 --- a/include/linux/netdevice.h +++ b/include/linux/netdevice.h | |||
@@ -342,7 +342,7 @@ struct net_device | |||
342 | /* Instance data managed by the core of Wireless Extensions. */ | 342 | /* Instance data managed by the core of Wireless Extensions. */ |
343 | struct iw_public_data * wireless_data; | 343 | struct iw_public_data * wireless_data; |
344 | 344 | ||
345 | struct ethtool_ops *ethtool_ops; | 345 | const struct ethtool_ops *ethtool_ops; |
346 | 346 | ||
347 | /* | 347 | /* |
348 | * This marks the end of the "visible" part of the structure. All | 348 | * This marks the end of the "visible" part of the structure. All |
@@ -976,7 +976,7 @@ extern void dev_mcast_init(void); | |||
976 | extern int netdev_max_backlog; | 976 | extern int netdev_max_backlog; |
977 | extern int weight_p; | 977 | extern int weight_p; |
978 | extern int netdev_set_master(struct net_device *dev, struct net_device *master); | 978 | extern int netdev_set_master(struct net_device *dev, struct net_device *master); |
979 | extern int skb_checksum_help(struct sk_buff *skb, int inward); | 979 | extern int skb_checksum_help(struct sk_buff *skb); |
980 | extern struct sk_buff *skb_gso_segment(struct sk_buff *skb, int features); | 980 | extern struct sk_buff *skb_gso_segment(struct sk_buff *skb, int features); |
981 | #ifdef CONFIG_BUG | 981 | #ifdef CONFIG_BUG |
982 | extern void netdev_rx_csum_fault(struct net_device *dev); | 982 | extern void netdev_rx_csum_fault(struct net_device *dev); |
@@ -1012,7 +1012,7 @@ static inline int netif_needs_gso(struct net_device *dev, struct sk_buff *skb) | |||
1012 | { | 1012 | { |
1013 | return skb_is_gso(skb) && | 1013 | return skb_is_gso(skb) && |
1014 | (!skb_gso_ok(skb, dev->features) || | 1014 | (!skb_gso_ok(skb, dev->features) || |
1015 | unlikely(skb->ip_summed != CHECKSUM_HW)); | 1015 | unlikely(skb->ip_summed != CHECKSUM_PARTIAL)); |
1016 | } | 1016 | } |
1017 | 1017 | ||
1018 | /* On bonding slaves other than the currently active slave, suppress | 1018 | /* On bonding slaves other than the currently active slave, suppress |
diff --git a/include/linux/netfilter.h b/include/linux/netfilter.h index 10168e26a846..b7e67d1d4382 100644 --- a/include/linux/netfilter.h +++ b/include/linux/netfilter.h | |||
@@ -282,6 +282,12 @@ extern void nf_invalidate_cache(int pf); | |||
282 | Returns true or false. */ | 282 | Returns true or false. */ |
283 | extern int skb_make_writable(struct sk_buff **pskb, unsigned int writable_len); | 283 | extern int skb_make_writable(struct sk_buff **pskb, unsigned int writable_len); |
284 | 284 | ||
285 | extern u_int16_t nf_csum_update(u_int32_t oldval, u_int32_t newval, | ||
286 | u_int32_t csum); | ||
287 | extern u_int16_t nf_proto_csum_update(struct sk_buff *skb, | ||
288 | u_int32_t oldval, u_int32_t newval, | ||
289 | u_int16_t csum, int pseudohdr); | ||
290 | |||
285 | struct nf_afinfo { | 291 | struct nf_afinfo { |
286 | unsigned short family; | 292 | unsigned short family; |
287 | unsigned int (*checksum)(struct sk_buff *skb, unsigned int hook, | 293 | unsigned int (*checksum)(struct sk_buff *skb, unsigned int hook, |
diff --git a/include/linux/netfilter/nf_conntrack_common.h b/include/linux/netfilter/nf_conntrack_common.h index d2e4bd7a7a14..9e0dae07861e 100644 --- a/include/linux/netfilter/nf_conntrack_common.h +++ b/include/linux/netfilter/nf_conntrack_common.h | |||
@@ -125,6 +125,10 @@ enum ip_conntrack_events | |||
125 | /* Counter highest bit has been set */ | 125 | /* Counter highest bit has been set */ |
126 | IPCT_COUNTER_FILLING_BIT = 11, | 126 | IPCT_COUNTER_FILLING_BIT = 11, |
127 | IPCT_COUNTER_FILLING = (1 << IPCT_COUNTER_FILLING_BIT), | 127 | IPCT_COUNTER_FILLING = (1 << IPCT_COUNTER_FILLING_BIT), |
128 | |||
129 | /* Mark is set */ | ||
130 | IPCT_MARK_BIT = 12, | ||
131 | IPCT_MARK = (1 << IPCT_MARK_BIT), | ||
128 | }; | 132 | }; |
129 | 133 | ||
130 | enum ip_conntrack_expect_events { | 134 | enum ip_conntrack_expect_events { |
diff --git a/include/linux/netfilter/nf_conntrack_tcp.h b/include/linux/netfilter/nf_conntrack_tcp.h index b2feeffde384..6b01ba297727 100644 --- a/include/linux/netfilter/nf_conntrack_tcp.h +++ b/include/linux/netfilter/nf_conntrack_tcp.h | |||
@@ -49,6 +49,7 @@ struct ip_ct_tcp | |||
49 | u_int32_t last_seq; /* Last sequence number seen in dir */ | 49 | u_int32_t last_seq; /* Last sequence number seen in dir */ |
50 | u_int32_t last_ack; /* Last sequence number seen in opposite dir */ | 50 | u_int32_t last_ack; /* Last sequence number seen in opposite dir */ |
51 | u_int32_t last_end; /* Last seq + len */ | 51 | u_int32_t last_end; /* Last seq + len */ |
52 | u_int16_t last_win; /* Last window advertisement seen in dir */ | ||
52 | }; | 53 | }; |
53 | 54 | ||
54 | #endif /* __KERNEL__ */ | 55 | #endif /* __KERNEL__ */ |
diff --git a/include/linux/netfilter/nfnetlink.h b/include/linux/netfilter/nfnetlink.h index 9f5b12cf489b..6d8e3e5a80e9 100644 --- a/include/linux/netfilter/nfnetlink.h +++ b/include/linux/netfilter/nfnetlink.h | |||
@@ -43,7 +43,7 @@ struct nfattr | |||
43 | u_int16_t nfa_len; | 43 | u_int16_t nfa_len; |
44 | u_int16_t nfa_type; /* we use 15 bits for the type, and the highest | 44 | u_int16_t nfa_type; /* we use 15 bits for the type, and the highest |
45 | * bit to indicate whether the payload is nested */ | 45 | * bit to indicate whether the payload is nested */ |
46 | } __attribute__ ((packed)); | 46 | }; |
47 | 47 | ||
48 | /* FIXME: Apart from NFNL_NFA_NESTED shamelessly copy and pasted from | 48 | /* FIXME: Apart from NFNL_NFA_NESTED shamelessly copy and pasted from |
49 | * rtnetlink.h, it's time to put this in a generic file */ | 49 | * rtnetlink.h, it's time to put this in a generic file */ |
@@ -79,7 +79,7 @@ struct nfgenmsg { | |||
79 | u_int8_t nfgen_family; /* AF_xxx */ | 79 | u_int8_t nfgen_family; /* AF_xxx */ |
80 | u_int8_t version; /* nfnetlink version */ | 80 | u_int8_t version; /* nfnetlink version */ |
81 | u_int16_t res_id; /* resource id */ | 81 | u_int16_t res_id; /* resource id */ |
82 | } __attribute__ ((packed)); | 82 | }; |
83 | 83 | ||
84 | #define NFNETLINK_V0 0 | 84 | #define NFNETLINK_V0 0 |
85 | 85 | ||
diff --git a/include/linux/netfilter/nfnetlink_log.h b/include/linux/netfilter/nfnetlink_log.h index a7497c7436df..87b92f8b988f 100644 --- a/include/linux/netfilter/nfnetlink_log.h +++ b/include/linux/netfilter/nfnetlink_log.h | |||
@@ -19,18 +19,18 @@ struct nfulnl_msg_packet_hdr { | |||
19 | u_int16_t hw_protocol; /* hw protocol (network order) */ | 19 | u_int16_t hw_protocol; /* hw protocol (network order) */ |
20 | u_int8_t hook; /* netfilter hook */ | 20 | u_int8_t hook; /* netfilter hook */ |
21 | u_int8_t _pad; | 21 | u_int8_t _pad; |
22 | } __attribute__ ((packed)); | 22 | }; |
23 | 23 | ||
24 | struct nfulnl_msg_packet_hw { | 24 | struct nfulnl_msg_packet_hw { |
25 | u_int16_t hw_addrlen; | 25 | u_int16_t hw_addrlen; |
26 | u_int16_t _pad; | 26 | u_int16_t _pad; |
27 | u_int8_t hw_addr[8]; | 27 | u_int8_t hw_addr[8]; |
28 | } __attribute__ ((packed)); | 28 | }; |
29 | 29 | ||
30 | struct nfulnl_msg_packet_timestamp { | 30 | struct nfulnl_msg_packet_timestamp { |
31 | aligned_u64 sec; | 31 | aligned_u64 sec; |
32 | aligned_u64 usec; | 32 | aligned_u64 usec; |
33 | } __attribute__ ((packed)); | 33 | }; |
34 | 34 | ||
35 | #define NFULNL_PREFIXLEN 30 /* just like old log target */ | 35 | #define NFULNL_PREFIXLEN 30 /* just like old log target */ |
36 | 36 | ||
diff --git a/include/linux/netfilter/nfnetlink_queue.h b/include/linux/netfilter/nfnetlink_queue.h index 9e774373244c..36af0360b56d 100644 --- a/include/linux/netfilter/nfnetlink_queue.h +++ b/include/linux/netfilter/nfnetlink_queue.h | |||
@@ -22,12 +22,12 @@ struct nfqnl_msg_packet_hw { | |||
22 | u_int16_t hw_addrlen; | 22 | u_int16_t hw_addrlen; |
23 | u_int16_t _pad; | 23 | u_int16_t _pad; |
24 | u_int8_t hw_addr[8]; | 24 | u_int8_t hw_addr[8]; |
25 | } __attribute__ ((packed)); | 25 | }; |
26 | 26 | ||
27 | struct nfqnl_msg_packet_timestamp { | 27 | struct nfqnl_msg_packet_timestamp { |
28 | aligned_u64 sec; | 28 | aligned_u64 sec; |
29 | aligned_u64 usec; | 29 | aligned_u64 usec; |
30 | } __attribute__ ((packed)); | 30 | }; |
31 | 31 | ||
32 | enum nfqnl_attr_type { | 32 | enum nfqnl_attr_type { |
33 | NFQA_UNSPEC, | 33 | NFQA_UNSPEC, |
@@ -49,7 +49,7 @@ enum nfqnl_attr_type { | |||
49 | struct nfqnl_msg_verdict_hdr { | 49 | struct nfqnl_msg_verdict_hdr { |
50 | u_int32_t verdict; | 50 | u_int32_t verdict; |
51 | u_int32_t id; | 51 | u_int32_t id; |
52 | } __attribute__ ((packed)); | 52 | }; |
53 | 53 | ||
54 | 54 | ||
55 | enum nfqnl_msg_config_cmds { | 55 | enum nfqnl_msg_config_cmds { |
@@ -64,7 +64,7 @@ struct nfqnl_msg_config_cmd { | |||
64 | u_int8_t command; /* nfqnl_msg_config_cmds */ | 64 | u_int8_t command; /* nfqnl_msg_config_cmds */ |
65 | u_int8_t _pad; | 65 | u_int8_t _pad; |
66 | u_int16_t pf; /* AF_xxx for PF_[UN]BIND */ | 66 | u_int16_t pf; /* AF_xxx for PF_[UN]BIND */ |
67 | } __attribute__ ((packed)); | 67 | }; |
68 | 68 | ||
69 | enum nfqnl_config_mode { | 69 | enum nfqnl_config_mode { |
70 | NFQNL_COPY_NONE, | 70 | NFQNL_COPY_NONE, |
diff --git a/include/linux/netfilter/x_tables.h b/include/linux/netfilter/x_tables.h index 48cc32d83f77..739a98eebe2c 100644 --- a/include/linux/netfilter/x_tables.h +++ b/include/linux/netfilter/x_tables.h | |||
@@ -138,16 +138,6 @@ struct xt_counters_info | |||
138 | 138 | ||
139 | #include <linux/netdevice.h> | 139 | #include <linux/netdevice.h> |
140 | 140 | ||
141 | #define ASSERT_READ_LOCK(x) | ||
142 | #define ASSERT_WRITE_LOCK(x) | ||
143 | #include <linux/netfilter_ipv4/listhelp.h> | ||
144 | |||
145 | #ifdef CONFIG_COMPAT | ||
146 | #define COMPAT_TO_USER 1 | ||
147 | #define COMPAT_FROM_USER -1 | ||
148 | #define COMPAT_CALC_SIZE 0 | ||
149 | #endif | ||
150 | |||
151 | struct xt_match | 141 | struct xt_match |
152 | { | 142 | { |
153 | struct list_head list; | 143 | struct list_head list; |
@@ -174,21 +164,24 @@ struct xt_match | |||
174 | const void *ip, | 164 | const void *ip, |
175 | const struct xt_match *match, | 165 | const struct xt_match *match, |
176 | void *matchinfo, | 166 | void *matchinfo, |
177 | unsigned int matchinfosize, | ||
178 | unsigned int hook_mask); | 167 | unsigned int hook_mask); |
179 | 168 | ||
180 | /* Called when entry of this type deleted. */ | 169 | /* Called when entry of this type deleted. */ |
181 | void (*destroy)(const struct xt_match *match, void *matchinfo, | 170 | void (*destroy)(const struct xt_match *match, void *matchinfo); |
182 | unsigned int matchinfosize); | ||
183 | 171 | ||
184 | /* Called when userspace align differs from kernel space one */ | 172 | /* Called when userspace align differs from kernel space one */ |
185 | int (*compat)(void *match, void **dstptr, int *size, int convert); | 173 | void (*compat_from_user)(void *dst, void *src); |
174 | int (*compat_to_user)(void __user *dst, void *src); | ||
186 | 175 | ||
187 | /* Set this to THIS_MODULE if you are a module, otherwise NULL */ | 176 | /* Set this to THIS_MODULE if you are a module, otherwise NULL */ |
188 | struct module *me; | 177 | struct module *me; |
189 | 178 | ||
179 | /* Free to use by each match */ | ||
180 | unsigned long data; | ||
181 | |||
190 | char *table; | 182 | char *table; |
191 | unsigned int matchsize; | 183 | unsigned int matchsize; |
184 | unsigned int compatsize; | ||
192 | unsigned int hooks; | 185 | unsigned int hooks; |
193 | unsigned short proto; | 186 | unsigned short proto; |
194 | 187 | ||
@@ -211,8 +204,7 @@ struct xt_target | |||
211 | const struct net_device *out, | 204 | const struct net_device *out, |
212 | unsigned int hooknum, | 205 | unsigned int hooknum, |
213 | const struct xt_target *target, | 206 | const struct xt_target *target, |
214 | const void *targinfo, | 207 | const void *targinfo); |
215 | void *userdata); | ||
216 | 208 | ||
217 | /* Called when user tries to insert an entry of this type: | 209 | /* Called when user tries to insert an entry of this type: |
218 | hook_mask is a bitmask of hooks from which it can be | 210 | hook_mask is a bitmask of hooks from which it can be |
@@ -222,21 +214,21 @@ struct xt_target | |||
222 | const void *entry, | 214 | const void *entry, |
223 | const struct xt_target *target, | 215 | const struct xt_target *target, |
224 | void *targinfo, | 216 | void *targinfo, |
225 | unsigned int targinfosize, | ||
226 | unsigned int hook_mask); | 217 | unsigned int hook_mask); |
227 | 218 | ||
228 | /* Called when entry of this type deleted. */ | 219 | /* Called when entry of this type deleted. */ |
229 | void (*destroy)(const struct xt_target *target, void *targinfo, | 220 | void (*destroy)(const struct xt_target *target, void *targinfo); |
230 | unsigned int targinfosize); | ||
231 | 221 | ||
232 | /* Called when userspace align differs from kernel space one */ | 222 | /* Called when userspace align differs from kernel space one */ |
233 | int (*compat)(void *target, void **dstptr, int *size, int convert); | 223 | void (*compat_from_user)(void *dst, void *src); |
224 | int (*compat_to_user)(void __user *dst, void *src); | ||
234 | 225 | ||
235 | /* Set this to THIS_MODULE if you are a module, otherwise NULL */ | 226 | /* Set this to THIS_MODULE if you are a module, otherwise NULL */ |
236 | struct module *me; | 227 | struct module *me; |
237 | 228 | ||
238 | char *table; | 229 | char *table; |
239 | unsigned int targetsize; | 230 | unsigned int targetsize; |
231 | unsigned int compatsize; | ||
240 | unsigned int hooks; | 232 | unsigned int hooks; |
241 | unsigned short proto; | 233 | unsigned short proto; |
242 | 234 | ||
@@ -290,8 +282,13 @@ struct xt_table_info | |||
290 | 282 | ||
291 | extern int xt_register_target(struct xt_target *target); | 283 | extern int xt_register_target(struct xt_target *target); |
292 | extern void xt_unregister_target(struct xt_target *target); | 284 | extern void xt_unregister_target(struct xt_target *target); |
285 | extern int xt_register_targets(struct xt_target *target, unsigned int n); | ||
286 | extern void xt_unregister_targets(struct xt_target *target, unsigned int n); | ||
287 | |||
293 | extern int xt_register_match(struct xt_match *target); | 288 | extern int xt_register_match(struct xt_match *target); |
294 | extern void xt_unregister_match(struct xt_match *target); | 289 | extern void xt_unregister_match(struct xt_match *target); |
290 | extern int xt_register_matches(struct xt_match *match, unsigned int n); | ||
291 | extern void xt_unregister_matches(struct xt_match *match, unsigned int n); | ||
295 | 292 | ||
296 | extern int xt_check_match(const struct xt_match *match, unsigned short family, | 293 | extern int xt_check_match(const struct xt_match *match, unsigned short family, |
297 | unsigned int size, const char *table, unsigned int hook, | 294 | unsigned int size, const char *table, unsigned int hook, |
@@ -388,9 +385,18 @@ struct compat_xt_counters_info | |||
388 | 385 | ||
389 | extern void xt_compat_lock(int af); | 386 | extern void xt_compat_lock(int af); |
390 | extern void xt_compat_unlock(int af); | 387 | extern void xt_compat_unlock(int af); |
391 | extern int xt_compat_match(void *match, void **dstptr, int *size, int convert); | 388 | |
392 | extern int xt_compat_target(void *target, void **dstptr, int *size, | 389 | extern int xt_compat_match_offset(struct xt_match *match); |
393 | int convert); | 390 | extern void xt_compat_match_from_user(struct xt_entry_match *m, |
391 | void **dstptr, int *size); | ||
392 | extern int xt_compat_match_to_user(struct xt_entry_match *m, | ||
393 | void * __user *dstptr, int *size); | ||
394 | |||
395 | extern int xt_compat_target_offset(struct xt_target *target); | ||
396 | extern void xt_compat_target_from_user(struct xt_entry_target *t, | ||
397 | void **dstptr, int *size); | ||
398 | extern int xt_compat_target_to_user(struct xt_entry_target *t, | ||
399 | void * __user *dstptr, int *size); | ||
394 | 400 | ||
395 | #endif /* CONFIG_COMPAT */ | 401 | #endif /* CONFIG_COMPAT */ |
396 | #endif /* __KERNEL__ */ | 402 | #endif /* __KERNEL__ */ |
diff --git a/include/linux/netfilter/xt_DSCP.h b/include/linux/netfilter/xt_DSCP.h new file mode 100644 index 000000000000..3c7c963997bd --- /dev/null +++ b/include/linux/netfilter/xt_DSCP.h | |||
@@ -0,0 +1,20 @@ | |||
1 | /* x_tables module for setting the IPv4/IPv6 DSCP field | ||
2 | * | ||
3 | * (C) 2002 Harald Welte <laforge@gnumonks.org> | ||
4 | * based on ipt_FTOS.c (C) 2000 by Matthew G. Marsh <mgm@paktronix.com> | ||
5 | * This software is distributed under GNU GPL v2, 1991 | ||
6 | * | ||
7 | * See RFC2474 for a description of the DSCP field within the IP Header. | ||
8 | * | ||
9 | * xt_DSCP.h,v 1.7 2002/03/14 12:03:13 laforge Exp | ||
10 | */ | ||
11 | #ifndef _XT_DSCP_TARGET_H | ||
12 | #define _XT_DSCP_TARGET_H | ||
13 | #include <linux/netfilter/xt_dscp.h> | ||
14 | |||
15 | /* target info */ | ||
16 | struct xt_DSCP_info { | ||
17 | u_int8_t dscp; | ||
18 | }; | ||
19 | |||
20 | #endif /* _XT_DSCP_TARGET_H */ | ||
diff --git a/include/linux/netfilter/xt_dscp.h b/include/linux/netfilter/xt_dscp.h new file mode 100644 index 000000000000..1da61e6acaf7 --- /dev/null +++ b/include/linux/netfilter/xt_dscp.h | |||
@@ -0,0 +1,23 @@ | |||
1 | /* x_tables module for matching the IPv4/IPv6 DSCP field | ||
2 | * | ||
3 | * (C) 2002 Harald Welte <laforge@gnumonks.org> | ||
4 | * This software is distributed under GNU GPL v2, 1991 | ||
5 | * | ||
6 | * See RFC2474 for a description of the DSCP field within the IP Header. | ||
7 | * | ||
8 | * xt_dscp.h,v 1.3 2002/08/05 19:00:21 laforge Exp | ||
9 | */ | ||
10 | #ifndef _XT_DSCP_H | ||
11 | #define _XT_DSCP_H | ||
12 | |||
13 | #define XT_DSCP_MASK 0xfc /* 11111100 */ | ||
14 | #define XT_DSCP_SHIFT 2 | ||
15 | #define XT_DSCP_MAX 0x3f /* 00111111 */ | ||
16 | |||
17 | /* match info */ | ||
18 | struct xt_dscp_info { | ||
19 | u_int8_t dscp; | ||
20 | u_int8_t invert; | ||
21 | }; | ||
22 | |||
23 | #endif /* _XT_DSCP_H */ | ||
diff --git a/include/linux/netfilter_arp/arp_tables.h b/include/linux/netfilter_arp/arp_tables.h index 62cc27daca4e..149e87c9ab13 100644 --- a/include/linux/netfilter_arp/arp_tables.h +++ b/include/linux/netfilter_arp/arp_tables.h | |||
@@ -248,8 +248,7 @@ extern unsigned int arpt_do_table(struct sk_buff **pskb, | |||
248 | unsigned int hook, | 248 | unsigned int hook, |
249 | const struct net_device *in, | 249 | const struct net_device *in, |
250 | const struct net_device *out, | 250 | const struct net_device *out, |
251 | struct arpt_table *table, | 251 | struct arpt_table *table); |
252 | void *userdata); | ||
253 | 252 | ||
254 | #define ARPT_ALIGN(s) (((s) + (__alignof__(struct arpt_entry)-1)) & ~(__alignof__(struct arpt_entry)-1)) | 253 | #define ARPT_ALIGN(s) (((s) + (__alignof__(struct arpt_entry)-1)) & ~(__alignof__(struct arpt_entry)-1)) |
255 | #endif /*__KERNEL__*/ | 254 | #endif /*__KERNEL__*/ |
diff --git a/include/linux/netfilter_bridge.h b/include/linux/netfilter_bridge.h index 427c67ff89e9..9a4dd11af86e 100644 --- a/include/linux/netfilter_bridge.h +++ b/include/linux/netfilter_bridge.h | |||
@@ -5,9 +5,8 @@ | |||
5 | */ | 5 | */ |
6 | 6 | ||
7 | #include <linux/netfilter.h> | 7 | #include <linux/netfilter.h> |
8 | #if defined(__KERNEL__) && defined(CONFIG_BRIDGE_NETFILTER) | ||
9 | #include <linux/if_ether.h> | 8 | #include <linux/if_ether.h> |
10 | #endif | 9 | #include <linux/if_vlan.h> |
11 | 10 | ||
12 | /* Bridge Hooks */ | 11 | /* Bridge Hooks */ |
13 | /* After promisc drops, checksum checks. */ | 12 | /* After promisc drops, checksum checks. */ |
@@ -47,40 +46,20 @@ enum nf_br_hook_priorities { | |||
47 | 46 | ||
48 | 47 | ||
49 | /* Only used in br_forward.c */ | 48 | /* Only used in br_forward.c */ |
50 | static inline | 49 | extern int nf_bridge_copy_header(struct sk_buff *skb); |
51 | int nf_bridge_maybe_copy_header(struct sk_buff *skb) | 50 | static inline int nf_bridge_maybe_copy_header(struct sk_buff *skb) |
52 | { | 51 | { |
53 | int err; | 52 | if (skb->nf_bridge) |
54 | 53 | return nf_bridge_copy_header(skb); | |
55 | if (skb->nf_bridge) { | 54 | return 0; |
56 | if (skb->protocol == __constant_htons(ETH_P_8021Q)) { | ||
57 | err = skb_cow(skb, 18); | ||
58 | if (err) | ||
59 | return err; | ||
60 | memcpy(skb->data - 18, skb->nf_bridge->data, 18); | ||
61 | skb_push(skb, 4); | ||
62 | } else { | ||
63 | err = skb_cow(skb, 16); | ||
64 | if (err) | ||
65 | return err; | ||
66 | memcpy(skb->data - 16, skb->nf_bridge->data, 16); | ||
67 | } | ||
68 | } | ||
69 | return 0; | ||
70 | } | 55 | } |
71 | 56 | ||
72 | /* This is called by the IP fragmenting code and it ensures there is | 57 | /* This is called by the IP fragmenting code and it ensures there is |
73 | * enough room for the encapsulating header (if there is one). */ | 58 | * enough room for the encapsulating header (if there is one). */ |
74 | static inline | 59 | static inline int nf_bridge_pad(const struct sk_buff *skb) |
75 | int nf_bridge_pad(struct sk_buff *skb) | ||
76 | { | 60 | { |
77 | if (skb->protocol == __constant_htons(ETH_P_IP)) | 61 | return (skb->nf_bridge && skb->protocol == htons(ETH_P_8021Q)) |
78 | return 0; | 62 | ? VLAN_HLEN : 0; |
79 | if (skb->nf_bridge) { | ||
80 | if (skb->protocol == __constant_htons(ETH_P_8021Q)) | ||
81 | return 4; | ||
82 | } | ||
83 | return 0; | ||
84 | } | 63 | } |
85 | 64 | ||
86 | struct bridge_skb_cb { | 65 | struct bridge_skb_cb { |
@@ -90,6 +69,9 @@ struct bridge_skb_cb { | |||
90 | }; | 69 | }; |
91 | 70 | ||
92 | extern int brnf_deferred_hooks; | 71 | extern int brnf_deferred_hooks; |
72 | #else | ||
73 | #define nf_bridge_maybe_copy_header(skb) (0) | ||
74 | #define nf_bridge_pad(skb) (0) | ||
93 | #endif /* CONFIG_BRIDGE_NETFILTER */ | 75 | #endif /* CONFIG_BRIDGE_NETFILTER */ |
94 | 76 | ||
95 | #endif /* __KERNEL__ */ | 77 | #endif /* __KERNEL__ */ |
diff --git a/include/linux/netfilter_ipv4/ip_conntrack_helper.h b/include/linux/netfilter_ipv4/ip_conntrack_helper.h index 8d69279ccfe4..77fe868d36ff 100644 --- a/include/linux/netfilter_ipv4/ip_conntrack_helper.h +++ b/include/linux/netfilter_ipv4/ip_conntrack_helper.h | |||
@@ -25,6 +25,8 @@ struct ip_conntrack_helper | |||
25 | struct ip_conntrack *ct, | 25 | struct ip_conntrack *ct, |
26 | enum ip_conntrack_info conntrackinfo); | 26 | enum ip_conntrack_info conntrackinfo); |
27 | 27 | ||
28 | void (*destroy)(struct ip_conntrack *ct); | ||
29 | |||
28 | int (*to_nfattr)(struct sk_buff *skb, const struct ip_conntrack *ct); | 30 | int (*to_nfattr)(struct sk_buff *skb, const struct ip_conntrack *ct); |
29 | }; | 31 | }; |
30 | 32 | ||
diff --git a/include/linux/netfilter_ipv4/ip_conntrack_pptp.h b/include/linux/netfilter_ipv4/ip_conntrack_pptp.h index 816144c75de0..2644b1faddd6 100644 --- a/include/linux/netfilter_ipv4/ip_conntrack_pptp.h +++ b/include/linux/netfilter_ipv4/ip_conntrack_pptp.h | |||
@@ -31,8 +31,8 @@ struct ip_ct_pptp_master { | |||
31 | /* everything below is going to be per-expectation in newnat, | 31 | /* everything below is going to be per-expectation in newnat, |
32 | * since there could be more than one call within one session */ | 32 | * since there could be more than one call within one session */ |
33 | enum pptp_ctrlcall_state cstate; /* call state */ | 33 | enum pptp_ctrlcall_state cstate; /* call state */ |
34 | u_int16_t pac_call_id; /* call id of PAC, host byte order */ | 34 | __be16 pac_call_id; /* call id of PAC, host byte order */ |
35 | u_int16_t pns_call_id; /* call id of PNS, host byte order */ | 35 | __be16 pns_call_id; /* call id of PNS, host byte order */ |
36 | 36 | ||
37 | /* in pre-2.6.11 this used to be per-expect. Now it is per-conntrack | 37 | /* in pre-2.6.11 this used to be per-expect. Now it is per-conntrack |
38 | * and therefore imposes a fixed limit on the number of maps */ | 38 | * and therefore imposes a fixed limit on the number of maps */ |
@@ -42,8 +42,8 @@ struct ip_ct_pptp_master { | |||
42 | /* conntrack_expect private member */ | 42 | /* conntrack_expect private member */ |
43 | struct ip_ct_pptp_expect { | 43 | struct ip_ct_pptp_expect { |
44 | enum pptp_ctrlcall_state cstate; /* call state */ | 44 | enum pptp_ctrlcall_state cstate; /* call state */ |
45 | u_int16_t pac_call_id; /* call id of PAC */ | 45 | __be16 pac_call_id; /* call id of PAC */ |
46 | u_int16_t pns_call_id; /* call id of PNS */ | 46 | __be16 pns_call_id; /* call id of PNS */ |
47 | }; | 47 | }; |
48 | 48 | ||
49 | 49 | ||
@@ -107,8 +107,7 @@ struct PptpControlHeader { | |||
107 | 107 | ||
108 | struct PptpStartSessionRequest { | 108 | struct PptpStartSessionRequest { |
109 | __be16 protocolVersion; | 109 | __be16 protocolVersion; |
110 | __u8 reserved1; | 110 | __u16 reserved1; |
111 | __u8 reserved2; | ||
112 | __be32 framingCapability; | 111 | __be32 framingCapability; |
113 | __be32 bearerCapability; | 112 | __be32 bearerCapability; |
114 | __be16 maxChannels; | 113 | __be16 maxChannels; |
@@ -143,6 +142,8 @@ struct PptpStartSessionReply { | |||
143 | 142 | ||
144 | struct PptpStopSessionRequest { | 143 | struct PptpStopSessionRequest { |
145 | __u8 reason; | 144 | __u8 reason; |
145 | __u8 reserved1; | ||
146 | __u16 reserved2; | ||
146 | }; | 147 | }; |
147 | 148 | ||
148 | /* PptpStopSessionResultCode */ | 149 | /* PptpStopSessionResultCode */ |
@@ -152,6 +153,7 @@ struct PptpStopSessionRequest { | |||
152 | struct PptpStopSessionReply { | 153 | struct PptpStopSessionReply { |
153 | __u8 resultCode; | 154 | __u8 resultCode; |
154 | __u8 generalErrorCode; | 155 | __u8 generalErrorCode; |
156 | __u16 reserved1; | ||
155 | }; | 157 | }; |
156 | 158 | ||
157 | struct PptpEchoRequest { | 159 | struct PptpEchoRequest { |
@@ -188,9 +190,8 @@ struct PptpOutCallRequest { | |||
188 | __be32 framingType; | 190 | __be32 framingType; |
189 | __be16 packetWindow; | 191 | __be16 packetWindow; |
190 | __be16 packetProcDelay; | 192 | __be16 packetProcDelay; |
191 | __u16 reserved1; | ||
192 | __be16 phoneNumberLength; | 193 | __be16 phoneNumberLength; |
193 | __u16 reserved2; | 194 | __u16 reserved1; |
194 | __u8 phoneNumber[64]; | 195 | __u8 phoneNumber[64]; |
195 | __u8 subAddress[64]; | 196 | __u8 subAddress[64]; |
196 | }; | 197 | }; |
@@ -285,19 +286,19 @@ struct PptpSetLinkInfo { | |||
285 | }; | 286 | }; |
286 | 287 | ||
287 | union pptp_ctrl_union { | 288 | union pptp_ctrl_union { |
288 | struct PptpStartSessionRequest sreq; | 289 | struct PptpStartSessionRequest sreq; |
289 | struct PptpStartSessionReply srep; | 290 | struct PptpStartSessionReply srep; |
290 | struct PptpStopSessionRequest streq; | 291 | struct PptpStopSessionRequest streq; |
291 | struct PptpStopSessionReply strep; | 292 | struct PptpStopSessionReply strep; |
292 | struct PptpOutCallRequest ocreq; | 293 | struct PptpOutCallRequest ocreq; |
293 | struct PptpOutCallReply ocack; | 294 | struct PptpOutCallReply ocack; |
294 | struct PptpInCallRequest icreq; | 295 | struct PptpInCallRequest icreq; |
295 | struct PptpInCallReply icack; | 296 | struct PptpInCallReply icack; |
296 | struct PptpInCallConnected iccon; | 297 | struct PptpInCallConnected iccon; |
297 | struct PptpClearCallRequest clrreq; | 298 | struct PptpClearCallRequest clrreq; |
298 | struct PptpCallDisconnectNotify disc; | 299 | struct PptpCallDisconnectNotify disc; |
299 | struct PptpWanErrorNotify wanerr; | 300 | struct PptpWanErrorNotify wanerr; |
300 | struct PptpSetLinkInfo setlink; | 301 | struct PptpSetLinkInfo setlink; |
301 | }; | 302 | }; |
302 | 303 | ||
303 | extern int | 304 | extern int |
@@ -314,7 +315,7 @@ extern int | |||
314 | struct PptpControlHeader *ctlh, | 315 | struct PptpControlHeader *ctlh, |
315 | union pptp_ctrl_union *pptpReq); | 316 | union pptp_ctrl_union *pptpReq); |
316 | 317 | ||
317 | extern int | 318 | extern void |
318 | (*ip_nat_pptp_hook_exp_gre)(struct ip_conntrack_expect *exp_orig, | 319 | (*ip_nat_pptp_hook_exp_gre)(struct ip_conntrack_expect *exp_orig, |
319 | struct ip_conntrack_expect *exp_reply); | 320 | struct ip_conntrack_expect *exp_reply); |
320 | 321 | ||
diff --git a/include/linux/netfilter_ipv4/ip_conntrack_proto_gre.h b/include/linux/netfilter_ipv4/ip_conntrack_proto_gre.h index 8d090ef82f5f..1d853aa873eb 100644 --- a/include/linux/netfilter_ipv4/ip_conntrack_proto_gre.h +++ b/include/linux/netfilter_ipv4/ip_conntrack_proto_gre.h | |||
@@ -49,18 +49,18 @@ struct gre_hdr { | |||
49 | #else | 49 | #else |
50 | #error "Adjust your <asm/byteorder.h> defines" | 50 | #error "Adjust your <asm/byteorder.h> defines" |
51 | #endif | 51 | #endif |
52 | __u16 protocol; | 52 | __be16 protocol; |
53 | }; | 53 | }; |
54 | 54 | ||
55 | /* modified GRE header for PPTP */ | 55 | /* modified GRE header for PPTP */ |
56 | struct gre_hdr_pptp { | 56 | struct gre_hdr_pptp { |
57 | __u8 flags; /* bitfield */ | 57 | __u8 flags; /* bitfield */ |
58 | __u8 version; /* should be GRE_VERSION_PPTP */ | 58 | __u8 version; /* should be GRE_VERSION_PPTP */ |
59 | __u16 protocol; /* should be GRE_PROTOCOL_PPTP */ | 59 | __be16 protocol; /* should be GRE_PROTOCOL_PPTP */ |
60 | __u16 payload_len; /* size of ppp payload, not inc. gre header */ | 60 | __be16 payload_len; /* size of ppp payload, not inc. gre header */ |
61 | __u16 call_id; /* peer's call_id for this session */ | 61 | __be16 call_id; /* peer's call_id for this session */ |
62 | __u32 seq; /* sequence number. Present if S==1 */ | 62 | __be32 seq; /* sequence number. Present if S==1 */ |
63 | __u32 ack; /* seq number of highest packet recieved by */ | 63 | __be32 ack; /* seq number of highest packet recieved by */ |
64 | /* sender in this session */ | 64 | /* sender in this session */ |
65 | }; | 65 | }; |
66 | 66 | ||
@@ -92,13 +92,13 @@ void ip_ct_gre_keymap_destroy(struct ip_conntrack *ct); | |||
92 | 92 | ||
93 | 93 | ||
94 | /* get pointer to gre key, if present */ | 94 | /* get pointer to gre key, if present */ |
95 | static inline u_int32_t *gre_key(struct gre_hdr *greh) | 95 | static inline __be32 *gre_key(struct gre_hdr *greh) |
96 | { | 96 | { |
97 | if (!greh->key) | 97 | if (!greh->key) |
98 | return NULL; | 98 | return NULL; |
99 | if (greh->csum || greh->routing) | 99 | if (greh->csum || greh->routing) |
100 | return (u_int32_t *) (greh+sizeof(*greh)+4); | 100 | return (__be32 *) (greh+sizeof(*greh)+4); |
101 | return (u_int32_t *) (greh+sizeof(*greh)); | 101 | return (__be32 *) (greh+sizeof(*greh)); |
102 | } | 102 | } |
103 | 103 | ||
104 | /* get pointer ot gre csum, if present */ | 104 | /* get pointer ot gre csum, if present */ |
diff --git a/include/linux/netfilter_ipv4/ip_nat.h b/include/linux/netfilter_ipv4/ip_nat.h index e9f5ed1d9f68..98f8407e4cb5 100644 --- a/include/linux/netfilter_ipv4/ip_nat.h +++ b/include/linux/netfilter_ipv4/ip_nat.h | |||
@@ -72,10 +72,6 @@ extern unsigned int ip_nat_setup_info(struct ip_conntrack *conntrack, | |||
72 | extern int ip_nat_used_tuple(const struct ip_conntrack_tuple *tuple, | 72 | extern int ip_nat_used_tuple(const struct ip_conntrack_tuple *tuple, |
73 | const struct ip_conntrack *ignored_conntrack); | 73 | const struct ip_conntrack *ignored_conntrack); |
74 | 74 | ||
75 | /* Calculate relative checksum. */ | ||
76 | extern u_int16_t ip_nat_cheat_check(u_int32_t oldvalinv, | ||
77 | u_int32_t newval, | ||
78 | u_int16_t oldcheck); | ||
79 | #else /* !__KERNEL__: iptables wants this to compile. */ | 75 | #else /* !__KERNEL__: iptables wants this to compile. */ |
80 | #define ip_nat_multi_range ip_nat_multi_range_compat | 76 | #define ip_nat_multi_range ip_nat_multi_range_compat |
81 | #endif /*__KERNEL__*/ | 77 | #endif /*__KERNEL__*/ |
diff --git a/include/linux/netfilter_ipv4/ip_nat_core.h b/include/linux/netfilter_ipv4/ip_nat_core.h index 30db23f06b03..60566f9fd7b3 100644 --- a/include/linux/netfilter_ipv4/ip_nat_core.h +++ b/include/linux/netfilter_ipv4/ip_nat_core.h | |||
@@ -11,8 +11,8 @@ extern unsigned int ip_nat_packet(struct ip_conntrack *ct, | |||
11 | unsigned int hooknum, | 11 | unsigned int hooknum, |
12 | struct sk_buff **pskb); | 12 | struct sk_buff **pskb); |
13 | 13 | ||
14 | extern int ip_nat_icmp_reply_translation(struct sk_buff **pskb, | 14 | extern int ip_nat_icmp_reply_translation(struct ip_conntrack *ct, |
15 | struct ip_conntrack *ct, | 15 | enum ip_conntrack_info ctinfo, |
16 | enum ip_nat_manip_type manip, | 16 | unsigned int hooknum, |
17 | enum ip_conntrack_dir dir); | 17 | struct sk_buff **pskb); |
18 | #endif /* _IP_NAT_CORE_H */ | 18 | #endif /* _IP_NAT_CORE_H */ |
diff --git a/include/linux/netfilter_ipv4/ip_nat_pptp.h b/include/linux/netfilter_ipv4/ip_nat_pptp.h index eaf66c2e8f93..36668bf0f373 100644 --- a/include/linux/netfilter_ipv4/ip_nat_pptp.h +++ b/include/linux/netfilter_ipv4/ip_nat_pptp.h | |||
@@ -4,8 +4,8 @@ | |||
4 | 4 | ||
5 | /* conntrack private data */ | 5 | /* conntrack private data */ |
6 | struct ip_nat_pptp { | 6 | struct ip_nat_pptp { |
7 | u_int16_t pns_call_id; /* NAT'ed PNS call id */ | 7 | __be16 pns_call_id; /* NAT'ed PNS call id */ |
8 | u_int16_t pac_call_id; /* NAT'ed PAC call id */ | 8 | __be16 pac_call_id; /* NAT'ed PAC call id */ |
9 | }; | 9 | }; |
10 | 10 | ||
11 | #endif /* _NAT_PPTP_H */ | 11 | #endif /* _NAT_PPTP_H */ |
diff --git a/include/linux/netfilter_ipv4/ip_tables.h b/include/linux/netfilter_ipv4/ip_tables.h index c0dac16e1902..a536bbdef145 100644 --- a/include/linux/netfilter_ipv4/ip_tables.h +++ b/include/linux/netfilter_ipv4/ip_tables.h | |||
@@ -312,8 +312,7 @@ extern unsigned int ipt_do_table(struct sk_buff **pskb, | |||
312 | unsigned int hook, | 312 | unsigned int hook, |
313 | const struct net_device *in, | 313 | const struct net_device *in, |
314 | const struct net_device *out, | 314 | const struct net_device *out, |
315 | struct ipt_table *table, | 315 | struct ipt_table *table); |
316 | void *userdata); | ||
317 | 316 | ||
318 | #define IPT_ALIGN(s) XT_ALIGN(s) | 317 | #define IPT_ALIGN(s) XT_ALIGN(s) |
319 | 318 | ||
diff --git a/include/linux/netfilter_ipv4/ipt_DSCP.h b/include/linux/netfilter_ipv4/ipt_DSCP.h index b30f510b5bef..3491e524d5ea 100644 --- a/include/linux/netfilter_ipv4/ipt_DSCP.h +++ b/include/linux/netfilter_ipv4/ipt_DSCP.h | |||
@@ -11,10 +11,8 @@ | |||
11 | #ifndef _IPT_DSCP_TARGET_H | 11 | #ifndef _IPT_DSCP_TARGET_H |
12 | #define _IPT_DSCP_TARGET_H | 12 | #define _IPT_DSCP_TARGET_H |
13 | #include <linux/netfilter_ipv4/ipt_dscp.h> | 13 | #include <linux/netfilter_ipv4/ipt_dscp.h> |
14 | #include <linux/netfilter/xt_DSCP.h> | ||
14 | 15 | ||
15 | /* target info */ | 16 | #define ipt_DSCP_info xt_DSCP_info |
16 | struct ipt_DSCP_info { | ||
17 | u_int8_t dscp; | ||
18 | }; | ||
19 | 17 | ||
20 | #endif /* _IPT_DSCP_TARGET_H */ | 18 | #endif /* _IPT_DSCP_TARGET_H */ |
diff --git a/include/linux/netfilter_ipv4/ipt_dscp.h b/include/linux/netfilter_ipv4/ipt_dscp.h index 2fa6dfe92894..4b82ca912b0e 100644 --- a/include/linux/netfilter_ipv4/ipt_dscp.h +++ b/include/linux/netfilter_ipv4/ipt_dscp.h | |||
@@ -10,14 +10,12 @@ | |||
10 | #ifndef _IPT_DSCP_H | 10 | #ifndef _IPT_DSCP_H |
11 | #define _IPT_DSCP_H | 11 | #define _IPT_DSCP_H |
12 | 12 | ||
13 | #define IPT_DSCP_MASK 0xfc /* 11111100 */ | 13 | #include <linux/netfilter/xt_dscp.h> |
14 | #define IPT_DSCP_SHIFT 2 | ||
15 | #define IPT_DSCP_MAX 0x3f /* 00111111 */ | ||
16 | 14 | ||
17 | /* match info */ | 15 | #define IPT_DSCP_MASK XT_DSCP_MASK |
18 | struct ipt_dscp_info { | 16 | #define IPT_DSCP_SHIFT XT_DSCP_SHIFT |
19 | u_int8_t dscp; | 17 | #define IPT_DSCP_MAX XT_DSCP_MAX |
20 | u_int8_t invert; | 18 | |
21 | }; | 19 | #define ipt_dscp_info xt_dscp_info |
22 | 20 | ||
23 | #endif /* _IPT_DSCP_H */ | 21 | #endif /* _IPT_DSCP_H */ |
diff --git a/include/linux/netfilter_ipv4/listhelp.h b/include/linux/netfilter_ipv4/listhelp.h deleted file mode 100644 index 5d92cf044d91..000000000000 --- a/include/linux/netfilter_ipv4/listhelp.h +++ /dev/null | |||
@@ -1,123 +0,0 @@ | |||
1 | #ifndef _LISTHELP_H | ||
2 | #define _LISTHELP_H | ||
3 | #include <linux/list.h> | ||
4 | |||
5 | /* Header to do more comprehensive job than linux/list.h; assume list | ||
6 | is first entry in structure. */ | ||
7 | |||
8 | /* Return pointer to first true entry, if any, or NULL. A macro | ||
9 | required to allow inlining of cmpfn. */ | ||
10 | #define LIST_FIND(head, cmpfn, type, args...) \ | ||
11 | ({ \ | ||
12 | const struct list_head *__i, *__j = NULL; \ | ||
13 | \ | ||
14 | ASSERT_READ_LOCK(head); \ | ||
15 | list_for_each(__i, (head)) \ | ||
16 | if (cmpfn((const type)__i , ## args)) { \ | ||
17 | __j = __i; \ | ||
18 | break; \ | ||
19 | } \ | ||
20 | (type)__j; \ | ||
21 | }) | ||
22 | |||
23 | #define LIST_FIND_W(head, cmpfn, type, args...) \ | ||
24 | ({ \ | ||
25 | const struct list_head *__i, *__j = NULL; \ | ||
26 | \ | ||
27 | ASSERT_WRITE_LOCK(head); \ | ||
28 | list_for_each(__i, (head)) \ | ||
29 | if (cmpfn((type)__i , ## args)) { \ | ||
30 | __j = __i; \ | ||
31 | break; \ | ||
32 | } \ | ||
33 | (type)__j; \ | ||
34 | }) | ||
35 | |||
36 | /* Just like LIST_FIND but we search backwards */ | ||
37 | #define LIST_FIND_B(head, cmpfn, type, args...) \ | ||
38 | ({ \ | ||
39 | const struct list_head *__i, *__j = NULL; \ | ||
40 | \ | ||
41 | ASSERT_READ_LOCK(head); \ | ||
42 | list_for_each_prev(__i, (head)) \ | ||
43 | if (cmpfn((const type)__i , ## args)) { \ | ||
44 | __j = __i; \ | ||
45 | break; \ | ||
46 | } \ | ||
47 | (type)__j; \ | ||
48 | }) | ||
49 | |||
50 | static inline int | ||
51 | __list_cmp_same(const void *p1, const void *p2) { return p1 == p2; } | ||
52 | |||
53 | /* Is this entry in the list? */ | ||
54 | static inline int | ||
55 | list_inlist(struct list_head *head, const void *entry) | ||
56 | { | ||
57 | return LIST_FIND(head, __list_cmp_same, void *, entry) != NULL; | ||
58 | } | ||
59 | |||
60 | /* Delete from list. */ | ||
61 | #ifdef CONFIG_NETFILTER_DEBUG | ||
62 | #define LIST_DELETE(head, oldentry) \ | ||
63 | do { \ | ||
64 | ASSERT_WRITE_LOCK(head); \ | ||
65 | if (!list_inlist(head, oldentry)) \ | ||
66 | printk("LIST_DELETE: %s:%u `%s'(%p) not in %s.\n", \ | ||
67 | __FILE__, __LINE__, #oldentry, oldentry, #head); \ | ||
68 | else list_del((struct list_head *)oldentry); \ | ||
69 | } while(0) | ||
70 | #else | ||
71 | #define LIST_DELETE(head, oldentry) list_del((struct list_head *)oldentry) | ||
72 | #endif | ||
73 | |||
74 | /* Append. */ | ||
75 | static inline void | ||
76 | list_append(struct list_head *head, void *new) | ||
77 | { | ||
78 | ASSERT_WRITE_LOCK(head); | ||
79 | list_add((new), (head)->prev); | ||
80 | } | ||
81 | |||
82 | /* Prepend. */ | ||
83 | static inline void | ||
84 | list_prepend(struct list_head *head, void *new) | ||
85 | { | ||
86 | ASSERT_WRITE_LOCK(head); | ||
87 | list_add(new, head); | ||
88 | } | ||
89 | |||
90 | /* Insert according to ordering function; insert before first true. */ | ||
91 | #define LIST_INSERT(head, new, cmpfn) \ | ||
92 | do { \ | ||
93 | struct list_head *__i; \ | ||
94 | ASSERT_WRITE_LOCK(head); \ | ||
95 | list_for_each(__i, (head)) \ | ||
96 | if ((new), (typeof (new))__i) \ | ||
97 | break; \ | ||
98 | list_add((struct list_head *)(new), __i->prev); \ | ||
99 | } while(0) | ||
100 | |||
101 | /* If the field after the list_head is a nul-terminated string, you | ||
102 | can use these functions. */ | ||
103 | static inline int __list_cmp_name(const void *i, const char *name) | ||
104 | { | ||
105 | return strcmp(name, i+sizeof(struct list_head)) == 0; | ||
106 | } | ||
107 | |||
108 | /* Returns false if same name already in list, otherwise does insert. */ | ||
109 | static inline int | ||
110 | list_named_insert(struct list_head *head, void *new) | ||
111 | { | ||
112 | if (LIST_FIND(head, __list_cmp_name, void *, | ||
113 | new + sizeof(struct list_head))) | ||
114 | return 0; | ||
115 | list_prepend(head, new); | ||
116 | return 1; | ||
117 | } | ||
118 | |||
119 | /* Find this named element in the list. */ | ||
120 | #define list_named_find(head, name) \ | ||
121 | LIST_FIND(head, __list_cmp_name, void *, name) | ||
122 | |||
123 | #endif /*_LISTHELP_H*/ | ||
diff --git a/include/linux/netfilter_ipv6.h b/include/linux/netfilter_ipv6.h index 52a7b9e76428..d97e268cdfe5 100644 --- a/include/linux/netfilter_ipv6.h +++ b/include/linux/netfilter_ipv6.h | |||
@@ -73,6 +73,7 @@ enum nf_ip6_hook_priorities { | |||
73 | }; | 73 | }; |
74 | 74 | ||
75 | #ifdef CONFIG_NETFILTER | 75 | #ifdef CONFIG_NETFILTER |
76 | extern int ip6_route_me_harder(struct sk_buff *skb); | ||
76 | extern unsigned int nf_ip6_checksum(struct sk_buff *skb, unsigned int hook, | 77 | extern unsigned int nf_ip6_checksum(struct sk_buff *skb, unsigned int hook, |
77 | unsigned int dataoff, u_int8_t protocol); | 78 | unsigned int dataoff, u_int8_t protocol); |
78 | 79 | ||
diff --git a/include/linux/netfilter_ipv6/ip6_tables.h b/include/linux/netfilter_ipv6/ip6_tables.h index d0d5d1ee4be3..d7a8e9c0dad0 100644 --- a/include/linux/netfilter_ipv6/ip6_tables.h +++ b/include/linux/netfilter_ipv6/ip6_tables.h | |||
@@ -300,8 +300,7 @@ extern unsigned int ip6t_do_table(struct sk_buff **pskb, | |||
300 | unsigned int hook, | 300 | unsigned int hook, |
301 | const struct net_device *in, | 301 | const struct net_device *in, |
302 | const struct net_device *out, | 302 | const struct net_device *out, |
303 | struct ip6t_table *table, | 303 | struct ip6t_table *table); |
304 | void *userdata); | ||
305 | 304 | ||
306 | /* Check for an extension */ | 305 | /* Check for an extension */ |
307 | extern int ip6t_ext_hdr(u8 nexthdr); | 306 | extern int ip6t_ext_hdr(u8 nexthdr); |
diff --git a/include/linux/netfilter_logging.h b/include/linux/netfilter_logging.h deleted file mode 100644 index 562bb6aad4e1..000000000000 --- a/include/linux/netfilter_logging.h +++ /dev/null | |||
@@ -1,33 +0,0 @@ | |||
1 | /* Internal logging interface, which relies on the real | ||
2 | LOG target modules */ | ||
3 | #ifndef __LINUX_NETFILTER_LOGGING_H | ||
4 | #define __LINUX_NETFILTER_LOGGING_H | ||
5 | |||
6 | #ifdef __KERNEL__ | ||
7 | #include <asm/atomic.h> | ||
8 | |||
9 | struct nf_logging_t { | ||
10 | void (*nf_log_packet)(struct sk_buff **pskb, | ||
11 | unsigned int hooknum, | ||
12 | const struct net_device *in, | ||
13 | const struct net_device *out, | ||
14 | const char *prefix); | ||
15 | void (*nf_log)(char *pfh, size_t len, | ||
16 | const char *prefix); | ||
17 | }; | ||
18 | |||
19 | extern void nf_log_register(int pf, const struct nf_logging_t *logging); | ||
20 | extern void nf_log_unregister(int pf, const struct nf_logging_t *logging); | ||
21 | |||
22 | extern void nf_log_packet(int pf, | ||
23 | struct sk_buff **pskb, | ||
24 | unsigned int hooknum, | ||
25 | const struct net_device *in, | ||
26 | const struct net_device *out, | ||
27 | const char *fmt, ...); | ||
28 | extern void nf_log(int pf, | ||
29 | char *pfh, size_t len, | ||
30 | const char *fmt, ...); | ||
31 | #endif /*__KERNEL__*/ | ||
32 | |||
33 | #endif /*__LINUX_NETFILTER_LOGGING_H*/ | ||
diff --git a/include/linux/netlink.h b/include/linux/netlink.h index 855b44668caa..66411622e06e 100644 --- a/include/linux/netlink.h +++ b/include/linux/netlink.h | |||
@@ -21,6 +21,8 @@ | |||
21 | #define NETLINK_DNRTMSG 14 /* DECnet routing messages */ | 21 | #define NETLINK_DNRTMSG 14 /* DECnet routing messages */ |
22 | #define NETLINK_KOBJECT_UEVENT 15 /* Kernel messages to userspace */ | 22 | #define NETLINK_KOBJECT_UEVENT 15 /* Kernel messages to userspace */ |
23 | #define NETLINK_GENERIC 16 | 23 | #define NETLINK_GENERIC 16 |
24 | /* leave room for NETLINK_DM (DM Events) */ | ||
25 | #define NETLINK_SCSITRANSPORT 18 /* SCSI Transports */ | ||
24 | 26 | ||
25 | #define MAX_LINKS 32 | 27 | #define MAX_LINKS 32 |
26 | 28 | ||
diff --git a/include/linux/nfs_fs.h b/include/linux/nfs_fs.h index 6c2066caeaab..36f5bcf513b0 100644 --- a/include/linux/nfs_fs.h +++ b/include/linux/nfs_fs.h | |||
@@ -9,6 +9,8 @@ | |||
9 | #ifndef _LINUX_NFS_FS_H | 9 | #ifndef _LINUX_NFS_FS_H |
10 | #define _LINUX_NFS_FS_H | 10 | #define _LINUX_NFS_FS_H |
11 | 11 | ||
12 | #include <linux/magic.h> | ||
13 | |||
12 | /* | 14 | /* |
13 | * Enable debugging support for nfs client. | 15 | * Enable debugging support for nfs client. |
14 | * Requires RPC_DEBUG. | 16 | * Requires RPC_DEBUG. |
@@ -22,11 +24,6 @@ | |||
22 | #define NFS_MAX_TCP_TIMEOUT (600*HZ) | 24 | #define NFS_MAX_TCP_TIMEOUT (600*HZ) |
23 | 25 | ||
24 | /* | 26 | /* |
25 | * superblock magic number for NFS | ||
26 | */ | ||
27 | #define NFS_SUPER_MAGIC 0x6969 | ||
28 | |||
29 | /* | ||
30 | * When flushing a cluster of dirty pages, there can be different | 27 | * When flushing a cluster of dirty pages, there can be different |
31 | * strategies: | 28 | * strategies: |
32 | */ | 29 | */ |
@@ -42,6 +39,7 @@ | |||
42 | #include <linux/in.h> | 39 | #include <linux/in.h> |
43 | #include <linux/mm.h> | 40 | #include <linux/mm.h> |
44 | #include <linux/pagemap.h> | 41 | #include <linux/pagemap.h> |
42 | #include <linux/rbtree.h> | ||
45 | #include <linux/rwsem.h> | 43 | #include <linux/rwsem.h> |
46 | #include <linux/wait.h> | 44 | #include <linux/wait.h> |
47 | 45 | ||
@@ -69,6 +67,8 @@ | |||
69 | * NFSv3/v4 Access mode cache entry | 67 | * NFSv3/v4 Access mode cache entry |
70 | */ | 68 | */ |
71 | struct nfs_access_entry { | 69 | struct nfs_access_entry { |
70 | struct rb_node rb_node; | ||
71 | struct list_head lru; | ||
72 | unsigned long jiffies; | 72 | unsigned long jiffies; |
73 | struct rpc_cred * cred; | 73 | struct rpc_cred * cred; |
74 | int mask; | 74 | int mask; |
@@ -145,7 +145,9 @@ struct nfs_inode { | |||
145 | */ | 145 | */ |
146 | atomic_t data_updates; | 146 | atomic_t data_updates; |
147 | 147 | ||
148 | struct nfs_access_entry cache_access; | 148 | struct rb_root access_cache; |
149 | struct list_head access_cache_entry_lru; | ||
150 | struct list_head access_cache_inode_lru; | ||
149 | #ifdef CONFIG_NFS_V3_ACL | 151 | #ifdef CONFIG_NFS_V3_ACL |
150 | struct posix_acl *acl_access; | 152 | struct posix_acl *acl_access; |
151 | struct posix_acl *acl_default; | 153 | struct posix_acl *acl_default; |
@@ -199,6 +201,7 @@ struct nfs_inode { | |||
199 | #define NFS_INO_REVALIDATING (0) /* revalidating attrs */ | 201 | #define NFS_INO_REVALIDATING (0) /* revalidating attrs */ |
200 | #define NFS_INO_ADVISE_RDPLUS (1) /* advise readdirplus */ | 202 | #define NFS_INO_ADVISE_RDPLUS (1) /* advise readdirplus */ |
201 | #define NFS_INO_STALE (2) /* possible stale inode */ | 203 | #define NFS_INO_STALE (2) /* possible stale inode */ |
204 | #define NFS_INO_ACL_LRU_SET (3) /* Inode is on the LRU list */ | ||
202 | 205 | ||
203 | static inline struct nfs_inode *NFS_I(struct inode *inode) | 206 | static inline struct nfs_inode *NFS_I(struct inode *inode) |
204 | { | 207 | { |
@@ -209,8 +212,7 @@ static inline struct nfs_inode *NFS_I(struct inode *inode) | |||
209 | #define NFS_FH(inode) (&NFS_I(inode)->fh) | 212 | #define NFS_FH(inode) (&NFS_I(inode)->fh) |
210 | #define NFS_SERVER(inode) (NFS_SB(inode->i_sb)) | 213 | #define NFS_SERVER(inode) (NFS_SB(inode->i_sb)) |
211 | #define NFS_CLIENT(inode) (NFS_SERVER(inode)->client) | 214 | #define NFS_CLIENT(inode) (NFS_SERVER(inode)->client) |
212 | #define NFS_PROTO(inode) (NFS_SERVER(inode)->rpc_ops) | 215 | #define NFS_PROTO(inode) (NFS_SERVER(inode)->nfs_client->rpc_ops) |
213 | #define NFS_ADDR(inode) (RPC_PEERADDR(NFS_CLIENT(inode))) | ||
214 | #define NFS_COOKIEVERF(inode) (NFS_I(inode)->cookieverf) | 216 | #define NFS_COOKIEVERF(inode) (NFS_I(inode)->cookieverf) |
215 | #define NFS_READTIME(inode) (NFS_I(inode)->read_cache_jiffies) | 217 | #define NFS_READTIME(inode) (NFS_I(inode)->read_cache_jiffies) |
216 | #define NFS_CHANGE_ATTR(inode) (NFS_I(inode)->change_attr) | 218 | #define NFS_CHANGE_ATTR(inode) (NFS_I(inode)->change_attr) |
@@ -297,6 +299,7 @@ extern int nfs_getattr(struct vfsmount *, struct dentry *, struct kstat *); | |||
297 | extern int nfs_permission(struct inode *, int, struct nameidata *); | 299 | extern int nfs_permission(struct inode *, int, struct nameidata *); |
298 | extern int nfs_access_get_cached(struct inode *, struct rpc_cred *, struct nfs_access_entry *); | 300 | extern int nfs_access_get_cached(struct inode *, struct rpc_cred *, struct nfs_access_entry *); |
299 | extern void nfs_access_add_cache(struct inode *, struct nfs_access_entry *); | 301 | extern void nfs_access_add_cache(struct inode *, struct nfs_access_entry *); |
302 | extern void nfs_access_zap_cache(struct inode *inode); | ||
300 | extern int nfs_open(struct inode *, struct file *); | 303 | extern int nfs_open(struct inode *, struct file *); |
301 | extern int nfs_release(struct inode *, struct file *); | 304 | extern int nfs_release(struct inode *, struct file *); |
302 | extern int nfs_attribute_timeout(struct inode *inode); | 305 | extern int nfs_attribute_timeout(struct inode *inode); |
@@ -579,6 +582,7 @@ extern void * nfs_root_data(void); | |||
579 | #define NFSDBG_FILE 0x0040 | 582 | #define NFSDBG_FILE 0x0040 |
580 | #define NFSDBG_ROOT 0x0080 | 583 | #define NFSDBG_ROOT 0x0080 |
581 | #define NFSDBG_CALLBACK 0x0100 | 584 | #define NFSDBG_CALLBACK 0x0100 |
585 | #define NFSDBG_CLIENT 0x0200 | ||
582 | #define NFSDBG_ALL 0xFFFF | 586 | #define NFSDBG_ALL 0xFFFF |
583 | 587 | ||
584 | #ifdef __KERNEL__ | 588 | #ifdef __KERNEL__ |
diff --git a/include/linux/nfs_fs_sb.h b/include/linux/nfs_fs_sb.h index 6b4a13c79474..7ccfc7ef0a83 100644 --- a/include/linux/nfs_fs_sb.h +++ b/include/linux/nfs_fs_sb.h | |||
@@ -7,13 +7,79 @@ | |||
7 | struct nfs_iostats; | 7 | struct nfs_iostats; |
8 | 8 | ||
9 | /* | 9 | /* |
10 | * The nfs_client identifies our client state to the server. | ||
11 | */ | ||
12 | struct nfs_client { | ||
13 | atomic_t cl_count; | ||
14 | int cl_cons_state; /* current construction state (-ve: init error) */ | ||
15 | #define NFS_CS_READY 0 /* ready to be used */ | ||
16 | #define NFS_CS_INITING 1 /* busy initialising */ | ||
17 | int cl_nfsversion; /* NFS protocol version */ | ||
18 | unsigned long cl_res_state; /* NFS resources state */ | ||
19 | #define NFS_CS_RPCIOD 0 /* - rpciod started */ | ||
20 | #define NFS_CS_CALLBACK 1 /* - callback started */ | ||
21 | #define NFS_CS_IDMAP 2 /* - idmap started */ | ||
22 | #define NFS_CS_RENEWD 3 /* - renewd started */ | ||
23 | struct sockaddr_in cl_addr; /* server identifier */ | ||
24 | char * cl_hostname; /* hostname of server */ | ||
25 | struct list_head cl_share_link; /* link in global client list */ | ||
26 | struct list_head cl_superblocks; /* List of nfs_server structs */ | ||
27 | |||
28 | struct rpc_clnt * cl_rpcclient; | ||
29 | const struct nfs_rpc_ops *rpc_ops; /* NFS protocol vector */ | ||
30 | unsigned long retrans_timeo; /* retransmit timeout */ | ||
31 | unsigned int retrans_count; /* number of retransmit tries */ | ||
32 | |||
33 | #ifdef CONFIG_NFS_V4 | ||
34 | u64 cl_clientid; /* constant */ | ||
35 | nfs4_verifier cl_confirm; | ||
36 | unsigned long cl_state; | ||
37 | |||
38 | u32 cl_lockowner_id; | ||
39 | |||
40 | /* | ||
41 | * The following rwsem ensures exclusive access to the server | ||
42 | * while we recover the state following a lease expiration. | ||
43 | */ | ||
44 | struct rw_semaphore cl_sem; | ||
45 | |||
46 | struct list_head cl_delegations; | ||
47 | struct list_head cl_state_owners; | ||
48 | struct list_head cl_unused; | ||
49 | int cl_nunused; | ||
50 | spinlock_t cl_lock; | ||
51 | |||
52 | unsigned long cl_lease_time; | ||
53 | unsigned long cl_last_renewal; | ||
54 | struct work_struct cl_renewd; | ||
55 | |||
56 | struct rpc_wait_queue cl_rpcwaitq; | ||
57 | |||
58 | /* used for the setclientid verifier */ | ||
59 | struct timespec cl_boot_time; | ||
60 | |||
61 | /* idmapper */ | ||
62 | struct idmap * cl_idmap; | ||
63 | |||
64 | /* Our own IP address, as a null-terminated string. | ||
65 | * This is used to generate the clientid, and the callback address. | ||
66 | */ | ||
67 | char cl_ipaddr[16]; | ||
68 | unsigned char cl_id_uniquifier; | ||
69 | #endif | ||
70 | }; | ||
71 | |||
72 | /* | ||
10 | * NFS client parameters stored in the superblock. | 73 | * NFS client parameters stored in the superblock. |
11 | */ | 74 | */ |
12 | struct nfs_server { | 75 | struct nfs_server { |
76 | struct nfs_client * nfs_client; /* shared client and NFS4 state */ | ||
77 | struct list_head client_link; /* List of other nfs_server structs | ||
78 | * that share the same client | ||
79 | */ | ||
80 | struct list_head master_link; /* link in master servers list */ | ||
13 | struct rpc_clnt * client; /* RPC client handle */ | 81 | struct rpc_clnt * client; /* RPC client handle */ |
14 | struct rpc_clnt * client_sys; /* 2nd handle for FSINFO */ | ||
15 | struct rpc_clnt * client_acl; /* ACL RPC client handle */ | 82 | struct rpc_clnt * client_acl; /* ACL RPC client handle */ |
16 | struct nfs_rpc_ops * rpc_ops; /* NFS protocol vector */ | ||
17 | struct nfs_iostats * io_stats; /* I/O statistics */ | 83 | struct nfs_iostats * io_stats; /* I/O statistics */ |
18 | struct backing_dev_info backing_dev_info; | 84 | struct backing_dev_info backing_dev_info; |
19 | int flags; /* various flags */ | 85 | int flags; /* various flags */ |
@@ -29,24 +95,14 @@ struct nfs_server { | |||
29 | unsigned int acregmax; | 95 | unsigned int acregmax; |
30 | unsigned int acdirmin; | 96 | unsigned int acdirmin; |
31 | unsigned int acdirmax; | 97 | unsigned int acdirmax; |
32 | unsigned long retrans_timeo; /* retransmit timeout */ | ||
33 | unsigned int retrans_count; /* number of retransmit tries */ | ||
34 | unsigned int namelen; | 98 | unsigned int namelen; |
35 | char * hostname; /* remote hostname */ | 99 | |
36 | struct nfs_fh fh; | ||
37 | struct sockaddr_in addr; | ||
38 | struct nfs_fsid fsid; | 100 | struct nfs_fsid fsid; |
101 | __u64 maxfilesize; /* maximum file size */ | ||
39 | unsigned long mount_time; /* when this fs was mounted */ | 102 | unsigned long mount_time; /* when this fs was mounted */ |
103 | dev_t s_dev; /* superblock dev numbers */ | ||
104 | |||
40 | #ifdef CONFIG_NFS_V4 | 105 | #ifdef CONFIG_NFS_V4 |
41 | /* Our own IP address, as a null-terminated string. | ||
42 | * This is used to generate the clientid, and the callback address. | ||
43 | */ | ||
44 | char ip_addr[16]; | ||
45 | char * mnt_path; | ||
46 | struct nfs4_client * nfs4_state; /* all NFSv4 state starts here */ | ||
47 | struct list_head nfs4_siblings; /* List of other nfs_server structs | ||
48 | * that share the same clientid | ||
49 | */ | ||
50 | u32 attr_bitmask[2];/* V4 bitmask representing the set | 106 | u32 attr_bitmask[2];/* V4 bitmask representing the set |
51 | of attributes supported on this | 107 | of attributes supported on this |
52 | filesystem */ | 108 | filesystem */ |
@@ -54,6 +110,7 @@ struct nfs_server { | |||
54 | that are supported on this | 110 | that are supported on this |
55 | filesystem */ | 111 | filesystem */ |
56 | #endif | 112 | #endif |
113 | void (*destroy)(struct nfs_server *); | ||
57 | }; | 114 | }; |
58 | 115 | ||
59 | /* Server capabilities */ | 116 | /* Server capabilities */ |
diff --git a/include/linux/nfs_idmap.h b/include/linux/nfs_idmap.h index 102e56094296..15a9f3b7289a 100644 --- a/include/linux/nfs_idmap.h +++ b/include/linux/nfs_idmap.h | |||
@@ -62,15 +62,15 @@ struct idmap_msg { | |||
62 | #ifdef __KERNEL__ | 62 | #ifdef __KERNEL__ |
63 | 63 | ||
64 | /* Forward declaration to make this header independent of others */ | 64 | /* Forward declaration to make this header independent of others */ |
65 | struct nfs4_client; | 65 | struct nfs_client; |
66 | 66 | ||
67 | void nfs_idmap_new(struct nfs4_client *); | 67 | int nfs_idmap_new(struct nfs_client *); |
68 | void nfs_idmap_delete(struct nfs4_client *); | 68 | void nfs_idmap_delete(struct nfs_client *); |
69 | 69 | ||
70 | int nfs_map_name_to_uid(struct nfs4_client *, const char *, size_t, __u32 *); | 70 | int nfs_map_name_to_uid(struct nfs_client *, const char *, size_t, __u32 *); |
71 | int nfs_map_group_to_gid(struct nfs4_client *, const char *, size_t, __u32 *); | 71 | int nfs_map_group_to_gid(struct nfs_client *, const char *, size_t, __u32 *); |
72 | int nfs_map_uid_to_name(struct nfs4_client *, __u32, char *); | 72 | int nfs_map_uid_to_name(struct nfs_client *, __u32, char *); |
73 | int nfs_map_gid_to_group(struct nfs4_client *, __u32, char *); | 73 | int nfs_map_gid_to_group(struct nfs_client *, __u32, char *); |
74 | 74 | ||
75 | extern unsigned int nfs_idmap_cache_timeout; | 75 | extern unsigned int nfs_idmap_cache_timeout; |
76 | #endif /* __KERNEL__ */ | 76 | #endif /* __KERNEL__ */ |
diff --git a/include/linux/nfs_xdr.h b/include/linux/nfs_xdr.h index 41e5a19199e9..dc5397d9d23c 100644 --- a/include/linux/nfs_xdr.h +++ b/include/linux/nfs_xdr.h | |||
@@ -1,7 +1,6 @@ | |||
1 | #ifndef _LINUX_NFS_XDR_H | 1 | #ifndef _LINUX_NFS_XDR_H |
2 | #define _LINUX_NFS_XDR_H | 2 | #define _LINUX_NFS_XDR_H |
3 | 3 | ||
4 | #include <linux/sunrpc/xprt.h> | ||
5 | #include <linux/nfsacl.h> | 4 | #include <linux/nfsacl.h> |
6 | 5 | ||
7 | /* | 6 | /* |
@@ -359,8 +358,8 @@ struct nfs_symlinkargs { | |||
359 | struct nfs_fh * fromfh; | 358 | struct nfs_fh * fromfh; |
360 | const char * fromname; | 359 | const char * fromname; |
361 | unsigned int fromlen; | 360 | unsigned int fromlen; |
362 | const char * topath; | 361 | struct page ** pages; |
363 | unsigned int tolen; | 362 | unsigned int pathlen; |
364 | struct iattr * sattr; | 363 | struct iattr * sattr; |
365 | }; | 364 | }; |
366 | 365 | ||
@@ -435,8 +434,8 @@ struct nfs3_symlinkargs { | |||
435 | struct nfs_fh * fromfh; | 434 | struct nfs_fh * fromfh; |
436 | const char * fromname; | 435 | const char * fromname; |
437 | unsigned int fromlen; | 436 | unsigned int fromlen; |
438 | const char * topath; | 437 | struct page ** pages; |
439 | unsigned int tolen; | 438 | unsigned int pathlen; |
440 | struct iattr * sattr; | 439 | struct iattr * sattr; |
441 | }; | 440 | }; |
442 | 441 | ||
@@ -534,7 +533,10 @@ struct nfs4_accessres { | |||
534 | struct nfs4_create_arg { | 533 | struct nfs4_create_arg { |
535 | u32 ftype; | 534 | u32 ftype; |
536 | union { | 535 | union { |
537 | struct qstr * symlink; /* NF4LNK */ | 536 | struct { |
537 | struct page ** pages; | ||
538 | unsigned int len; | ||
539 | } symlink; /* NF4LNK */ | ||
538 | struct { | 540 | struct { |
539 | u32 specdata1; | 541 | u32 specdata1; |
540 | u32 specdata2; | 542 | u32 specdata2; |
@@ -770,6 +772,9 @@ struct nfs_rpc_ops { | |||
770 | 772 | ||
771 | int (*getroot) (struct nfs_server *, struct nfs_fh *, | 773 | int (*getroot) (struct nfs_server *, struct nfs_fh *, |
772 | struct nfs_fsinfo *); | 774 | struct nfs_fsinfo *); |
775 | int (*lookupfh)(struct nfs_server *, struct nfs_fh *, | ||
776 | struct qstr *, struct nfs_fh *, | ||
777 | struct nfs_fattr *); | ||
773 | int (*getattr) (struct nfs_server *, struct nfs_fh *, | 778 | int (*getattr) (struct nfs_server *, struct nfs_fh *, |
774 | struct nfs_fattr *); | 779 | struct nfs_fattr *); |
775 | int (*setattr) (struct dentry *, struct nfs_fattr *, | 780 | int (*setattr) (struct dentry *, struct nfs_fattr *, |
@@ -791,9 +796,8 @@ struct nfs_rpc_ops { | |||
791 | int (*rename) (struct inode *, struct qstr *, | 796 | int (*rename) (struct inode *, struct qstr *, |
792 | struct inode *, struct qstr *); | 797 | struct inode *, struct qstr *); |
793 | int (*link) (struct inode *, struct inode *, struct qstr *); | 798 | int (*link) (struct inode *, struct inode *, struct qstr *); |
794 | int (*symlink) (struct inode *, struct qstr *, struct qstr *, | 799 | int (*symlink) (struct inode *, struct dentry *, struct page *, |
795 | struct iattr *, struct nfs_fh *, | 800 | unsigned int, struct iattr *); |
796 | struct nfs_fattr *); | ||
797 | int (*mkdir) (struct inode *, struct dentry *, struct iattr *); | 801 | int (*mkdir) (struct inode *, struct dentry *, struct iattr *); |
798 | int (*rmdir) (struct inode *, struct qstr *); | 802 | int (*rmdir) (struct inode *, struct qstr *); |
799 | int (*readdir) (struct dentry *, struct rpc_cred *, | 803 | int (*readdir) (struct dentry *, struct rpc_cred *, |
@@ -806,6 +810,7 @@ struct nfs_rpc_ops { | |||
806 | struct nfs_fsinfo *); | 810 | struct nfs_fsinfo *); |
807 | int (*pathconf) (struct nfs_server *, struct nfs_fh *, | 811 | int (*pathconf) (struct nfs_server *, struct nfs_fh *, |
808 | struct nfs_pathconf *); | 812 | struct nfs_pathconf *); |
813 | int (*set_capabilities)(struct nfs_server *, struct nfs_fh *); | ||
809 | u32 * (*decode_dirent)(u32 *, struct nfs_entry *, int plus); | 814 | u32 * (*decode_dirent)(u32 *, struct nfs_entry *, int plus); |
810 | void (*read_setup) (struct nfs_read_data *); | 815 | void (*read_setup) (struct nfs_read_data *); |
811 | int (*read_done) (struct rpc_task *, struct nfs_read_data *); | 816 | int (*read_done) (struct rpc_task *, struct nfs_read_data *); |
@@ -829,9 +834,9 @@ struct nfs_rpc_ops { | |||
829 | /* | 834 | /* |
830 | * Function vectors etc. for the NFS client | 835 | * Function vectors etc. for the NFS client |
831 | */ | 836 | */ |
832 | extern struct nfs_rpc_ops nfs_v2_clientops; | 837 | extern const struct nfs_rpc_ops nfs_v2_clientops; |
833 | extern struct nfs_rpc_ops nfs_v3_clientops; | 838 | extern const struct nfs_rpc_ops nfs_v3_clientops; |
834 | extern struct nfs_rpc_ops nfs_v4_clientops; | 839 | extern const struct nfs_rpc_ops nfs_v4_clientops; |
835 | extern struct rpc_version nfs_version2; | 840 | extern struct rpc_version nfs_version2; |
836 | extern struct rpc_version nfs_version3; | 841 | extern struct rpc_version nfs_version3; |
837 | extern struct rpc_version nfs_version4; | 842 | extern struct rpc_version nfs_version4; |
diff --git a/include/linux/openprom_fs.h b/include/linux/openprom_fs.h deleted file mode 100644 index a837aab8217e..000000000000 --- a/include/linux/openprom_fs.h +++ /dev/null | |||
@@ -1,10 +0,0 @@ | |||
1 | #ifndef _LINUX_OPENPROM_FS_H | ||
2 | #define _LINUX_OPENPROM_FS_H | ||
3 | |||
4 | /* | ||
5 | * The openprom filesystem constants/structures | ||
6 | */ | ||
7 | |||
8 | #define OPENPROM_SUPER_MAGIC 0x9fa1 | ||
9 | |||
10 | #endif /* _LINUX_OPENPROM_FS_H */ | ||
diff --git a/include/linux/pci_ids.h b/include/linux/pci_ids.h index 7a249155ee4e..6a1e09834559 100644 --- a/include/linux/pci_ids.h +++ b/include/linux/pci_ids.h | |||
@@ -2010,6 +2010,23 @@ | |||
2010 | #define PCI_DEVICE_ID_ALTIMA_AC9100 0x03ea | 2010 | #define PCI_DEVICE_ID_ALTIMA_AC9100 0x03ea |
2011 | #define PCI_DEVICE_ID_ALTIMA_AC1003 0x03eb | 2011 | #define PCI_DEVICE_ID_ALTIMA_AC1003 0x03eb |
2012 | 2012 | ||
2013 | #define PCI_VENDOR_ID_ARECA 0x17d3 | ||
2014 | #define PCI_DEVICE_ID_ARECA_1110 0x1110 | ||
2015 | #define PCI_DEVICE_ID_ARECA_1120 0x1120 | ||
2016 | #define PCI_DEVICE_ID_ARECA_1130 0x1130 | ||
2017 | #define PCI_DEVICE_ID_ARECA_1160 0x1160 | ||
2018 | #define PCI_DEVICE_ID_ARECA_1170 0x1170 | ||
2019 | #define PCI_DEVICE_ID_ARECA_1210 0x1210 | ||
2020 | #define PCI_DEVICE_ID_ARECA_1220 0x1220 | ||
2021 | #define PCI_DEVICE_ID_ARECA_1230 0x1230 | ||
2022 | #define PCI_DEVICE_ID_ARECA_1260 0x1260 | ||
2023 | #define PCI_DEVICE_ID_ARECA_1270 0x1270 | ||
2024 | #define PCI_DEVICE_ID_ARECA_1280 0x1280 | ||
2025 | #define PCI_DEVICE_ID_ARECA_1380 0x1380 | ||
2026 | #define PCI_DEVICE_ID_ARECA_1381 0x1381 | ||
2027 | #define PCI_DEVICE_ID_ARECA_1680 0x1680 | ||
2028 | #define PCI_DEVICE_ID_ARECA_1681 0x1681 | ||
2029 | |||
2013 | #define PCI_VENDOR_ID_S2IO 0x17d5 | 2030 | #define PCI_VENDOR_ID_S2IO 0x17d5 |
2014 | #define PCI_DEVICE_ID_S2IO_WIN 0x5731 | 2031 | #define PCI_DEVICE_ID_S2IO_WIN 0x5731 |
2015 | #define PCI_DEVICE_ID_S2IO_UNI 0x5831 | 2032 | #define PCI_DEVICE_ID_S2IO_UNI 0x5831 |
diff --git a/include/linux/pkt_cls.h b/include/linux/pkt_cls.h index bd2c5a2bbbf5..c3f01b3085a4 100644 --- a/include/linux/pkt_cls.h +++ b/include/linux/pkt_cls.h | |||
@@ -305,6 +305,7 @@ enum | |||
305 | TCA_FW_POLICE, | 305 | TCA_FW_POLICE, |
306 | TCA_FW_INDEV, /* used by CONFIG_NET_CLS_IND */ | 306 | TCA_FW_INDEV, /* used by CONFIG_NET_CLS_IND */ |
307 | TCA_FW_ACT, /* used by CONFIG_NET_CLS_ACT */ | 307 | TCA_FW_ACT, /* used by CONFIG_NET_CLS_ACT */ |
308 | TCA_FW_MASK, | ||
308 | __TCA_FW_MAX | 309 | __TCA_FW_MAX |
309 | }; | 310 | }; |
310 | 311 | ||
diff --git a/include/linux/proc_fs.h b/include/linux/proc_fs.h index 17e75783e3a5..3435ca38dd14 100644 --- a/include/linux/proc_fs.h +++ b/include/linux/proc_fs.h | |||
@@ -4,6 +4,7 @@ | |||
4 | #include <linux/slab.h> | 4 | #include <linux/slab.h> |
5 | #include <linux/fs.h> | 5 | #include <linux/fs.h> |
6 | #include <linux/spinlock.h> | 6 | #include <linux/spinlock.h> |
7 | #include <linux/magic.h> | ||
7 | #include <asm/atomic.h> | 8 | #include <asm/atomic.h> |
8 | 9 | ||
9 | /* | 10 | /* |
@@ -24,8 +25,6 @@ enum { | |||
24 | PROC_ROOT_INO = 1, | 25 | PROC_ROOT_INO = 1, |
25 | }; | 26 | }; |
26 | 27 | ||
27 | #define PROC_SUPER_MAGIC 0x9fa0 | ||
28 | |||
29 | /* | 28 | /* |
30 | * This is not completely implemented yet. The idea is to | 29 | * This is not completely implemented yet. The idea is to |
31 | * create an in-memory tree (like the actual /proc filesystem | 30 | * create an in-memory tree (like the actual /proc filesystem |
diff --git a/include/linux/qnx4_fs.h b/include/linux/qnx4_fs.h index 27f49c85d5d6..0c7ac444fd35 100644 --- a/include/linux/qnx4_fs.h +++ b/include/linux/qnx4_fs.h | |||
@@ -11,6 +11,7 @@ | |||
11 | #define _LINUX_QNX4_FS_H | 11 | #define _LINUX_QNX4_FS_H |
12 | 12 | ||
13 | #include <linux/qnxtypes.h> | 13 | #include <linux/qnxtypes.h> |
14 | #include <linux/magic.h> | ||
14 | 15 | ||
15 | #define QNX4_ROOT_INO 1 | 16 | #define QNX4_ROOT_INO 1 |
16 | 17 | ||
@@ -25,7 +26,6 @@ | |||
25 | 26 | ||
26 | #define QNX4_I_MAP_SLOTS 8 | 27 | #define QNX4_I_MAP_SLOTS 8 |
27 | #define QNX4_Z_MAP_SLOTS 64 | 28 | #define QNX4_Z_MAP_SLOTS 64 |
28 | #define QNX4_SUPER_MAGIC 0x002f /* qnx4 fs detection */ | ||
29 | #define QNX4_VALID_FS 0x0001 /* Clean fs. */ | 29 | #define QNX4_VALID_FS 0x0001 /* Clean fs. */ |
30 | #define QNX4_ERROR_FS 0x0002 /* fs has errors. */ | 30 | #define QNX4_ERROR_FS 0x0002 /* fs has errors. */ |
31 | #define QNX4_BLOCK_SIZE 0x200 /* blocksize of 512 bytes */ | 31 | #define QNX4_BLOCK_SIZE 0x200 /* blocksize of 512 bytes */ |
diff --git a/include/linux/reiserfs_fs.h b/include/linux/reiserfs_fs.h index daa2d83cefe8..28493ffaafe7 100644 --- a/include/linux/reiserfs_fs.h +++ b/include/linux/reiserfs_fs.h | |||
@@ -12,6 +12,8 @@ | |||
12 | #define _LINUX_REISER_FS_H | 12 | #define _LINUX_REISER_FS_H |
13 | 13 | ||
14 | #include <linux/types.h> | 14 | #include <linux/types.h> |
15 | #include <linux/magic.h> | ||
16 | |||
15 | #ifdef __KERNEL__ | 17 | #ifdef __KERNEL__ |
16 | #include <linux/slab.h> | 18 | #include <linux/slab.h> |
17 | #include <linux/interrupt.h> | 19 | #include <linux/interrupt.h> |
@@ -227,14 +229,6 @@ struct reiserfs_super_block { | |||
227 | ((!is_reiserfs_jr(SB_DISK_SUPER_BLOCK(s)) ? \ | 229 | ((!is_reiserfs_jr(SB_DISK_SUPER_BLOCK(s)) ? \ |
228 | SB_ONDISK_JOURNAL_SIZE(s) + 1 : SB_ONDISK_RESERVED_FOR_JOURNAL(s))) | 230 | SB_ONDISK_JOURNAL_SIZE(s) + 1 : SB_ONDISK_RESERVED_FOR_JOURNAL(s))) |
229 | 231 | ||
230 | /* used by gcc */ | ||
231 | #define REISERFS_SUPER_MAGIC 0x52654973 | ||
232 | /* used by file system utilities that | ||
233 | look at the superblock, etc. */ | ||
234 | #define REISERFS_SUPER_MAGIC_STRING "ReIsErFs" | ||
235 | #define REISER2FS_SUPER_MAGIC_STRING "ReIsEr2Fs" | ||
236 | #define REISER2FS_JR_SUPER_MAGIC_STRING "ReIsEr3Fs" | ||
237 | |||
238 | int is_reiserfs_3_5(struct reiserfs_super_block *rs); | 232 | int is_reiserfs_3_5(struct reiserfs_super_block *rs); |
239 | int is_reiserfs_3_6(struct reiserfs_super_block *rs); | 233 | int is_reiserfs_3_6(struct reiserfs_super_block *rs); |
240 | int is_reiserfs_jr(struct reiserfs_super_block *rs); | 234 | int is_reiserfs_jr(struct reiserfs_super_block *rs); |
diff --git a/include/linux/rtnetlink.h b/include/linux/rtnetlink.h index facd9ee37b76..9c92dc8b9a08 100644 --- a/include/linux/rtnetlink.h +++ b/include/linux/rtnetlink.h | |||
@@ -2,6 +2,7 @@ | |||
2 | #define __LINUX_RTNETLINK_H | 2 | #define __LINUX_RTNETLINK_H |
3 | 3 | ||
4 | #include <linux/netlink.h> | 4 | #include <linux/netlink.h> |
5 | #include <linux/if.h> | ||
5 | 6 | ||
6 | /**** | 7 | /**** |
7 | * Routing/neighbour discovery messages. | 8 | * Routing/neighbour discovery messages. |
@@ -238,10 +239,8 @@ enum rt_class_t | |||
238 | RT_TABLE_DEFAULT=253, | 239 | RT_TABLE_DEFAULT=253, |
239 | RT_TABLE_MAIN=254, | 240 | RT_TABLE_MAIN=254, |
240 | RT_TABLE_LOCAL=255, | 241 | RT_TABLE_LOCAL=255, |
241 | __RT_TABLE_MAX | 242 | RT_TABLE_MAX=0xFFFFFFFF |
242 | }; | 243 | }; |
243 | #define RT_TABLE_MAX (__RT_TABLE_MAX - 1) | ||
244 | |||
245 | 244 | ||
246 | 245 | ||
247 | /* Routing message attributes */ | 246 | /* Routing message attributes */ |
@@ -263,6 +262,7 @@ enum rtattr_type_t | |||
263 | RTA_CACHEINFO, | 262 | RTA_CACHEINFO, |
264 | RTA_SESSION, | 263 | RTA_SESSION, |
265 | RTA_MP_ALGO, | 264 | RTA_MP_ALGO, |
265 | RTA_TABLE, | ||
266 | __RTA_MAX | 266 | __RTA_MAX |
267 | }; | 267 | }; |
268 | 268 | ||
@@ -383,226 +383,6 @@ struct rta_session | |||
383 | } u; | 383 | } u; |
384 | }; | 384 | }; |
385 | 385 | ||
386 | |||
387 | /********************************************************* | ||
388 | * Interface address. | ||
389 | ****/ | ||
390 | |||
391 | struct ifaddrmsg | ||
392 | { | ||
393 | unsigned char ifa_family; | ||
394 | unsigned char ifa_prefixlen; /* The prefix length */ | ||
395 | unsigned char ifa_flags; /* Flags */ | ||
396 | unsigned char ifa_scope; /* See above */ | ||
397 | int ifa_index; /* Link index */ | ||
398 | }; | ||
399 | |||
400 | enum | ||
401 | { | ||
402 | IFA_UNSPEC, | ||
403 | IFA_ADDRESS, | ||
404 | IFA_LOCAL, | ||
405 | IFA_LABEL, | ||
406 | IFA_BROADCAST, | ||
407 | IFA_ANYCAST, | ||
408 | IFA_CACHEINFO, | ||
409 | IFA_MULTICAST, | ||
410 | __IFA_MAX | ||
411 | }; | ||
412 | |||
413 | #define IFA_MAX (__IFA_MAX - 1) | ||
414 | |||
415 | /* ifa_flags */ | ||
416 | |||
417 | #define IFA_F_SECONDARY 0x01 | ||
418 | #define IFA_F_TEMPORARY IFA_F_SECONDARY | ||
419 | |||
420 | #define IFA_F_DEPRECATED 0x20 | ||
421 | #define IFA_F_TENTATIVE 0x40 | ||
422 | #define IFA_F_PERMANENT 0x80 | ||
423 | |||
424 | struct ifa_cacheinfo | ||
425 | { | ||
426 | __u32 ifa_prefered; | ||
427 | __u32 ifa_valid; | ||
428 | __u32 cstamp; /* created timestamp, hundredths of seconds */ | ||
429 | __u32 tstamp; /* updated timestamp, hundredths of seconds */ | ||
430 | }; | ||
431 | |||
432 | |||
433 | #define IFA_RTA(r) ((struct rtattr*)(((char*)(r)) + NLMSG_ALIGN(sizeof(struct ifaddrmsg)))) | ||
434 | #define IFA_PAYLOAD(n) NLMSG_PAYLOAD(n,sizeof(struct ifaddrmsg)) | ||
435 | |||
436 | /* | ||
437 | Important comment: | ||
438 | IFA_ADDRESS is prefix address, rather than local interface address. | ||
439 | It makes no difference for normally configured broadcast interfaces, | ||
440 | but for point-to-point IFA_ADDRESS is DESTINATION address, | ||
441 | local address is supplied in IFA_LOCAL attribute. | ||
442 | */ | ||
443 | |||
444 | /************************************************************** | ||
445 | * Neighbour discovery. | ||
446 | ****/ | ||
447 | |||
448 | struct ndmsg | ||
449 | { | ||
450 | unsigned char ndm_family; | ||
451 | unsigned char ndm_pad1; | ||
452 | unsigned short ndm_pad2; | ||
453 | int ndm_ifindex; /* Link index */ | ||
454 | __u16 ndm_state; | ||
455 | __u8 ndm_flags; | ||
456 | __u8 ndm_type; | ||
457 | }; | ||
458 | |||
459 | enum | ||
460 | { | ||
461 | NDA_UNSPEC, | ||
462 | NDA_DST, | ||
463 | NDA_LLADDR, | ||
464 | NDA_CACHEINFO, | ||
465 | NDA_PROBES, | ||
466 | __NDA_MAX | ||
467 | }; | ||
468 | |||
469 | #define NDA_MAX (__NDA_MAX - 1) | ||
470 | |||
471 | #define NDA_RTA(r) ((struct rtattr*)(((char*)(r)) + NLMSG_ALIGN(sizeof(struct ndmsg)))) | ||
472 | #define NDA_PAYLOAD(n) NLMSG_PAYLOAD(n,sizeof(struct ndmsg)) | ||
473 | |||
474 | /* | ||
475 | * Neighbor Cache Entry Flags | ||
476 | */ | ||
477 | |||
478 | #define NTF_PROXY 0x08 /* == ATF_PUBL */ | ||
479 | #define NTF_ROUTER 0x80 | ||
480 | |||
481 | /* | ||
482 | * Neighbor Cache Entry States. | ||
483 | */ | ||
484 | |||
485 | #define NUD_INCOMPLETE 0x01 | ||
486 | #define NUD_REACHABLE 0x02 | ||
487 | #define NUD_STALE 0x04 | ||
488 | #define NUD_DELAY 0x08 | ||
489 | #define NUD_PROBE 0x10 | ||
490 | #define NUD_FAILED 0x20 | ||
491 | |||
492 | /* Dummy states */ | ||
493 | #define NUD_NOARP 0x40 | ||
494 | #define NUD_PERMANENT 0x80 | ||
495 | #define NUD_NONE 0x00 | ||
496 | |||
497 | |||
498 | struct nda_cacheinfo | ||
499 | { | ||
500 | __u32 ndm_confirmed; | ||
501 | __u32 ndm_used; | ||
502 | __u32 ndm_updated; | ||
503 | __u32 ndm_refcnt; | ||
504 | }; | ||
505 | |||
506 | |||
507 | /***************************************************************** | ||
508 | * Neighbour tables specific messages. | ||
509 | * | ||
510 | * To retrieve the neighbour tables send RTM_GETNEIGHTBL with the | ||
511 | * NLM_F_DUMP flag set. Every neighbour table configuration is | ||
512 | * spread over multiple messages to avoid running into message | ||
513 | * size limits on systems with many interfaces. The first message | ||
514 | * in the sequence transports all not device specific data such as | ||
515 | * statistics, configuration, and the default parameter set. | ||
516 | * This message is followed by 0..n messages carrying device | ||
517 | * specific parameter sets. | ||
518 | * Although the ordering should be sufficient, NDTA_NAME can be | ||
519 | * used to identify sequences. The initial message can be identified | ||
520 | * by checking for NDTA_CONFIG. The device specific messages do | ||
521 | * not contain this TLV but have NDTPA_IFINDEX set to the | ||
522 | * corresponding interface index. | ||
523 | * | ||
524 | * To change neighbour table attributes, send RTM_SETNEIGHTBL | ||
525 | * with NDTA_NAME set. Changeable attribute include NDTA_THRESH[1-3], | ||
526 | * NDTA_GC_INTERVAL, and all TLVs in NDTA_PARMS unless marked | ||
527 | * otherwise. Device specific parameter sets can be changed by | ||
528 | * setting NDTPA_IFINDEX to the interface index of the corresponding | ||
529 | * device. | ||
530 | ****/ | ||
531 | |||
532 | struct ndt_stats | ||
533 | { | ||
534 | __u64 ndts_allocs; | ||
535 | __u64 ndts_destroys; | ||
536 | __u64 ndts_hash_grows; | ||
537 | __u64 ndts_res_failed; | ||
538 | __u64 ndts_lookups; | ||
539 | __u64 ndts_hits; | ||
540 | __u64 ndts_rcv_probes_mcast; | ||
541 | __u64 ndts_rcv_probes_ucast; | ||
542 | __u64 ndts_periodic_gc_runs; | ||
543 | __u64 ndts_forced_gc_runs; | ||
544 | }; | ||
545 | |||
546 | enum { | ||
547 | NDTPA_UNSPEC, | ||
548 | NDTPA_IFINDEX, /* u32, unchangeable */ | ||
549 | NDTPA_REFCNT, /* u32, read-only */ | ||
550 | NDTPA_REACHABLE_TIME, /* u64, read-only, msecs */ | ||
551 | NDTPA_BASE_REACHABLE_TIME, /* u64, msecs */ | ||
552 | NDTPA_RETRANS_TIME, /* u64, msecs */ | ||
553 | NDTPA_GC_STALETIME, /* u64, msecs */ | ||
554 | NDTPA_DELAY_PROBE_TIME, /* u64, msecs */ | ||
555 | NDTPA_QUEUE_LEN, /* u32 */ | ||
556 | NDTPA_APP_PROBES, /* u32 */ | ||
557 | NDTPA_UCAST_PROBES, /* u32 */ | ||
558 | NDTPA_MCAST_PROBES, /* u32 */ | ||
559 | NDTPA_ANYCAST_DELAY, /* u64, msecs */ | ||
560 | NDTPA_PROXY_DELAY, /* u64, msecs */ | ||
561 | NDTPA_PROXY_QLEN, /* u32 */ | ||
562 | NDTPA_LOCKTIME, /* u64, msecs */ | ||
563 | __NDTPA_MAX | ||
564 | }; | ||
565 | #define NDTPA_MAX (__NDTPA_MAX - 1) | ||
566 | |||
567 | struct ndtmsg | ||
568 | { | ||
569 | __u8 ndtm_family; | ||
570 | __u8 ndtm_pad1; | ||
571 | __u16 ndtm_pad2; | ||
572 | }; | ||
573 | |||
574 | struct ndt_config | ||
575 | { | ||
576 | __u16 ndtc_key_len; | ||
577 | __u16 ndtc_entry_size; | ||
578 | __u32 ndtc_entries; | ||
579 | __u32 ndtc_last_flush; /* delta to now in msecs */ | ||
580 | __u32 ndtc_last_rand; /* delta to now in msecs */ | ||
581 | __u32 ndtc_hash_rnd; | ||
582 | __u32 ndtc_hash_mask; | ||
583 | __u32 ndtc_hash_chain_gc; | ||
584 | __u32 ndtc_proxy_qlen; | ||
585 | }; | ||
586 | |||
587 | enum { | ||
588 | NDTA_UNSPEC, | ||
589 | NDTA_NAME, /* char *, unchangeable */ | ||
590 | NDTA_THRESH1, /* u32 */ | ||
591 | NDTA_THRESH2, /* u32 */ | ||
592 | NDTA_THRESH3, /* u32 */ | ||
593 | NDTA_CONFIG, /* struct ndt_config, read-only */ | ||
594 | NDTA_PARMS, /* nested TLV NDTPA_* */ | ||
595 | NDTA_STATS, /* struct ndt_stats, read-only */ | ||
596 | NDTA_GC_INTERVAL, /* u64, msecs */ | ||
597 | __NDTA_MAX | ||
598 | }; | ||
599 | #define NDTA_MAX (__NDTA_MAX - 1) | ||
600 | |||
601 | #define NDTA_RTA(r) ((struct rtattr*)(((char*)(r)) + \ | ||
602 | NLMSG_ALIGN(sizeof(struct ndtmsg)))) | ||
603 | #define NDTA_PAYLOAD(n) NLMSG_PAYLOAD(n,sizeof(struct ndtmsg)) | ||
604 | |||
605 | |||
606 | /**** | 386 | /**** |
607 | * General form of address family dependent message. | 387 | * General form of address family dependent message. |
608 | ****/ | 388 | ****/ |
@@ -663,138 +443,6 @@ struct prefix_cacheinfo | |||
663 | __u32 valid_time; | 443 | __u32 valid_time; |
664 | }; | 444 | }; |
665 | 445 | ||
666 | /* The struct should be in sync with struct net_device_stats */ | ||
667 | struct rtnl_link_stats | ||
668 | { | ||
669 | __u32 rx_packets; /* total packets received */ | ||
670 | __u32 tx_packets; /* total packets transmitted */ | ||
671 | __u32 rx_bytes; /* total bytes received */ | ||
672 | __u32 tx_bytes; /* total bytes transmitted */ | ||
673 | __u32 rx_errors; /* bad packets received */ | ||
674 | __u32 tx_errors; /* packet transmit problems */ | ||
675 | __u32 rx_dropped; /* no space in linux buffers */ | ||
676 | __u32 tx_dropped; /* no space available in linux */ | ||
677 | __u32 multicast; /* multicast packets received */ | ||
678 | __u32 collisions; | ||
679 | |||
680 | /* detailed rx_errors: */ | ||
681 | __u32 rx_length_errors; | ||
682 | __u32 rx_over_errors; /* receiver ring buff overflow */ | ||
683 | __u32 rx_crc_errors; /* recved pkt with crc error */ | ||
684 | __u32 rx_frame_errors; /* recv'd frame alignment error */ | ||
685 | __u32 rx_fifo_errors; /* recv'r fifo overrun */ | ||
686 | __u32 rx_missed_errors; /* receiver missed packet */ | ||
687 | |||
688 | /* detailed tx_errors */ | ||
689 | __u32 tx_aborted_errors; | ||
690 | __u32 tx_carrier_errors; | ||
691 | __u32 tx_fifo_errors; | ||
692 | __u32 tx_heartbeat_errors; | ||
693 | __u32 tx_window_errors; | ||
694 | |||
695 | /* for cslip etc */ | ||
696 | __u32 rx_compressed; | ||
697 | __u32 tx_compressed; | ||
698 | }; | ||
699 | |||
700 | /* The struct should be in sync with struct ifmap */ | ||
701 | struct rtnl_link_ifmap | ||
702 | { | ||
703 | __u64 mem_start; | ||
704 | __u64 mem_end; | ||
705 | __u64 base_addr; | ||
706 | __u16 irq; | ||
707 | __u8 dma; | ||
708 | __u8 port; | ||
709 | }; | ||
710 | |||
711 | enum | ||
712 | { | ||
713 | IFLA_UNSPEC, | ||
714 | IFLA_ADDRESS, | ||
715 | IFLA_BROADCAST, | ||
716 | IFLA_IFNAME, | ||
717 | IFLA_MTU, | ||
718 | IFLA_LINK, | ||
719 | IFLA_QDISC, | ||
720 | IFLA_STATS, | ||
721 | IFLA_COST, | ||
722 | #define IFLA_COST IFLA_COST | ||
723 | IFLA_PRIORITY, | ||
724 | #define IFLA_PRIORITY IFLA_PRIORITY | ||
725 | IFLA_MASTER, | ||
726 | #define IFLA_MASTER IFLA_MASTER | ||
727 | IFLA_WIRELESS, /* Wireless Extension event - see wireless.h */ | ||
728 | #define IFLA_WIRELESS IFLA_WIRELESS | ||
729 | IFLA_PROTINFO, /* Protocol specific information for a link */ | ||
730 | #define IFLA_PROTINFO IFLA_PROTINFO | ||
731 | IFLA_TXQLEN, | ||
732 | #define IFLA_TXQLEN IFLA_TXQLEN | ||
733 | IFLA_MAP, | ||
734 | #define IFLA_MAP IFLA_MAP | ||
735 | IFLA_WEIGHT, | ||
736 | #define IFLA_WEIGHT IFLA_WEIGHT | ||
737 | IFLA_OPERSTATE, | ||
738 | IFLA_LINKMODE, | ||
739 | __IFLA_MAX | ||
740 | }; | ||
741 | |||
742 | |||
743 | #define IFLA_MAX (__IFLA_MAX - 1) | ||
744 | |||
745 | #define IFLA_RTA(r) ((struct rtattr*)(((char*)(r)) + NLMSG_ALIGN(sizeof(struct ifinfomsg)))) | ||
746 | #define IFLA_PAYLOAD(n) NLMSG_PAYLOAD(n,sizeof(struct ifinfomsg)) | ||
747 | |||
748 | /* ifi_flags. | ||
749 | |||
750 | IFF_* flags. | ||
751 | |||
752 | The only change is: | ||
753 | IFF_LOOPBACK, IFF_BROADCAST and IFF_POINTOPOINT are | ||
754 | more not changeable by user. They describe link media | ||
755 | characteristics and set by device driver. | ||
756 | |||
757 | Comments: | ||
758 | - Combination IFF_BROADCAST|IFF_POINTOPOINT is invalid | ||
759 | - If neither of these three flags are set; | ||
760 | the interface is NBMA. | ||
761 | |||
762 | - IFF_MULTICAST does not mean anything special: | ||
763 | multicasts can be used on all not-NBMA links. | ||
764 | IFF_MULTICAST means that this media uses special encapsulation | ||
765 | for multicast frames. Apparently, all IFF_POINTOPOINT and | ||
766 | IFF_BROADCAST devices are able to use multicasts too. | ||
767 | */ | ||
768 | |||
769 | /* IFLA_LINK. | ||
770 | For usual devices it is equal ifi_index. | ||
771 | If it is a "virtual interface" (f.e. tunnel), ifi_link | ||
772 | can point to real physical interface (f.e. for bandwidth calculations), | ||
773 | or maybe 0, what means, that real media is unknown (usual | ||
774 | for IPIP tunnels, when route to endpoint is allowed to change) | ||
775 | */ | ||
776 | |||
777 | /* Subtype attributes for IFLA_PROTINFO */ | ||
778 | enum | ||
779 | { | ||
780 | IFLA_INET6_UNSPEC, | ||
781 | IFLA_INET6_FLAGS, /* link flags */ | ||
782 | IFLA_INET6_CONF, /* sysctl parameters */ | ||
783 | IFLA_INET6_STATS, /* statistics */ | ||
784 | IFLA_INET6_MCAST, /* MC things. What of them? */ | ||
785 | IFLA_INET6_CACHEINFO, /* time values and max reasm size */ | ||
786 | __IFLA_INET6_MAX | ||
787 | }; | ||
788 | |||
789 | #define IFLA_INET6_MAX (__IFLA_INET6_MAX - 1) | ||
790 | |||
791 | struct ifla_cacheinfo | ||
792 | { | ||
793 | __u32 max_reasm_len; | ||
794 | __u32 tstamp; /* ipv6InterfaceTable updated timestamp */ | ||
795 | __u32 reachable_time; | ||
796 | __u32 retrans_time; | ||
797 | }; | ||
798 | 446 | ||
799 | /***************************************************************** | 447 | /***************************************************************** |
800 | * Traffic control messages. | 448 | * Traffic control messages. |
@@ -885,10 +533,13 @@ enum rtnetlink_groups { | |||
885 | RTNLGRP_NOP2, | 533 | RTNLGRP_NOP2, |
886 | RTNLGRP_DECnet_ROUTE, | 534 | RTNLGRP_DECnet_ROUTE, |
887 | #define RTNLGRP_DECnet_ROUTE RTNLGRP_DECnet_ROUTE | 535 | #define RTNLGRP_DECnet_ROUTE RTNLGRP_DECnet_ROUTE |
888 | RTNLGRP_NOP3, | 536 | RTNLGRP_DECnet_RULE, |
537 | #define RTNLGRP_DECnet_RULE RTNLGRP_DECnet_RULE | ||
889 | RTNLGRP_NOP4, | 538 | RTNLGRP_NOP4, |
890 | RTNLGRP_IPV6_PREFIX, | 539 | RTNLGRP_IPV6_PREFIX, |
891 | #define RTNLGRP_IPV6_PREFIX RTNLGRP_IPV6_PREFIX | 540 | #define RTNLGRP_IPV6_PREFIX RTNLGRP_IPV6_PREFIX |
541 | RTNLGRP_IPV6_RULE, | ||
542 | #define RTNLGRP_IPV6_RULE RTNLGRP_IPV6_RULE | ||
892 | __RTNLGRP_MAX | 543 | __RTNLGRP_MAX |
893 | }; | 544 | }; |
894 | #define RTNLGRP_MAX (__RTNLGRP_MAX - 1) | 545 | #define RTNLGRP_MAX (__RTNLGRP_MAX - 1) |
@@ -923,8 +574,6 @@ extern int rtattr_parse(struct rtattr *tb[], int maxattr, struct rtattr *rta, in | |||
923 | #define rtattr_parse_nested(tb, max, rta) \ | 574 | #define rtattr_parse_nested(tb, max, rta) \ |
924 | rtattr_parse((tb), (max), RTA_DATA((rta)), RTA_PAYLOAD((rta))) | 575 | rtattr_parse((tb), (max), RTA_DATA((rta)), RTA_PAYLOAD((rta))) |
925 | 576 | ||
926 | extern struct sock *rtnl; | ||
927 | |||
928 | struct rtnetlink_link | 577 | struct rtnetlink_link |
929 | { | 578 | { |
930 | int (*doit)(struct sk_buff *, struct nlmsghdr*, void *attr); | 579 | int (*doit)(struct sk_buff *, struct nlmsghdr*, void *attr); |
@@ -933,6 +582,10 @@ struct rtnetlink_link | |||
933 | 582 | ||
934 | extern struct rtnetlink_link * rtnetlink_links[NPROTO]; | 583 | extern struct rtnetlink_link * rtnetlink_links[NPROTO]; |
935 | extern int rtnetlink_send(struct sk_buff *skb, u32 pid, u32 group, int echo); | 584 | extern int rtnetlink_send(struct sk_buff *skb, u32 pid, u32 group, int echo); |
585 | extern int rtnl_unicast(struct sk_buff *skb, u32 pid); | ||
586 | extern int rtnl_notify(struct sk_buff *skb, u32 pid, u32 group, | ||
587 | struct nlmsghdr *nlh, gfp_t flags); | ||
588 | extern void rtnl_set_sk_err(u32 group, int error); | ||
936 | extern int rtnetlink_put_metrics(struct sk_buff *skb, u32 *metrics); | 589 | extern int rtnetlink_put_metrics(struct sk_buff *skb, u32 *metrics); |
937 | 590 | ||
938 | extern void __rta_fill(struct sk_buff *skb, int attrtype, int attrlen, const void *data); | 591 | extern void __rta_fill(struct sk_buff *skb, int attrtype, int attrlen, const void *data); |
@@ -1065,6 +718,13 @@ extern void __rtnl_unlock(void); | |||
1065 | } \ | 718 | } \ |
1066 | } while(0) | 719 | } while(0) |
1067 | 720 | ||
721 | static inline u32 rtm_get_table(struct rtattr **rta, u8 table) | ||
722 | { | ||
723 | return RTA_GET_U32(rta[RTA_TABLE-1]); | ||
724 | rtattr_failure: | ||
725 | return table; | ||
726 | } | ||
727 | |||
1068 | #endif /* __KERNEL__ */ | 728 | #endif /* __KERNEL__ */ |
1069 | 729 | ||
1070 | 730 | ||
diff --git a/include/linux/scatterlist.h b/include/linux/scatterlist.h index 66ff545552f7..4efbd9c445f5 100644 --- a/include/linux/scatterlist.h +++ b/include/linux/scatterlist.h | |||
@@ -5,7 +5,7 @@ | |||
5 | #include <linux/mm.h> | 5 | #include <linux/mm.h> |
6 | #include <linux/string.h> | 6 | #include <linux/string.h> |
7 | 7 | ||
8 | static inline void sg_set_buf(struct scatterlist *sg, void *buf, | 8 | static inline void sg_set_buf(struct scatterlist *sg, const void *buf, |
9 | unsigned int buflen) | 9 | unsigned int buflen) |
10 | { | 10 | { |
11 | sg->page = virt_to_page(buf); | 11 | sg->page = virt_to_page(buf); |
@@ -13,7 +13,7 @@ static inline void sg_set_buf(struct scatterlist *sg, void *buf, | |||
13 | sg->length = buflen; | 13 | sg->length = buflen; |
14 | } | 14 | } |
15 | 15 | ||
16 | static inline void sg_init_one(struct scatterlist *sg, void *buf, | 16 | static inline void sg_init_one(struct scatterlist *sg, const void *buf, |
17 | unsigned int buflen) | 17 | unsigned int buflen) |
18 | { | 18 | { |
19 | memset(sg, 0, sizeof(*sg)); | 19 | memset(sg, 0, sizeof(*sg)); |
diff --git a/include/linux/security.h b/include/linux/security.h index 6bc2aad494ff..9f56fb8a4a6c 100644 --- a/include/linux/security.h +++ b/include/linux/security.h | |||
@@ -31,6 +31,8 @@ | |||
31 | #include <linux/msg.h> | 31 | #include <linux/msg.h> |
32 | #include <linux/sched.h> | 32 | #include <linux/sched.h> |
33 | #include <linux/key.h> | 33 | #include <linux/key.h> |
34 | #include <linux/xfrm.h> | ||
35 | #include <net/flow.h> | ||
34 | 36 | ||
35 | struct ctl_table; | 37 | struct ctl_table; |
36 | 38 | ||
@@ -88,6 +90,7 @@ extern int cap_netlink_recv(struct sk_buff *skb, int cap); | |||
88 | struct nfsctl_arg; | 90 | struct nfsctl_arg; |
89 | struct sched_param; | 91 | struct sched_param; |
90 | struct swap_info_struct; | 92 | struct swap_info_struct; |
93 | struct request_sock; | ||
91 | 94 | ||
92 | /* bprm_apply_creds unsafe reasons */ | 95 | /* bprm_apply_creds unsafe reasons */ |
93 | #define LSM_UNSAFE_SHARE 1 | 96 | #define LSM_UNSAFE_SHARE 1 |
@@ -812,9 +815,19 @@ struct swap_info_struct; | |||
812 | * which is used to copy security attributes between local stream sockets. | 815 | * which is used to copy security attributes between local stream sockets. |
813 | * @sk_free_security: | 816 | * @sk_free_security: |
814 | * Deallocate security structure. | 817 | * Deallocate security structure. |
815 | * @sk_getsid: | 818 | * @sk_clone_security: |
816 | * Retrieve the LSM-specific sid for the sock to enable caching of network | 819 | * Clone/copy security structure. |
820 | * @sk_getsecid: | ||
821 | * Retrieve the LSM-specific secid for the sock to enable caching of network | ||
817 | * authorizations. | 822 | * authorizations. |
823 | * @sock_graft: | ||
824 | * Sets the socket's isec sid to the sock's sid. | ||
825 | * @inet_conn_request: | ||
826 | * Sets the openreq's sid to socket's sid with MLS portion taken from peer sid. | ||
827 | * @inet_csk_clone: | ||
828 | * Sets the new child socket's sid to the openreq sid. | ||
829 | * @req_classify_flow: | ||
830 | * Sets the flow's sid to the openreq sid. | ||
818 | * | 831 | * |
819 | * Security hooks for XFRM operations. | 832 | * Security hooks for XFRM operations. |
820 | * | 833 | * |
@@ -823,9 +836,10 @@ struct swap_info_struct; | |||
823 | * used by the XFRM system. | 836 | * used by the XFRM system. |
824 | * @sec_ctx contains the security context information being provided by | 837 | * @sec_ctx contains the security context information being provided by |
825 | * the user-level policy update program (e.g., setkey). | 838 | * the user-level policy update program (e.g., setkey). |
826 | * Allocate a security structure to the xp->security field. | 839 | * @sk refers to the sock from which to derive the security context. |
827 | * The security field is initialized to NULL when the xfrm_policy is | 840 | * Allocate a security structure to the xp->security field; the security |
828 | * allocated. | 841 | * field is initialized to NULL when the xfrm_policy is allocated. Only |
842 | * one of sec_ctx or sock can be specified. | ||
829 | * Return 0 if operation was successful (memory to allocate, legal context) | 843 | * Return 0 if operation was successful (memory to allocate, legal context) |
830 | * @xfrm_policy_clone_security: | 844 | * @xfrm_policy_clone_security: |
831 | * @old contains an existing xfrm_policy in the SPD. | 845 | * @old contains an existing xfrm_policy in the SPD. |
@@ -844,9 +858,14 @@ struct swap_info_struct; | |||
844 | * Database by the XFRM system. | 858 | * Database by the XFRM system. |
845 | * @sec_ctx contains the security context information being provided by | 859 | * @sec_ctx contains the security context information being provided by |
846 | * the user-level SA generation program (e.g., setkey or racoon). | 860 | * the user-level SA generation program (e.g., setkey or racoon). |
847 | * Allocate a security structure to the x->security field. The | 861 | * @polsec contains the security context information associated with a xfrm |
848 | * security field is initialized to NULL when the xfrm_state is | 862 | * policy rule from which to take the base context. polsec must be NULL |
849 | * allocated. | 863 | * when sec_ctx is specified. |
864 | * @secid contains the secid from which to take the mls portion of the context. | ||
865 | * Allocate a security structure to the x->security field; the security | ||
866 | * field is initialized to NULL when the xfrm_state is allocated. Set the | ||
867 | * context to correspond to either sec_ctx or polsec, with the mls portion | ||
868 | * taken from secid in the latter case. | ||
850 | * Return 0 if operation was successful (memory to allocate, legal context). | 869 | * Return 0 if operation was successful (memory to allocate, legal context). |
851 | * @xfrm_state_free_security: | 870 | * @xfrm_state_free_security: |
852 | * @x contains the xfrm_state. | 871 | * @x contains the xfrm_state. |
@@ -857,13 +876,27 @@ struct swap_info_struct; | |||
857 | * @xfrm_policy_lookup: | 876 | * @xfrm_policy_lookup: |
858 | * @xp contains the xfrm_policy for which the access control is being | 877 | * @xp contains the xfrm_policy for which the access control is being |
859 | * checked. | 878 | * checked. |
860 | * @sk_sid contains the sock security label that is used to authorize | 879 | * @fl_secid contains the flow security label that is used to authorize |
861 | * access to the policy xp. | 880 | * access to the policy xp. |
862 | * @dir contains the direction of the flow (input or output). | 881 | * @dir contains the direction of the flow (input or output). |
863 | * Check permission when a sock selects a xfrm_policy for processing | 882 | * Check permission when a flow selects a xfrm_policy for processing |
864 | * XFRMs on a packet. The hook is called when selecting either a | 883 | * XFRMs on a packet. The hook is called when selecting either a |
865 | * per-socket policy or a generic xfrm policy. | 884 | * per-socket policy or a generic xfrm policy. |
866 | * Return 0 if permission is granted. | 885 | * Return 0 if permission is granted. |
886 | * @xfrm_state_pol_flow_match: | ||
887 | * @x contains the state to match. | ||
888 | * @xp contains the policy to check for a match. | ||
889 | * @fl contains the flow to check for a match. | ||
890 | * Return 1 if there is a match. | ||
891 | * @xfrm_flow_state_match: | ||
892 | * @fl contains the flow key to match. | ||
893 | * @xfrm points to the xfrm_state to match. | ||
894 | * Return 1 if there is a match. | ||
895 | * @xfrm_decode_session: | ||
896 | * @skb points to skb to decode. | ||
897 | * @secid points to the flow key secid to set. | ||
898 | * @ckall says if all xfrms used should be checked for same secid. | ||
899 | * Return 0 if ckall is zero or all xfrms used have the same secid. | ||
867 | * | 900 | * |
868 | * Security hooks affecting all Key Management operations | 901 | * Security hooks affecting all Key Management operations |
869 | * | 902 | * |
@@ -1308,8 +1341,8 @@ struct security_operations { | |||
1308 | int (*unix_may_send) (struct socket * sock, struct socket * other); | 1341 | int (*unix_may_send) (struct socket * sock, struct socket * other); |
1309 | 1342 | ||
1310 | int (*socket_create) (int family, int type, int protocol, int kern); | 1343 | int (*socket_create) (int family, int type, int protocol, int kern); |
1311 | void (*socket_post_create) (struct socket * sock, int family, | 1344 | int (*socket_post_create) (struct socket * sock, int family, |
1312 | int type, int protocol, int kern); | 1345 | int type, int protocol, int kern); |
1313 | int (*socket_bind) (struct socket * sock, | 1346 | int (*socket_bind) (struct socket * sock, |
1314 | struct sockaddr * address, int addrlen); | 1347 | struct sockaddr * address, int addrlen); |
1315 | int (*socket_connect) (struct socket * sock, | 1348 | int (*socket_connect) (struct socket * sock, |
@@ -1332,18 +1365,31 @@ struct security_operations { | |||
1332 | int (*socket_getpeersec_dgram) (struct socket *sock, struct sk_buff *skb, u32 *secid); | 1365 | int (*socket_getpeersec_dgram) (struct socket *sock, struct sk_buff *skb, u32 *secid); |
1333 | int (*sk_alloc_security) (struct sock *sk, int family, gfp_t priority); | 1366 | int (*sk_alloc_security) (struct sock *sk, int family, gfp_t priority); |
1334 | void (*sk_free_security) (struct sock *sk); | 1367 | void (*sk_free_security) (struct sock *sk); |
1335 | unsigned int (*sk_getsid) (struct sock *sk, struct flowi *fl, u8 dir); | 1368 | void (*sk_clone_security) (const struct sock *sk, struct sock *newsk); |
1369 | void (*sk_getsecid) (struct sock *sk, u32 *secid); | ||
1370 | void (*sock_graft)(struct sock* sk, struct socket *parent); | ||
1371 | int (*inet_conn_request)(struct sock *sk, struct sk_buff *skb, | ||
1372 | struct request_sock *req); | ||
1373 | void (*inet_csk_clone)(struct sock *newsk, const struct request_sock *req); | ||
1374 | void (*req_classify_flow)(const struct request_sock *req, struct flowi *fl); | ||
1336 | #endif /* CONFIG_SECURITY_NETWORK */ | 1375 | #endif /* CONFIG_SECURITY_NETWORK */ |
1337 | 1376 | ||
1338 | #ifdef CONFIG_SECURITY_NETWORK_XFRM | 1377 | #ifdef CONFIG_SECURITY_NETWORK_XFRM |
1339 | int (*xfrm_policy_alloc_security) (struct xfrm_policy *xp, struct xfrm_user_sec_ctx *sec_ctx); | 1378 | int (*xfrm_policy_alloc_security) (struct xfrm_policy *xp, |
1379 | struct xfrm_user_sec_ctx *sec_ctx, struct sock *sk); | ||
1340 | int (*xfrm_policy_clone_security) (struct xfrm_policy *old, struct xfrm_policy *new); | 1380 | int (*xfrm_policy_clone_security) (struct xfrm_policy *old, struct xfrm_policy *new); |
1341 | void (*xfrm_policy_free_security) (struct xfrm_policy *xp); | 1381 | void (*xfrm_policy_free_security) (struct xfrm_policy *xp); |
1342 | int (*xfrm_policy_delete_security) (struct xfrm_policy *xp); | 1382 | int (*xfrm_policy_delete_security) (struct xfrm_policy *xp); |
1343 | int (*xfrm_state_alloc_security) (struct xfrm_state *x, struct xfrm_user_sec_ctx *sec_ctx); | 1383 | int (*xfrm_state_alloc_security) (struct xfrm_state *x, |
1384 | struct xfrm_user_sec_ctx *sec_ctx, struct xfrm_sec_ctx *polsec, | ||
1385 | u32 secid); | ||
1344 | void (*xfrm_state_free_security) (struct xfrm_state *x); | 1386 | void (*xfrm_state_free_security) (struct xfrm_state *x); |
1345 | int (*xfrm_state_delete_security) (struct xfrm_state *x); | 1387 | int (*xfrm_state_delete_security) (struct xfrm_state *x); |
1346 | int (*xfrm_policy_lookup)(struct xfrm_policy *xp, u32 sk_sid, u8 dir); | 1388 | int (*xfrm_policy_lookup)(struct xfrm_policy *xp, u32 fl_secid, u8 dir); |
1389 | int (*xfrm_state_pol_flow_match)(struct xfrm_state *x, | ||
1390 | struct xfrm_policy *xp, struct flowi *fl); | ||
1391 | int (*xfrm_flow_state_match)(struct flowi *fl, struct xfrm_state *xfrm); | ||
1392 | int (*xfrm_decode_session)(struct sk_buff *skb, u32 *secid, int ckall); | ||
1347 | #endif /* CONFIG_SECURITY_NETWORK_XFRM */ | 1393 | #endif /* CONFIG_SECURITY_NETWORK_XFRM */ |
1348 | 1394 | ||
1349 | /* key management security hooks */ | 1395 | /* key management security hooks */ |
@@ -2778,13 +2824,13 @@ static inline int security_socket_create (int family, int type, | |||
2778 | return security_ops->socket_create(family, type, protocol, kern); | 2824 | return security_ops->socket_create(family, type, protocol, kern); |
2779 | } | 2825 | } |
2780 | 2826 | ||
2781 | static inline void security_socket_post_create(struct socket * sock, | 2827 | static inline int security_socket_post_create(struct socket * sock, |
2782 | int family, | 2828 | int family, |
2783 | int type, | 2829 | int type, |
2784 | int protocol, int kern) | 2830 | int protocol, int kern) |
2785 | { | 2831 | { |
2786 | security_ops->socket_post_create(sock, family, type, | 2832 | return security_ops->socket_post_create(sock, family, type, |
2787 | protocol, kern); | 2833 | protocol, kern); |
2788 | } | 2834 | } |
2789 | 2835 | ||
2790 | static inline int security_socket_bind(struct socket * sock, | 2836 | static inline int security_socket_bind(struct socket * sock, |
@@ -2885,9 +2931,36 @@ static inline void security_sk_free(struct sock *sk) | |||
2885 | return security_ops->sk_free_security(sk); | 2931 | return security_ops->sk_free_security(sk); |
2886 | } | 2932 | } |
2887 | 2933 | ||
2888 | static inline unsigned int security_sk_sid(struct sock *sk, struct flowi *fl, u8 dir) | 2934 | static inline void security_sk_clone(const struct sock *sk, struct sock *newsk) |
2935 | { | ||
2936 | return security_ops->sk_clone_security(sk, newsk); | ||
2937 | } | ||
2938 | |||
2939 | static inline void security_sk_classify_flow(struct sock *sk, struct flowi *fl) | ||
2889 | { | 2940 | { |
2890 | return security_ops->sk_getsid(sk, fl, dir); | 2941 | security_ops->sk_getsecid(sk, &fl->secid); |
2942 | } | ||
2943 | |||
2944 | static inline void security_req_classify_flow(const struct request_sock *req, struct flowi *fl) | ||
2945 | { | ||
2946 | security_ops->req_classify_flow(req, fl); | ||
2947 | } | ||
2948 | |||
2949 | static inline void security_sock_graft(struct sock* sk, struct socket *parent) | ||
2950 | { | ||
2951 | security_ops->sock_graft(sk, parent); | ||
2952 | } | ||
2953 | |||
2954 | static inline int security_inet_conn_request(struct sock *sk, | ||
2955 | struct sk_buff *skb, struct request_sock *req) | ||
2956 | { | ||
2957 | return security_ops->inet_conn_request(sk, skb, req); | ||
2958 | } | ||
2959 | |||
2960 | static inline void security_inet_csk_clone(struct sock *newsk, | ||
2961 | const struct request_sock *req) | ||
2962 | { | ||
2963 | security_ops->inet_csk_clone(newsk, req); | ||
2891 | } | 2964 | } |
2892 | #else /* CONFIG_SECURITY_NETWORK */ | 2965 | #else /* CONFIG_SECURITY_NETWORK */ |
2893 | static inline int security_unix_stream_connect(struct socket * sock, | 2966 | static inline int security_unix_stream_connect(struct socket * sock, |
@@ -2909,11 +2982,12 @@ static inline int security_socket_create (int family, int type, | |||
2909 | return 0; | 2982 | return 0; |
2910 | } | 2983 | } |
2911 | 2984 | ||
2912 | static inline void security_socket_post_create(struct socket * sock, | 2985 | static inline int security_socket_post_create(struct socket * sock, |
2913 | int family, | 2986 | int family, |
2914 | int type, | 2987 | int type, |
2915 | int protocol, int kern) | 2988 | int protocol, int kern) |
2916 | { | 2989 | { |
2990 | return 0; | ||
2917 | } | 2991 | } |
2918 | 2992 | ||
2919 | static inline int security_socket_bind(struct socket * sock, | 2993 | static inline int security_socket_bind(struct socket * sock, |
@@ -3011,16 +3085,43 @@ static inline void security_sk_free(struct sock *sk) | |||
3011 | { | 3085 | { |
3012 | } | 3086 | } |
3013 | 3087 | ||
3014 | static inline unsigned int security_sk_sid(struct sock *sk, struct flowi *fl, u8 dir) | 3088 | static inline void security_sk_clone(const struct sock *sk, struct sock *newsk) |
3089 | { | ||
3090 | } | ||
3091 | |||
3092 | static inline void security_sk_classify_flow(struct sock *sk, struct flowi *fl) | ||
3093 | { | ||
3094 | } | ||
3095 | |||
3096 | static inline void security_req_classify_flow(const struct request_sock *req, struct flowi *fl) | ||
3097 | { | ||
3098 | } | ||
3099 | |||
3100 | static inline void security_sock_graft(struct sock* sk, struct socket *parent) | ||
3101 | { | ||
3102 | } | ||
3103 | |||
3104 | static inline int security_inet_conn_request(struct sock *sk, | ||
3105 | struct sk_buff *skb, struct request_sock *req) | ||
3015 | { | 3106 | { |
3016 | return 0; | 3107 | return 0; |
3017 | } | 3108 | } |
3109 | |||
3110 | static inline void security_inet_csk_clone(struct sock *newsk, | ||
3111 | const struct request_sock *req) | ||
3112 | { | ||
3113 | } | ||
3018 | #endif /* CONFIG_SECURITY_NETWORK */ | 3114 | #endif /* CONFIG_SECURITY_NETWORK */ |
3019 | 3115 | ||
3020 | #ifdef CONFIG_SECURITY_NETWORK_XFRM | 3116 | #ifdef CONFIG_SECURITY_NETWORK_XFRM |
3021 | static inline int security_xfrm_policy_alloc(struct xfrm_policy *xp, struct xfrm_user_sec_ctx *sec_ctx) | 3117 | static inline int security_xfrm_policy_alloc(struct xfrm_policy *xp, struct xfrm_user_sec_ctx *sec_ctx) |
3022 | { | 3118 | { |
3023 | return security_ops->xfrm_policy_alloc_security(xp, sec_ctx); | 3119 | return security_ops->xfrm_policy_alloc_security(xp, sec_ctx, NULL); |
3120 | } | ||
3121 | |||
3122 | static inline int security_xfrm_sock_policy_alloc(struct xfrm_policy *xp, struct sock *sk) | ||
3123 | { | ||
3124 | return security_ops->xfrm_policy_alloc_security(xp, NULL, sk); | ||
3024 | } | 3125 | } |
3025 | 3126 | ||
3026 | static inline int security_xfrm_policy_clone(struct xfrm_policy *old, struct xfrm_policy *new) | 3127 | static inline int security_xfrm_policy_clone(struct xfrm_policy *old, struct xfrm_policy *new) |
@@ -3038,9 +3139,18 @@ static inline int security_xfrm_policy_delete(struct xfrm_policy *xp) | |||
3038 | return security_ops->xfrm_policy_delete_security(xp); | 3139 | return security_ops->xfrm_policy_delete_security(xp); |
3039 | } | 3140 | } |
3040 | 3141 | ||
3041 | static inline int security_xfrm_state_alloc(struct xfrm_state *x, struct xfrm_user_sec_ctx *sec_ctx) | 3142 | static inline int security_xfrm_state_alloc(struct xfrm_state *x, |
3143 | struct xfrm_user_sec_ctx *sec_ctx) | ||
3042 | { | 3144 | { |
3043 | return security_ops->xfrm_state_alloc_security(x, sec_ctx); | 3145 | return security_ops->xfrm_state_alloc_security(x, sec_ctx, NULL, 0); |
3146 | } | ||
3147 | |||
3148 | static inline int security_xfrm_state_alloc_acquire(struct xfrm_state *x, | ||
3149 | struct xfrm_sec_ctx *polsec, u32 secid) | ||
3150 | { | ||
3151 | if (!polsec) | ||
3152 | return 0; | ||
3153 | return security_ops->xfrm_state_alloc_security(x, NULL, polsec, secid); | ||
3044 | } | 3154 | } |
3045 | 3155 | ||
3046 | static inline int security_xfrm_state_delete(struct xfrm_state *x) | 3156 | static inline int security_xfrm_state_delete(struct xfrm_state *x) |
@@ -3053,9 +3163,32 @@ static inline void security_xfrm_state_free(struct xfrm_state *x) | |||
3053 | security_ops->xfrm_state_free_security(x); | 3163 | security_ops->xfrm_state_free_security(x); |
3054 | } | 3164 | } |
3055 | 3165 | ||
3056 | static inline int security_xfrm_policy_lookup(struct xfrm_policy *xp, u32 sk_sid, u8 dir) | 3166 | static inline int security_xfrm_policy_lookup(struct xfrm_policy *xp, u32 fl_secid, u8 dir) |
3167 | { | ||
3168 | return security_ops->xfrm_policy_lookup(xp, fl_secid, dir); | ||
3169 | } | ||
3170 | |||
3171 | static inline int security_xfrm_state_pol_flow_match(struct xfrm_state *x, | ||
3172 | struct xfrm_policy *xp, struct flowi *fl) | ||
3057 | { | 3173 | { |
3058 | return security_ops->xfrm_policy_lookup(xp, sk_sid, dir); | 3174 | return security_ops->xfrm_state_pol_flow_match(x, xp, fl); |
3175 | } | ||
3176 | |||
3177 | static inline int security_xfrm_flow_state_match(struct flowi *fl, struct xfrm_state *xfrm) | ||
3178 | { | ||
3179 | return security_ops->xfrm_flow_state_match(fl, xfrm); | ||
3180 | } | ||
3181 | |||
3182 | static inline int security_xfrm_decode_session(struct sk_buff *skb, u32 *secid) | ||
3183 | { | ||
3184 | return security_ops->xfrm_decode_session(skb, secid, 1); | ||
3185 | } | ||
3186 | |||
3187 | static inline void security_skb_classify_flow(struct sk_buff *skb, struct flowi *fl) | ||
3188 | { | ||
3189 | int rc = security_ops->xfrm_decode_session(skb, &fl->secid, 0); | ||
3190 | |||
3191 | BUG_ON(rc); | ||
3059 | } | 3192 | } |
3060 | #else /* CONFIG_SECURITY_NETWORK_XFRM */ | 3193 | #else /* CONFIG_SECURITY_NETWORK_XFRM */ |
3061 | static inline int security_xfrm_policy_alloc(struct xfrm_policy *xp, struct xfrm_user_sec_ctx *sec_ctx) | 3194 | static inline int security_xfrm_policy_alloc(struct xfrm_policy *xp, struct xfrm_user_sec_ctx *sec_ctx) |
@@ -3063,6 +3196,11 @@ static inline int security_xfrm_policy_alloc(struct xfrm_policy *xp, struct xfrm | |||
3063 | return 0; | 3196 | return 0; |
3064 | } | 3197 | } |
3065 | 3198 | ||
3199 | static inline int security_xfrm_sock_policy_alloc(struct xfrm_policy *xp, struct sock *sk) | ||
3200 | { | ||
3201 | return 0; | ||
3202 | } | ||
3203 | |||
3066 | static inline int security_xfrm_policy_clone(struct xfrm_policy *old, struct xfrm_policy *new) | 3204 | static inline int security_xfrm_policy_clone(struct xfrm_policy *old, struct xfrm_policy *new) |
3067 | { | 3205 | { |
3068 | return 0; | 3206 | return 0; |
@@ -3077,7 +3215,14 @@ static inline int security_xfrm_policy_delete(struct xfrm_policy *xp) | |||
3077 | return 0; | 3215 | return 0; |
3078 | } | 3216 | } |
3079 | 3217 | ||
3080 | static inline int security_xfrm_state_alloc(struct xfrm_state *x, struct xfrm_user_sec_ctx *sec_ctx) | 3218 | static inline int security_xfrm_state_alloc(struct xfrm_state *x, |
3219 | struct xfrm_user_sec_ctx *sec_ctx) | ||
3220 | { | ||
3221 | return 0; | ||
3222 | } | ||
3223 | |||
3224 | static inline int security_xfrm_state_alloc_acquire(struct xfrm_state *x, | ||
3225 | struct xfrm_sec_ctx *polsec, u32 secid) | ||
3081 | { | 3226 | { |
3082 | return 0; | 3227 | return 0; |
3083 | } | 3228 | } |
@@ -3091,10 +3236,32 @@ static inline int security_xfrm_state_delete(struct xfrm_state *x) | |||
3091 | return 0; | 3236 | return 0; |
3092 | } | 3237 | } |
3093 | 3238 | ||
3094 | static inline int security_xfrm_policy_lookup(struct xfrm_policy *xp, u32 sk_sid, u8 dir) | 3239 | static inline int security_xfrm_policy_lookup(struct xfrm_policy *xp, u32 fl_secid, u8 dir) |
3240 | { | ||
3241 | return 0; | ||
3242 | } | ||
3243 | |||
3244 | static inline int security_xfrm_state_pol_flow_match(struct xfrm_state *x, | ||
3245 | struct xfrm_policy *xp, struct flowi *fl) | ||
3246 | { | ||
3247 | return 1; | ||
3248 | } | ||
3249 | |||
3250 | static inline int security_xfrm_flow_state_match(struct flowi *fl, | ||
3251 | struct xfrm_state *xfrm) | ||
3252 | { | ||
3253 | return 1; | ||
3254 | } | ||
3255 | |||
3256 | static inline int security_xfrm_decode_session(struct sk_buff *skb, u32 *secid) | ||
3095 | { | 3257 | { |
3096 | return 0; | 3258 | return 0; |
3097 | } | 3259 | } |
3260 | |||
3261 | static inline void security_skb_classify_flow(struct sk_buff *skb, struct flowi *fl) | ||
3262 | { | ||
3263 | } | ||
3264 | |||
3098 | #endif /* CONFIG_SECURITY_NETWORK_XFRM */ | 3265 | #endif /* CONFIG_SECURITY_NETWORK_XFRM */ |
3099 | 3266 | ||
3100 | #ifdef CONFIG_KEYS | 3267 | #ifdef CONFIG_KEYS |
diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h index 755e9cddac47..85577a4ffa61 100644 --- a/include/linux/skbuff.h +++ b/include/linux/skbuff.h | |||
@@ -34,8 +34,9 @@ | |||
34 | #define HAVE_ALIGNABLE_SKB /* Ditto 8) */ | 34 | #define HAVE_ALIGNABLE_SKB /* Ditto 8) */ |
35 | 35 | ||
36 | #define CHECKSUM_NONE 0 | 36 | #define CHECKSUM_NONE 0 |
37 | #define CHECKSUM_HW 1 | 37 | #define CHECKSUM_PARTIAL 1 |
38 | #define CHECKSUM_UNNECESSARY 2 | 38 | #define CHECKSUM_UNNECESSARY 2 |
39 | #define CHECKSUM_COMPLETE 3 | ||
39 | 40 | ||
40 | #define SKB_DATA_ALIGN(X) (((X) + (SMP_CACHE_BYTES - 1)) & \ | 41 | #define SKB_DATA_ALIGN(X) (((X) + (SMP_CACHE_BYTES - 1)) & \ |
41 | ~(SMP_CACHE_BYTES - 1)) | 42 | ~(SMP_CACHE_BYTES - 1)) |
@@ -56,17 +57,17 @@ | |||
56 | * Apparently with secret goal to sell you new device, when you | 57 | * Apparently with secret goal to sell you new device, when you |
57 | * will add new protocol to your host. F.e. IPv6. 8) | 58 | * will add new protocol to your host. F.e. IPv6. 8) |
58 | * | 59 | * |
59 | * HW: the most generic way. Device supplied checksum of _all_ | 60 | * COMPLETE: the most generic way. Device supplied checksum of _all_ |
60 | * the packet as seen by netif_rx in skb->csum. | 61 | * the packet as seen by netif_rx in skb->csum. |
61 | * NOTE: Even if device supports only some protocols, but | 62 | * NOTE: Even if device supports only some protocols, but |
62 | * is able to produce some skb->csum, it MUST use HW, | 63 | * is able to produce some skb->csum, it MUST use COMPLETE, |
63 | * not UNNECESSARY. | 64 | * not UNNECESSARY. |
64 | * | 65 | * |
65 | * B. Checksumming on output. | 66 | * B. Checksumming on output. |
66 | * | 67 | * |
67 | * NONE: skb is checksummed by protocol or csum is not required. | 68 | * NONE: skb is checksummed by protocol or csum is not required. |
68 | * | 69 | * |
69 | * HW: device is required to csum packet as seen by hard_start_xmit | 70 | * PARTIAL: device is required to csum packet as seen by hard_start_xmit |
70 | * from skb->h.raw to the end and to record the checksum | 71 | * from skb->h.raw to the end and to record the checksum |
71 | * at skb->h.raw+skb->csum. | 72 | * at skb->h.raw+skb->csum. |
72 | * | 73 | * |
@@ -1261,14 +1262,14 @@ static inline int skb_linearize_cow(struct sk_buff *skb) | |||
1261 | * @len: length of data pulled | 1262 | * @len: length of data pulled |
1262 | * | 1263 | * |
1263 | * After doing a pull on a received packet, you need to call this to | 1264 | * After doing a pull on a received packet, you need to call this to |
1264 | * update the CHECKSUM_HW checksum, or set ip_summed to CHECKSUM_NONE | 1265 | * update the CHECKSUM_COMPLETE checksum, or set ip_summed to |
1265 | * so that it can be recomputed from scratch. | 1266 | * CHECKSUM_NONE so that it can be recomputed from scratch. |
1266 | */ | 1267 | */ |
1267 | 1268 | ||
1268 | static inline void skb_postpull_rcsum(struct sk_buff *skb, | 1269 | static inline void skb_postpull_rcsum(struct sk_buff *skb, |
1269 | const void *start, unsigned int len) | 1270 | const void *start, unsigned int len) |
1270 | { | 1271 | { |
1271 | if (skb->ip_summed == CHECKSUM_HW) | 1272 | if (skb->ip_summed == CHECKSUM_COMPLETE) |
1272 | skb->csum = csum_sub(skb->csum, csum_partial(start, len, 0)); | 1273 | skb->csum = csum_sub(skb->csum, csum_partial(start, len, 0)); |
1273 | } | 1274 | } |
1274 | 1275 | ||
@@ -1287,7 +1288,7 @@ static inline int pskb_trim_rcsum(struct sk_buff *skb, unsigned int len) | |||
1287 | { | 1288 | { |
1288 | if (likely(len >= skb->len)) | 1289 | if (likely(len >= skb->len)) |
1289 | return 0; | 1290 | return 0; |
1290 | if (skb->ip_summed == CHECKSUM_HW) | 1291 | if (skb->ip_summed == CHECKSUM_COMPLETE) |
1291 | skb->ip_summed = CHECKSUM_NONE; | 1292 | skb->ip_summed = CHECKSUM_NONE; |
1292 | return __pskb_trim(skb, len); | 1293 | return __pskb_trim(skb, len); |
1293 | } | 1294 | } |
diff --git a/include/linux/smb.h b/include/linux/smb.h index b0162208c963..6df3b1501559 100644 --- a/include/linux/smb.h +++ b/include/linux/smb.h | |||
@@ -10,6 +10,7 @@ | |||
10 | #define _LINUX_SMB_H | 10 | #define _LINUX_SMB_H |
11 | 11 | ||
12 | #include <linux/types.h> | 12 | #include <linux/types.h> |
13 | #include <linux/magic.h> | ||
13 | 14 | ||
14 | enum smb_protocol { | 15 | enum smb_protocol { |
15 | SMB_PROTOCOL_NONE, | 16 | SMB_PROTOCOL_NONE, |
@@ -101,8 +102,6 @@ enum smb_conn_state { | |||
101 | CONN_RETRYING /* Currently trying to reconnect */ | 102 | CONN_RETRYING /* Currently trying to reconnect */ |
102 | }; | 103 | }; |
103 | 104 | ||
104 | #define SMB_SUPER_MAGIC 0x517B | ||
105 | |||
106 | #define SMB_HEADER_LEN 37 /* includes everything up to, but not | 105 | #define SMB_HEADER_LEN 37 /* includes everything up to, but not |
107 | * including smb_bcc */ | 106 | * including smb_bcc */ |
108 | 107 | ||
diff --git a/include/linux/snmp.h b/include/linux/snmp.h index 4db25d5c7cd1..854aa6b543f1 100644 --- a/include/linux/snmp.h +++ b/include/linux/snmp.h | |||
@@ -155,42 +155,11 @@ enum | |||
155 | UDP_MIB_NOPORTS, /* NoPorts */ | 155 | UDP_MIB_NOPORTS, /* NoPorts */ |
156 | UDP_MIB_INERRORS, /* InErrors */ | 156 | UDP_MIB_INERRORS, /* InErrors */ |
157 | UDP_MIB_OUTDATAGRAMS, /* OutDatagrams */ | 157 | UDP_MIB_OUTDATAGRAMS, /* OutDatagrams */ |
158 | UDP_MIB_RCVBUFERRORS, /* RcvbufErrors */ | ||
159 | UDP_MIB_SNDBUFERRORS, /* SndbufErrors */ | ||
158 | __UDP_MIB_MAX | 160 | __UDP_MIB_MAX |
159 | }; | 161 | }; |
160 | 162 | ||
161 | /* sctp mib definitions */ | ||
162 | /* | ||
163 | * draft-ietf-sigtran-sctp-mib-07.txt | ||
164 | */ | ||
165 | enum | ||
166 | { | ||
167 | SCTP_MIB_NUM = 0, | ||
168 | SCTP_MIB_CURRESTAB, /* CurrEstab */ | ||
169 | SCTP_MIB_ACTIVEESTABS, /* ActiveEstabs */ | ||
170 | SCTP_MIB_PASSIVEESTABS, /* PassiveEstabs */ | ||
171 | SCTP_MIB_ABORTEDS, /* Aborteds */ | ||
172 | SCTP_MIB_SHUTDOWNS, /* Shutdowns */ | ||
173 | SCTP_MIB_OUTOFBLUES, /* OutOfBlues */ | ||
174 | SCTP_MIB_CHECKSUMERRORS, /* ChecksumErrors */ | ||
175 | SCTP_MIB_OUTCTRLCHUNKS, /* OutCtrlChunks */ | ||
176 | SCTP_MIB_OUTORDERCHUNKS, /* OutOrderChunks */ | ||
177 | SCTP_MIB_OUTUNORDERCHUNKS, /* OutUnorderChunks */ | ||
178 | SCTP_MIB_INCTRLCHUNKS, /* InCtrlChunks */ | ||
179 | SCTP_MIB_INORDERCHUNKS, /* InOrderChunks */ | ||
180 | SCTP_MIB_INUNORDERCHUNKS, /* InUnorderChunks */ | ||
181 | SCTP_MIB_FRAGUSRMSGS, /* FragUsrMsgs */ | ||
182 | SCTP_MIB_REASMUSRMSGS, /* ReasmUsrMsgs */ | ||
183 | SCTP_MIB_OUTSCTPPACKS, /* OutSCTPPacks */ | ||
184 | SCTP_MIB_INSCTPPACKS, /* InSCTPPacks */ | ||
185 | SCTP_MIB_RTOALGORITHM, /* RtoAlgorithm */ | ||
186 | SCTP_MIB_RTOMIN, /* RtoMin */ | ||
187 | SCTP_MIB_RTOMAX, /* RtoMax */ | ||
188 | SCTP_MIB_RTOINITIAL, /* RtoInitial */ | ||
189 | SCTP_MIB_VALCOOKIELIFE, /* ValCookieLife */ | ||
190 | SCTP_MIB_MAXINITRETR, /* MaxInitRetr */ | ||
191 | __SCTP_MIB_MAX | ||
192 | }; | ||
193 | |||
194 | /* linux mib definitions */ | 163 | /* linux mib definitions */ |
195 | enum | 164 | enum |
196 | { | 165 | { |
diff --git a/include/linux/sunrpc/clnt.h b/include/linux/sunrpc/clnt.h index 8fe9f35eba31..f6d1d646ce05 100644 --- a/include/linux/sunrpc/clnt.h +++ b/include/linux/sunrpc/clnt.h | |||
@@ -18,18 +18,6 @@ | |||
18 | #include <linux/sunrpc/timer.h> | 18 | #include <linux/sunrpc/timer.h> |
19 | #include <asm/signal.h> | 19 | #include <asm/signal.h> |
20 | 20 | ||
21 | /* | ||
22 | * This defines an RPC port mapping | ||
23 | */ | ||
24 | struct rpc_portmap { | ||
25 | __u32 pm_prog; | ||
26 | __u32 pm_vers; | ||
27 | __u32 pm_prot; | ||
28 | __u16 pm_port; | ||
29 | unsigned char pm_binding : 1; /* doing a getport() */ | ||
30 | struct rpc_wait_queue pm_bindwait; /* waiting on getport() */ | ||
31 | }; | ||
32 | |||
33 | struct rpc_inode; | 21 | struct rpc_inode; |
34 | 22 | ||
35 | /* | 23 | /* |
@@ -40,7 +28,9 @@ struct rpc_clnt { | |||
40 | atomic_t cl_users; /* number of references */ | 28 | atomic_t cl_users; /* number of references */ |
41 | struct rpc_xprt * cl_xprt; /* transport */ | 29 | struct rpc_xprt * cl_xprt; /* transport */ |
42 | struct rpc_procinfo * cl_procinfo; /* procedure info */ | 30 | struct rpc_procinfo * cl_procinfo; /* procedure info */ |
43 | u32 cl_maxproc; /* max procedure number */ | 31 | u32 cl_prog, /* RPC program number */ |
32 | cl_vers, /* RPC version number */ | ||
33 | cl_maxproc; /* max procedure number */ | ||
44 | 34 | ||
45 | char * cl_server; /* server machine name */ | 35 | char * cl_server; /* server machine name */ |
46 | char * cl_protname; /* protocol name */ | 36 | char * cl_protname; /* protocol name */ |
@@ -55,7 +45,6 @@ struct rpc_clnt { | |||
55 | cl_dead : 1;/* abandoned */ | 45 | cl_dead : 1;/* abandoned */ |
56 | 46 | ||
57 | struct rpc_rtt * cl_rtt; /* RTO estimator data */ | 47 | struct rpc_rtt * cl_rtt; /* RTO estimator data */ |
58 | struct rpc_portmap * cl_pmap; /* port mapping */ | ||
59 | 48 | ||
60 | int cl_nodelen; /* nodename length */ | 49 | int cl_nodelen; /* nodename length */ |
61 | char cl_nodename[UNX_MAXNODENAME]; | 50 | char cl_nodename[UNX_MAXNODENAME]; |
@@ -64,14 +53,8 @@ struct rpc_clnt { | |||
64 | struct dentry * cl_dentry; /* inode */ | 53 | struct dentry * cl_dentry; /* inode */ |
65 | struct rpc_clnt * cl_parent; /* Points to parent of clones */ | 54 | struct rpc_clnt * cl_parent; /* Points to parent of clones */ |
66 | struct rpc_rtt cl_rtt_default; | 55 | struct rpc_rtt cl_rtt_default; |
67 | struct rpc_portmap cl_pmap_default; | ||
68 | char cl_inline_name[32]; | 56 | char cl_inline_name[32]; |
69 | }; | 57 | }; |
70 | #define cl_timeout cl_xprt->timeout | ||
71 | #define cl_prog cl_pmap->pm_prog | ||
72 | #define cl_vers cl_pmap->pm_vers | ||
73 | #define cl_port cl_pmap->pm_port | ||
74 | #define cl_prot cl_pmap->pm_prot | ||
75 | 58 | ||
76 | /* | 59 | /* |
77 | * General RPC program info | 60 | * General RPC program info |
@@ -106,24 +89,36 @@ struct rpc_procinfo { | |||
106 | char * p_name; /* name of procedure */ | 89 | char * p_name; /* name of procedure */ |
107 | }; | 90 | }; |
108 | 91 | ||
109 | #define RPC_CONGESTED(clnt) (RPCXPRT_CONGESTED((clnt)->cl_xprt)) | ||
110 | #define RPC_PEERADDR(clnt) (&(clnt)->cl_xprt->addr) | ||
111 | |||
112 | #ifdef __KERNEL__ | 92 | #ifdef __KERNEL__ |
113 | 93 | ||
114 | struct rpc_clnt *rpc_create_client(struct rpc_xprt *xprt, char *servname, | 94 | struct rpc_create_args { |
115 | struct rpc_program *info, | 95 | int protocol; |
116 | u32 version, rpc_authflavor_t authflavor); | 96 | struct sockaddr *address; |
117 | struct rpc_clnt *rpc_new_client(struct rpc_xprt *xprt, char *servname, | 97 | size_t addrsize; |
118 | struct rpc_program *info, | 98 | struct rpc_timeout *timeout; |
119 | u32 version, rpc_authflavor_t authflavor); | 99 | char *servername; |
100 | struct rpc_program *program; | ||
101 | u32 version; | ||
102 | rpc_authflavor_t authflavor; | ||
103 | unsigned long flags; | ||
104 | }; | ||
105 | |||
106 | /* Values for "flags" field */ | ||
107 | #define RPC_CLNT_CREATE_HARDRTRY (1UL << 0) | ||
108 | #define RPC_CLNT_CREATE_INTR (1UL << 1) | ||
109 | #define RPC_CLNT_CREATE_AUTOBIND (1UL << 2) | ||
110 | #define RPC_CLNT_CREATE_ONESHOT (1UL << 3) | ||
111 | #define RPC_CLNT_CREATE_NONPRIVPORT (1UL << 4) | ||
112 | #define RPC_CLNT_CREATE_NOPING (1UL << 5) | ||
113 | |||
114 | struct rpc_clnt *rpc_create(struct rpc_create_args *args); | ||
120 | struct rpc_clnt *rpc_bind_new_program(struct rpc_clnt *, | 115 | struct rpc_clnt *rpc_bind_new_program(struct rpc_clnt *, |
121 | struct rpc_program *, int); | 116 | struct rpc_program *, int); |
122 | struct rpc_clnt *rpc_clone_client(struct rpc_clnt *); | 117 | struct rpc_clnt *rpc_clone_client(struct rpc_clnt *); |
123 | int rpc_shutdown_client(struct rpc_clnt *); | 118 | int rpc_shutdown_client(struct rpc_clnt *); |
124 | int rpc_destroy_client(struct rpc_clnt *); | 119 | int rpc_destroy_client(struct rpc_clnt *); |
125 | void rpc_release_client(struct rpc_clnt *); | 120 | void rpc_release_client(struct rpc_clnt *); |
126 | void rpc_getport(struct rpc_task *, struct rpc_clnt *); | 121 | void rpc_getport(struct rpc_task *); |
127 | int rpc_register(u32, u32, int, unsigned short, int *); | 122 | int rpc_register(u32, u32, int, unsigned short, int *); |
128 | 123 | ||
129 | void rpc_call_setup(struct rpc_task *, struct rpc_message *, int); | 124 | void rpc_call_setup(struct rpc_task *, struct rpc_message *, int); |
@@ -140,6 +135,8 @@ void rpc_setbufsize(struct rpc_clnt *, unsigned int, unsigned int); | |||
140 | size_t rpc_max_payload(struct rpc_clnt *); | 135 | size_t rpc_max_payload(struct rpc_clnt *); |
141 | void rpc_force_rebind(struct rpc_clnt *); | 136 | void rpc_force_rebind(struct rpc_clnt *); |
142 | int rpc_ping(struct rpc_clnt *clnt, int flags); | 137 | int rpc_ping(struct rpc_clnt *clnt, int flags); |
138 | size_t rpc_peeraddr(struct rpc_clnt *, struct sockaddr *, size_t); | ||
139 | char * rpc_peeraddr2str(struct rpc_clnt *, enum rpc_display_format_t); | ||
143 | 140 | ||
144 | /* | 141 | /* |
145 | * Helper function for NFSroot support | 142 | * Helper function for NFSroot support |
diff --git a/include/linux/sunrpc/gss_krb5.h b/include/linux/sunrpc/gss_krb5.h index 1279280d7196..e30ba201910a 100644 --- a/include/linux/sunrpc/gss_krb5.h +++ b/include/linux/sunrpc/gss_krb5.h | |||
@@ -46,8 +46,8 @@ struct krb5_ctx { | |||
46 | unsigned char seed[16]; | 46 | unsigned char seed[16]; |
47 | int signalg; | 47 | int signalg; |
48 | int sealalg; | 48 | int sealalg; |
49 | struct crypto_tfm *enc; | 49 | struct crypto_blkcipher *enc; |
50 | struct crypto_tfm *seq; | 50 | struct crypto_blkcipher *seq; |
51 | s32 endtime; | 51 | s32 endtime; |
52 | u32 seq_send; | 52 | u32 seq_send; |
53 | struct xdr_netobj mech_used; | 53 | struct xdr_netobj mech_used; |
@@ -136,26 +136,27 @@ gss_unwrap_kerberos(struct gss_ctx *ctx_id, int offset, | |||
136 | 136 | ||
137 | 137 | ||
138 | u32 | 138 | u32 |
139 | krb5_encrypt(struct crypto_tfm * key, | 139 | krb5_encrypt(struct crypto_blkcipher *key, |
140 | void *iv, void *in, void *out, int length); | 140 | void *iv, void *in, void *out, int length); |
141 | 141 | ||
142 | u32 | 142 | u32 |
143 | krb5_decrypt(struct crypto_tfm * key, | 143 | krb5_decrypt(struct crypto_blkcipher *key, |
144 | void *iv, void *in, void *out, int length); | 144 | void *iv, void *in, void *out, int length); |
145 | 145 | ||
146 | int | 146 | int |
147 | gss_encrypt_xdr_buf(struct crypto_tfm *tfm, struct xdr_buf *outbuf, int offset, | 147 | gss_encrypt_xdr_buf(struct crypto_blkcipher *tfm, struct xdr_buf *outbuf, |
148 | struct page **pages); | 148 | int offset, struct page **pages); |
149 | 149 | ||
150 | int | 150 | int |
151 | gss_decrypt_xdr_buf(struct crypto_tfm *tfm, struct xdr_buf *inbuf, int offset); | 151 | gss_decrypt_xdr_buf(struct crypto_blkcipher *tfm, struct xdr_buf *inbuf, |
152 | int offset); | ||
152 | 153 | ||
153 | s32 | 154 | s32 |
154 | krb5_make_seq_num(struct crypto_tfm * key, | 155 | krb5_make_seq_num(struct crypto_blkcipher *key, |
155 | int direction, | 156 | int direction, |
156 | s32 seqnum, unsigned char *cksum, unsigned char *buf); | 157 | s32 seqnum, unsigned char *cksum, unsigned char *buf); |
157 | 158 | ||
158 | s32 | 159 | s32 |
159 | krb5_get_seq_num(struct crypto_tfm * key, | 160 | krb5_get_seq_num(struct crypto_blkcipher *key, |
160 | unsigned char *cksum, | 161 | unsigned char *cksum, |
161 | unsigned char *buf, int *direction, s32 * seqnum); | 162 | unsigned char *buf, int *direction, s32 * seqnum); |
diff --git a/include/linux/sunrpc/gss_spkm3.h b/include/linux/sunrpc/gss_spkm3.h index 336e218c2782..2cf3fbb40b4f 100644 --- a/include/linux/sunrpc/gss_spkm3.h +++ b/include/linux/sunrpc/gss_spkm3.h | |||
@@ -19,9 +19,9 @@ struct spkm3_ctx { | |||
19 | unsigned int req_flags ; | 19 | unsigned int req_flags ; |
20 | struct xdr_netobj share_key; | 20 | struct xdr_netobj share_key; |
21 | int conf_alg; | 21 | int conf_alg; |
22 | struct crypto_tfm* derived_conf_key; | 22 | struct crypto_blkcipher *derived_conf_key; |
23 | int intg_alg; | 23 | int intg_alg; |
24 | struct crypto_tfm* derived_integ_key; | 24 | struct crypto_blkcipher *derived_integ_key; |
25 | int keyestb_alg; /* alg used to get share_key */ | 25 | int keyestb_alg; /* alg used to get share_key */ |
26 | int owf_alg; /* one way function */ | 26 | int owf_alg; /* one way function */ |
27 | }; | 27 | }; |
diff --git a/include/linux/sunrpc/rpc_pipe_fs.h b/include/linux/sunrpc/rpc_pipe_fs.h index a481472c9484..a2eb9b4a9de3 100644 --- a/include/linux/sunrpc/rpc_pipe_fs.h +++ b/include/linux/sunrpc/rpc_pipe_fs.h | |||
@@ -43,7 +43,7 @@ extern int rpc_queue_upcall(struct inode *, struct rpc_pipe_msg *); | |||
43 | 43 | ||
44 | extern struct dentry *rpc_mkdir(char *, struct rpc_clnt *); | 44 | extern struct dentry *rpc_mkdir(char *, struct rpc_clnt *); |
45 | extern int rpc_rmdir(struct dentry *); | 45 | extern int rpc_rmdir(struct dentry *); |
46 | extern struct dentry *rpc_mkpipe(char *, void *, struct rpc_pipe_ops *, int flags); | 46 | extern struct dentry *rpc_mkpipe(struct dentry *, const char *, void *, struct rpc_pipe_ops *, int flags); |
47 | extern int rpc_unlink(struct dentry *); | 47 | extern int rpc_unlink(struct dentry *); |
48 | extern struct vfsmount *rpc_get_mount(void); | 48 | extern struct vfsmount *rpc_get_mount(void); |
49 | extern void rpc_put_mount(void); | 49 | extern void rpc_put_mount(void); |
diff --git a/include/linux/sunrpc/sched.h b/include/linux/sunrpc/sched.h index 82a91bb22362..f399c138f79d 100644 --- a/include/linux/sunrpc/sched.h +++ b/include/linux/sunrpc/sched.h | |||
@@ -127,7 +127,6 @@ struct rpc_call_ops { | |||
127 | */ | 127 | */ |
128 | #define RPC_TASK_ASYNC 0x0001 /* is an async task */ | 128 | #define RPC_TASK_ASYNC 0x0001 /* is an async task */ |
129 | #define RPC_TASK_SWAPPER 0x0002 /* is swapping in/out */ | 129 | #define RPC_TASK_SWAPPER 0x0002 /* is swapping in/out */ |
130 | #define RPC_TASK_CHILD 0x0008 /* is child of other task */ | ||
131 | #define RPC_CALL_MAJORSEEN 0x0020 /* major timeout seen */ | 130 | #define RPC_CALL_MAJORSEEN 0x0020 /* major timeout seen */ |
132 | #define RPC_TASK_ROOTCREDS 0x0040 /* force root creds */ | 131 | #define RPC_TASK_ROOTCREDS 0x0040 /* force root creds */ |
133 | #define RPC_TASK_DYNAMIC 0x0080 /* task was kmalloc'ed */ | 132 | #define RPC_TASK_DYNAMIC 0x0080 /* task was kmalloc'ed */ |
@@ -136,7 +135,6 @@ struct rpc_call_ops { | |||
136 | #define RPC_TASK_NOINTR 0x0400 /* uninterruptible task */ | 135 | #define RPC_TASK_NOINTR 0x0400 /* uninterruptible task */ |
137 | 136 | ||
138 | #define RPC_IS_ASYNC(t) ((t)->tk_flags & RPC_TASK_ASYNC) | 137 | #define RPC_IS_ASYNC(t) ((t)->tk_flags & RPC_TASK_ASYNC) |
139 | #define RPC_IS_CHILD(t) ((t)->tk_flags & RPC_TASK_CHILD) | ||
140 | #define RPC_IS_SWAPPER(t) ((t)->tk_flags & RPC_TASK_SWAPPER) | 138 | #define RPC_IS_SWAPPER(t) ((t)->tk_flags & RPC_TASK_SWAPPER) |
141 | #define RPC_DO_ROOTOVERRIDE(t) ((t)->tk_flags & RPC_TASK_ROOTCREDS) | 139 | #define RPC_DO_ROOTOVERRIDE(t) ((t)->tk_flags & RPC_TASK_ROOTCREDS) |
142 | #define RPC_ASSASSINATED(t) ((t)->tk_flags & RPC_TASK_KILLED) | 140 | #define RPC_ASSASSINATED(t) ((t)->tk_flags & RPC_TASK_KILLED) |
@@ -253,7 +251,6 @@ struct rpc_task *rpc_new_task(struct rpc_clnt *, int flags, | |||
253 | const struct rpc_call_ops *ops, void *data); | 251 | const struct rpc_call_ops *ops, void *data); |
254 | struct rpc_task *rpc_run_task(struct rpc_clnt *clnt, int flags, | 252 | struct rpc_task *rpc_run_task(struct rpc_clnt *clnt, int flags, |
255 | const struct rpc_call_ops *ops, void *data); | 253 | const struct rpc_call_ops *ops, void *data); |
256 | struct rpc_task *rpc_new_child(struct rpc_clnt *, struct rpc_task *parent); | ||
257 | void rpc_init_task(struct rpc_task *task, struct rpc_clnt *clnt, | 254 | void rpc_init_task(struct rpc_task *task, struct rpc_clnt *clnt, |
258 | int flags, const struct rpc_call_ops *ops, | 255 | int flags, const struct rpc_call_ops *ops, |
259 | void *data); | 256 | void *data); |
@@ -261,8 +258,6 @@ void rpc_release_task(struct rpc_task *); | |||
261 | void rpc_exit_task(struct rpc_task *); | 258 | void rpc_exit_task(struct rpc_task *); |
262 | void rpc_killall_tasks(struct rpc_clnt *); | 259 | void rpc_killall_tasks(struct rpc_clnt *); |
263 | int rpc_execute(struct rpc_task *); | 260 | int rpc_execute(struct rpc_task *); |
264 | void rpc_run_child(struct rpc_task *parent, struct rpc_task *child, | ||
265 | rpc_action action); | ||
266 | void rpc_init_priority_wait_queue(struct rpc_wait_queue *, const char *); | 261 | void rpc_init_priority_wait_queue(struct rpc_wait_queue *, const char *); |
267 | void rpc_init_wait_queue(struct rpc_wait_queue *, const char *); | 262 | void rpc_init_wait_queue(struct rpc_wait_queue *, const char *); |
268 | void rpc_sleep_on(struct rpc_wait_queue *, struct rpc_task *, | 263 | void rpc_sleep_on(struct rpc_wait_queue *, struct rpc_task *, |
diff --git a/include/linux/sunrpc/xprt.h b/include/linux/sunrpc/xprt.h index 3a0cca255b76..bdeba8538c71 100644 --- a/include/linux/sunrpc/xprt.h +++ b/include/linux/sunrpc/xprt.h | |||
@@ -12,6 +12,7 @@ | |||
12 | #include <linux/uio.h> | 12 | #include <linux/uio.h> |
13 | #include <linux/socket.h> | 13 | #include <linux/socket.h> |
14 | #include <linux/in.h> | 14 | #include <linux/in.h> |
15 | #include <linux/kref.h> | ||
15 | #include <linux/sunrpc/sched.h> | 16 | #include <linux/sunrpc/sched.h> |
16 | #include <linux/sunrpc/xdr.h> | 17 | #include <linux/sunrpc/xdr.h> |
17 | 18 | ||
@@ -51,6 +52,14 @@ struct rpc_timeout { | |||
51 | unsigned char to_exponential; | 52 | unsigned char to_exponential; |
52 | }; | 53 | }; |
53 | 54 | ||
55 | enum rpc_display_format_t { | ||
56 | RPC_DISPLAY_ADDR = 0, | ||
57 | RPC_DISPLAY_PORT, | ||
58 | RPC_DISPLAY_PROTO, | ||
59 | RPC_DISPLAY_ALL, | ||
60 | RPC_DISPLAY_MAX, | ||
61 | }; | ||
62 | |||
54 | struct rpc_task; | 63 | struct rpc_task; |
55 | struct rpc_xprt; | 64 | struct rpc_xprt; |
56 | struct seq_file; | 65 | struct seq_file; |
@@ -103,8 +112,10 @@ struct rpc_rqst { | |||
103 | 112 | ||
104 | struct rpc_xprt_ops { | 113 | struct rpc_xprt_ops { |
105 | void (*set_buffer_size)(struct rpc_xprt *xprt, size_t sndsize, size_t rcvsize); | 114 | void (*set_buffer_size)(struct rpc_xprt *xprt, size_t sndsize, size_t rcvsize); |
115 | char * (*print_addr)(struct rpc_xprt *xprt, enum rpc_display_format_t format); | ||
106 | int (*reserve_xprt)(struct rpc_task *task); | 116 | int (*reserve_xprt)(struct rpc_task *task); |
107 | void (*release_xprt)(struct rpc_xprt *xprt, struct rpc_task *task); | 117 | void (*release_xprt)(struct rpc_xprt *xprt, struct rpc_task *task); |
118 | void (*rpcbind)(struct rpc_task *task); | ||
108 | void (*set_port)(struct rpc_xprt *xprt, unsigned short port); | 119 | void (*set_port)(struct rpc_xprt *xprt, unsigned short port); |
109 | void (*connect)(struct rpc_task *task); | 120 | void (*connect)(struct rpc_task *task); |
110 | void * (*buf_alloc)(struct rpc_task *task, size_t size); | 121 | void * (*buf_alloc)(struct rpc_task *task, size_t size); |
@@ -119,12 +130,14 @@ struct rpc_xprt_ops { | |||
119 | }; | 130 | }; |
120 | 131 | ||
121 | struct rpc_xprt { | 132 | struct rpc_xprt { |
133 | struct kref kref; /* Reference count */ | ||
122 | struct rpc_xprt_ops * ops; /* transport methods */ | 134 | struct rpc_xprt_ops * ops; /* transport methods */ |
123 | struct socket * sock; /* BSD socket layer */ | 135 | struct socket * sock; /* BSD socket layer */ |
124 | struct sock * inet; /* INET layer */ | 136 | struct sock * inet; /* INET layer */ |
125 | 137 | ||
126 | struct rpc_timeout timeout; /* timeout parms */ | 138 | struct rpc_timeout timeout; /* timeout parms */ |
127 | struct sockaddr_in addr; /* server address */ | 139 | struct sockaddr_storage addr; /* server address */ |
140 | size_t addrlen; /* size of server address */ | ||
128 | int prot; /* IP protocol */ | 141 | int prot; /* IP protocol */ |
129 | 142 | ||
130 | unsigned long cong; /* current congestion */ | 143 | unsigned long cong; /* current congestion */ |
@@ -138,6 +151,7 @@ struct rpc_xprt { | |||
138 | unsigned int tsh_size; /* size of transport specific | 151 | unsigned int tsh_size; /* size of transport specific |
139 | header */ | 152 | header */ |
140 | 153 | ||
154 | struct rpc_wait_queue binding; /* requests waiting on rpcbind */ | ||
141 | struct rpc_wait_queue sending; /* requests waiting to send */ | 155 | struct rpc_wait_queue sending; /* requests waiting to send */ |
142 | struct rpc_wait_queue resend; /* requests waiting to resend */ | 156 | struct rpc_wait_queue resend; /* requests waiting to resend */ |
143 | struct rpc_wait_queue pending; /* requests in flight */ | 157 | struct rpc_wait_queue pending; /* requests in flight */ |
@@ -205,6 +219,8 @@ struct rpc_xprt { | |||
205 | void (*old_data_ready)(struct sock *, int); | 219 | void (*old_data_ready)(struct sock *, int); |
206 | void (*old_state_change)(struct sock *); | 220 | void (*old_state_change)(struct sock *); |
207 | void (*old_write_space)(struct sock *); | 221 | void (*old_write_space)(struct sock *); |
222 | |||
223 | char * address_strings[RPC_DISPLAY_MAX]; | ||
208 | }; | 224 | }; |
209 | 225 | ||
210 | #define XPRT_LAST_FRAG (1 << 0) | 226 | #define XPRT_LAST_FRAG (1 << 0) |
@@ -217,12 +233,12 @@ struct rpc_xprt { | |||
217 | /* | 233 | /* |
218 | * Transport operations used by ULPs | 234 | * Transport operations used by ULPs |
219 | */ | 235 | */ |
220 | struct rpc_xprt * xprt_create_proto(int proto, struct sockaddr_in *addr, struct rpc_timeout *to); | ||
221 | void xprt_set_timeout(struct rpc_timeout *to, unsigned int retr, unsigned long incr); | 236 | void xprt_set_timeout(struct rpc_timeout *to, unsigned int retr, unsigned long incr); |
222 | 237 | ||
223 | /* | 238 | /* |
224 | * Generic internal transport functions | 239 | * Generic internal transport functions |
225 | */ | 240 | */ |
241 | struct rpc_xprt * xprt_create_transport(int proto, struct sockaddr *addr, size_t size, struct rpc_timeout *toparms); | ||
226 | void xprt_connect(struct rpc_task *task); | 242 | void xprt_connect(struct rpc_task *task); |
227 | void xprt_reserve(struct rpc_task *task); | 243 | void xprt_reserve(struct rpc_task *task); |
228 | int xprt_reserve_xprt(struct rpc_task *task); | 244 | int xprt_reserve_xprt(struct rpc_task *task); |
@@ -234,7 +250,8 @@ int xprt_adjust_timeout(struct rpc_rqst *req); | |||
234 | void xprt_release_xprt(struct rpc_xprt *xprt, struct rpc_task *task); | 250 | void xprt_release_xprt(struct rpc_xprt *xprt, struct rpc_task *task); |
235 | void xprt_release_xprt_cong(struct rpc_xprt *xprt, struct rpc_task *task); | 251 | void xprt_release_xprt_cong(struct rpc_xprt *xprt, struct rpc_task *task); |
236 | void xprt_release(struct rpc_task *task); | 252 | void xprt_release(struct rpc_task *task); |
237 | int xprt_destroy(struct rpc_xprt *xprt); | 253 | struct rpc_xprt * xprt_get(struct rpc_xprt *xprt); |
254 | void xprt_put(struct rpc_xprt *xprt); | ||
238 | 255 | ||
239 | static inline u32 *xprt_skip_transport_header(struct rpc_xprt *xprt, u32 *p) | 256 | static inline u32 *xprt_skip_transport_header(struct rpc_xprt *xprt, u32 *p) |
240 | { | 257 | { |
@@ -269,6 +286,8 @@ int xs_setup_tcp(struct rpc_xprt *xprt, struct rpc_timeout *to); | |||
269 | #define XPRT_CONNECTED (1) | 286 | #define XPRT_CONNECTED (1) |
270 | #define XPRT_CONNECTING (2) | 287 | #define XPRT_CONNECTING (2) |
271 | #define XPRT_CLOSE_WAIT (3) | 288 | #define XPRT_CLOSE_WAIT (3) |
289 | #define XPRT_BOUND (4) | ||
290 | #define XPRT_BINDING (5) | ||
272 | 291 | ||
273 | static inline void xprt_set_connected(struct rpc_xprt *xprt) | 292 | static inline void xprt_set_connected(struct rpc_xprt *xprt) |
274 | { | 293 | { |
@@ -312,6 +331,33 @@ static inline int xprt_test_and_set_connecting(struct rpc_xprt *xprt) | |||
312 | return test_and_set_bit(XPRT_CONNECTING, &xprt->state); | 331 | return test_and_set_bit(XPRT_CONNECTING, &xprt->state); |
313 | } | 332 | } |
314 | 333 | ||
334 | static inline void xprt_set_bound(struct rpc_xprt *xprt) | ||
335 | { | ||
336 | test_and_set_bit(XPRT_BOUND, &xprt->state); | ||
337 | } | ||
338 | |||
339 | static inline int xprt_bound(struct rpc_xprt *xprt) | ||
340 | { | ||
341 | return test_bit(XPRT_BOUND, &xprt->state); | ||
342 | } | ||
343 | |||
344 | static inline void xprt_clear_bound(struct rpc_xprt *xprt) | ||
345 | { | ||
346 | clear_bit(XPRT_BOUND, &xprt->state); | ||
347 | } | ||
348 | |||
349 | static inline void xprt_clear_binding(struct rpc_xprt *xprt) | ||
350 | { | ||
351 | smp_mb__before_clear_bit(); | ||
352 | clear_bit(XPRT_BINDING, &xprt->state); | ||
353 | smp_mb__after_clear_bit(); | ||
354 | } | ||
355 | |||
356 | static inline int xprt_test_and_set_binding(struct rpc_xprt *xprt) | ||
357 | { | ||
358 | return test_and_set_bit(XPRT_BINDING, &xprt->state); | ||
359 | } | ||
360 | |||
315 | #endif /* __KERNEL__*/ | 361 | #endif /* __KERNEL__*/ |
316 | 362 | ||
317 | #endif /* _LINUX_SUNRPC_XPRT_H */ | 363 | #endif /* _LINUX_SUNRPC_XPRT_H */ |
diff --git a/include/linux/sysctl.h b/include/linux/sysctl.h index e4b1a4d4dcf3..736ed917a4f8 100644 --- a/include/linux/sysctl.h +++ b/include/linux/sysctl.h | |||
@@ -411,6 +411,10 @@ enum | |||
411 | NET_IPV4_TCP_WORKAROUND_SIGNED_WINDOWS=115, | 411 | NET_IPV4_TCP_WORKAROUND_SIGNED_WINDOWS=115, |
412 | NET_TCP_DMA_COPYBREAK=116, | 412 | NET_TCP_DMA_COPYBREAK=116, |
413 | NET_TCP_SLOW_START_AFTER_IDLE=117, | 413 | NET_TCP_SLOW_START_AFTER_IDLE=117, |
414 | NET_CIPSOV4_CACHE_ENABLE=118, | ||
415 | NET_CIPSOV4_CACHE_BUCKET_SIZE=119, | ||
416 | NET_CIPSOV4_RBM_OPTFMT=120, | ||
417 | NET_CIPSOV4_RBM_STRICTVALID=121, | ||
414 | }; | 418 | }; |
415 | 419 | ||
416 | enum { | 420 | enum { |
@@ -552,6 +556,7 @@ enum { | |||
552 | NET_IPV6_ACCEPT_RA_RTR_PREF=20, | 556 | NET_IPV6_ACCEPT_RA_RTR_PREF=20, |
553 | NET_IPV6_RTR_PROBE_INTERVAL=21, | 557 | NET_IPV6_RTR_PROBE_INTERVAL=21, |
554 | NET_IPV6_ACCEPT_RA_RT_INFO_MAX_PLEN=22, | 558 | NET_IPV6_ACCEPT_RA_RT_INFO_MAX_PLEN=22, |
559 | NET_IPV6_PROXY_NDP=23, | ||
555 | __NET_IPV6_MAX | 560 | __NET_IPV6_MAX |
556 | }; | 561 | }; |
557 | 562 | ||
diff --git a/include/linux/usbdevice_fs.h b/include/linux/usbdevice_fs.h index 7b7aadb69092..617d8a1c59ae 100644 --- a/include/linux/usbdevice_fs.h +++ b/include/linux/usbdevice_fs.h | |||
@@ -32,11 +32,10 @@ | |||
32 | #define _LINUX_USBDEVICE_FS_H | 32 | #define _LINUX_USBDEVICE_FS_H |
33 | 33 | ||
34 | #include <linux/types.h> | 34 | #include <linux/types.h> |
35 | #include <linux/magic.h> | ||
35 | 36 | ||
36 | /* --------------------------------------------------------------------- */ | 37 | /* --------------------------------------------------------------------- */ |
37 | 38 | ||
38 | #define USBDEVICE_SUPER_MAGIC 0x9fa2 | ||
39 | |||
40 | /* usbdevfs ioctl codes */ | 39 | /* usbdevfs ioctl codes */ |
41 | 40 | ||
42 | struct usbdevfs_ctrltransfer { | 41 | struct usbdevfs_ctrltransfer { |
diff --git a/include/linux/writeback.h b/include/linux/writeback.h index 9e38b566d0e7..0422036af4eb 100644 --- a/include/linux/writeback.h +++ b/include/linux/writeback.h | |||
@@ -85,6 +85,7 @@ int wakeup_pdflush(long nr_pages); | |||
85 | void laptop_io_completion(void); | 85 | void laptop_io_completion(void); |
86 | void laptop_sync_completion(void); | 86 | void laptop_sync_completion(void); |
87 | void throttle_vm_writeout(void); | 87 | void throttle_vm_writeout(void); |
88 | void writeback_congestion_end(void); | ||
88 | 89 | ||
89 | /* These are exported to sysctl. */ | 90 | /* These are exported to sysctl. */ |
90 | extern int dirty_background_ratio; | 91 | extern int dirty_background_ratio; |
diff --git a/include/linux/xfrm.h b/include/linux/xfrm.h index 46a15c7a1a13..14ecd19f4cdc 100644 --- a/include/linux/xfrm.h +++ b/include/linux/xfrm.h | |||
@@ -104,6 +104,13 @@ struct xfrm_stats { | |||
104 | 104 | ||
105 | enum | 105 | enum |
106 | { | 106 | { |
107 | XFRM_POLICY_TYPE_MAIN = 0, | ||
108 | XFRM_POLICY_TYPE_SUB = 1, | ||
109 | XFRM_POLICY_TYPE_MAX = 2 | ||
110 | }; | ||
111 | |||
112 | enum | ||
113 | { | ||
107 | XFRM_POLICY_IN = 0, | 114 | XFRM_POLICY_IN = 0, |
108 | XFRM_POLICY_OUT = 1, | 115 | XFRM_POLICY_OUT = 1, |
109 | XFRM_POLICY_FWD = 2, | 116 | XFRM_POLICY_FWD = 2, |
@@ -120,7 +127,9 @@ enum | |||
120 | 127 | ||
121 | #define XFRM_MODE_TRANSPORT 0 | 128 | #define XFRM_MODE_TRANSPORT 0 |
122 | #define XFRM_MODE_TUNNEL 1 | 129 | #define XFRM_MODE_TUNNEL 1 |
123 | #define XFRM_MODE_MAX 2 | 130 | #define XFRM_MODE_ROUTEOPTIMIZATION 2 |
131 | #define XFRM_MODE_IN_TRIGGER 3 | ||
132 | #define XFRM_MODE_MAX 4 | ||
124 | 133 | ||
125 | /* Netlink configuration messages. */ | 134 | /* Netlink configuration messages. */ |
126 | enum { | 135 | enum { |
@@ -164,6 +173,10 @@ enum { | |||
164 | #define XFRM_MSG_NEWAE XFRM_MSG_NEWAE | 173 | #define XFRM_MSG_NEWAE XFRM_MSG_NEWAE |
165 | XFRM_MSG_GETAE, | 174 | XFRM_MSG_GETAE, |
166 | #define XFRM_MSG_GETAE XFRM_MSG_GETAE | 175 | #define XFRM_MSG_GETAE XFRM_MSG_GETAE |
176 | |||
177 | XFRM_MSG_REPORT, | ||
178 | #define XFRM_MSG_REPORT XFRM_MSG_REPORT | ||
179 | |||
167 | __XFRM_MSG_MAX | 180 | __XFRM_MSG_MAX |
168 | }; | 181 | }; |
169 | #define XFRM_MSG_MAX (__XFRM_MSG_MAX - 1) | 182 | #define XFRM_MSG_MAX (__XFRM_MSG_MAX - 1) |
@@ -217,6 +230,12 @@ enum xfrm_ae_ftype_t { | |||
217 | #define XFRM_AE_MAX (__XFRM_AE_MAX - 1) | 230 | #define XFRM_AE_MAX (__XFRM_AE_MAX - 1) |
218 | }; | 231 | }; |
219 | 232 | ||
233 | struct xfrm_userpolicy_type { | ||
234 | __u8 type; | ||
235 | __u16 reserved1; | ||
236 | __u8 reserved2; | ||
237 | }; | ||
238 | |||
220 | /* Netlink message attributes. */ | 239 | /* Netlink message attributes. */ |
221 | enum xfrm_attr_type_t { | 240 | enum xfrm_attr_type_t { |
222 | XFRMA_UNSPEC, | 241 | XFRMA_UNSPEC, |
@@ -232,6 +251,10 @@ enum xfrm_attr_type_t { | |||
232 | XFRMA_REPLAY_VAL, | 251 | XFRMA_REPLAY_VAL, |
233 | XFRMA_REPLAY_THRESH, | 252 | XFRMA_REPLAY_THRESH, |
234 | XFRMA_ETIMER_THRESH, | 253 | XFRMA_ETIMER_THRESH, |
254 | XFRMA_SRCADDR, /* xfrm_address_t */ | ||
255 | XFRMA_COADDR, /* xfrm_address_t */ | ||
256 | XFRMA_LASTUSED, | ||
257 | XFRMA_POLICY_TYPE, /* struct xfrm_userpolicy_type */ | ||
235 | __XFRMA_MAX | 258 | __XFRMA_MAX |
236 | 259 | ||
237 | #define XFRMA_MAX (__XFRMA_MAX - 1) | 260 | #define XFRMA_MAX (__XFRMA_MAX - 1) |
@@ -247,12 +270,13 @@ struct xfrm_usersa_info { | |||
247 | __u32 seq; | 270 | __u32 seq; |
248 | __u32 reqid; | 271 | __u32 reqid; |
249 | __u16 family; | 272 | __u16 family; |
250 | __u8 mode; /* 0=transport,1=tunnel */ | 273 | __u8 mode; /* XFRM_MODE_xxx */ |
251 | __u8 replay_window; | 274 | __u8 replay_window; |
252 | __u8 flags; | 275 | __u8 flags; |
253 | #define XFRM_STATE_NOECN 1 | 276 | #define XFRM_STATE_NOECN 1 |
254 | #define XFRM_STATE_DECAP_DSCP 2 | 277 | #define XFRM_STATE_DECAP_DSCP 2 |
255 | #define XFRM_STATE_NOPMTUDISC 4 | 278 | #define XFRM_STATE_NOPMTUDISC 4 |
279 | #define XFRM_STATE_WILDRECV 8 | ||
256 | }; | 280 | }; |
257 | 281 | ||
258 | struct xfrm_usersa_id { | 282 | struct xfrm_usersa_id { |
@@ -319,12 +343,18 @@ struct xfrm_usersa_flush { | |||
319 | __u8 proto; | 343 | __u8 proto; |
320 | }; | 344 | }; |
321 | 345 | ||
346 | struct xfrm_user_report { | ||
347 | __u8 proto; | ||
348 | struct xfrm_selector sel; | ||
349 | }; | ||
350 | |||
322 | #ifndef __KERNEL__ | 351 | #ifndef __KERNEL__ |
323 | /* backwards compatibility for userspace */ | 352 | /* backwards compatibility for userspace */ |
324 | #define XFRMGRP_ACQUIRE 1 | 353 | #define XFRMGRP_ACQUIRE 1 |
325 | #define XFRMGRP_EXPIRE 2 | 354 | #define XFRMGRP_EXPIRE 2 |
326 | #define XFRMGRP_SA 4 | 355 | #define XFRMGRP_SA 4 |
327 | #define XFRMGRP_POLICY 8 | 356 | #define XFRMGRP_POLICY 8 |
357 | #define XFRMGRP_REPORT 0x10 | ||
328 | #endif | 358 | #endif |
329 | 359 | ||
330 | enum xfrm_nlgroups { | 360 | enum xfrm_nlgroups { |
@@ -340,6 +370,8 @@ enum xfrm_nlgroups { | |||
340 | #define XFRMNLGRP_POLICY XFRMNLGRP_POLICY | 370 | #define XFRMNLGRP_POLICY XFRMNLGRP_POLICY |
341 | XFRMNLGRP_AEVENTS, | 371 | XFRMNLGRP_AEVENTS, |
342 | #define XFRMNLGRP_AEVENTS XFRMNLGRP_AEVENTS | 372 | #define XFRMNLGRP_AEVENTS XFRMNLGRP_AEVENTS |
373 | XFRMNLGRP_REPORT, | ||
374 | #define XFRMNLGRP_REPORT XFRMNLGRP_REPORT | ||
343 | __XFRMNLGRP_MAX | 375 | __XFRMNLGRP_MAX |
344 | }; | 376 | }; |
345 | #define XFRMNLGRP_MAX (__XFRMNLGRP_MAX - 1) | 377 | #define XFRMNLGRP_MAX (__XFRMNLGRP_MAX - 1) |
diff --git a/include/mtd/mtd-abi.h b/include/mtd/mtd-abi.h index 1da3f7fa7993..b0a67b7ffdcd 100644 --- a/include/mtd/mtd-abi.h +++ b/include/mtd/mtd-abi.h | |||
@@ -34,6 +34,7 @@ struct mtd_oob_buf { | |||
34 | #define MTD_WRITEABLE 0x400 /* Device is writeable */ | 34 | #define MTD_WRITEABLE 0x400 /* Device is writeable */ |
35 | #define MTD_BIT_WRITEABLE 0x800 /* Single bits can be flipped */ | 35 | #define MTD_BIT_WRITEABLE 0x800 /* Single bits can be flipped */ |
36 | #define MTD_NO_ERASE 0x1000 /* No erase necessary */ | 36 | #define MTD_NO_ERASE 0x1000 /* No erase necessary */ |
37 | #define MTD_STUPID_LOCK 0x2000 /* Always locked after reset */ | ||
37 | 38 | ||
38 | // Some common devices / combinations of capabilities | 39 | // Some common devices / combinations of capabilities |
39 | #define MTD_CAP_ROM 0 | 40 | #define MTD_CAP_ROM 0 |
diff --git a/include/net/act_api.h b/include/net/act_api.h index 11e9eaf79f5a..8b06c2f3657f 100644 --- a/include/net/act_api.h +++ b/include/net/act_api.h | |||
@@ -8,70 +8,110 @@ | |||
8 | #include <net/sch_generic.h> | 8 | #include <net/sch_generic.h> |
9 | #include <net/pkt_sched.h> | 9 | #include <net/pkt_sched.h> |
10 | 10 | ||
11 | #define tca_gen(name) \ | 11 | struct tcf_common { |
12 | struct tcf_##name *next; \ | 12 | struct tcf_common *tcfc_next; |
13 | u32 index; \ | 13 | u32 tcfc_index; |
14 | int refcnt; \ | 14 | int tcfc_refcnt; |
15 | int bindcnt; \ | 15 | int tcfc_bindcnt; |
16 | u32 capab; \ | 16 | u32 tcfc_capab; |
17 | int action; \ | 17 | int tcfc_action; |
18 | struct tcf_t tm; \ | 18 | struct tcf_t tcfc_tm; |
19 | struct gnet_stats_basic bstats; \ | 19 | struct gnet_stats_basic tcfc_bstats; |
20 | struct gnet_stats_queue qstats; \ | 20 | struct gnet_stats_queue tcfc_qstats; |
21 | struct gnet_stats_rate_est rate_est; \ | 21 | struct gnet_stats_rate_est tcfc_rate_est; |
22 | spinlock_t *stats_lock; \ | 22 | spinlock_t *tcfc_stats_lock; |
23 | spinlock_t lock | 23 | spinlock_t tcfc_lock; |
24 | 24 | }; | |
25 | struct tcf_police | 25 | #define tcf_next common.tcfc_next |
26 | { | 26 | #define tcf_index common.tcfc_index |
27 | tca_gen(police); | 27 | #define tcf_refcnt common.tcfc_refcnt |
28 | int result; | 28 | #define tcf_bindcnt common.tcfc_bindcnt |
29 | u32 ewma_rate; | 29 | #define tcf_capab common.tcfc_capab |
30 | u32 burst; | 30 | #define tcf_action common.tcfc_action |
31 | u32 mtu; | 31 | #define tcf_tm common.tcfc_tm |
32 | u32 toks; | 32 | #define tcf_bstats common.tcfc_bstats |
33 | u32 ptoks; | 33 | #define tcf_qstats common.tcfc_qstats |
34 | psched_time_t t_c; | 34 | #define tcf_rate_est common.tcfc_rate_est |
35 | struct qdisc_rate_table *R_tab; | 35 | #define tcf_stats_lock common.tcfc_stats_lock |
36 | struct qdisc_rate_table *P_tab; | 36 | #define tcf_lock common.tcfc_lock |
37 | |||
38 | struct tcf_police { | ||
39 | struct tcf_common common; | ||
40 | int tcfp_result; | ||
41 | u32 tcfp_ewma_rate; | ||
42 | u32 tcfp_burst; | ||
43 | u32 tcfp_mtu; | ||
44 | u32 tcfp_toks; | ||
45 | u32 tcfp_ptoks; | ||
46 | psched_time_t tcfp_t_c; | ||
47 | struct qdisc_rate_table *tcfp_R_tab; | ||
48 | struct qdisc_rate_table *tcfp_P_tab; | ||
37 | }; | 49 | }; |
50 | #define to_police(pc) \ | ||
51 | container_of(pc, struct tcf_police, common) | ||
52 | |||
53 | struct tcf_hashinfo { | ||
54 | struct tcf_common **htab; | ||
55 | unsigned int hmask; | ||
56 | rwlock_t *lock; | ||
57 | }; | ||
58 | |||
59 | static inline unsigned int tcf_hash(u32 index, unsigned int hmask) | ||
60 | { | ||
61 | return index & hmask; | ||
62 | } | ||
38 | 63 | ||
39 | #ifdef CONFIG_NET_CLS_ACT | 64 | #ifdef CONFIG_NET_CLS_ACT |
40 | 65 | ||
41 | #define ACT_P_CREATED 1 | 66 | #define ACT_P_CREATED 1 |
42 | #define ACT_P_DELETED 1 | 67 | #define ACT_P_DELETED 1 |
43 | 68 | ||
44 | struct tcf_act_hdr | 69 | struct tcf_act_hdr { |
45 | { | 70 | struct tcf_common common; |
46 | tca_gen(act_hdr); | ||
47 | }; | 71 | }; |
48 | 72 | ||
49 | struct tc_action | 73 | struct tc_action { |
50 | { | 74 | void *priv; |
51 | void *priv; | 75 | struct tc_action_ops *ops; |
52 | struct tc_action_ops *ops; | 76 | __u32 type; /* for backward compat(TCA_OLD_COMPAT) */ |
53 | __u32 type; /* for backward compat(TCA_OLD_COMPAT) */ | 77 | __u32 order; |
54 | __u32 order; | 78 | struct tc_action *next; |
55 | struct tc_action *next; | ||
56 | }; | 79 | }; |
57 | 80 | ||
58 | #define TCA_CAP_NONE 0 | 81 | #define TCA_CAP_NONE 0 |
59 | struct tc_action_ops | 82 | struct tc_action_ops { |
60 | { | ||
61 | struct tc_action_ops *next; | 83 | struct tc_action_ops *next; |
84 | struct tcf_hashinfo *hinfo; | ||
62 | char kind[IFNAMSIZ]; | 85 | char kind[IFNAMSIZ]; |
63 | __u32 type; /* TBD to match kind */ | 86 | __u32 type; /* TBD to match kind */ |
64 | __u32 capab; /* capabilities includes 4 bit version */ | 87 | __u32 capab; /* capabilities includes 4 bit version */ |
65 | struct module *owner; | 88 | struct module *owner; |
66 | int (*act)(struct sk_buff *, struct tc_action *, struct tcf_result *); | 89 | int (*act)(struct sk_buff *, struct tc_action *, struct tcf_result *); |
67 | int (*get_stats)(struct sk_buff *, struct tc_action *); | 90 | int (*get_stats)(struct sk_buff *, struct tc_action *); |
68 | int (*dump)(struct sk_buff *, struct tc_action *,int , int); | 91 | int (*dump)(struct sk_buff *, struct tc_action *, int, int); |
69 | int (*cleanup)(struct tc_action *, int bind); | 92 | int (*cleanup)(struct tc_action *, int bind); |
70 | int (*lookup)(struct tc_action *, u32 ); | 93 | int (*lookup)(struct tc_action *, u32); |
71 | int (*init)(struct rtattr *,struct rtattr *,struct tc_action *, int , int ); | 94 | int (*init)(struct rtattr *, struct rtattr *, struct tc_action *, int , int); |
72 | int (*walk)(struct sk_buff *, struct netlink_callback *, int , struct tc_action *); | 95 | int (*walk)(struct sk_buff *, struct netlink_callback *, int, struct tc_action *); |
73 | }; | 96 | }; |
74 | 97 | ||
98 | extern struct tcf_common *tcf_hash_lookup(u32 index, | ||
99 | struct tcf_hashinfo *hinfo); | ||
100 | extern void tcf_hash_destroy(struct tcf_common *p, struct tcf_hashinfo *hinfo); | ||
101 | extern int tcf_hash_release(struct tcf_common *p, int bind, | ||
102 | struct tcf_hashinfo *hinfo); | ||
103 | extern int tcf_generic_walker(struct sk_buff *skb, struct netlink_callback *cb, | ||
104 | int type, struct tc_action *a); | ||
105 | extern u32 tcf_hash_new_index(u32 *idx_gen, struct tcf_hashinfo *hinfo); | ||
106 | extern int tcf_hash_search(struct tc_action *a, u32 index); | ||
107 | extern struct tcf_common *tcf_hash_check(u32 index, struct tc_action *a, | ||
108 | int bind, struct tcf_hashinfo *hinfo); | ||
109 | extern struct tcf_common *tcf_hash_create(u32 index, struct rtattr *est, | ||
110 | struct tc_action *a, int size, | ||
111 | int bind, u32 *idx_gen, | ||
112 | struct tcf_hashinfo *hinfo); | ||
113 | extern void tcf_hash_insert(struct tcf_common *p, struct tcf_hashinfo *hinfo); | ||
114 | |||
75 | extern int tcf_register_action(struct tc_action_ops *a); | 115 | extern int tcf_register_action(struct tc_action_ops *a); |
76 | extern int tcf_unregister_action(struct tc_action_ops *a); | 116 | extern int tcf_unregister_action(struct tc_action_ops *a); |
77 | extern void tcf_action_destroy(struct tc_action *a, int bind); | 117 | extern void tcf_action_destroy(struct tc_action *a, int bind); |
@@ -96,17 +136,17 @@ tcf_police_release(struct tcf_police *p, int bind) | |||
96 | int ret = 0; | 136 | int ret = 0; |
97 | #ifdef CONFIG_NET_CLS_ACT | 137 | #ifdef CONFIG_NET_CLS_ACT |
98 | if (p) { | 138 | if (p) { |
99 | if (bind) { | 139 | if (bind) |
100 | p->bindcnt--; | 140 | p->tcf_bindcnt--; |
101 | } | 141 | |
102 | p->refcnt--; | 142 | p->tcf_refcnt--; |
103 | if (p->refcnt <= 0 && !p->bindcnt) { | 143 | if (p->tcf_refcnt <= 0 && !p->tcf_bindcnt) { |
104 | tcf_police_destroy(p); | 144 | tcf_police_destroy(p); |
105 | ret = 1; | 145 | ret = 1; |
106 | } | 146 | } |
107 | } | 147 | } |
108 | #else | 148 | #else |
109 | if (p && --p->refcnt == 0) | 149 | if (p && --p->tcf_refcnt == 0) |
110 | tcf_police_destroy(p); | 150 | tcf_police_destroy(p); |
111 | 151 | ||
112 | #endif /* CONFIG_NET_CLS_ACT */ | 152 | #endif /* CONFIG_NET_CLS_ACT */ |
diff --git a/include/net/act_generic.h b/include/net/act_generic.h deleted file mode 100644 index c9daa7e52300..000000000000 --- a/include/net/act_generic.h +++ /dev/null | |||
@@ -1,142 +0,0 @@ | |||
1 | /* | ||
2 | * include/net/act_generic.h | ||
3 | * | ||
4 | */ | ||
5 | #ifndef _NET_ACT_GENERIC_H | ||
6 | #define _NET_ACT_GENERIC_H | ||
7 | static inline int tcf_defact_release(struct tcf_defact *p, int bind) | ||
8 | { | ||
9 | int ret = 0; | ||
10 | if (p) { | ||
11 | if (bind) { | ||
12 | p->bindcnt--; | ||
13 | } | ||
14 | p->refcnt--; | ||
15 | if (p->bindcnt <= 0 && p->refcnt <= 0) { | ||
16 | kfree(p->defdata); | ||
17 | tcf_hash_destroy(p); | ||
18 | ret = 1; | ||
19 | } | ||
20 | } | ||
21 | return ret; | ||
22 | } | ||
23 | |||
24 | static inline int | ||
25 | alloc_defdata(struct tcf_defact *p, u32 datalen, void *defdata) | ||
26 | { | ||
27 | p->defdata = kmalloc(datalen, GFP_KERNEL); | ||
28 | if (p->defdata == NULL) | ||
29 | return -ENOMEM; | ||
30 | p->datalen = datalen; | ||
31 | memcpy(p->defdata, defdata, datalen); | ||
32 | return 0; | ||
33 | } | ||
34 | |||
35 | static inline int | ||
36 | realloc_defdata(struct tcf_defact *p, u32 datalen, void *defdata) | ||
37 | { | ||
38 | /* safer to be just brute force for now */ | ||
39 | kfree(p->defdata); | ||
40 | return alloc_defdata(p, datalen, defdata); | ||
41 | } | ||
42 | |||
43 | static inline int | ||
44 | tcf_defact_init(struct rtattr *rta, struct rtattr *est, | ||
45 | struct tc_action *a, int ovr, int bind) | ||
46 | { | ||
47 | struct rtattr *tb[TCA_DEF_MAX]; | ||
48 | struct tc_defact *parm; | ||
49 | struct tcf_defact *p; | ||
50 | void *defdata; | ||
51 | u32 datalen = 0; | ||
52 | int ret = 0; | ||
53 | |||
54 | if (rta == NULL || rtattr_parse_nested(tb, TCA_DEF_MAX, rta) < 0) | ||
55 | return -EINVAL; | ||
56 | |||
57 | if (tb[TCA_DEF_PARMS - 1] == NULL || | ||
58 | RTA_PAYLOAD(tb[TCA_DEF_PARMS - 1]) < sizeof(*parm)) | ||
59 | return -EINVAL; | ||
60 | |||
61 | parm = RTA_DATA(tb[TCA_DEF_PARMS - 1]); | ||
62 | defdata = RTA_DATA(tb[TCA_DEF_DATA - 1]); | ||
63 | if (defdata == NULL) | ||
64 | return -EINVAL; | ||
65 | |||
66 | datalen = RTA_PAYLOAD(tb[TCA_DEF_DATA - 1]); | ||
67 | if (datalen <= 0) | ||
68 | return -EINVAL; | ||
69 | |||
70 | p = tcf_hash_check(parm->index, a, ovr, bind); | ||
71 | if (p == NULL) { | ||
72 | p = tcf_hash_create(parm->index, est, a, sizeof(*p), ovr, bind); | ||
73 | if (p == NULL) | ||
74 | return -ENOMEM; | ||
75 | |||
76 | ret = alloc_defdata(p, datalen, defdata); | ||
77 | if (ret < 0) { | ||
78 | kfree(p); | ||
79 | return ret; | ||
80 | } | ||
81 | ret = ACT_P_CREATED; | ||
82 | } else { | ||
83 | if (!ovr) { | ||
84 | tcf_defact_release(p, bind); | ||
85 | return -EEXIST; | ||
86 | } | ||
87 | realloc_defdata(p, datalen, defdata); | ||
88 | } | ||
89 | |||
90 | spin_lock_bh(&p->lock); | ||
91 | p->action = parm->action; | ||
92 | spin_unlock_bh(&p->lock); | ||
93 | if (ret == ACT_P_CREATED) | ||
94 | tcf_hash_insert(p); | ||
95 | return ret; | ||
96 | } | ||
97 | |||
98 | static inline int tcf_defact_cleanup(struct tc_action *a, int bind) | ||
99 | { | ||
100 | struct tcf_defact *p = PRIV(a, defact); | ||
101 | |||
102 | if (p != NULL) | ||
103 | return tcf_defact_release(p, bind); | ||
104 | return 0; | ||
105 | } | ||
106 | |||
107 | static inline int | ||
108 | tcf_defact_dump(struct sk_buff *skb, struct tc_action *a, int bind, int ref) | ||
109 | { | ||
110 | unsigned char *b = skb->tail; | ||
111 | struct tc_defact opt; | ||
112 | struct tcf_defact *p = PRIV(a, defact); | ||
113 | struct tcf_t t; | ||
114 | |||
115 | opt.index = p->index; | ||
116 | opt.refcnt = p->refcnt - ref; | ||
117 | opt.bindcnt = p->bindcnt - bind; | ||
118 | opt.action = p->action; | ||
119 | RTA_PUT(skb, TCA_DEF_PARMS, sizeof(opt), &opt); | ||
120 | RTA_PUT(skb, TCA_DEF_DATA, p->datalen, p->defdata); | ||
121 | t.install = jiffies_to_clock_t(jiffies - p->tm.install); | ||
122 | t.lastuse = jiffies_to_clock_t(jiffies - p->tm.lastuse); | ||
123 | t.expires = jiffies_to_clock_t(p->tm.expires); | ||
124 | RTA_PUT(skb, TCA_DEF_TM, sizeof(t), &t); | ||
125 | return skb->len; | ||
126 | |||
127 | rtattr_failure: | ||
128 | skb_trim(skb, b - skb->data); | ||
129 | return -1; | ||
130 | } | ||
131 | |||
132 | #define tca_use_default_ops \ | ||
133 | .dump = tcf_defact_dump, \ | ||
134 | .cleanup = tcf_defact_cleanup, \ | ||
135 | .init = tcf_defact_init, \ | ||
136 | .walk = tcf_generic_walker, \ | ||
137 | |||
138 | #define tca_use_default_defines(name) \ | ||
139 | static u32 idx_gen; \ | ||
140 | static struct tcf_defact *tcf_##name_ht[MY_TAB_SIZE]; \ | ||
141 | static DEFINE_RWLOCK(##name_lock); | ||
142 | #endif /* _NET_ACT_GENERIC_H */ | ||
diff --git a/include/net/addrconf.h b/include/net/addrconf.h index 3d71251b3eca..44f1b673f916 100644 --- a/include/net/addrconf.h +++ b/include/net/addrconf.h | |||
@@ -61,6 +61,9 @@ extern int addrconf_set_dstaddr(void __user *arg); | |||
61 | extern int ipv6_chk_addr(struct in6_addr *addr, | 61 | extern int ipv6_chk_addr(struct in6_addr *addr, |
62 | struct net_device *dev, | 62 | struct net_device *dev, |
63 | int strict); | 63 | int strict); |
64 | #ifdef CONFIG_IPV6_MIP6 | ||
65 | extern int ipv6_chk_home_addr(struct in6_addr *addr); | ||
66 | #endif | ||
64 | extern struct inet6_ifaddr * ipv6_get_ifaddr(struct in6_addr *addr, | 67 | extern struct inet6_ifaddr * ipv6_get_ifaddr(struct in6_addr *addr, |
65 | struct net_device *dev, | 68 | struct net_device *dev, |
66 | int strict); | 69 | int strict); |
@@ -126,20 +129,18 @@ extern int unregister_inet6addr_notifier(struct notifier_block *nb); | |||
126 | static inline struct inet6_dev * | 129 | static inline struct inet6_dev * |
127 | __in6_dev_get(struct net_device *dev) | 130 | __in6_dev_get(struct net_device *dev) |
128 | { | 131 | { |
129 | return (struct inet6_dev *)dev->ip6_ptr; | 132 | return rcu_dereference(dev->ip6_ptr); |
130 | } | 133 | } |
131 | 134 | ||
132 | extern rwlock_t addrconf_lock; | ||
133 | |||
134 | static inline struct inet6_dev * | 135 | static inline struct inet6_dev * |
135 | in6_dev_get(struct net_device *dev) | 136 | in6_dev_get(struct net_device *dev) |
136 | { | 137 | { |
137 | struct inet6_dev *idev = NULL; | 138 | struct inet6_dev *idev = NULL; |
138 | read_lock(&addrconf_lock); | 139 | rcu_read_lock(); |
139 | idev = dev->ip6_ptr; | 140 | idev = __in6_dev_get(dev); |
140 | if (idev) | 141 | if (idev) |
141 | atomic_inc(&idev->refcnt); | 142 | atomic_inc(&idev->refcnt); |
142 | read_unlock(&addrconf_lock); | 143 | rcu_read_unlock(); |
143 | return idev; | 144 | return idev; |
144 | } | 145 | } |
145 | 146 | ||
diff --git a/include/net/ah.h b/include/net/ah.h index ceff00afae09..8f257c159902 100644 --- a/include/net/ah.h +++ b/include/net/ah.h | |||
@@ -1,6 +1,7 @@ | |||
1 | #ifndef _NET_AH_H | 1 | #ifndef _NET_AH_H |
2 | #define _NET_AH_H | 2 | #define _NET_AH_H |
3 | 3 | ||
4 | #include <linux/crypto.h> | ||
4 | #include <net/xfrm.h> | 5 | #include <net/xfrm.h> |
5 | 6 | ||
6 | /* This is the maximum truncated ICV length that we know of. */ | 7 | /* This is the maximum truncated ICV length that we know of. */ |
@@ -14,22 +15,29 @@ struct ah_data | |||
14 | int icv_full_len; | 15 | int icv_full_len; |
15 | int icv_trunc_len; | 16 | int icv_trunc_len; |
16 | 17 | ||
17 | void (*icv)(struct ah_data*, | 18 | struct crypto_hash *tfm; |
18 | struct sk_buff *skb, u8 *icv); | ||
19 | |||
20 | struct crypto_tfm *tfm; | ||
21 | }; | 19 | }; |
22 | 20 | ||
23 | static inline void | 21 | static inline int ah_mac_digest(struct ah_data *ahp, struct sk_buff *skb, |
24 | ah_hmac_digest(struct ah_data *ahp, struct sk_buff *skb, u8 *auth_data) | 22 | u8 *auth_data) |
25 | { | 23 | { |
26 | struct crypto_tfm *tfm = ahp->tfm; | 24 | struct hash_desc desc; |
25 | int err; | ||
26 | |||
27 | desc.tfm = ahp->tfm; | ||
28 | desc.flags = 0; | ||
27 | 29 | ||
28 | memset(auth_data, 0, ahp->icv_trunc_len); | 30 | memset(auth_data, 0, ahp->icv_trunc_len); |
29 | crypto_hmac_init(tfm, ahp->key, &ahp->key_len); | 31 | err = crypto_hash_init(&desc); |
30 | skb_icv_walk(skb, tfm, 0, skb->len, crypto_hmac_update); | 32 | if (unlikely(err)) |
31 | crypto_hmac_final(tfm, ahp->key, &ahp->key_len, ahp->work_icv); | 33 | goto out; |
32 | memcpy(auth_data, ahp->work_icv, ahp->icv_trunc_len); | 34 | err = skb_icv_walk(skb, &desc, 0, skb->len, crypto_hash_update); |
35 | if (unlikely(err)) | ||
36 | goto out; | ||
37 | err = crypto_hash_final(&desc, ahp->work_icv); | ||
38 | |||
39 | out: | ||
40 | return err; | ||
33 | } | 41 | } |
34 | 42 | ||
35 | #endif | 43 | #endif |
diff --git a/include/net/cipso_ipv4.h b/include/net/cipso_ipv4.h new file mode 100644 index 000000000000..59406e0dc5b2 --- /dev/null +++ b/include/net/cipso_ipv4.h | |||
@@ -0,0 +1,246 @@ | |||
1 | /* | ||
2 | * CIPSO - Commercial IP Security Option | ||
3 | * | ||
4 | * This is an implementation of the CIPSO 2.2 protocol as specified in | ||
5 | * draft-ietf-cipso-ipsecurity-01.txt with additional tag types as found in | ||
6 | * FIPS-188, copies of both documents can be found in the Documentation | ||
7 | * directory. While CIPSO never became a full IETF RFC standard many vendors | ||
8 | * have chosen to adopt the protocol and over the years it has become a | ||
9 | * de-facto standard for labeled networking. | ||
10 | * | ||
11 | * Author: Paul Moore <paul.moore@hp.com> | ||
12 | * | ||
13 | */ | ||
14 | |||
15 | /* | ||
16 | * (c) Copyright Hewlett-Packard Development Company, L.P., 2006 | ||
17 | * | ||
18 | * This program is free software; you can redistribute it and/or modify | ||
19 | * it under the terms of the GNU General Public License as published by | ||
20 | * the Free Software Foundation; either version 2 of the License, or | ||
21 | * (at your option) any later version. | ||
22 | * | ||
23 | * This program is distributed in the hope that it will be useful, | ||
24 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
25 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See | ||
26 | * the GNU General Public License for more details. | ||
27 | * | ||
28 | * You should have received a copy of the GNU General Public License | ||
29 | * along with this program; if not, write to the Free Software | ||
30 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
31 | * | ||
32 | */ | ||
33 | |||
34 | #ifndef _CIPSO_IPV4_H | ||
35 | #define _CIPSO_IPV4_H | ||
36 | |||
37 | #include <linux/types.h> | ||
38 | #include <linux/rcupdate.h> | ||
39 | #include <linux/list.h> | ||
40 | #include <linux/net.h> | ||
41 | #include <linux/skbuff.h> | ||
42 | #include <net/netlabel.h> | ||
43 | |||
44 | /* known doi values */ | ||
45 | #define CIPSO_V4_DOI_UNKNOWN 0x00000000 | ||
46 | |||
47 | /* tag types */ | ||
48 | #define CIPSO_V4_TAG_INVALID 0 | ||
49 | #define CIPSO_V4_TAG_RBITMAP 1 | ||
50 | #define CIPSO_V4_TAG_ENUM 2 | ||
51 | #define CIPSO_V4_TAG_RANGE 5 | ||
52 | #define CIPSO_V4_TAG_PBITMAP 6 | ||
53 | #define CIPSO_V4_TAG_FREEFORM 7 | ||
54 | |||
55 | /* doi mapping types */ | ||
56 | #define CIPSO_V4_MAP_UNKNOWN 0 | ||
57 | #define CIPSO_V4_MAP_STD 1 | ||
58 | #define CIPSO_V4_MAP_PASS 2 | ||
59 | |||
60 | /* limits */ | ||
61 | #define CIPSO_V4_MAX_REM_LVLS 256 | ||
62 | #define CIPSO_V4_INV_LVL 0x80000000 | ||
63 | #define CIPSO_V4_MAX_LOC_LVLS (CIPSO_V4_INV_LVL - 1) | ||
64 | #define CIPSO_V4_MAX_REM_CATS 65536 | ||
65 | #define CIPSO_V4_INV_CAT 0x80000000 | ||
66 | #define CIPSO_V4_MAX_LOC_CATS (CIPSO_V4_INV_CAT - 1) | ||
67 | |||
68 | /* | ||
69 | * CIPSO DOI definitions | ||
70 | */ | ||
71 | |||
72 | /* DOI definition struct */ | ||
73 | #define CIPSO_V4_TAG_MAXCNT 5 | ||
74 | struct cipso_v4_doi { | ||
75 | u32 doi; | ||
76 | u32 type; | ||
77 | union { | ||
78 | struct cipso_v4_std_map_tbl *std; | ||
79 | } map; | ||
80 | u8 tags[CIPSO_V4_TAG_MAXCNT]; | ||
81 | |||
82 | u32 valid; | ||
83 | struct list_head list; | ||
84 | struct rcu_head rcu; | ||
85 | struct list_head dom_list; | ||
86 | }; | ||
87 | |||
88 | /* Standard CIPSO mapping table */ | ||
89 | /* NOTE: the highest order bit (i.e. 0x80000000) is an 'invalid' flag, if the | ||
90 | * bit is set then consider that value as unspecified, meaning the | ||
91 | * mapping for that particular level/category is invalid */ | ||
92 | struct cipso_v4_std_map_tbl { | ||
93 | struct { | ||
94 | u32 *cipso; | ||
95 | u32 *local; | ||
96 | u32 cipso_size; | ||
97 | u32 local_size; | ||
98 | } lvl; | ||
99 | struct { | ||
100 | u32 *cipso; | ||
101 | u32 *local; | ||
102 | u32 cipso_size; | ||
103 | u32 local_size; | ||
104 | } cat; | ||
105 | }; | ||
106 | |||
107 | /* | ||
108 | * Sysctl Variables | ||
109 | */ | ||
110 | |||
111 | #ifdef CONFIG_NETLABEL | ||
112 | extern int cipso_v4_cache_enabled; | ||
113 | extern int cipso_v4_cache_bucketsize; | ||
114 | extern int cipso_v4_rbm_optfmt; | ||
115 | extern int cipso_v4_rbm_strictvalid; | ||
116 | #endif | ||
117 | |||
118 | /* | ||
119 | * Helper Functions | ||
120 | */ | ||
121 | |||
122 | #define CIPSO_V4_OPTEXIST(x) (IPCB(x)->opt.cipso != 0) | ||
123 | #define CIPSO_V4_OPTPTR(x) ((x)->nh.raw + IPCB(x)->opt.cipso) | ||
124 | |||
125 | /* | ||
126 | * DOI List Functions | ||
127 | */ | ||
128 | |||
129 | #ifdef CONFIG_NETLABEL | ||
130 | int cipso_v4_doi_add(struct cipso_v4_doi *doi_def); | ||
131 | int cipso_v4_doi_remove(u32 doi, void (*callback) (struct rcu_head * head)); | ||
132 | struct cipso_v4_doi *cipso_v4_doi_getdef(u32 doi); | ||
133 | struct sk_buff *cipso_v4_doi_dump_all(size_t headroom); | ||
134 | struct sk_buff *cipso_v4_doi_dump(u32 doi, size_t headroom); | ||
135 | int cipso_v4_doi_domhsh_add(struct cipso_v4_doi *doi_def, const char *domain); | ||
136 | int cipso_v4_doi_domhsh_remove(struct cipso_v4_doi *doi_def, | ||
137 | const char *domain); | ||
138 | #else | ||
139 | static inline int cipso_v4_doi_add(struct cipso_v4_doi *doi_def) | ||
140 | { | ||
141 | return -ENOSYS; | ||
142 | } | ||
143 | |||
144 | static inline int cipso_v4_doi_remove(u32 doi, | ||
145 | void (*callback) (struct rcu_head * head)) | ||
146 | { | ||
147 | return 0; | ||
148 | } | ||
149 | |||
150 | static inline struct cipso_v4_doi *cipso_v4_doi_getdef(u32 doi) | ||
151 | { | ||
152 | return NULL; | ||
153 | } | ||
154 | |||
155 | static inline struct sk_buff *cipso_v4_doi_dump_all(size_t headroom) | ||
156 | { | ||
157 | return NULL; | ||
158 | } | ||
159 | |||
160 | static inline struct sk_buff *cipso_v4_doi_dump(u32 doi, size_t headroom) | ||
161 | { | ||
162 | return NULL; | ||
163 | } | ||
164 | |||
165 | static inline int cipso_v4_doi_domhsh_add(struct cipso_v4_doi *doi_def, | ||
166 | const char *domain) | ||
167 | { | ||
168 | return -ENOSYS; | ||
169 | } | ||
170 | |||
171 | static inline int cipso_v4_doi_domhsh_remove(struct cipso_v4_doi *doi_def, | ||
172 | const char *domain) | ||
173 | { | ||
174 | return 0; | ||
175 | } | ||
176 | #endif /* CONFIG_NETLABEL */ | ||
177 | |||
178 | /* | ||
179 | * Label Mapping Cache Functions | ||
180 | */ | ||
181 | |||
182 | #ifdef CONFIG_NETLABEL | ||
183 | void cipso_v4_cache_invalidate(void); | ||
184 | int cipso_v4_cache_add(const struct sk_buff *skb, | ||
185 | const struct netlbl_lsm_secattr *secattr); | ||
186 | #else | ||
187 | static inline void cipso_v4_cache_invalidate(void) | ||
188 | { | ||
189 | return; | ||
190 | } | ||
191 | |||
192 | static inline int cipso_v4_cache_add(const struct sk_buff *skb, | ||
193 | const struct netlbl_lsm_secattr *secattr) | ||
194 | { | ||
195 | return 0; | ||
196 | } | ||
197 | #endif /* CONFIG_NETLABEL */ | ||
198 | |||
199 | /* | ||
200 | * Protocol Handling Functions | ||
201 | */ | ||
202 | |||
203 | #ifdef CONFIG_NETLABEL | ||
204 | void cipso_v4_error(struct sk_buff *skb, int error, u32 gateway); | ||
205 | int cipso_v4_socket_setattr(const struct socket *sock, | ||
206 | const struct cipso_v4_doi *doi_def, | ||
207 | const struct netlbl_lsm_secattr *secattr); | ||
208 | int cipso_v4_socket_getattr(const struct socket *sock, | ||
209 | struct netlbl_lsm_secattr *secattr); | ||
210 | int cipso_v4_skbuff_getattr(const struct sk_buff *skb, | ||
211 | struct netlbl_lsm_secattr *secattr); | ||
212 | int cipso_v4_validate(unsigned char **option); | ||
213 | #else | ||
214 | static inline void cipso_v4_error(struct sk_buff *skb, | ||
215 | int error, | ||
216 | u32 gateway) | ||
217 | { | ||
218 | return; | ||
219 | } | ||
220 | |||
221 | static inline int cipso_v4_socket_setattr(const struct socket *sock, | ||
222 | const struct cipso_v4_doi *doi_def, | ||
223 | const struct netlbl_lsm_secattr *secattr) | ||
224 | { | ||
225 | return -ENOSYS; | ||
226 | } | ||
227 | |||
228 | static inline int cipso_v4_socket_getattr(const struct socket *sock, | ||
229 | struct netlbl_lsm_secattr *secattr) | ||
230 | { | ||
231 | return -ENOSYS; | ||
232 | } | ||
233 | |||
234 | static inline int cipso_v4_skbuff_getattr(const struct sk_buff *skb, | ||
235 | struct netlbl_lsm_secattr *secattr) | ||
236 | { | ||
237 | return -ENOSYS; | ||
238 | } | ||
239 | |||
240 | static inline int cipso_v4_validate(unsigned char **option) | ||
241 | { | ||
242 | return -ENOSYS; | ||
243 | } | ||
244 | #endif /* CONFIG_NETLABEL */ | ||
245 | |||
246 | #endif /* _CIPSO_IPV4_H */ | ||
diff --git a/include/net/dn_fib.h b/include/net/dn_fib.h index a15dcf0d5c1e..f01626cbbed6 100644 --- a/include/net/dn_fib.h +++ b/include/net/dn_fib.h | |||
@@ -22,7 +22,7 @@ struct dn_kern_rta | |||
22 | }; | 22 | }; |
23 | 23 | ||
24 | struct dn_fib_res { | 24 | struct dn_fib_res { |
25 | struct dn_fib_rule *r; | 25 | struct fib_rule *r; |
26 | struct dn_fib_info *fi; | 26 | struct dn_fib_info *fi; |
27 | unsigned char prefixlen; | 27 | unsigned char prefixlen; |
28 | unsigned char nh_sel; | 28 | unsigned char nh_sel; |
@@ -94,7 +94,8 @@ struct dn_fib_node { | |||
94 | 94 | ||
95 | 95 | ||
96 | struct dn_fib_table { | 96 | struct dn_fib_table { |
97 | int n; | 97 | struct hlist_node hlist; |
98 | u32 n; | ||
98 | 99 | ||
99 | int (*insert)(struct dn_fib_table *t, struct rtmsg *r, | 100 | int (*insert)(struct dn_fib_table *t, struct rtmsg *r, |
100 | struct dn_kern_rta *rta, struct nlmsghdr *n, | 101 | struct dn_kern_rta *rta, struct nlmsghdr *n, |
@@ -130,14 +131,11 @@ extern __le16 dn_fib_get_attr16(struct rtattr *attr, int attrlen, int type); | |||
130 | extern void dn_fib_flush(void); | 131 | extern void dn_fib_flush(void); |
131 | extern void dn_fib_select_multipath(const struct flowi *fl, | 132 | extern void dn_fib_select_multipath(const struct flowi *fl, |
132 | struct dn_fib_res *res); | 133 | struct dn_fib_res *res); |
133 | extern int dn_fib_sync_down(__le16 local, struct net_device *dev, | ||
134 | int force); | ||
135 | extern int dn_fib_sync_up(struct net_device *dev); | ||
136 | 134 | ||
137 | /* | 135 | /* |
138 | * dn_tables.c | 136 | * dn_tables.c |
139 | */ | 137 | */ |
140 | extern struct dn_fib_table *dn_fib_get_table(int n, int creat); | 138 | extern struct dn_fib_table *dn_fib_get_table(u32 n, int creat); |
141 | extern struct dn_fib_table *dn_fib_empty_table(void); | 139 | extern struct dn_fib_table *dn_fib_empty_table(void); |
142 | extern void dn_fib_table_init(void); | 140 | extern void dn_fib_table_init(void); |
143 | extern void dn_fib_table_cleanup(void); | 141 | extern void dn_fib_table_cleanup(void); |
@@ -147,10 +145,8 @@ extern void dn_fib_table_cleanup(void); | |||
147 | */ | 145 | */ |
148 | extern void dn_fib_rules_init(void); | 146 | extern void dn_fib_rules_init(void); |
149 | extern void dn_fib_rules_cleanup(void); | 147 | extern void dn_fib_rules_cleanup(void); |
150 | extern void dn_fib_rule_put(struct dn_fib_rule *); | ||
151 | extern __le16 dn_fib_rules_policy(__le16 saddr, struct dn_fib_res *res, unsigned *flags); | ||
152 | extern unsigned dnet_addr_type(__le16 addr); | 148 | extern unsigned dnet_addr_type(__le16 addr); |
153 | extern int dn_fib_lookup(const struct flowi *fl, struct dn_fib_res *res); | 149 | extern int dn_fib_lookup(struct flowi *fl, struct dn_fib_res *res); |
154 | 150 | ||
155 | /* | 151 | /* |
156 | * rtnetlink interface | 152 | * rtnetlink interface |
@@ -176,11 +172,9 @@ static inline void dn_fib_res_put(struct dn_fib_res *res) | |||
176 | if (res->fi) | 172 | if (res->fi) |
177 | dn_fib_info_put(res->fi); | 173 | dn_fib_info_put(res->fi); |
178 | if (res->r) | 174 | if (res->r) |
179 | dn_fib_rule_put(res->r); | 175 | fib_rule_put(res->r); |
180 | } | 176 | } |
181 | 177 | ||
182 | extern struct dn_fib_table *dn_fib_tables[]; | ||
183 | |||
184 | #else /* Endnode */ | 178 | #else /* Endnode */ |
185 | 179 | ||
186 | #define dn_fib_init() do { } while(0) | 180 | #define dn_fib_init() do { } while(0) |
diff --git a/include/net/dst.h b/include/net/dst.h index 36d54fc248b0..a8d825f90305 100644 --- a/include/net/dst.h +++ b/include/net/dst.h | |||
@@ -54,6 +54,7 @@ struct dst_entry | |||
54 | unsigned long expires; | 54 | unsigned long expires; |
55 | 55 | ||
56 | unsigned short header_len; /* more space at head required */ | 56 | unsigned short header_len; /* more space at head required */ |
57 | unsigned short nfheader_len; /* more non-fragment space at head required */ | ||
57 | unsigned short trailer_len; /* space to reserve at tail */ | 58 | unsigned short trailer_len; /* space to reserve at tail */ |
58 | 59 | ||
59 | u32 metrics[RTAX_MAX]; | 60 | u32 metrics[RTAX_MAX]; |
diff --git a/include/net/esp.h b/include/net/esp.h index 90cd94fad7d9..713d039f4af7 100644 --- a/include/net/esp.h +++ b/include/net/esp.h | |||
@@ -1,6 +1,7 @@ | |||
1 | #ifndef _NET_ESP_H | 1 | #ifndef _NET_ESP_H |
2 | #define _NET_ESP_H | 2 | #define _NET_ESP_H |
3 | 3 | ||
4 | #include <linux/crypto.h> | ||
4 | #include <net/xfrm.h> | 5 | #include <net/xfrm.h> |
5 | #include <asm/scatterlist.h> | 6 | #include <asm/scatterlist.h> |
6 | 7 | ||
@@ -14,14 +15,15 @@ struct esp_data | |||
14 | struct { | 15 | struct { |
15 | u8 *key; /* Key */ | 16 | u8 *key; /* Key */ |
16 | int key_len; /* Key length */ | 17 | int key_len; /* Key length */ |
17 | u8 *ivec; /* ivec buffer */ | 18 | int padlen; /* 0..255 */ |
18 | /* ivlen is offset from enc_data, where encrypted data start. | 19 | /* ivlen is offset from enc_data, where encrypted data start. |
19 | * It is logically different of crypto_tfm_alg_ivsize(tfm). | 20 | * It is logically different of crypto_tfm_alg_ivsize(tfm). |
20 | * We assume that it is either zero (no ivec), or | 21 | * We assume that it is either zero (no ivec), or |
21 | * >= crypto_tfm_alg_ivsize(tfm). */ | 22 | * >= crypto_tfm_alg_ivsize(tfm). */ |
22 | int ivlen; | 23 | int ivlen; |
23 | int padlen; /* 0..255 */ | 24 | int ivinitted; |
24 | struct crypto_tfm *tfm; /* crypto handle */ | 25 | u8 *ivec; /* ivec buffer */ |
26 | struct crypto_blkcipher *tfm; /* crypto handle */ | ||
25 | } conf; | 27 | } conf; |
26 | 28 | ||
27 | /* Integrity. It is active when icv_full_len != 0 */ | 29 | /* Integrity. It is active when icv_full_len != 0 */ |
@@ -34,7 +36,7 @@ struct esp_data | |||
34 | void (*icv)(struct esp_data*, | 36 | void (*icv)(struct esp_data*, |
35 | struct sk_buff *skb, | 37 | struct sk_buff *skb, |
36 | int offset, int len, u8 *icv); | 38 | int offset, int len, u8 *icv); |
37 | struct crypto_tfm *tfm; | 39 | struct crypto_hash *tfm; |
38 | } auth; | 40 | } auth; |
39 | }; | 41 | }; |
40 | 42 | ||
@@ -42,18 +44,22 @@ extern int skb_to_sgvec(struct sk_buff *skb, struct scatterlist *sg, int offset, | |||
42 | extern int skb_cow_data(struct sk_buff *skb, int tailbits, struct sk_buff **trailer); | 44 | extern int skb_cow_data(struct sk_buff *skb, int tailbits, struct sk_buff **trailer); |
43 | extern void *pskb_put(struct sk_buff *skb, struct sk_buff *tail, int len); | 45 | extern void *pskb_put(struct sk_buff *skb, struct sk_buff *tail, int len); |
44 | 46 | ||
45 | static inline void | 47 | static inline int esp_mac_digest(struct esp_data *esp, struct sk_buff *skb, |
46 | esp_hmac_digest(struct esp_data *esp, struct sk_buff *skb, int offset, | 48 | int offset, int len) |
47 | int len, u8 *auth_data) | ||
48 | { | 49 | { |
49 | struct crypto_tfm *tfm = esp->auth.tfm; | 50 | struct hash_desc desc; |
50 | char *icv = esp->auth.work_icv; | 51 | int err; |
51 | 52 | ||
52 | memset(auth_data, 0, esp->auth.icv_trunc_len); | 53 | desc.tfm = esp->auth.tfm; |
53 | crypto_hmac_init(tfm, esp->auth.key, &esp->auth.key_len); | 54 | desc.flags = 0; |
54 | skb_icv_walk(skb, tfm, offset, len, crypto_hmac_update); | 55 | |
55 | crypto_hmac_final(tfm, esp->auth.key, &esp->auth.key_len, icv); | 56 | err = crypto_hash_init(&desc); |
56 | memcpy(auth_data, icv, esp->auth.icv_trunc_len); | 57 | if (unlikely(err)) |
58 | return err; | ||
59 | err = skb_icv_walk(skb, &desc, offset, len, crypto_hash_update); | ||
60 | if (unlikely(err)) | ||
61 | return err; | ||
62 | return crypto_hash_final(&desc, esp->auth.work_icv); | ||
57 | } | 63 | } |
58 | 64 | ||
59 | #endif | 65 | #endif |
diff --git a/include/net/fib_rules.h b/include/net/fib_rules.h new file mode 100644 index 000000000000..8e2f473d3e82 --- /dev/null +++ b/include/net/fib_rules.h | |||
@@ -0,0 +1,97 @@ | |||
1 | #ifndef __NET_FIB_RULES_H | ||
2 | #define __NET_FIB_RULES_H | ||
3 | |||
4 | #include <linux/types.h> | ||
5 | #include <linux/netdevice.h> | ||
6 | #include <linux/fib_rules.h> | ||
7 | #include <net/flow.h> | ||
8 | #include <net/netlink.h> | ||
9 | |||
10 | struct fib_rule | ||
11 | { | ||
12 | struct list_head list; | ||
13 | atomic_t refcnt; | ||
14 | int ifindex; | ||
15 | char ifname[IFNAMSIZ]; | ||
16 | u32 pref; | ||
17 | u32 flags; | ||
18 | u32 table; | ||
19 | u8 action; | ||
20 | struct rcu_head rcu; | ||
21 | }; | ||
22 | |||
23 | struct fib_lookup_arg | ||
24 | { | ||
25 | void *lookup_ptr; | ||
26 | void *result; | ||
27 | struct fib_rule *rule; | ||
28 | }; | ||
29 | |||
30 | struct fib_rules_ops | ||
31 | { | ||
32 | int family; | ||
33 | struct list_head list; | ||
34 | int rule_size; | ||
35 | |||
36 | int (*action)(struct fib_rule *, | ||
37 | struct flowi *, int, | ||
38 | struct fib_lookup_arg *); | ||
39 | int (*match)(struct fib_rule *, | ||
40 | struct flowi *, int); | ||
41 | int (*configure)(struct fib_rule *, | ||
42 | struct sk_buff *, | ||
43 | struct nlmsghdr *, | ||
44 | struct fib_rule_hdr *, | ||
45 | struct nlattr **); | ||
46 | int (*compare)(struct fib_rule *, | ||
47 | struct fib_rule_hdr *, | ||
48 | struct nlattr **); | ||
49 | int (*fill)(struct fib_rule *, struct sk_buff *, | ||
50 | struct nlmsghdr *, | ||
51 | struct fib_rule_hdr *); | ||
52 | u32 (*default_pref)(void); | ||
53 | |||
54 | int nlgroup; | ||
55 | struct nla_policy *policy; | ||
56 | struct list_head *rules_list; | ||
57 | struct module *owner; | ||
58 | }; | ||
59 | |||
60 | static inline void fib_rule_get(struct fib_rule *rule) | ||
61 | { | ||
62 | atomic_inc(&rule->refcnt); | ||
63 | } | ||
64 | |||
65 | static inline void fib_rule_put_rcu(struct rcu_head *head) | ||
66 | { | ||
67 | struct fib_rule *rule = container_of(head, struct fib_rule, rcu); | ||
68 | kfree(rule); | ||
69 | } | ||
70 | |||
71 | static inline void fib_rule_put(struct fib_rule *rule) | ||
72 | { | ||
73 | if (atomic_dec_and_test(&rule->refcnt)) | ||
74 | call_rcu(&rule->rcu, fib_rule_put_rcu); | ||
75 | } | ||
76 | |||
77 | static inline u32 frh_get_table(struct fib_rule_hdr *frh, struct nlattr **nla) | ||
78 | { | ||
79 | if (nla[FRA_TABLE]) | ||
80 | return nla_get_u32(nla[FRA_TABLE]); | ||
81 | return frh->table; | ||
82 | } | ||
83 | |||
84 | extern int fib_rules_register(struct fib_rules_ops *); | ||
85 | extern int fib_rules_unregister(struct fib_rules_ops *); | ||
86 | |||
87 | extern int fib_rules_lookup(struct fib_rules_ops *, | ||
88 | struct flowi *, int flags, | ||
89 | struct fib_lookup_arg *); | ||
90 | |||
91 | extern int fib_nl_newrule(struct sk_buff *, | ||
92 | struct nlmsghdr *, void *); | ||
93 | extern int fib_nl_delrule(struct sk_buff *, | ||
94 | struct nlmsghdr *, void *); | ||
95 | extern int fib_rules_dump(struct sk_buff *, | ||
96 | struct netlink_callback *, int); | ||
97 | #endif | ||
diff --git a/include/net/flow.h b/include/net/flow.h index 04d89f763451..3ca210ec1379 100644 --- a/include/net/flow.h +++ b/include/net/flow.h | |||
@@ -26,6 +26,7 @@ struct flowi { | |||
26 | struct { | 26 | struct { |
27 | struct in6_addr daddr; | 27 | struct in6_addr daddr; |
28 | struct in6_addr saddr; | 28 | struct in6_addr saddr; |
29 | __u32 fwmark; | ||
29 | __u32 flowlabel; | 30 | __u32 flowlabel; |
30 | } ip6_u; | 31 | } ip6_u; |
31 | 32 | ||
@@ -42,6 +43,7 @@ struct flowi { | |||
42 | #define fld_scope nl_u.dn_u.scope | 43 | #define fld_scope nl_u.dn_u.scope |
43 | #define fl6_dst nl_u.ip6_u.daddr | 44 | #define fl6_dst nl_u.ip6_u.daddr |
44 | #define fl6_src nl_u.ip6_u.saddr | 45 | #define fl6_src nl_u.ip6_u.saddr |
46 | #define fl6_fwmark nl_u.ip6_u.fwmark | ||
45 | #define fl6_flowlabel nl_u.ip6_u.flowlabel | 47 | #define fl6_flowlabel nl_u.ip6_u.flowlabel |
46 | #define fl4_dst nl_u.ip4_u.daddr | 48 | #define fl4_dst nl_u.ip4_u.daddr |
47 | #define fl4_src nl_u.ip4_u.saddr | 49 | #define fl4_src nl_u.ip4_u.saddr |
@@ -72,12 +74,22 @@ struct flowi { | |||
72 | } dnports; | 74 | } dnports; |
73 | 75 | ||
74 | __u32 spi; | 76 | __u32 spi; |
77 | |||
78 | #ifdef CONFIG_IPV6_MIP6 | ||
79 | struct { | ||
80 | __u8 type; | ||
81 | } mht; | ||
82 | #endif | ||
75 | } uli_u; | 83 | } uli_u; |
76 | #define fl_ip_sport uli_u.ports.sport | 84 | #define fl_ip_sport uli_u.ports.sport |
77 | #define fl_ip_dport uli_u.ports.dport | 85 | #define fl_ip_dport uli_u.ports.dport |
78 | #define fl_icmp_type uli_u.icmpt.type | 86 | #define fl_icmp_type uli_u.icmpt.type |
79 | #define fl_icmp_code uli_u.icmpt.code | 87 | #define fl_icmp_code uli_u.icmpt.code |
80 | #define fl_ipsec_spi uli_u.spi | 88 | #define fl_ipsec_spi uli_u.spi |
89 | #ifdef CONFIG_IPV6_MIP6 | ||
90 | #define fl_mh_type uli_u.mht.type | ||
91 | #endif | ||
92 | __u32 secid; /* used by xfrm; see secid.txt */ | ||
81 | } __attribute__((__aligned__(BITS_PER_LONG/8))); | 93 | } __attribute__((__aligned__(BITS_PER_LONG/8))); |
82 | 94 | ||
83 | #define FLOW_DIR_IN 0 | 95 | #define FLOW_DIR_IN 0 |
@@ -85,10 +97,10 @@ struct flowi { | |||
85 | #define FLOW_DIR_FWD 2 | 97 | #define FLOW_DIR_FWD 2 |
86 | 98 | ||
87 | struct sock; | 99 | struct sock; |
88 | typedef void (*flow_resolve_t)(struct flowi *key, u32 sk_sid, u16 family, u8 dir, | 100 | typedef void (*flow_resolve_t)(struct flowi *key, u16 family, u8 dir, |
89 | void **objp, atomic_t **obj_refp); | 101 | void **objp, atomic_t **obj_refp); |
90 | 102 | ||
91 | extern void *flow_cache_lookup(struct flowi *key, u32 sk_sid, u16 family, u8 dir, | 103 | extern void *flow_cache_lookup(struct flowi *key, u16 family, u8 dir, |
92 | flow_resolve_t resolver); | 104 | flow_resolve_t resolver); |
93 | extern void flow_cache_flush(void); | 105 | extern void flow_cache_flush(void); |
94 | extern atomic_t flow_cache_genid; | 106 | extern atomic_t flow_cache_genid; |
diff --git a/include/net/genetlink.h b/include/net/genetlink.h index 8c2287264266..4a38d85e4e25 100644 --- a/include/net/genetlink.h +++ b/include/net/genetlink.h | |||
@@ -27,8 +27,6 @@ struct genl_family | |||
27 | struct list_head family_list; /* private */ | 27 | struct list_head family_list; /* private */ |
28 | }; | 28 | }; |
29 | 29 | ||
30 | #define GENL_ADMIN_PERM 0x01 | ||
31 | |||
32 | /** | 30 | /** |
33 | * struct genl_info - receiving information | 31 | * struct genl_info - receiving information |
34 | * @snd_seq: sending sequence number | 32 | * @snd_seq: sending sequence number |
@@ -133,11 +131,12 @@ static inline int genlmsg_cancel(struct sk_buff *skb, void *hdr) | |||
133 | * @skb: netlink message as socket buffer | 131 | * @skb: netlink message as socket buffer |
134 | * @pid: own netlink pid to avoid sending to yourself | 132 | * @pid: own netlink pid to avoid sending to yourself |
135 | * @group: multicast group id | 133 | * @group: multicast group id |
134 | * @flags: allocation flags | ||
136 | */ | 135 | */ |
137 | static inline int genlmsg_multicast(struct sk_buff *skb, u32 pid, | 136 | static inline int genlmsg_multicast(struct sk_buff *skb, u32 pid, |
138 | unsigned int group) | 137 | unsigned int group, gfp_t flags) |
139 | { | 138 | { |
140 | return nlmsg_multicast(genl_sock, skb, pid, group); | 139 | return nlmsg_multicast(genl_sock, skb, pid, group, flags); |
141 | } | 140 | } |
142 | 141 | ||
143 | /** | 142 | /** |
diff --git a/include/net/ieee80211.h b/include/net/ieee80211.h index ecc42864b001..b174ebb277a9 100644 --- a/include/net/ieee80211.h +++ b/include/net/ieee80211.h | |||
@@ -240,6 +240,11 @@ struct ieee80211_snap_hdr { | |||
240 | #define WLAN_CAPABILITY_SHORT_SLOT_TIME (1<<10) | 240 | #define WLAN_CAPABILITY_SHORT_SLOT_TIME (1<<10) |
241 | #define WLAN_CAPABILITY_DSSS_OFDM (1<<13) | 241 | #define WLAN_CAPABILITY_DSSS_OFDM (1<<13) |
242 | 242 | ||
243 | /* 802.11g ERP information element */ | ||
244 | #define WLAN_ERP_NON_ERP_PRESENT (1<<0) | ||
245 | #define WLAN_ERP_USE_PROTECTION (1<<1) | ||
246 | #define WLAN_ERP_BARKER_PREAMBLE (1<<2) | ||
247 | |||
243 | /* Status codes */ | 248 | /* Status codes */ |
244 | enum ieee80211_statuscode { | 249 | enum ieee80211_statuscode { |
245 | WLAN_STATUS_SUCCESS = 0, | 250 | WLAN_STATUS_SUCCESS = 0, |
@@ -747,6 +752,8 @@ struct ieee80211_txb { | |||
747 | #define NETWORK_HAS_IBSS_DFS (1<<8) | 752 | #define NETWORK_HAS_IBSS_DFS (1<<8) |
748 | #define NETWORK_HAS_TPC_REPORT (1<<9) | 753 | #define NETWORK_HAS_TPC_REPORT (1<<9) |
749 | 754 | ||
755 | #define NETWORK_HAS_ERP_VALUE (1<<10) | ||
756 | |||
750 | #define QOS_QUEUE_NUM 4 | 757 | #define QOS_QUEUE_NUM 4 |
751 | #define QOS_OUI_LEN 3 | 758 | #define QOS_OUI_LEN 3 |
752 | #define QOS_OUI_TYPE 2 | 759 | #define QOS_OUI_TYPE 2 |
@@ -1252,6 +1259,8 @@ extern int ieee80211_tx_frame(struct ieee80211_device *ieee, | |||
1252 | int total_len, int encrypt_mpdu); | 1259 | int total_len, int encrypt_mpdu); |
1253 | 1260 | ||
1254 | /* ieee80211_rx.c */ | 1261 | /* ieee80211_rx.c */ |
1262 | extern void ieee80211_rx_any(struct ieee80211_device *ieee, | ||
1263 | struct sk_buff *skb, struct ieee80211_rx_stats *stats); | ||
1255 | extern int ieee80211_rx(struct ieee80211_device *ieee, struct sk_buff *skb, | 1264 | extern int ieee80211_rx(struct ieee80211_device *ieee, struct sk_buff *skb, |
1256 | struct ieee80211_rx_stats *rx_stats); | 1265 | struct ieee80211_rx_stats *rx_stats); |
1257 | /* make sure to set stats->len */ | 1266 | /* make sure to set stats->len */ |
diff --git a/include/net/ieee80211softmac.h b/include/net/ieee80211softmac.h index 00ad810eb883..425b3a57ac74 100644 --- a/include/net/ieee80211softmac.h +++ b/include/net/ieee80211softmac.h | |||
@@ -86,9 +86,6 @@ struct ieee80211softmac_assoc_info { | |||
86 | 86 | ||
87 | /* BSSID we're trying to associate to */ | 87 | /* BSSID we're trying to associate to */ |
88 | char bssid[ETH_ALEN]; | 88 | char bssid[ETH_ALEN]; |
89 | |||
90 | /* Rates supported by the network */ | ||
91 | struct ieee80211softmac_ratesinfo supported_rates; | ||
92 | 89 | ||
93 | /* some flags. | 90 | /* some flags. |
94 | * static_essid is valid if the essid is constant, | 91 | * static_essid is valid if the essid is constant, |
@@ -103,6 +100,7 @@ struct ieee80211softmac_assoc_info { | |||
103 | * bssfixed is used for SIOCSIWAP. | 100 | * bssfixed is used for SIOCSIWAP. |
104 | */ | 101 | */ |
105 | u8 static_essid:1, | 102 | u8 static_essid:1, |
103 | short_preamble_available:1, | ||
106 | associating:1, | 104 | associating:1, |
107 | assoc_wait:1, | 105 | assoc_wait:1, |
108 | bssvalid:1, | 106 | bssvalid:1, |
@@ -115,6 +113,19 @@ struct ieee80211softmac_assoc_info { | |||
115 | struct work_struct timeout; | 113 | struct work_struct timeout; |
116 | }; | 114 | }; |
117 | 115 | ||
116 | struct ieee80211softmac_bss_info { | ||
117 | /* Rates supported by the network */ | ||
118 | struct ieee80211softmac_ratesinfo supported_rates; | ||
119 | |||
120 | /* This indicates whether frames can currently be transmitted with | ||
121 | * short preamble (only use this variable during TX at CCK rates) */ | ||
122 | u8 short_preamble:1; | ||
123 | |||
124 | /* This indicates whether protection (e.g. self-CTS) should be used | ||
125 | * when transmitting with OFDM modulation */ | ||
126 | u8 use_protection:1; | ||
127 | }; | ||
128 | |||
118 | enum { | 129 | enum { |
119 | IEEE80211SOFTMAC_AUTH_OPEN_REQUEST = 1, | 130 | IEEE80211SOFTMAC_AUTH_OPEN_REQUEST = 1, |
120 | IEEE80211SOFTMAC_AUTH_OPEN_RESPONSE = 2, | 131 | IEEE80211SOFTMAC_AUTH_OPEN_RESPONSE = 2, |
@@ -157,6 +168,10 @@ struct ieee80211softmac_txrates { | |||
157 | #define IEEE80211SOFTMAC_TXRATECHG_MCAST (1 << 2) /* mcast_rate */ | 168 | #define IEEE80211SOFTMAC_TXRATECHG_MCAST (1 << 2) /* mcast_rate */ |
158 | #define IEEE80211SOFTMAC_TXRATECHG_MGT_MCAST (1 << 3) /* mgt_mcast_rate */ | 169 | #define IEEE80211SOFTMAC_TXRATECHG_MGT_MCAST (1 << 3) /* mgt_mcast_rate */ |
159 | 170 | ||
171 | #define IEEE80211SOFTMAC_BSSINFOCHG_RATES (1 << 0) /* supported_rates */ | ||
172 | #define IEEE80211SOFTMAC_BSSINFOCHG_SHORT_PREAMBLE (1 << 1) /* short_preamble */ | ||
173 | #define IEEE80211SOFTMAC_BSSINFOCHG_PROTECTION (1 << 2) /* use_protection */ | ||
174 | |||
160 | struct ieee80211softmac_device { | 175 | struct ieee80211softmac_device { |
161 | /* 802.11 structure for data stuff */ | 176 | /* 802.11 structure for data stuff */ |
162 | struct ieee80211_device *ieee; | 177 | struct ieee80211_device *ieee; |
@@ -200,10 +215,16 @@ struct ieee80211softmac_device { | |||
200 | * The driver just needs to read them. | 215 | * The driver just needs to read them. |
201 | */ | 216 | */ |
202 | struct ieee80211softmac_txrates txrates; | 217 | struct ieee80211softmac_txrates txrates; |
203 | /* If the driver needs to do stuff on TX rate changes, assign this callback. */ | 218 | |
219 | /* If the driver needs to do stuff on TX rate changes, assign this | ||
220 | * callback. See IEEE80211SOFTMAC_TXRATECHG for change flags. */ | ||
204 | void (*txrates_change)(struct net_device *dev, | 221 | void (*txrates_change)(struct net_device *dev, |
205 | u32 changes, /* see IEEE80211SOFTMAC_TXRATECHG flags */ | 222 | u32 changes); |
206 | const struct ieee80211softmac_txrates *rates_before_change); | 223 | |
224 | /* If the driver needs to do stuff when BSS properties change, assign | ||
225 | * this callback. see IEEE80211SOFTMAC_BSSINFOCHG for change flags. */ | ||
226 | void (*bssinfo_change)(struct net_device *dev, | ||
227 | u32 changes); | ||
207 | 228 | ||
208 | /* private stuff follows */ | 229 | /* private stuff follows */ |
209 | /* this lock protects this structure */ | 230 | /* this lock protects this structure */ |
@@ -216,6 +237,7 @@ struct ieee80211softmac_device { | |||
216 | 237 | ||
217 | struct ieee80211softmac_scaninfo *scaninfo; | 238 | struct ieee80211softmac_scaninfo *scaninfo; |
218 | struct ieee80211softmac_assoc_info associnfo; | 239 | struct ieee80211softmac_assoc_info associnfo; |
240 | struct ieee80211softmac_bss_info bssinfo; | ||
219 | 241 | ||
220 | struct list_head auth_queue; | 242 | struct list_head auth_queue; |
221 | struct list_head events; | 243 | struct list_head events; |
@@ -257,6 +279,14 @@ extern void ieee80211softmac_fragment_lost(struct net_device *dev, | |||
257 | * Note that the rates need to be sorted. */ | 279 | * Note that the rates need to be sorted. */ |
258 | extern void ieee80211softmac_set_rates(struct net_device *dev, u8 count, u8 *rates); | 280 | extern void ieee80211softmac_set_rates(struct net_device *dev, u8 count, u8 *rates); |
259 | 281 | ||
282 | /* Finds the highest rate which is: | ||
283 | * 1. Present in ri (optionally a basic rate) | ||
284 | * 2. Supported by the device | ||
285 | * 3. Less than or equal to the user-defined rate | ||
286 | */ | ||
287 | extern u8 ieee80211softmac_highest_supported_rate(struct ieee80211softmac_device *mac, | ||
288 | struct ieee80211softmac_ratesinfo *ri, int basic_only); | ||
289 | |||
260 | /* Helper function which advises you the rate at which a frame should be | 290 | /* Helper function which advises you the rate at which a frame should be |
261 | * transmitted at. */ | 291 | * transmitted at. */ |
262 | static inline u8 ieee80211softmac_suggest_txrate(struct ieee80211softmac_device *mac, | 292 | static inline u8 ieee80211softmac_suggest_txrate(struct ieee80211softmac_device *mac, |
@@ -279,6 +309,24 @@ static inline u8 ieee80211softmac_suggest_txrate(struct ieee80211softmac_device | |||
279 | return txrates->mcast_rate; | 309 | return txrates->mcast_rate; |
280 | } | 310 | } |
281 | 311 | ||
312 | /* Helper function which advises you when it is safe to transmit with short | ||
313 | * preamble. | ||
314 | * You should only call this function when transmitting at CCK rates. */ | ||
315 | static inline int ieee80211softmac_short_preamble_ok(struct ieee80211softmac_device *mac, | ||
316 | int is_multicast, | ||
317 | int is_mgt) | ||
318 | { | ||
319 | return (is_multicast && is_mgt) ? 0 : mac->bssinfo.short_preamble; | ||
320 | } | ||
321 | |||
322 | /* Helper function which advises you whether protection (e.g. self-CTS) is | ||
323 | * needed. 1 = protection needed, 0 = no protection needed | ||
324 | * Only use this function when transmitting with OFDM modulation. */ | ||
325 | static inline int ieee80211softmac_protection_needed(struct ieee80211softmac_device *mac) | ||
326 | { | ||
327 | return mac->bssinfo.use_protection; | ||
328 | } | ||
329 | |||
282 | /* Start the SoftMAC. Call this after you initialized the device | 330 | /* Start the SoftMAC. Call this after you initialized the device |
283 | * and it is ready to run. | 331 | * and it is ready to run. |
284 | */ | 332 | */ |
diff --git a/include/net/if_inet6.h b/include/net/if_inet6.h index e459e1a0ae4a..34489c13c119 100644 --- a/include/net/if_inet6.h +++ b/include/net/if_inet6.h | |||
@@ -189,6 +189,7 @@ struct inet6_dev | |||
189 | struct ipv6_devconf cnf; | 189 | struct ipv6_devconf cnf; |
190 | struct ipv6_devstat stats; | 190 | struct ipv6_devstat stats; |
191 | unsigned long tstamp; /* ipv6InterfaceTable update timestamp */ | 191 | unsigned long tstamp; /* ipv6InterfaceTable update timestamp */ |
192 | struct rcu_head rcu; | ||
192 | }; | 193 | }; |
193 | 194 | ||
194 | extern struct ipv6_devconf ipv6_devconf; | 195 | extern struct ipv6_devconf ipv6_devconf; |
diff --git a/include/net/inet_connection_sock.h b/include/net/inet_connection_sock.h index 9bf73fe50948..de4e83b6da4b 100644 --- a/include/net/inet_connection_sock.h +++ b/include/net/inet_connection_sock.h | |||
@@ -147,7 +147,8 @@ extern struct sock *inet_csk_clone(struct sock *sk, | |||
147 | enum inet_csk_ack_state_t { | 147 | enum inet_csk_ack_state_t { |
148 | ICSK_ACK_SCHED = 1, | 148 | ICSK_ACK_SCHED = 1, |
149 | ICSK_ACK_TIMER = 2, | 149 | ICSK_ACK_TIMER = 2, |
150 | ICSK_ACK_PUSHED = 4 | 150 | ICSK_ACK_PUSHED = 4, |
151 | ICSK_ACK_PUSHED2 = 8 | ||
151 | }; | 152 | }; |
152 | 153 | ||
153 | extern void inet_csk_init_xmit_timers(struct sock *sk, | 154 | extern void inet_csk_init_xmit_timers(struct sock *sk, |
diff --git a/include/net/inet_hashtables.h b/include/net/inet_hashtables.h index 98e0bb3014fe..b4491c9e2a5a 100644 --- a/include/net/inet_hashtables.h +++ b/include/net/inet_hashtables.h | |||
@@ -271,38 +271,15 @@ static inline int inet_iif(const struct sk_buff *skb) | |||
271 | return ((struct rtable *)skb->dst)->rt_iif; | 271 | return ((struct rtable *)skb->dst)->rt_iif; |
272 | } | 272 | } |
273 | 273 | ||
274 | extern struct sock *__inet_lookup_listener(const struct hlist_head *head, | 274 | extern struct sock *__inet_lookup_listener(struct inet_hashinfo *hashinfo, |
275 | const u32 daddr, | 275 | const u32 daddr, |
276 | const unsigned short hnum, | 276 | const unsigned short hnum, |
277 | const int dif); | 277 | const int dif); |
278 | 278 | ||
279 | /* Optimize the common listener case. */ | 279 | static inline struct sock *inet_lookup_listener(struct inet_hashinfo *hashinfo, |
280 | static inline struct sock * | 280 | u32 daddr, u16 dport, int dif) |
281 | inet_lookup_listener(struct inet_hashinfo *hashinfo, | ||
282 | const u32 daddr, | ||
283 | const unsigned short hnum, const int dif) | ||
284 | { | 281 | { |
285 | struct sock *sk = NULL; | 282 | return __inet_lookup_listener(hashinfo, daddr, ntohs(dport), dif); |
286 | const struct hlist_head *head; | ||
287 | |||
288 | read_lock(&hashinfo->lhash_lock); | ||
289 | head = &hashinfo->listening_hash[inet_lhashfn(hnum)]; | ||
290 | if (!hlist_empty(head)) { | ||
291 | const struct inet_sock *inet = inet_sk((sk = __sk_head(head))); | ||
292 | |||
293 | if (inet->num == hnum && !sk->sk_node.next && | ||
294 | (!inet->rcv_saddr || inet->rcv_saddr == daddr) && | ||
295 | (sk->sk_family == PF_INET || !ipv6_only_sock(sk)) && | ||
296 | !sk->sk_bound_dev_if) | ||
297 | goto sherry_cache; | ||
298 | sk = __inet_lookup_listener(head, daddr, hnum, dif); | ||
299 | } | ||
300 | if (sk) { | ||
301 | sherry_cache: | ||
302 | sock_hold(sk); | ||
303 | } | ||
304 | read_unlock(&hashinfo->lhash_lock); | ||
305 | return sk; | ||
306 | } | 283 | } |
307 | 284 | ||
308 | /* Socket demux engine toys. */ | 285 | /* Socket demux engine toys. */ |
@@ -391,14 +368,25 @@ hit: | |||
391 | goto out; | 368 | goto out; |
392 | } | 369 | } |
393 | 370 | ||
371 | static inline struct sock * | ||
372 | inet_lookup_established(struct inet_hashinfo *hashinfo, | ||
373 | const u32 saddr, const u16 sport, | ||
374 | const u32 daddr, const u16 dport, | ||
375 | const int dif) | ||
376 | { | ||
377 | return __inet_lookup_established(hashinfo, saddr, sport, daddr, | ||
378 | ntohs(dport), dif); | ||
379 | } | ||
380 | |||
394 | static inline struct sock *__inet_lookup(struct inet_hashinfo *hashinfo, | 381 | static inline struct sock *__inet_lookup(struct inet_hashinfo *hashinfo, |
395 | const u32 saddr, const u16 sport, | 382 | const u32 saddr, const u16 sport, |
396 | const u32 daddr, const u16 hnum, | 383 | const u32 daddr, const u16 dport, |
397 | const int dif) | 384 | const int dif) |
398 | { | 385 | { |
386 | u16 hnum = ntohs(dport); | ||
399 | struct sock *sk = __inet_lookup_established(hashinfo, saddr, sport, daddr, | 387 | struct sock *sk = __inet_lookup_established(hashinfo, saddr, sport, daddr, |
400 | hnum, dif); | 388 | hnum, dif); |
401 | return sk ? : inet_lookup_listener(hashinfo, daddr, hnum, dif); | 389 | return sk ? : __inet_lookup_listener(hashinfo, daddr, hnum, dif); |
402 | } | 390 | } |
403 | 391 | ||
404 | static inline struct sock *inet_lookup(struct inet_hashinfo *hashinfo, | 392 | static inline struct sock *inet_lookup(struct inet_hashinfo *hashinfo, |
@@ -409,7 +397,7 @@ static inline struct sock *inet_lookup(struct inet_hashinfo *hashinfo, | |||
409 | struct sock *sk; | 397 | struct sock *sk; |
410 | 398 | ||
411 | local_bh_disable(); | 399 | local_bh_disable(); |
412 | sk = __inet_lookup(hashinfo, saddr, sport, daddr, ntohs(dport), dif); | 400 | sk = __inet_lookup(hashinfo, saddr, sport, daddr, dport, dif); |
413 | local_bh_enable(); | 401 | local_bh_enable(); |
414 | 402 | ||
415 | return sk; | 403 | return sk; |
diff --git a/include/net/inet_sock.h b/include/net/inet_sock.h index 1f4a9a60d4cc..f6242710f2ff 100644 --- a/include/net/inet_sock.h +++ b/include/net/inet_sock.h | |||
@@ -27,7 +27,6 @@ | |||
27 | /** struct ip_options - IP Options | 27 | /** struct ip_options - IP Options |
28 | * | 28 | * |
29 | * @faddr - Saved first hop address | 29 | * @faddr - Saved first hop address |
30 | * @is_setbyuser - Set by setsockopt? | ||
31 | * @is_data - Options in __data, rather than skb | 30 | * @is_data - Options in __data, rather than skb |
32 | * @is_strictroute - Strict source route | 31 | * @is_strictroute - Strict source route |
33 | * @srr_is_hit - Packet destination addr was our one | 32 | * @srr_is_hit - Packet destination addr was our one |
@@ -42,8 +41,7 @@ struct ip_options { | |||
42 | unsigned char srr; | 41 | unsigned char srr; |
43 | unsigned char rr; | 42 | unsigned char rr; |
44 | unsigned char ts; | 43 | unsigned char ts; |
45 | unsigned char is_setbyuser:1, | 44 | unsigned char is_data:1, |
46 | is_data:1, | ||
47 | is_strictroute:1, | 45 | is_strictroute:1, |
48 | srr_is_hit:1, | 46 | srr_is_hit:1, |
49 | is_changed:1, | 47 | is_changed:1, |
@@ -51,7 +49,7 @@ struct ip_options { | |||
51 | ts_needtime:1, | 49 | ts_needtime:1, |
52 | ts_needaddr:1; | 50 | ts_needaddr:1; |
53 | unsigned char router_alert; | 51 | unsigned char router_alert; |
54 | unsigned char __pad1; | 52 | unsigned char cipso; |
55 | unsigned char __pad2; | 53 | unsigned char __pad2; |
56 | unsigned char __data[0]; | 54 | unsigned char __data[0]; |
57 | }; | 55 | }; |
diff --git a/include/net/ip6_fib.h b/include/net/ip6_fib.h index a66e9de16a6c..e4438de3bd6b 100644 --- a/include/net/ip6_fib.h +++ b/include/net/ip6_fib.h | |||
@@ -16,14 +16,35 @@ | |||
16 | #ifdef __KERNEL__ | 16 | #ifdef __KERNEL__ |
17 | 17 | ||
18 | #include <linux/ipv6_route.h> | 18 | #include <linux/ipv6_route.h> |
19 | |||
20 | #include <net/dst.h> | ||
21 | #include <net/flow.h> | ||
22 | #include <linux/rtnetlink.h> | 19 | #include <linux/rtnetlink.h> |
23 | #include <linux/spinlock.h> | 20 | #include <linux/spinlock.h> |
21 | #include <net/dst.h> | ||
22 | #include <net/flow.h> | ||
23 | #include <net/netlink.h> | ||
24 | 24 | ||
25 | struct rt6_info; | 25 | struct rt6_info; |
26 | 26 | ||
27 | struct fib6_config | ||
28 | { | ||
29 | u32 fc_table; | ||
30 | u32 fc_metric; | ||
31 | int fc_dst_len; | ||
32 | int fc_src_len; | ||
33 | int fc_ifindex; | ||
34 | u32 fc_flags; | ||
35 | u32 fc_protocol; | ||
36 | |||
37 | struct in6_addr fc_dst; | ||
38 | struct in6_addr fc_src; | ||
39 | struct in6_addr fc_gateway; | ||
40 | |||
41 | unsigned long fc_expires; | ||
42 | struct nlattr *fc_mx; | ||
43 | int fc_mx_len; | ||
44 | |||
45 | struct nl_info fc_nlinfo; | ||
46 | }; | ||
47 | |||
27 | struct fib6_node | 48 | struct fib6_node |
28 | { | 49 | { |
29 | struct fib6_node *parent; | 50 | struct fib6_node *parent; |
@@ -39,6 +60,11 @@ struct fib6_node | |||
39 | __u32 fn_sernum; | 60 | __u32 fn_sernum; |
40 | }; | 61 | }; |
41 | 62 | ||
63 | #ifndef CONFIG_IPV6_SUBTREES | ||
64 | #define FIB6_SUBTREE(fn) NULL | ||
65 | #else | ||
66 | #define FIB6_SUBTREE(fn) ((fn)->subtree) | ||
67 | #endif | ||
42 | 68 | ||
43 | /* | 69 | /* |
44 | * routing information | 70 | * routing information |
@@ -51,6 +77,8 @@ struct rt6key | |||
51 | int plen; | 77 | int plen; |
52 | }; | 78 | }; |
53 | 79 | ||
80 | struct fib6_table; | ||
81 | |||
54 | struct rt6_info | 82 | struct rt6_info |
55 | { | 83 | { |
56 | union { | 84 | union { |
@@ -71,6 +99,7 @@ struct rt6_info | |||
71 | u32 rt6i_flags; | 99 | u32 rt6i_flags; |
72 | u32 rt6i_metric; | 100 | u32 rt6i_metric; |
73 | atomic_t rt6i_ref; | 101 | atomic_t rt6i_ref; |
102 | struct fib6_table *rt6i_table; | ||
74 | 103 | ||
75 | struct rt6key rt6i_dst; | 104 | struct rt6key rt6i_dst; |
76 | struct rt6key rt6i_src; | 105 | struct rt6key rt6i_src; |
@@ -89,28 +118,6 @@ struct fib6_walker_t | |||
89 | void *args; | 118 | void *args; |
90 | }; | 119 | }; |
91 | 120 | ||
92 | extern struct fib6_walker_t fib6_walker_list; | ||
93 | extern rwlock_t fib6_walker_lock; | ||
94 | |||
95 | static inline void fib6_walker_link(struct fib6_walker_t *w) | ||
96 | { | ||
97 | write_lock_bh(&fib6_walker_lock); | ||
98 | w->next = fib6_walker_list.next; | ||
99 | w->prev = &fib6_walker_list; | ||
100 | w->next->prev = w; | ||
101 | w->prev->next = w; | ||
102 | write_unlock_bh(&fib6_walker_lock); | ||
103 | } | ||
104 | |||
105 | static inline void fib6_walker_unlink(struct fib6_walker_t *w) | ||
106 | { | ||
107 | write_lock_bh(&fib6_walker_lock); | ||
108 | w->next->prev = w->prev; | ||
109 | w->prev->next = w->next; | ||
110 | w->prev = w->next = w; | ||
111 | write_unlock_bh(&fib6_walker_lock); | ||
112 | } | ||
113 | |||
114 | struct rt6_statistics { | 121 | struct rt6_statistics { |
115 | __u32 fib_nodes; | 122 | __u32 fib_nodes; |
116 | __u32 fib_route_nodes; | 123 | __u32 fib_route_nodes; |
@@ -143,12 +150,41 @@ struct rt6_statistics { | |||
143 | 150 | ||
144 | typedef void (*f_pnode)(struct fib6_node *fn, void *); | 151 | typedef void (*f_pnode)(struct fib6_node *fn, void *); |
145 | 152 | ||
146 | extern struct fib6_node ip6_routing_table; | 153 | struct fib6_table { |
154 | struct hlist_node tb6_hlist; | ||
155 | u32 tb6_id; | ||
156 | rwlock_t tb6_lock; | ||
157 | struct fib6_node tb6_root; | ||
158 | }; | ||
159 | |||
160 | #define RT6_TABLE_UNSPEC RT_TABLE_UNSPEC | ||
161 | #define RT6_TABLE_MAIN RT_TABLE_MAIN | ||
162 | #define RT6_TABLE_DFLT RT6_TABLE_MAIN | ||
163 | #define RT6_TABLE_INFO RT6_TABLE_MAIN | ||
164 | #define RT6_TABLE_PREFIX RT6_TABLE_MAIN | ||
165 | |||
166 | #ifdef CONFIG_IPV6_MULTIPLE_TABLES | ||
167 | #define FIB6_TABLE_MIN 1 | ||
168 | #define FIB6_TABLE_MAX RT_TABLE_MAX | ||
169 | #define RT6_TABLE_LOCAL RT_TABLE_LOCAL | ||
170 | #else | ||
171 | #define FIB6_TABLE_MIN RT_TABLE_MAIN | ||
172 | #define FIB6_TABLE_MAX FIB6_TABLE_MIN | ||
173 | #define RT6_TABLE_LOCAL RT6_TABLE_MAIN | ||
174 | #endif | ||
175 | |||
176 | typedef struct rt6_info *(*pol_lookup_t)(struct fib6_table *, | ||
177 | struct flowi *, int); | ||
147 | 178 | ||
148 | /* | 179 | /* |
149 | * exported functions | 180 | * exported functions |
150 | */ | 181 | */ |
151 | 182 | ||
183 | extern struct fib6_table * fib6_get_table(u32 id); | ||
184 | extern struct fib6_table * fib6_new_table(u32 id); | ||
185 | extern struct dst_entry * fib6_rule_lookup(struct flowi *fl, int flags, | ||
186 | pol_lookup_t lookup); | ||
187 | |||
152 | extern struct fib6_node *fib6_lookup(struct fib6_node *root, | 188 | extern struct fib6_node *fib6_lookup(struct fib6_node *root, |
153 | struct in6_addr *daddr, | 189 | struct in6_addr *daddr, |
154 | struct in6_addr *saddr); | 190 | struct in6_addr *saddr); |
@@ -157,32 +193,29 @@ struct fib6_node *fib6_locate(struct fib6_node *root, | |||
157 | struct in6_addr *daddr, int dst_len, | 193 | struct in6_addr *daddr, int dst_len, |
158 | struct in6_addr *saddr, int src_len); | 194 | struct in6_addr *saddr, int src_len); |
159 | 195 | ||
160 | extern void fib6_clean_tree(struct fib6_node *root, | 196 | extern void fib6_clean_all(int (*func)(struct rt6_info *, void *arg), |
161 | int (*func)(struct rt6_info *, void *arg), | 197 | int prune, void *arg); |
162 | int prune, void *arg); | ||
163 | |||
164 | extern int fib6_walk(struct fib6_walker_t *w); | ||
165 | extern int fib6_walk_continue(struct fib6_walker_t *w); | ||
166 | 198 | ||
167 | extern int fib6_add(struct fib6_node *root, | 199 | extern int fib6_add(struct fib6_node *root, |
168 | struct rt6_info *rt, | 200 | struct rt6_info *rt, |
169 | struct nlmsghdr *nlh, | 201 | struct nl_info *info); |
170 | void *rtattr, | ||
171 | struct netlink_skb_parms *req); | ||
172 | 202 | ||
173 | extern int fib6_del(struct rt6_info *rt, | 203 | extern int fib6_del(struct rt6_info *rt, |
174 | struct nlmsghdr *nlh, | 204 | struct nl_info *info); |
175 | void *rtattr, | ||
176 | struct netlink_skb_parms *req); | ||
177 | 205 | ||
178 | extern void inet6_rt_notify(int event, struct rt6_info *rt, | 206 | extern void inet6_rt_notify(int event, struct rt6_info *rt, |
179 | struct nlmsghdr *nlh, | 207 | struct nl_info *info); |
180 | struct netlink_skb_parms *req); | ||
181 | 208 | ||
182 | extern void fib6_run_gc(unsigned long dummy); | 209 | extern void fib6_run_gc(unsigned long dummy); |
183 | 210 | ||
184 | extern void fib6_gc_cleanup(void); | 211 | extern void fib6_gc_cleanup(void); |
185 | 212 | ||
186 | extern void fib6_init(void); | 213 | extern void fib6_init(void); |
214 | |||
215 | extern void fib6_rules_init(void); | ||
216 | extern void fib6_rules_cleanup(void); | ||
217 | extern int fib6_rules_dump(struct sk_buff *, | ||
218 | struct netlink_callback *); | ||
219 | |||
187 | #endif | 220 | #endif |
188 | #endif | 221 | #endif |
diff --git a/include/net/ip6_route.h b/include/net/ip6_route.h index 96b0e66406ec..6ca6b71dfe0f 100644 --- a/include/net/ip6_route.h +++ b/include/net/ip6_route.h | |||
@@ -32,6 +32,10 @@ struct route_info { | |||
32 | #include <linux/ip.h> | 32 | #include <linux/ip.h> |
33 | #include <linux/ipv6.h> | 33 | #include <linux/ipv6.h> |
34 | 34 | ||
35 | #define RT6_LOOKUP_F_IFACE 0x1 | ||
36 | #define RT6_LOOKUP_F_REACHABLE 0x2 | ||
37 | #define RT6_LOOKUP_F_HAS_SADDR 0x4 | ||
38 | |||
35 | struct pol_chain { | 39 | struct pol_chain { |
36 | int type; | 40 | int type; |
37 | int priority; | 41 | int priority; |
@@ -41,6 +45,11 @@ struct pol_chain { | |||
41 | 45 | ||
42 | extern struct rt6_info ip6_null_entry; | 46 | extern struct rt6_info ip6_null_entry; |
43 | 47 | ||
48 | #ifdef CONFIG_IPV6_MULTIPLE_TABLES | ||
49 | extern struct rt6_info ip6_prohibit_entry; | ||
50 | extern struct rt6_info ip6_blk_hole_entry; | ||
51 | #endif | ||
52 | |||
44 | extern int ip6_rt_gc_interval; | 53 | extern int ip6_rt_gc_interval; |
45 | 54 | ||
46 | extern void ip6_route_input(struct sk_buff *skb); | 55 | extern void ip6_route_input(struct sk_buff *skb); |
@@ -48,25 +57,14 @@ extern void ip6_route_input(struct sk_buff *skb); | |||
48 | extern struct dst_entry * ip6_route_output(struct sock *sk, | 57 | extern struct dst_entry * ip6_route_output(struct sock *sk, |
49 | struct flowi *fl); | 58 | struct flowi *fl); |
50 | 59 | ||
51 | extern int ip6_route_me_harder(struct sk_buff *skb); | ||
52 | |||
53 | extern void ip6_route_init(void); | 60 | extern void ip6_route_init(void); |
54 | extern void ip6_route_cleanup(void); | 61 | extern void ip6_route_cleanup(void); |
55 | 62 | ||
56 | extern int ipv6_route_ioctl(unsigned int cmd, void __user *arg); | 63 | extern int ipv6_route_ioctl(unsigned int cmd, void __user *arg); |
57 | 64 | ||
58 | extern int ip6_route_add(struct in6_rtmsg *rtmsg, | 65 | extern int ip6_route_add(struct fib6_config *cfg); |
59 | struct nlmsghdr *, | 66 | extern int ip6_ins_rt(struct rt6_info *); |
60 | void *rtattr, | 67 | extern int ip6_del_rt(struct rt6_info *); |
61 | struct netlink_skb_parms *req); | ||
62 | extern int ip6_ins_rt(struct rt6_info *, | ||
63 | struct nlmsghdr *, | ||
64 | void *rtattr, | ||
65 | struct netlink_skb_parms *req); | ||
66 | extern int ip6_del_rt(struct rt6_info *, | ||
67 | struct nlmsghdr *, | ||
68 | void *rtattr, | ||
69 | struct netlink_skb_parms *req); | ||
70 | 68 | ||
71 | extern int ip6_rt_addr_add(struct in6_addr *addr, | 69 | extern int ip6_rt_addr_add(struct in6_addr *addr, |
72 | struct net_device *dev, | 70 | struct net_device *dev, |
@@ -114,6 +112,7 @@ extern int rt6_route_rcv(struct net_device *dev, | |||
114 | struct in6_addr *gwaddr); | 112 | struct in6_addr *gwaddr); |
115 | 113 | ||
116 | extern void rt6_redirect(struct in6_addr *dest, | 114 | extern void rt6_redirect(struct in6_addr *dest, |
115 | struct in6_addr *src, | ||
117 | struct in6_addr *saddr, | 116 | struct in6_addr *saddr, |
118 | struct neighbour *neigh, | 117 | struct neighbour *neigh, |
119 | u8 *lladdr, | 118 | u8 *lladdr, |
@@ -131,6 +130,13 @@ extern int inet6_rtm_newroute(struct sk_buff *skb, struct nlmsghdr* nlh, void *a | |||
131 | extern int inet6_rtm_delroute(struct sk_buff *skb, struct nlmsghdr* nlh, void *arg); | 130 | extern int inet6_rtm_delroute(struct sk_buff *skb, struct nlmsghdr* nlh, void *arg); |
132 | extern int inet6_rtm_getroute(struct sk_buff *skb, struct nlmsghdr* nlh, void *arg); | 131 | extern int inet6_rtm_getroute(struct sk_buff *skb, struct nlmsghdr* nlh, void *arg); |
133 | 132 | ||
133 | struct rt6_rtnl_dump_arg | ||
134 | { | ||
135 | struct sk_buff *skb; | ||
136 | struct netlink_callback *cb; | ||
137 | }; | ||
138 | |||
139 | extern int rt6_dump_route(struct rt6_info *rt, void *p_arg); | ||
134 | extern void rt6_ifdown(struct net_device *dev); | 140 | extern void rt6_ifdown(struct net_device *dev); |
135 | extern void rt6_mtu_change(struct net_device *dev, unsigned mtu); | 141 | extern void rt6_mtu_change(struct net_device *dev, unsigned mtu); |
136 | 142 | ||
@@ -140,21 +146,24 @@ extern rwlock_t rt6_lock; | |||
140 | * Store a destination cache entry in a socket | 146 | * Store a destination cache entry in a socket |
141 | */ | 147 | */ |
142 | static inline void __ip6_dst_store(struct sock *sk, struct dst_entry *dst, | 148 | static inline void __ip6_dst_store(struct sock *sk, struct dst_entry *dst, |
143 | struct in6_addr *daddr) | 149 | struct in6_addr *daddr, struct in6_addr *saddr) |
144 | { | 150 | { |
145 | struct ipv6_pinfo *np = inet6_sk(sk); | 151 | struct ipv6_pinfo *np = inet6_sk(sk); |
146 | struct rt6_info *rt = (struct rt6_info *) dst; | 152 | struct rt6_info *rt = (struct rt6_info *) dst; |
147 | 153 | ||
148 | sk_setup_caps(sk, dst); | 154 | sk_setup_caps(sk, dst); |
149 | np->daddr_cache = daddr; | 155 | np->daddr_cache = daddr; |
156 | #ifdef CONFIG_IPV6_SUBTREES | ||
157 | np->saddr_cache = saddr; | ||
158 | #endif | ||
150 | np->dst_cookie = rt->rt6i_node ? rt->rt6i_node->fn_sernum : 0; | 159 | np->dst_cookie = rt->rt6i_node ? rt->rt6i_node->fn_sernum : 0; |
151 | } | 160 | } |
152 | 161 | ||
153 | static inline void ip6_dst_store(struct sock *sk, struct dst_entry *dst, | 162 | static inline void ip6_dst_store(struct sock *sk, struct dst_entry *dst, |
154 | struct in6_addr *daddr) | 163 | struct in6_addr *daddr, struct in6_addr *saddr) |
155 | { | 164 | { |
156 | write_lock(&sk->sk_dst_lock); | 165 | write_lock(&sk->sk_dst_lock); |
157 | __ip6_dst_store(sk, dst, daddr); | 166 | __ip6_dst_store(sk, dst, daddr, saddr); |
158 | write_unlock(&sk->sk_dst_lock); | 167 | write_unlock(&sk->sk_dst_lock); |
159 | } | 168 | } |
160 | 169 | ||
diff --git a/include/net/ip_fib.h b/include/net/ip_fib.h index a095d1dec7a4..fcc159a4ac17 100644 --- a/include/net/ip_fib.h +++ b/include/net/ip_fib.h | |||
@@ -18,26 +18,34 @@ | |||
18 | 18 | ||
19 | #include <net/flow.h> | 19 | #include <net/flow.h> |
20 | #include <linux/seq_file.h> | 20 | #include <linux/seq_file.h> |
21 | 21 | #include <net/fib_rules.h> | |
22 | /* WARNING: The ordering of these elements must match ordering | 22 | |
23 | * of RTA_* rtnetlink attribute numbers. | 23 | struct fib_config { |
24 | */ | 24 | u8 fc_family; |
25 | struct kern_rta { | 25 | u8 fc_dst_len; |
26 | void *rta_dst; | 26 | u8 fc_src_len; |
27 | void *rta_src; | 27 | u8 fc_tos; |
28 | int *rta_iif; | 28 | u8 fc_protocol; |
29 | int *rta_oif; | 29 | u8 fc_scope; |
30 | void *rta_gw; | 30 | u8 fc_type; |
31 | u32 *rta_priority; | 31 | /* 1 byte unused */ |
32 | void *rta_prefsrc; | 32 | u32 fc_table; |
33 | struct rtattr *rta_mx; | 33 | u32 fc_dst; |
34 | struct rtattr *rta_mp; | 34 | u32 fc_src; |
35 | unsigned char *rta_protoinfo; | 35 | u32 fc_gw; |
36 | u32 *rta_flow; | 36 | int fc_oif; |
37 | struct rta_cacheinfo *rta_ci; | 37 | u32 fc_flags; |
38 | struct rta_session *rta_sess; | 38 | u32 fc_priority; |
39 | u32 *rta_mp_alg; | 39 | u32 fc_prefsrc; |
40 | }; | 40 | struct nlattr *fc_mx; |
41 | struct rtnexthop *fc_mp; | ||
42 | int fc_mx_len; | ||
43 | int fc_mp_len; | ||
44 | u32 fc_flow; | ||
45 | u32 fc_mp_alg; | ||
46 | u32 fc_nlflags; | ||
47 | struct nl_info fc_nlinfo; | ||
48 | }; | ||
41 | 49 | ||
42 | struct fib_info; | 50 | struct fib_info; |
43 | 51 | ||
@@ -149,15 +157,12 @@ struct fib_result_nl { | |||
149 | #endif /* CONFIG_IP_ROUTE_MULTIPATH_WRANDOM */ | 157 | #endif /* CONFIG_IP_ROUTE_MULTIPATH_WRANDOM */ |
150 | 158 | ||
151 | struct fib_table { | 159 | struct fib_table { |
152 | unsigned char tb_id; | 160 | struct hlist_node tb_hlist; |
161 | u32 tb_id; | ||
153 | unsigned tb_stamp; | 162 | unsigned tb_stamp; |
154 | int (*tb_lookup)(struct fib_table *tb, const struct flowi *flp, struct fib_result *res); | 163 | int (*tb_lookup)(struct fib_table *tb, const struct flowi *flp, struct fib_result *res); |
155 | int (*tb_insert)(struct fib_table *table, struct rtmsg *r, | 164 | int (*tb_insert)(struct fib_table *, struct fib_config *); |
156 | struct kern_rta *rta, struct nlmsghdr *n, | 165 | int (*tb_delete)(struct fib_table *, struct fib_config *); |
157 | struct netlink_skb_parms *req); | ||
158 | int (*tb_delete)(struct fib_table *table, struct rtmsg *r, | ||
159 | struct kern_rta *rta, struct nlmsghdr *n, | ||
160 | struct netlink_skb_parms *req); | ||
161 | int (*tb_dump)(struct fib_table *table, struct sk_buff *skb, | 166 | int (*tb_dump)(struct fib_table *table, struct sk_buff *skb, |
162 | struct netlink_callback *cb); | 167 | struct netlink_callback *cb); |
163 | int (*tb_flush)(struct fib_table *table); | 168 | int (*tb_flush)(struct fib_table *table); |
@@ -172,14 +177,14 @@ struct fib_table { | |||
172 | extern struct fib_table *ip_fib_local_table; | 177 | extern struct fib_table *ip_fib_local_table; |
173 | extern struct fib_table *ip_fib_main_table; | 178 | extern struct fib_table *ip_fib_main_table; |
174 | 179 | ||
175 | static inline struct fib_table *fib_get_table(int id) | 180 | static inline struct fib_table *fib_get_table(u32 id) |
176 | { | 181 | { |
177 | if (id != RT_TABLE_LOCAL) | 182 | if (id != RT_TABLE_LOCAL) |
178 | return ip_fib_main_table; | 183 | return ip_fib_main_table; |
179 | return ip_fib_local_table; | 184 | return ip_fib_local_table; |
180 | } | 185 | } |
181 | 186 | ||
182 | static inline struct fib_table *fib_new_table(int id) | 187 | static inline struct fib_table *fib_new_table(u32 id) |
183 | { | 188 | { |
184 | return fib_get_table(id); | 189 | return fib_get_table(id); |
185 | } | 190 | } |
@@ -199,35 +204,19 @@ static inline void fib_select_default(const struct flowi *flp, struct fib_result | |||
199 | } | 204 | } |
200 | 205 | ||
201 | #else /* CONFIG_IP_MULTIPLE_TABLES */ | 206 | #else /* CONFIG_IP_MULTIPLE_TABLES */ |
202 | #define ip_fib_local_table (fib_tables[RT_TABLE_LOCAL]) | 207 | #define ip_fib_local_table fib_get_table(RT_TABLE_LOCAL) |
203 | #define ip_fib_main_table (fib_tables[RT_TABLE_MAIN]) | 208 | #define ip_fib_main_table fib_get_table(RT_TABLE_MAIN) |
204 | |||
205 | extern struct fib_table * fib_tables[RT_TABLE_MAX+1]; | ||
206 | extern int fib_lookup(const struct flowi *flp, struct fib_result *res); | ||
207 | extern struct fib_table *__fib_new_table(int id); | ||
208 | extern void fib_rule_put(struct fib_rule *r); | ||
209 | 209 | ||
210 | static inline struct fib_table *fib_get_table(int id) | 210 | extern int fib_lookup(struct flowi *flp, struct fib_result *res); |
211 | { | ||
212 | if (id == 0) | ||
213 | id = RT_TABLE_MAIN; | ||
214 | |||
215 | return fib_tables[id]; | ||
216 | } | ||
217 | |||
218 | static inline struct fib_table *fib_new_table(int id) | ||
219 | { | ||
220 | if (id == 0) | ||
221 | id = RT_TABLE_MAIN; | ||
222 | |||
223 | return fib_tables[id] ? : __fib_new_table(id); | ||
224 | } | ||
225 | 211 | ||
212 | extern struct fib_table *fib_new_table(u32 id); | ||
213 | extern struct fib_table *fib_get_table(u32 id); | ||
226 | extern void fib_select_default(const struct flowi *flp, struct fib_result *res); | 214 | extern void fib_select_default(const struct flowi *flp, struct fib_result *res); |
227 | 215 | ||
228 | #endif /* CONFIG_IP_MULTIPLE_TABLES */ | 216 | #endif /* CONFIG_IP_MULTIPLE_TABLES */ |
229 | 217 | ||
230 | /* Exported by fib_frontend.c */ | 218 | /* Exported by fib_frontend.c */ |
219 | extern struct nla_policy rtm_ipv4_policy[]; | ||
231 | extern void ip_fib_init(void); | 220 | extern void ip_fib_init(void); |
232 | extern int inet_rtm_delroute(struct sk_buff *skb, struct nlmsghdr* nlh, void *arg); | 221 | extern int inet_rtm_delroute(struct sk_buff *skb, struct nlmsghdr* nlh, void *arg); |
233 | extern int inet_rtm_newroute(struct sk_buff *skb, struct nlmsghdr* nlh, void *arg); | 222 | extern int inet_rtm_newroute(struct sk_buff *skb, struct nlmsghdr* nlh, void *arg); |
@@ -243,23 +232,20 @@ struct rtentry; | |||
243 | extern int ip_fib_check_default(u32 gw, struct net_device *dev); | 232 | extern int ip_fib_check_default(u32 gw, struct net_device *dev); |
244 | extern int fib_sync_down(u32 local, struct net_device *dev, int force); | 233 | extern int fib_sync_down(u32 local, struct net_device *dev, int force); |
245 | extern int fib_sync_up(struct net_device *dev); | 234 | extern int fib_sync_up(struct net_device *dev); |
246 | extern int fib_convert_rtentry(int cmd, struct nlmsghdr *nl, struct rtmsg *rtm, | ||
247 | struct kern_rta *rta, struct rtentry *r); | ||
248 | extern u32 __fib_res_prefsrc(struct fib_result *res); | 235 | extern u32 __fib_res_prefsrc(struct fib_result *res); |
249 | 236 | ||
250 | /* Exported by fib_hash.c */ | 237 | /* Exported by fib_hash.c */ |
251 | extern struct fib_table *fib_hash_init(int id); | 238 | extern struct fib_table *fib_hash_init(u32 id); |
252 | 239 | ||
253 | #ifdef CONFIG_IP_MULTIPLE_TABLES | 240 | #ifdef CONFIG_IP_MULTIPLE_TABLES |
254 | /* Exported by fib_rules.c */ | 241 | extern int fib4_rules_dump(struct sk_buff *skb, struct netlink_callback *cb); |
242 | |||
243 | extern void __init fib4_rules_init(void); | ||
255 | 244 | ||
256 | extern int inet_rtm_delrule(struct sk_buff *skb, struct nlmsghdr* nlh, void *arg); | ||
257 | extern int inet_rtm_newrule(struct sk_buff *skb, struct nlmsghdr* nlh, void *arg); | ||
258 | extern int inet_dump_rules(struct sk_buff *skb, struct netlink_callback *cb); | ||
259 | #ifdef CONFIG_NET_CLS_ROUTE | 245 | #ifdef CONFIG_NET_CLS_ROUTE |
260 | extern u32 fib_rules_tclass(struct fib_result *res); | 246 | extern u32 fib_rules_tclass(struct fib_result *res); |
261 | #endif | 247 | #endif |
262 | extern void fib_rules_init(void); | 248 | |
263 | #endif | 249 | #endif |
264 | 250 | ||
265 | static inline void fib_combine_itag(u32 *itag, struct fib_result *res) | 251 | static inline void fib_combine_itag(u32 *itag, struct fib_result *res) |
diff --git a/include/net/ipcomp.h b/include/net/ipcomp.h index e651a57ecdd5..87c1af3e5e82 100644 --- a/include/net/ipcomp.h +++ b/include/net/ipcomp.h | |||
@@ -1,11 +1,14 @@ | |||
1 | #ifndef _NET_IPCOMP_H | 1 | #ifndef _NET_IPCOMP_H |
2 | #define _NET_IPCOMP_H | 2 | #define _NET_IPCOMP_H |
3 | 3 | ||
4 | #include <linux/crypto.h> | ||
5 | #include <linux/types.h> | ||
6 | |||
4 | #define IPCOMP_SCRATCH_SIZE 65400 | 7 | #define IPCOMP_SCRATCH_SIZE 65400 |
5 | 8 | ||
6 | struct ipcomp_data { | 9 | struct ipcomp_data { |
7 | u16 threshold; | 10 | u16 threshold; |
8 | struct crypto_tfm **tfms; | 11 | struct crypto_comp **tfms; |
9 | }; | 12 | }; |
10 | 13 | ||
11 | #endif | 14 | #endif |
diff --git a/include/net/ipv6.h b/include/net/ipv6.h index ece7e8a84ffd..72bf47b2a4e0 100644 --- a/include/net/ipv6.h +++ b/include/net/ipv6.h | |||
@@ -40,6 +40,7 @@ | |||
40 | #define NEXTHDR_ICMP 58 /* ICMP for IPv6. */ | 40 | #define NEXTHDR_ICMP 58 /* ICMP for IPv6. */ |
41 | #define NEXTHDR_NONE 59 /* No next header */ | 41 | #define NEXTHDR_NONE 59 /* No next header */ |
42 | #define NEXTHDR_DEST 60 /* Destination options header. */ | 42 | #define NEXTHDR_DEST 60 /* Destination options header. */ |
43 | #define NEXTHDR_MOBILITY 135 /* Mobility header. */ | ||
43 | 44 | ||
44 | #define NEXTHDR_MAX 255 | 45 | #define NEXTHDR_MAX 255 |
45 | 46 | ||
@@ -229,7 +230,7 @@ extern int ip6_ra_control(struct sock *sk, int sel, | |||
229 | void (*destructor)(struct sock *)); | 230 | void (*destructor)(struct sock *)); |
230 | 231 | ||
231 | 232 | ||
232 | extern int ipv6_parse_hopopts(struct sk_buff *skb); | 233 | extern int ipv6_parse_hopopts(struct sk_buff **skbp); |
233 | 234 | ||
234 | extern struct ipv6_txoptions * ipv6_dup_options(struct sock *sk, struct ipv6_txoptions *opt); | 235 | extern struct ipv6_txoptions * ipv6_dup_options(struct sock *sk, struct ipv6_txoptions *opt); |
235 | extern struct ipv6_txoptions * ipv6_renew_options(struct sock *sk, struct ipv6_txoptions *opt, | 236 | extern struct ipv6_txoptions * ipv6_renew_options(struct sock *sk, struct ipv6_txoptions *opt, |
@@ -506,6 +507,8 @@ extern int ipv6_skip_exthdr(const struct sk_buff *, int start, | |||
506 | 507 | ||
507 | extern int ipv6_ext_hdr(u8 nexthdr); | 508 | extern int ipv6_ext_hdr(u8 nexthdr); |
508 | 509 | ||
510 | extern int ipv6_find_tlv(struct sk_buff *skb, int offset, int type); | ||
511 | |||
509 | extern struct ipv6_txoptions * ipv6_invert_rthdr(struct sock *sk, | 512 | extern struct ipv6_txoptions * ipv6_invert_rthdr(struct sock *sk, |
510 | struct ipv6_rt_hdr *hdr); | 513 | struct ipv6_rt_hdr *hdr); |
511 | 514 | ||
diff --git a/include/net/mip6.h b/include/net/mip6.h new file mode 100644 index 000000000000..68263c6d9996 --- /dev/null +++ b/include/net/mip6.h | |||
@@ -0,0 +1,61 @@ | |||
1 | /* | ||
2 | * Copyright (C)2003-2006 Helsinki University of Technology | ||
3 | * Copyright (C)2003-2006 USAGI/WIDE Project | ||
4 | * | ||
5 | * This program is free software; you can redistribute it and/or modify | ||
6 | * it under the terms of the GNU General Public License as published by | ||
7 | * the Free Software Foundation; either version 2 of the License, or | ||
8 | * (at your option) any later version. | ||
9 | * | ||
10 | * This program is distributed in the hope that it will be useful, | ||
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
13 | * GNU General Public License for more details. | ||
14 | * | ||
15 | * You should have received a copy of the GNU General Public License | ||
16 | * along with this program; if not, write to the Free Software | ||
17 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
18 | */ | ||
19 | /* | ||
20 | * Authors: | ||
21 | * Noriaki TAKAMIYA @USAGI | ||
22 | * Masahide NAKAMURA @USAGI | ||
23 | * YOSHIFUJI Hideaki @USAGI | ||
24 | */ | ||
25 | #ifndef _NET_MIP6_H | ||
26 | #define _NET_MIP6_H | ||
27 | |||
28 | #include <linux/skbuff.h> | ||
29 | #include <net/sock.h> | ||
30 | |||
31 | #define MIP6_OPT_PAD_1 0 | ||
32 | #define MIP6_OPT_PAD_N 1 | ||
33 | |||
34 | /* | ||
35 | * Mobility Header | ||
36 | */ | ||
37 | struct ip6_mh { | ||
38 | __u8 ip6mh_proto; | ||
39 | __u8 ip6mh_hdrlen; | ||
40 | __u8 ip6mh_type; | ||
41 | __u8 ip6mh_reserved; | ||
42 | __u16 ip6mh_cksum; | ||
43 | /* Followed by type specific messages */ | ||
44 | __u8 data[0]; | ||
45 | } __attribute__ ((__packed__)); | ||
46 | |||
47 | #define IP6_MH_TYPE_BRR 0 /* Binding Refresh Request */ | ||
48 | #define IP6_MH_TYPE_HOTI 1 /* HOTI Message */ | ||
49 | #define IP6_MH_TYPE_COTI 2 /* COTI Message */ | ||
50 | #define IP6_MH_TYPE_HOT 3 /* HOT Message */ | ||
51 | #define IP6_MH_TYPE_COT 4 /* COT Message */ | ||
52 | #define IP6_MH_TYPE_BU 5 /* Binding Update */ | ||
53 | #define IP6_MH_TYPE_BACK 6 /* Binding ACK */ | ||
54 | #define IP6_MH_TYPE_BERROR 7 /* Binding Error */ | ||
55 | #define IP6_MH_TYPE_MAX IP6_MH_TYPE_BERROR | ||
56 | |||
57 | extern int mip6_init(void); | ||
58 | extern void mip6_fini(void); | ||
59 | extern int mip6_mh_filter(struct sock *sk, struct sk_buff *skb); | ||
60 | |||
61 | #endif | ||
diff --git a/include/net/neighbour.h b/include/net/neighbour.h index 4901ee446879..c8aacbd2e333 100644 --- a/include/net/neighbour.h +++ b/include/net/neighbour.h | |||
@@ -1,6 +1,8 @@ | |||
1 | #ifndef _NET_NEIGHBOUR_H | 1 | #ifndef _NET_NEIGHBOUR_H |
2 | #define _NET_NEIGHBOUR_H | 2 | #define _NET_NEIGHBOUR_H |
3 | 3 | ||
4 | #include <linux/neighbour.h> | ||
5 | |||
4 | /* | 6 | /* |
5 | * Generic neighbour manipulation | 7 | * Generic neighbour manipulation |
6 | * | 8 | * |
@@ -14,40 +16,6 @@ | |||
14 | * - Add neighbour cache statistics like rtstat | 16 | * - Add neighbour cache statistics like rtstat |
15 | */ | 17 | */ |
16 | 18 | ||
17 | /* The following flags & states are exported to user space, | ||
18 | so that they should be moved to include/linux/ directory. | ||
19 | */ | ||
20 | |||
21 | /* | ||
22 | * Neighbor Cache Entry Flags | ||
23 | */ | ||
24 | |||
25 | #define NTF_PROXY 0x08 /* == ATF_PUBL */ | ||
26 | #define NTF_ROUTER 0x80 | ||
27 | |||
28 | /* | ||
29 | * Neighbor Cache Entry States. | ||
30 | */ | ||
31 | |||
32 | #define NUD_INCOMPLETE 0x01 | ||
33 | #define NUD_REACHABLE 0x02 | ||
34 | #define NUD_STALE 0x04 | ||
35 | #define NUD_DELAY 0x08 | ||
36 | #define NUD_PROBE 0x10 | ||
37 | #define NUD_FAILED 0x20 | ||
38 | |||
39 | /* Dummy states */ | ||
40 | #define NUD_NOARP 0x40 | ||
41 | #define NUD_PERMANENT 0x80 | ||
42 | #define NUD_NONE 0x00 | ||
43 | |||
44 | /* NUD_NOARP & NUD_PERMANENT are pseudostates, they never change | ||
45 | and make no address resolution or NUD. | ||
46 | NUD_PERMANENT is also cannot be deleted by garbage collectors. | ||
47 | */ | ||
48 | |||
49 | #ifdef __KERNEL__ | ||
50 | |||
51 | #include <asm/atomic.h> | 19 | #include <asm/atomic.h> |
52 | #include <linux/netdevice.h> | 20 | #include <linux/netdevice.h> |
53 | #include <linux/skbuff.h> | 21 | #include <linux/skbuff.h> |
@@ -133,7 +101,7 @@ struct neighbour | |||
133 | __u8 dead; | 101 | __u8 dead; |
134 | atomic_t probes; | 102 | atomic_t probes; |
135 | rwlock_t lock; | 103 | rwlock_t lock; |
136 | unsigned char ha[(MAX_ADDR_LEN+sizeof(unsigned long)-1)&~(sizeof(unsigned long)-1)]; | 104 | unsigned char ha[ALIGN(MAX_ADDR_LEN, sizeof(unsigned long))]; |
137 | struct hh_cache *hh; | 105 | struct hh_cache *hh; |
138 | atomic_t refcnt; | 106 | atomic_t refcnt; |
139 | int (*output)(struct sk_buff *skb); | 107 | int (*output)(struct sk_buff *skb); |
@@ -158,6 +126,7 @@ struct pneigh_entry | |||
158 | { | 126 | { |
159 | struct pneigh_entry *next; | 127 | struct pneigh_entry *next; |
160 | struct net_device *dev; | 128 | struct net_device *dev; |
129 | u8 flags; | ||
161 | u8 key[0]; | 130 | u8 key[0]; |
162 | }; | 131 | }; |
163 | 132 | ||
@@ -374,6 +343,3 @@ struct neighbour_cb { | |||
374 | #define NEIGH_CB(skb) ((struct neighbour_cb *)(skb)->cb) | 343 | #define NEIGH_CB(skb) ((struct neighbour_cb *)(skb)->cb) |
375 | 344 | ||
376 | #endif | 345 | #endif |
377 | #endif | ||
378 | |||
379 | |||
diff --git a/include/net/netlabel.h b/include/net/netlabel.h new file mode 100644 index 000000000000..fc2b72fc7e07 --- /dev/null +++ b/include/net/netlabel.h | |||
@@ -0,0 +1,292 @@ | |||
1 | /* | ||
2 | * NetLabel System | ||
3 | * | ||
4 | * The NetLabel system manages static and dynamic label mappings for network | ||
5 | * protocols such as CIPSO and RIPSO. | ||
6 | * | ||
7 | * Author: Paul Moore <paul.moore@hp.com> | ||
8 | * | ||
9 | */ | ||
10 | |||
11 | /* | ||
12 | * (c) Copyright Hewlett-Packard Development Company, L.P., 2006 | ||
13 | * | ||
14 | * This program is free software; you can redistribute it and/or modify | ||
15 | * it under the terms of the GNU General Public License as published by | ||
16 | * the Free Software Foundation; either version 2 of the License, or | ||
17 | * (at your option) any later version. | ||
18 | * | ||
19 | * This program is distributed in the hope that it will be useful, | ||
20 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
21 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See | ||
22 | * the GNU General Public License for more details. | ||
23 | * | ||
24 | * You should have received a copy of the GNU General Public License | ||
25 | * along with this program; if not, write to the Free Software | ||
26 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
27 | * | ||
28 | */ | ||
29 | |||
30 | #ifndef _NETLABEL_H | ||
31 | #define _NETLABEL_H | ||
32 | |||
33 | #include <linux/types.h> | ||
34 | #include <linux/net.h> | ||
35 | #include <linux/skbuff.h> | ||
36 | #include <net/netlink.h> | ||
37 | |||
38 | /* | ||
39 | * NetLabel - A management interface for maintaining network packet label | ||
40 | * mapping tables for explicit packet labling protocols. | ||
41 | * | ||
42 | * Network protocols such as CIPSO and RIPSO require a label translation layer | ||
43 | * to convert the label on the packet into something meaningful on the host | ||
44 | * machine. In the current Linux implementation these mapping tables live | ||
45 | * inside the kernel; NetLabel provides a mechanism for user space applications | ||
46 | * to manage these mapping tables. | ||
47 | * | ||
48 | * NetLabel makes use of the Generic NETLINK mechanism as a transport layer to | ||
49 | * send messages between kernel and user space. The general format of a | ||
50 | * NetLabel message is shown below: | ||
51 | * | ||
52 | * +-----------------+-------------------+--------- --- -- - | ||
53 | * | struct nlmsghdr | struct genlmsghdr | payload | ||
54 | * +-----------------+-------------------+--------- --- -- - | ||
55 | * | ||
56 | * The 'nlmsghdr' and 'genlmsghdr' structs should be dealt with like normal. | ||
57 | * The payload is dependent on the subsystem specified in the | ||
58 | * 'nlmsghdr->nlmsg_type' and should be defined below, supporting functions | ||
59 | * should be defined in the corresponding net/netlabel/netlabel_<subsys>.h|c | ||
60 | * file. All of the fields in the NetLabel payload are NETLINK attributes, the | ||
61 | * length of each field is the length of the NETLINK attribute payload, see | ||
62 | * include/net/netlink.h for more information on NETLINK attributes. | ||
63 | * | ||
64 | */ | ||
65 | |||
66 | /* | ||
67 | * NetLabel NETLINK protocol | ||
68 | */ | ||
69 | |||
70 | #define NETLBL_PROTO_VERSION 1 | ||
71 | |||
72 | /* NetLabel NETLINK types/families */ | ||
73 | #define NETLBL_NLTYPE_NONE 0 | ||
74 | #define NETLBL_NLTYPE_MGMT 1 | ||
75 | #define NETLBL_NLTYPE_MGMT_NAME "NLBL_MGMT" | ||
76 | #define NETLBL_NLTYPE_RIPSO 2 | ||
77 | #define NETLBL_NLTYPE_RIPSO_NAME "NLBL_RIPSO" | ||
78 | #define NETLBL_NLTYPE_CIPSOV4 3 | ||
79 | #define NETLBL_NLTYPE_CIPSOV4_NAME "NLBL_CIPSOv4" | ||
80 | #define NETLBL_NLTYPE_CIPSOV6 4 | ||
81 | #define NETLBL_NLTYPE_CIPSOV6_NAME "NLBL_CIPSOv6" | ||
82 | #define NETLBL_NLTYPE_UNLABELED 5 | ||
83 | #define NETLBL_NLTYPE_UNLABELED_NAME "NLBL_UNLBL" | ||
84 | |||
85 | /* NetLabel return codes */ | ||
86 | #define NETLBL_E_OK 0 | ||
87 | |||
88 | /* | ||
89 | * Helper functions | ||
90 | */ | ||
91 | |||
92 | #define NETLBL_LEN_U8 nla_total_size(sizeof(u8)) | ||
93 | #define NETLBL_LEN_U16 nla_total_size(sizeof(u16)) | ||
94 | #define NETLBL_LEN_U32 nla_total_size(sizeof(u32)) | ||
95 | |||
96 | /** | ||
97 | * netlbl_netlink_alloc_skb - Allocate a NETLINK message buffer | ||
98 | * @head: the amount of headroom in bytes | ||
99 | * @body: the desired size (minus headroom) in bytes | ||
100 | * @gfp_flags: the alloc flags to pass to alloc_skb() | ||
101 | * | ||
102 | * Description: | ||
103 | * Allocate a NETLINK message buffer based on the sizes given in @head and | ||
104 | * @body. If @head is greater than zero skb_reserve() is called to reserve | ||
105 | * @head bytes at the start of the buffer. Returns a valid sk_buff pointer on | ||
106 | * success, NULL on failure. | ||
107 | * | ||
108 | */ | ||
109 | static inline struct sk_buff *netlbl_netlink_alloc_skb(size_t head, | ||
110 | size_t body, | ||
111 | int gfp_flags) | ||
112 | { | ||
113 | struct sk_buff *skb; | ||
114 | |||
115 | skb = alloc_skb(NLMSG_ALIGN(head + body), gfp_flags); | ||
116 | if (skb == NULL) | ||
117 | return NULL; | ||
118 | if (head > 0) { | ||
119 | skb_reserve(skb, head); | ||
120 | if (skb_tailroom(skb) < body) { | ||
121 | kfree_skb(skb); | ||
122 | return NULL; | ||
123 | } | ||
124 | } | ||
125 | |||
126 | return skb; | ||
127 | } | ||
128 | |||
129 | /* | ||
130 | * NetLabel - Kernel API for accessing the network packet label mappings. | ||
131 | * | ||
132 | * The following functions are provided for use by other kernel modules, | ||
133 | * specifically kernel LSM modules, to provide a consistent, transparent API | ||
134 | * for dealing with explicit packet labeling protocols such as CIPSO and | ||
135 | * RIPSO. The functions defined here are implemented in the | ||
136 | * net/netlabel/netlabel_kapi.c file. | ||
137 | * | ||
138 | */ | ||
139 | |||
140 | /* Domain mapping definition struct */ | ||
141 | struct netlbl_dom_map; | ||
142 | |||
143 | /* Domain mapping operations */ | ||
144 | int netlbl_domhsh_remove(const char *domain); | ||
145 | |||
146 | /* LSM security attributes */ | ||
147 | struct netlbl_lsm_cache { | ||
148 | void (*free) (const void *data); | ||
149 | void *data; | ||
150 | }; | ||
151 | struct netlbl_lsm_secattr { | ||
152 | char *domain; | ||
153 | |||
154 | u32 mls_lvl; | ||
155 | u32 mls_lvl_vld; | ||
156 | unsigned char *mls_cat; | ||
157 | size_t mls_cat_len; | ||
158 | |||
159 | struct netlbl_lsm_cache cache; | ||
160 | }; | ||
161 | |||
162 | /* | ||
163 | * LSM security attribute operations | ||
164 | */ | ||
165 | |||
166 | |||
167 | /** | ||
168 | * netlbl_secattr_init - Initialize a netlbl_lsm_secattr struct | ||
169 | * @secattr: the struct to initialize | ||
170 | * | ||
171 | * Description: | ||
172 | * Initialize an already allocated netlbl_lsm_secattr struct. Returns zero on | ||
173 | * success, negative values on error. | ||
174 | * | ||
175 | */ | ||
176 | static inline int netlbl_secattr_init(struct netlbl_lsm_secattr *secattr) | ||
177 | { | ||
178 | memset(secattr, 0, sizeof(*secattr)); | ||
179 | return 0; | ||
180 | } | ||
181 | |||
182 | /** | ||
183 | * netlbl_secattr_destroy - Clears a netlbl_lsm_secattr struct | ||
184 | * @secattr: the struct to clear | ||
185 | * @clear_cache: cache clear flag | ||
186 | * | ||
187 | * Description: | ||
188 | * Destroys the @secattr struct, including freeing all of the internal buffers. | ||
189 | * If @clear_cache is true then free the cache fields, otherwise leave them | ||
190 | * intact. The struct must be reset with a call to netlbl_secattr_init() | ||
191 | * before reuse. | ||
192 | * | ||
193 | */ | ||
194 | static inline void netlbl_secattr_destroy(struct netlbl_lsm_secattr *secattr, | ||
195 | u32 clear_cache) | ||
196 | { | ||
197 | if (clear_cache && secattr->cache.data != NULL && secattr->cache.free) | ||
198 | secattr->cache.free(secattr->cache.data); | ||
199 | kfree(secattr->domain); | ||
200 | kfree(secattr->mls_cat); | ||
201 | } | ||
202 | |||
203 | /** | ||
204 | * netlbl_secattr_alloc - Allocate and initialize a netlbl_lsm_secattr struct | ||
205 | * @flags: the memory allocation flags | ||
206 | * | ||
207 | * Description: | ||
208 | * Allocate and initialize a netlbl_lsm_secattr struct. Returns a valid | ||
209 | * pointer on success, or NULL on failure. | ||
210 | * | ||
211 | */ | ||
212 | static inline struct netlbl_lsm_secattr *netlbl_secattr_alloc(int flags) | ||
213 | { | ||
214 | return kzalloc(sizeof(struct netlbl_lsm_secattr), flags); | ||
215 | } | ||
216 | |||
217 | /** | ||
218 | * netlbl_secattr_free - Frees a netlbl_lsm_secattr struct | ||
219 | * @secattr: the struct to free | ||
220 | * @clear_cache: cache clear flag | ||
221 | * | ||
222 | * Description: | ||
223 | * Frees @secattr including all of the internal buffers. If @clear_cache is | ||
224 | * true then free the cache fields, otherwise leave them intact. | ||
225 | * | ||
226 | */ | ||
227 | static inline void netlbl_secattr_free(struct netlbl_lsm_secattr *secattr, | ||
228 | u32 clear_cache) | ||
229 | { | ||
230 | netlbl_secattr_destroy(secattr, clear_cache); | ||
231 | kfree(secattr); | ||
232 | } | ||
233 | |||
234 | /* | ||
235 | * LSM protocol operations | ||
236 | */ | ||
237 | |||
238 | #ifdef CONFIG_NETLABEL | ||
239 | int netlbl_socket_setattr(const struct socket *sock, | ||
240 | const struct netlbl_lsm_secattr *secattr); | ||
241 | int netlbl_socket_getattr(const struct socket *sock, | ||
242 | struct netlbl_lsm_secattr *secattr); | ||
243 | int netlbl_skbuff_getattr(const struct sk_buff *skb, | ||
244 | struct netlbl_lsm_secattr *secattr); | ||
245 | void netlbl_skbuff_err(struct sk_buff *skb, int error); | ||
246 | #else | ||
247 | static inline int netlbl_socket_setattr(const struct socket *sock, | ||
248 | const struct netlbl_lsm_secattr *secattr) | ||
249 | { | ||
250 | return -ENOSYS; | ||
251 | } | ||
252 | |||
253 | static inline int netlbl_socket_getattr(const struct socket *sock, | ||
254 | struct netlbl_lsm_secattr *secattr) | ||
255 | { | ||
256 | return -ENOSYS; | ||
257 | } | ||
258 | |||
259 | static inline int netlbl_skbuff_getattr(const struct sk_buff *skb, | ||
260 | struct netlbl_lsm_secattr *secattr) | ||
261 | { | ||
262 | return -ENOSYS; | ||
263 | } | ||
264 | |||
265 | static inline void netlbl_skbuff_err(struct sk_buff *skb, int error) | ||
266 | { | ||
267 | return; | ||
268 | } | ||
269 | #endif /* CONFIG_NETLABEL */ | ||
270 | |||
271 | /* | ||
272 | * LSM label mapping cache operations | ||
273 | */ | ||
274 | |||
275 | #ifdef CONFIG_NETLABEL | ||
276 | void netlbl_cache_invalidate(void); | ||
277 | int netlbl_cache_add(const struct sk_buff *skb, | ||
278 | const struct netlbl_lsm_secattr *secattr); | ||
279 | #else | ||
280 | static inline void netlbl_cache_invalidate(void) | ||
281 | { | ||
282 | return; | ||
283 | } | ||
284 | |||
285 | static inline int netlbl_cache_add(const struct sk_buff *skb, | ||
286 | const struct netlbl_lsm_secattr *secattr) | ||
287 | { | ||
288 | return 0; | ||
289 | } | ||
290 | #endif /* CONFIG_NETLABEL */ | ||
291 | |||
292 | #endif /* _NETLABEL_H */ | ||
diff --git a/include/net/netlink.h b/include/net/netlink.h index 640c26a90cf1..11dc2e7f679a 100644 --- a/include/net/netlink.h +++ b/include/net/netlink.h | |||
@@ -35,12 +35,15 @@ | |||
35 | * nlmsg_put() add a netlink message to an skb | 35 | * nlmsg_put() add a netlink message to an skb |
36 | * nlmsg_put_answer() callback based nlmsg_put() | 36 | * nlmsg_put_answer() callback based nlmsg_put() |
37 | * nlmsg_end() finanlize netlink message | 37 | * nlmsg_end() finanlize netlink message |
38 | * nlmsg_get_pos() return current position in message | ||
39 | * nlmsg_trim() trim part of message | ||
38 | * nlmsg_cancel() cancel message construction | 40 | * nlmsg_cancel() cancel message construction |
39 | * nlmsg_free() free a netlink message | 41 | * nlmsg_free() free a netlink message |
40 | * | 42 | * |
41 | * Message Sending: | 43 | * Message Sending: |
42 | * nlmsg_multicast() multicast message to several groups | 44 | * nlmsg_multicast() multicast message to several groups |
43 | * nlmsg_unicast() unicast a message to a single socket | 45 | * nlmsg_unicast() unicast a message to a single socket |
46 | * nlmsg_notify() send notification message | ||
44 | * | 47 | * |
45 | * Message Length Calculations: | 48 | * Message Length Calculations: |
46 | * nlmsg_msg_size(payload) length of message w/o padding | 49 | * nlmsg_msg_size(payload) length of message w/o padding |
@@ -62,6 +65,9 @@ | |||
62 | * nlmsg_validate() validate netlink message incl. attrs | 65 | * nlmsg_validate() validate netlink message incl. attrs |
63 | * nlmsg_for_each_attr() loop over all attributes | 66 | * nlmsg_for_each_attr() loop over all attributes |
64 | * | 67 | * |
68 | * Misc: | ||
69 | * nlmsg_report() report back to application? | ||
70 | * | ||
65 | * ------------------------------------------------------------------------ | 71 | * ------------------------------------------------------------------------ |
66 | * Attributes Interface | 72 | * Attributes Interface |
67 | * ------------------------------------------------------------------------ | 73 | * ------------------------------------------------------------------------ |
@@ -80,8 +86,10 @@ | |||
80 | * struct nlattr netlink attribtue header | 86 | * struct nlattr netlink attribtue header |
81 | * | 87 | * |
82 | * Attribute Construction: | 88 | * Attribute Construction: |
83 | * nla_reserve(skb, type, len) reserve skb tailroom for an attribute | 89 | * nla_reserve(skb, type, len) reserve room for an attribute |
90 | * nla_reserve_nohdr(skb, len) reserve room for an attribute w/o hdr | ||
84 | * nla_put(skb, type, len, data) add attribute to skb | 91 | * nla_put(skb, type, len, data) add attribute to skb |
92 | * nla_put_nohdr(skb, len, data) add attribute w/o hdr | ||
85 | * | 93 | * |
86 | * Attribute Construction for Basic Types: | 94 | * Attribute Construction for Basic Types: |
87 | * nla_put_u8(skb, type, value) add u8 attribute to skb | 95 | * nla_put_u8(skb, type, value) add u8 attribute to skb |
@@ -139,6 +147,7 @@ | |||
139 | * nla_next(nla, remaining) get next netlink attribute | 147 | * nla_next(nla, remaining) get next netlink attribute |
140 | * nla_validate() validate a stream of attributes | 148 | * nla_validate() validate a stream of attributes |
141 | * nla_find() find attribute in stream of attributes | 149 | * nla_find() find attribute in stream of attributes |
150 | * nla_find_nested() find attribute in nested attributes | ||
142 | * nla_parse() parse and validate stream of attrs | 151 | * nla_parse() parse and validate stream of attrs |
143 | * nla_parse_nested() parse nested attribuets | 152 | * nla_parse_nested() parse nested attribuets |
144 | * nla_for_each_attr() loop over all attributes | 153 | * nla_for_each_attr() loop over all attributes |
@@ -158,6 +167,7 @@ enum { | |||
158 | NLA_FLAG, | 167 | NLA_FLAG, |
159 | NLA_MSECS, | 168 | NLA_MSECS, |
160 | NLA_NESTED, | 169 | NLA_NESTED, |
170 | NLA_NUL_STRING, | ||
161 | __NLA_TYPE_MAX, | 171 | __NLA_TYPE_MAX, |
162 | }; | 172 | }; |
163 | 173 | ||
@@ -166,21 +176,37 @@ enum { | |||
166 | /** | 176 | /** |
167 | * struct nla_policy - attribute validation policy | 177 | * struct nla_policy - attribute validation policy |
168 | * @type: Type of attribute or NLA_UNSPEC | 178 | * @type: Type of attribute or NLA_UNSPEC |
169 | * @minlen: Minimal length of payload required to be available | 179 | * @len: Type specific length of payload |
170 | * | 180 | * |
171 | * Policies are defined as arrays of this struct, the array must be | 181 | * Policies are defined as arrays of this struct, the array must be |
172 | * accessible by attribute type up to the highest identifier to be expected. | 182 | * accessible by attribute type up to the highest identifier to be expected. |
173 | * | 183 | * |
184 | * Meaning of `len' field: | ||
185 | * NLA_STRING Maximum length of string | ||
186 | * NLA_NUL_STRING Maximum length of string (excluding NUL) | ||
187 | * NLA_FLAG Unused | ||
188 | * All other Exact length of attribute payload | ||
189 | * | ||
174 | * Example: | 190 | * Example: |
175 | * static struct nla_policy my_policy[ATTR_MAX+1] __read_mostly = { | 191 | * static struct nla_policy my_policy[ATTR_MAX+1] __read_mostly = { |
176 | * [ATTR_FOO] = { .type = NLA_U16 }, | 192 | * [ATTR_FOO] = { .type = NLA_U16 }, |
177 | * [ATTR_BAR] = { .type = NLA_STRING }, | 193 | * [ATTR_BAR] = { .type = NLA_STRING, len = BARSIZ }, |
178 | * [ATTR_BAZ] = { .minlen = sizeof(struct mystruct) }, | 194 | * [ATTR_BAZ] = { .len = sizeof(struct mystruct) }, |
179 | * }; | 195 | * }; |
180 | */ | 196 | */ |
181 | struct nla_policy { | 197 | struct nla_policy { |
182 | u16 type; | 198 | u16 type; |
183 | u16 minlen; | 199 | u16 len; |
200 | }; | ||
201 | |||
202 | /** | ||
203 | * struct nl_info - netlink source information | ||
204 | * @nlh: Netlink message header of original request | ||
205 | * @pid: Netlink PID of requesting application | ||
206 | */ | ||
207 | struct nl_info { | ||
208 | struct nlmsghdr *nlh; | ||
209 | u32 pid; | ||
184 | }; | 210 | }; |
185 | 211 | ||
186 | extern void netlink_run_queue(struct sock *sk, unsigned int *qlen, | 212 | extern void netlink_run_queue(struct sock *sk, unsigned int *qlen, |
@@ -188,6 +214,9 @@ extern void netlink_run_queue(struct sock *sk, unsigned int *qlen, | |||
188 | struct nlmsghdr *, int *)); | 214 | struct nlmsghdr *, int *)); |
189 | extern void netlink_queue_skip(struct nlmsghdr *nlh, | 215 | extern void netlink_queue_skip(struct nlmsghdr *nlh, |
190 | struct sk_buff *skb); | 216 | struct sk_buff *skb); |
217 | extern int nlmsg_notify(struct sock *sk, struct sk_buff *skb, | ||
218 | u32 pid, unsigned int group, int report, | ||
219 | gfp_t flags); | ||
191 | 220 | ||
192 | extern int nla_validate(struct nlattr *head, int len, int maxtype, | 221 | extern int nla_validate(struct nlattr *head, int len, int maxtype, |
193 | struct nla_policy *policy); | 222 | struct nla_policy *policy); |
@@ -203,12 +232,18 @@ extern int nla_memcmp(const struct nlattr *nla, const void *data, | |||
203 | extern int nla_strcmp(const struct nlattr *nla, const char *str); | 232 | extern int nla_strcmp(const struct nlattr *nla, const char *str); |
204 | extern struct nlattr * __nla_reserve(struct sk_buff *skb, int attrtype, | 233 | extern struct nlattr * __nla_reserve(struct sk_buff *skb, int attrtype, |
205 | int attrlen); | 234 | int attrlen); |
235 | extern void * __nla_reserve_nohdr(struct sk_buff *skb, int attrlen); | ||
206 | extern struct nlattr * nla_reserve(struct sk_buff *skb, int attrtype, | 236 | extern struct nlattr * nla_reserve(struct sk_buff *skb, int attrtype, |
207 | int attrlen); | 237 | int attrlen); |
238 | extern void * nla_reserve_nohdr(struct sk_buff *skb, int attrlen); | ||
208 | extern void __nla_put(struct sk_buff *skb, int attrtype, | 239 | extern void __nla_put(struct sk_buff *skb, int attrtype, |
209 | int attrlen, const void *data); | 240 | int attrlen, const void *data); |
241 | extern void __nla_put_nohdr(struct sk_buff *skb, int attrlen, | ||
242 | const void *data); | ||
210 | extern int nla_put(struct sk_buff *skb, int attrtype, | 243 | extern int nla_put(struct sk_buff *skb, int attrtype, |
211 | int attrlen, const void *data); | 244 | int attrlen, const void *data); |
245 | extern int nla_put_nohdr(struct sk_buff *skb, int attrlen, | ||
246 | const void *data); | ||
212 | 247 | ||
213 | /************************************************************************** | 248 | /************************************************************************** |
214 | * Netlink Messages | 249 | * Netlink Messages |
@@ -364,6 +399,17 @@ static inline int nlmsg_validate(struct nlmsghdr *nlh, int hdrlen, int maxtype, | |||
364 | } | 399 | } |
365 | 400 | ||
366 | /** | 401 | /** |
402 | * nlmsg_report - need to report back to application? | ||
403 | * @nlh: netlink message header | ||
404 | * | ||
405 | * Returns 1 if a report back to the application is requested. | ||
406 | */ | ||
407 | static inline int nlmsg_report(struct nlmsghdr *nlh) | ||
408 | { | ||
409 | return !!(nlh->nlmsg_flags & NLM_F_ECHO); | ||
410 | } | ||
411 | |||
412 | /** | ||
367 | * nlmsg_for_each_attr - iterate over a stream of attributes | 413 | * nlmsg_for_each_attr - iterate over a stream of attributes |
368 | * @pos: loop counter, set to current attribute | 414 | * @pos: loop counter, set to current attribute |
369 | * @nlh: netlink message header | 415 | * @nlh: netlink message header |
@@ -453,12 +499,13 @@ static inline struct nlmsghdr *nlmsg_put_answer(struct sk_buff *skb, | |||
453 | /** | 499 | /** |
454 | * nlmsg_new - Allocate a new netlink message | 500 | * nlmsg_new - Allocate a new netlink message |
455 | * @size: maximum size of message | 501 | * @size: maximum size of message |
502 | * @flags: the type of memory to allocate. | ||
456 | * | 503 | * |
457 | * Use NLMSG_GOODSIZE if size isn't know and you need a good default size. | 504 | * Use NLMSG_GOODSIZE if size isn't know and you need a good default size. |
458 | */ | 505 | */ |
459 | static inline struct sk_buff *nlmsg_new(int size) | 506 | static inline struct sk_buff *nlmsg_new(int size, gfp_t flags) |
460 | { | 507 | { |
461 | return alloc_skb(NLMSG_GOODSIZE, GFP_KERNEL); | 508 | return alloc_skb(size, flags); |
462 | } | 509 | } |
463 | 510 | ||
464 | /** | 511 | /** |
@@ -480,6 +527,32 @@ static inline int nlmsg_end(struct sk_buff *skb, struct nlmsghdr *nlh) | |||
480 | } | 527 | } |
481 | 528 | ||
482 | /** | 529 | /** |
530 | * nlmsg_get_pos - return current position in netlink message | ||
531 | * @skb: socket buffer the message is stored in | ||
532 | * | ||
533 | * Returns a pointer to the current tail of the message. | ||
534 | */ | ||
535 | static inline void *nlmsg_get_pos(struct sk_buff *skb) | ||
536 | { | ||
537 | return skb->tail; | ||
538 | } | ||
539 | |||
540 | /** | ||
541 | * nlmsg_trim - Trim message to a mark | ||
542 | * @skb: socket buffer the message is stored in | ||
543 | * @mark: mark to trim to | ||
544 | * | ||
545 | * Trims the message to the provided mark. Returns -1. | ||
546 | */ | ||
547 | static inline int nlmsg_trim(struct sk_buff *skb, void *mark) | ||
548 | { | ||
549 | if (mark) | ||
550 | skb_trim(skb, (unsigned char *) mark - skb->data); | ||
551 | |||
552 | return -1; | ||
553 | } | ||
554 | |||
555 | /** | ||
483 | * nlmsg_cancel - Cancel construction of a netlink message | 556 | * nlmsg_cancel - Cancel construction of a netlink message |
484 | * @skb: socket buffer the message is stored in | 557 | * @skb: socket buffer the message is stored in |
485 | * @nlh: netlink message header | 558 | * @nlh: netlink message header |
@@ -489,9 +562,7 @@ static inline int nlmsg_end(struct sk_buff *skb, struct nlmsghdr *nlh) | |||
489 | */ | 562 | */ |
490 | static inline int nlmsg_cancel(struct sk_buff *skb, struct nlmsghdr *nlh) | 563 | static inline int nlmsg_cancel(struct sk_buff *skb, struct nlmsghdr *nlh) |
491 | { | 564 | { |
492 | skb_trim(skb, (unsigned char *) nlh - skb->data); | 565 | return nlmsg_trim(skb, nlh); |
493 | |||
494 | return -1; | ||
495 | } | 566 | } |
496 | 567 | ||
497 | /** | 568 | /** |
@@ -509,15 +580,16 @@ static inline void nlmsg_free(struct sk_buff *skb) | |||
509 | * @skb: netlink message as socket buffer | 580 | * @skb: netlink message as socket buffer |
510 | * @pid: own netlink pid to avoid sending to yourself | 581 | * @pid: own netlink pid to avoid sending to yourself |
511 | * @group: multicast group id | 582 | * @group: multicast group id |
583 | * @flags: allocation flags | ||
512 | */ | 584 | */ |
513 | static inline int nlmsg_multicast(struct sock *sk, struct sk_buff *skb, | 585 | static inline int nlmsg_multicast(struct sock *sk, struct sk_buff *skb, |
514 | u32 pid, unsigned int group) | 586 | u32 pid, unsigned int group, gfp_t flags) |
515 | { | 587 | { |
516 | int err; | 588 | int err; |
517 | 589 | ||
518 | NETLINK_CB(skb).dst_group = group; | 590 | NETLINK_CB(skb).dst_group = group; |
519 | 591 | ||
520 | err = netlink_broadcast(sk, skb, pid, group, GFP_KERNEL); | 592 | err = netlink_broadcast(sk, skb, pid, group, flags); |
521 | if (err > 0) | 593 | if (err > 0) |
522 | err = 0; | 594 | err = 0; |
523 | 595 | ||
@@ -631,6 +703,18 @@ static inline struct nlattr *nla_next(const struct nlattr *nla, int *remaining) | |||
631 | } | 703 | } |
632 | 704 | ||
633 | /** | 705 | /** |
706 | * nla_find_nested - find attribute in a set of nested attributes | ||
707 | * @nla: attribute containing the nested attributes | ||
708 | * @attrtype: type of attribute to look for | ||
709 | * | ||
710 | * Returns the first attribute which matches the specified type. | ||
711 | */ | ||
712 | static inline struct nlattr *nla_find_nested(struct nlattr *nla, int attrtype) | ||
713 | { | ||
714 | return nla_find(nla_data(nla), nla_len(nla), attrtype); | ||
715 | } | ||
716 | |||
717 | /** | ||
634 | * nla_parse_nested - parse nested attributes | 718 | * nla_parse_nested - parse nested attributes |
635 | * @tb: destination array with maxtype+1 elements | 719 | * @tb: destination array with maxtype+1 elements |
636 | * @maxtype: maximum attribute type to be expected | 720 | * @maxtype: maximum attribute type to be expected |
@@ -751,7 +835,7 @@ static inline int nla_put_msecs(struct sk_buff *skb, int attrtype, | |||
751 | #define NLA_PUT_STRING(skb, attrtype, value) \ | 835 | #define NLA_PUT_STRING(skb, attrtype, value) \ |
752 | NLA_PUT(skb, attrtype, strlen(value) + 1, value) | 836 | NLA_PUT(skb, attrtype, strlen(value) + 1, value) |
753 | 837 | ||
754 | #define NLA_PUT_FLAG(skb, attrtype, value) \ | 838 | #define NLA_PUT_FLAG(skb, attrtype) \ |
755 | NLA_PUT(skb, attrtype, 0, NULL) | 839 | NLA_PUT(skb, attrtype, 0, NULL) |
756 | 840 | ||
757 | #define NLA_PUT_MSECS(skb, attrtype, jiffies) \ | 841 | #define NLA_PUT_MSECS(skb, attrtype, jiffies) \ |
@@ -862,10 +946,7 @@ static inline int nla_nest_end(struct sk_buff *skb, struct nlattr *start) | |||
862 | */ | 946 | */ |
863 | static inline int nla_nest_cancel(struct sk_buff *skb, struct nlattr *start) | 947 | static inline int nla_nest_cancel(struct sk_buff *skb, struct nlattr *start) |
864 | { | 948 | { |
865 | if (start) | 949 | return nlmsg_trim(skb, start); |
866 | skb_trim(skb, (unsigned char *) start - skb->data); | ||
867 | |||
868 | return -1; | ||
869 | } | 950 | } |
870 | 951 | ||
871 | /** | 952 | /** |
@@ -880,4 +961,13 @@ static inline int nla_nest_cancel(struct sk_buff *skb, struct nlattr *start) | |||
880 | nla_ok(pos, rem); \ | 961 | nla_ok(pos, rem); \ |
881 | pos = nla_next(pos, &(rem))) | 962 | pos = nla_next(pos, &(rem))) |
882 | 963 | ||
964 | /** | ||
965 | * nla_for_each_nested - iterate over nested attributes | ||
966 | * @pos: loop counter, set to current attribute | ||
967 | * @nla: attribute containing the nested attributes | ||
968 | * @rem: initialized to len, holds bytes currently remaining in stream | ||
969 | */ | ||
970 | #define nla_for_each_nested(pos, nla, rem) \ | ||
971 | nla_for_each_attr(pos, nla_data(nla), nla_len(nla), rem) | ||
972 | |||
883 | #endif | 973 | #endif |
diff --git a/include/net/nexthop.h b/include/net/nexthop.h new file mode 100644 index 000000000000..3334dbfa5aa4 --- /dev/null +++ b/include/net/nexthop.h | |||
@@ -0,0 +1,33 @@ | |||
1 | #ifndef __NET_NEXTHOP_H | ||
2 | #define __NET_NEXTHOP_H | ||
3 | |||
4 | #include <linux/rtnetlink.h> | ||
5 | #include <net/netlink.h> | ||
6 | |||
7 | static inline int rtnh_ok(const struct rtnexthop *rtnh, int remaining) | ||
8 | { | ||
9 | return remaining >= sizeof(*rtnh) && | ||
10 | rtnh->rtnh_len >= sizeof(*rtnh) && | ||
11 | rtnh->rtnh_len <= remaining; | ||
12 | } | ||
13 | |||
14 | static inline struct rtnexthop *rtnh_next(const struct rtnexthop *rtnh, | ||
15 | int *remaining) | ||
16 | { | ||
17 | int totlen = NLA_ALIGN(rtnh->rtnh_len); | ||
18 | |||
19 | *remaining -= totlen; | ||
20 | return (struct rtnexthop *) ((char *) rtnh + totlen); | ||
21 | } | ||
22 | |||
23 | static inline struct nlattr *rtnh_attrs(const struct rtnexthop *rtnh) | ||
24 | { | ||
25 | return (struct nlattr *) ((char *) rtnh + NLA_ALIGN(sizeof(*rtnh))); | ||
26 | } | ||
27 | |||
28 | static inline int rtnh_attrlen(const struct rtnexthop *rtnh) | ||
29 | { | ||
30 | return rtnh->rtnh_len - NLA_ALIGN(sizeof(*rtnh)); | ||
31 | } | ||
32 | |||
33 | #endif | ||
diff --git a/include/net/pkt_act.h b/include/net/pkt_act.h deleted file mode 100644 index cf5e4d2e4c21..000000000000 --- a/include/net/pkt_act.h +++ /dev/null | |||
@@ -1,273 +0,0 @@ | |||
1 | #ifndef __NET_PKT_ACT_H | ||
2 | #define __NET_PKT_ACT_H | ||
3 | |||
4 | #include <asm/uaccess.h> | ||
5 | #include <asm/system.h> | ||
6 | #include <linux/bitops.h> | ||
7 | #include <linux/types.h> | ||
8 | #include <linux/kernel.h> | ||
9 | #include <linux/sched.h> | ||
10 | #include <linux/string.h> | ||
11 | #include <linux/mm.h> | ||
12 | #include <linux/socket.h> | ||
13 | #include <linux/sockios.h> | ||
14 | #include <linux/in.h> | ||
15 | #include <linux/errno.h> | ||
16 | #include <linux/interrupt.h> | ||
17 | #include <linux/skbuff.h> | ||
18 | #include <linux/rtnetlink.h> | ||
19 | #include <linux/module.h> | ||
20 | #include <linux/init.h> | ||
21 | #include <linux/proc_fs.h> | ||
22 | #include <net/sock.h> | ||
23 | #include <net/pkt_sched.h> | ||
24 | |||
25 | #define tca_st(val) (struct tcf_##val *) | ||
26 | #define PRIV(a,name) ( tca_st(name) (a)->priv) | ||
27 | |||
28 | #if 0 /* control */ | ||
29 | #define DPRINTK(format,args...) printk(KERN_DEBUG format,##args) | ||
30 | #else | ||
31 | #define DPRINTK(format,args...) | ||
32 | #endif | ||
33 | |||
34 | #if 0 /* data */ | ||
35 | #define D2PRINTK(format,args...) printk(KERN_DEBUG format,##args) | ||
36 | #else | ||
37 | #define D2PRINTK(format,args...) | ||
38 | #endif | ||
39 | |||
40 | static __inline__ unsigned | ||
41 | tcf_hash(u32 index) | ||
42 | { | ||
43 | return index & MY_TAB_MASK; | ||
44 | } | ||
45 | |||
46 | /* probably move this from being inline | ||
47 | * and put into act_generic | ||
48 | */ | ||
49 | static inline void | ||
50 | tcf_hash_destroy(struct tcf_st *p) | ||
51 | { | ||
52 | unsigned h = tcf_hash(p->index); | ||
53 | struct tcf_st **p1p; | ||
54 | |||
55 | for (p1p = &tcf_ht[h]; *p1p; p1p = &(*p1p)->next) { | ||
56 | if (*p1p == p) { | ||
57 | write_lock_bh(&tcf_t_lock); | ||
58 | *p1p = p->next; | ||
59 | write_unlock_bh(&tcf_t_lock); | ||
60 | #ifdef CONFIG_NET_ESTIMATOR | ||
61 | gen_kill_estimator(&p->bstats, &p->rate_est); | ||
62 | #endif | ||
63 | kfree(p); | ||
64 | return; | ||
65 | } | ||
66 | } | ||
67 | BUG_TRAP(0); | ||
68 | } | ||
69 | |||
70 | static inline int | ||
71 | tcf_hash_release(struct tcf_st *p, int bind ) | ||
72 | { | ||
73 | int ret = 0; | ||
74 | if (p) { | ||
75 | if (bind) { | ||
76 | p->bindcnt--; | ||
77 | } | ||
78 | p->refcnt--; | ||
79 | if(p->bindcnt <=0 && p->refcnt <= 0) { | ||
80 | tcf_hash_destroy(p); | ||
81 | ret = 1; | ||
82 | } | ||
83 | } | ||
84 | return ret; | ||
85 | } | ||
86 | |||
87 | static __inline__ int | ||
88 | tcf_dump_walker(struct sk_buff *skb, struct netlink_callback *cb, | ||
89 | struct tc_action *a) | ||
90 | { | ||
91 | struct tcf_st *p; | ||
92 | int err =0, index = -1,i= 0, s_i = 0, n_i = 0; | ||
93 | struct rtattr *r ; | ||
94 | |||
95 | read_lock(&tcf_t_lock); | ||
96 | |||
97 | s_i = cb->args[0]; | ||
98 | |||
99 | for (i = 0; i < MY_TAB_SIZE; i++) { | ||
100 | p = tcf_ht[tcf_hash(i)]; | ||
101 | |||
102 | for (; p; p = p->next) { | ||
103 | index++; | ||
104 | if (index < s_i) | ||
105 | continue; | ||
106 | a->priv = p; | ||
107 | a->order = n_i; | ||
108 | r = (struct rtattr*) skb->tail; | ||
109 | RTA_PUT(skb, a->order, 0, NULL); | ||
110 | err = tcf_action_dump_1(skb, a, 0, 0); | ||
111 | if (0 > err) { | ||
112 | index--; | ||
113 | skb_trim(skb, (u8*)r - skb->data); | ||
114 | goto done; | ||
115 | } | ||
116 | r->rta_len = skb->tail - (u8*)r; | ||
117 | n_i++; | ||
118 | if (n_i >= TCA_ACT_MAX_PRIO) { | ||
119 | goto done; | ||
120 | } | ||
121 | } | ||
122 | } | ||
123 | done: | ||
124 | read_unlock(&tcf_t_lock); | ||
125 | if (n_i) | ||
126 | cb->args[0] += n_i; | ||
127 | return n_i; | ||
128 | |||
129 | rtattr_failure: | ||
130 | skb_trim(skb, (u8*)r - skb->data); | ||
131 | goto done; | ||
132 | } | ||
133 | |||
134 | static __inline__ int | ||
135 | tcf_del_walker(struct sk_buff *skb, struct tc_action *a) | ||
136 | { | ||
137 | struct tcf_st *p, *s_p; | ||
138 | struct rtattr *r ; | ||
139 | int i= 0, n_i = 0; | ||
140 | |||
141 | r = (struct rtattr*) skb->tail; | ||
142 | RTA_PUT(skb, a->order, 0, NULL); | ||
143 | RTA_PUT(skb, TCA_KIND, IFNAMSIZ, a->ops->kind); | ||
144 | for (i = 0; i < MY_TAB_SIZE; i++) { | ||
145 | p = tcf_ht[tcf_hash(i)]; | ||
146 | |||
147 | while (p != NULL) { | ||
148 | s_p = p->next; | ||
149 | if (ACT_P_DELETED == tcf_hash_release(p, 0)) { | ||
150 | module_put(a->ops->owner); | ||
151 | } | ||
152 | n_i++; | ||
153 | p = s_p; | ||
154 | } | ||
155 | } | ||
156 | RTA_PUT(skb, TCA_FCNT, 4, &n_i); | ||
157 | r->rta_len = skb->tail - (u8*)r; | ||
158 | |||
159 | return n_i; | ||
160 | rtattr_failure: | ||
161 | skb_trim(skb, (u8*)r - skb->data); | ||
162 | return -EINVAL; | ||
163 | } | ||
164 | |||
165 | static __inline__ int | ||
166 | tcf_generic_walker(struct sk_buff *skb, struct netlink_callback *cb, int type, | ||
167 | struct tc_action *a) | ||
168 | { | ||
169 | if (type == RTM_DELACTION) { | ||
170 | return tcf_del_walker(skb,a); | ||
171 | } else if (type == RTM_GETACTION) { | ||
172 | return tcf_dump_walker(skb,cb,a); | ||
173 | } else { | ||
174 | printk("tcf_generic_walker: unknown action %d\n",type); | ||
175 | return -EINVAL; | ||
176 | } | ||
177 | } | ||
178 | |||
179 | static __inline__ struct tcf_st * | ||
180 | tcf_hash_lookup(u32 index) | ||
181 | { | ||
182 | struct tcf_st *p; | ||
183 | |||
184 | read_lock(&tcf_t_lock); | ||
185 | for (p = tcf_ht[tcf_hash(index)]; p; p = p->next) { | ||
186 | if (p->index == index) | ||
187 | break; | ||
188 | } | ||
189 | read_unlock(&tcf_t_lock); | ||
190 | return p; | ||
191 | } | ||
192 | |||
193 | static __inline__ u32 | ||
194 | tcf_hash_new_index(void) | ||
195 | { | ||
196 | do { | ||
197 | if (++idx_gen == 0) | ||
198 | idx_gen = 1; | ||
199 | } while (tcf_hash_lookup(idx_gen)); | ||
200 | |||
201 | return idx_gen; | ||
202 | } | ||
203 | |||
204 | |||
205 | static inline int | ||
206 | tcf_hash_search(struct tc_action *a, u32 index) | ||
207 | { | ||
208 | struct tcf_st *p = tcf_hash_lookup(index); | ||
209 | |||
210 | if (p != NULL) { | ||
211 | a->priv = p; | ||
212 | return 1; | ||
213 | } | ||
214 | return 0; | ||
215 | } | ||
216 | |||
217 | #ifdef CONFIG_NET_ACT_INIT | ||
218 | static inline struct tcf_st * | ||
219 | tcf_hash_check(u32 index, struct tc_action *a, int ovr, int bind) | ||
220 | { | ||
221 | struct tcf_st *p = NULL; | ||
222 | if (index && (p = tcf_hash_lookup(index)) != NULL) { | ||
223 | if (bind) { | ||
224 | p->bindcnt++; | ||
225 | p->refcnt++; | ||
226 | } | ||
227 | a->priv = p; | ||
228 | } | ||
229 | return p; | ||
230 | } | ||
231 | |||
232 | static inline struct tcf_st * | ||
233 | tcf_hash_create(u32 index, struct rtattr *est, struct tc_action *a, int size, int ovr, int bind) | ||
234 | { | ||
235 | struct tcf_st *p = NULL; | ||
236 | |||
237 | p = kmalloc(size, GFP_KERNEL); | ||
238 | if (p == NULL) | ||
239 | return p; | ||
240 | |||
241 | memset(p, 0, size); | ||
242 | p->refcnt = 1; | ||
243 | |||
244 | if (bind) { | ||
245 | p->bindcnt = 1; | ||
246 | } | ||
247 | |||
248 | spin_lock_init(&p->lock); | ||
249 | p->stats_lock = &p->lock; | ||
250 | p->index = index ? : tcf_hash_new_index(); | ||
251 | p->tm.install = jiffies; | ||
252 | p->tm.lastuse = jiffies; | ||
253 | #ifdef CONFIG_NET_ESTIMATOR | ||
254 | if (est) | ||
255 | gen_new_estimator(&p->bstats, &p->rate_est, p->stats_lock, est); | ||
256 | #endif | ||
257 | a->priv = (void *) p; | ||
258 | return p; | ||
259 | } | ||
260 | |||
261 | static inline void tcf_hash_insert(struct tcf_st *p) | ||
262 | { | ||
263 | unsigned h = tcf_hash(p->index); | ||
264 | |||
265 | write_lock_bh(&tcf_t_lock); | ||
266 | p->next = tcf_ht[h]; | ||
267 | tcf_ht[h] = p; | ||
268 | write_unlock_bh(&tcf_t_lock); | ||
269 | } | ||
270 | |||
271 | #endif | ||
272 | |||
273 | #endif | ||
diff --git a/include/net/request_sock.h b/include/net/request_sock.h index c5d7f920c352..8e165ca16bd8 100644 --- a/include/net/request_sock.h +++ b/include/net/request_sock.h | |||
@@ -53,6 +53,7 @@ struct request_sock { | |||
53 | unsigned long expires; | 53 | unsigned long expires; |
54 | struct request_sock_ops *rsk_ops; | 54 | struct request_sock_ops *rsk_ops; |
55 | struct sock *sk; | 55 | struct sock *sk; |
56 | u32 secid; | ||
56 | }; | 57 | }; |
57 | 58 | ||
58 | static inline struct request_sock *reqsk_alloc(struct request_sock_ops *ops) | 59 | static inline struct request_sock *reqsk_alloc(struct request_sock_ops *ops) |
diff --git a/include/net/route.h b/include/net/route.h index c4a068692dcc..7f93ac0e0899 100644 --- a/include/net/route.h +++ b/include/net/route.h | |||
@@ -32,6 +32,7 @@ | |||
32 | #include <linux/route.h> | 32 | #include <linux/route.h> |
33 | #include <linux/ip.h> | 33 | #include <linux/ip.h> |
34 | #include <linux/cache.h> | 34 | #include <linux/cache.h> |
35 | #include <linux/security.h> | ||
35 | 36 | ||
36 | #ifndef __KERNEL__ | 37 | #ifndef __KERNEL__ |
37 | #warning This file is not supposed to be used outside of kernel. | 38 | #warning This file is not supposed to be used outside of kernel. |
@@ -166,6 +167,7 @@ static inline int ip_route_connect(struct rtable **rp, u32 dst, | |||
166 | ip_rt_put(*rp); | 167 | ip_rt_put(*rp); |
167 | *rp = NULL; | 168 | *rp = NULL; |
168 | } | 169 | } |
170 | security_sk_classify_flow(sk, &fl); | ||
169 | return ip_route_output_flow(rp, &fl, sk, 0); | 171 | return ip_route_output_flow(rp, &fl, sk, 0); |
170 | } | 172 | } |
171 | 173 | ||
@@ -182,6 +184,7 @@ static inline int ip_route_newports(struct rtable **rp, u8 protocol, | |||
182 | fl.proto = protocol; | 184 | fl.proto = protocol; |
183 | ip_rt_put(*rp); | 185 | ip_rt_put(*rp); |
184 | *rp = NULL; | 186 | *rp = NULL; |
187 | security_sk_classify_flow(sk, &fl); | ||
185 | return ip_route_output_flow(rp, &fl, sk, 0); | 188 | return ip_route_output_flow(rp, &fl, sk, 0); |
186 | } | 189 | } |
187 | return 0; | 190 | return 0; |
diff --git a/include/net/sctp/constants.h b/include/net/sctp/constants.h index c51541ee0247..6c632e26f72d 100644 --- a/include/net/sctp/constants.h +++ b/include/net/sctp/constants.h | |||
@@ -264,10 +264,10 @@ enum { SCTP_MAX_DUP_TSNS = 16 }; | |||
264 | enum { SCTP_MAX_GABS = 16 }; | 264 | enum { SCTP_MAX_GABS = 16 }; |
265 | 265 | ||
266 | /* Heartbeat interval - 30 secs */ | 266 | /* Heartbeat interval - 30 secs */ |
267 | #define SCTP_DEFAULT_TIMEOUT_HEARTBEAT (30 * HZ) | 267 | #define SCTP_DEFAULT_TIMEOUT_HEARTBEAT (30*1000) |
268 | 268 | ||
269 | /* Delayed sack timer - 200ms */ | 269 | /* Delayed sack timer - 200ms */ |
270 | #define SCTP_DEFAULT_TIMEOUT_SACK ((200 * HZ) / 1000) | 270 | #define SCTP_DEFAULT_TIMEOUT_SACK (200) |
271 | 271 | ||
272 | /* RTO.Initial - 3 seconds | 272 | /* RTO.Initial - 3 seconds |
273 | * RTO.Min - 1 second | 273 | * RTO.Min - 1 second |
@@ -275,9 +275,9 @@ enum { SCTP_MAX_GABS = 16 }; | |||
275 | * RTO.Alpha - 1/8 | 275 | * RTO.Alpha - 1/8 |
276 | * RTO.Beta - 1/4 | 276 | * RTO.Beta - 1/4 |
277 | */ | 277 | */ |
278 | #define SCTP_RTO_INITIAL (3 * HZ) | 278 | #define SCTP_RTO_INITIAL (3 * 1000) |
279 | #define SCTP_RTO_MIN (1 * HZ) | 279 | #define SCTP_RTO_MIN (1 * 1000) |
280 | #define SCTP_RTO_MAX (60 * HZ) | 280 | #define SCTP_RTO_MAX (60 * 1000) |
281 | 281 | ||
282 | #define SCTP_RTO_ALPHA 3 /* 1/8 when converted to right shifts. */ | 282 | #define SCTP_RTO_ALPHA 3 /* 1/8 when converted to right shifts. */ |
283 | #define SCTP_RTO_BETA 2 /* 1/4 when converted to right shifts. */ | 283 | #define SCTP_RTO_BETA 2 /* 1/4 when converted to right shifts. */ |
@@ -290,8 +290,7 @@ enum { SCTP_MAX_GABS = 16 }; | |||
290 | #define SCTP_DEF_MAX_INIT 6 | 290 | #define SCTP_DEF_MAX_INIT 6 |
291 | #define SCTP_DEF_MAX_SEND 10 | 291 | #define SCTP_DEF_MAX_SEND 10 |
292 | 292 | ||
293 | #define SCTP_DEFAULT_COOKIE_LIFE_SEC 60 /* seconds */ | 293 | #define SCTP_DEFAULT_COOKIE_LIFE (60 * 1000) /* 60 seconds */ |
294 | #define SCTP_DEFAULT_COOKIE_LIFE_USEC 0 /* microseconds */ | ||
295 | 294 | ||
296 | #define SCTP_DEFAULT_MINWINDOW 1500 /* default minimum rwnd size */ | 295 | #define SCTP_DEFAULT_MINWINDOW 1500 /* default minimum rwnd size */ |
297 | #define SCTP_DEFAULT_MAXWINDOW 65535 /* default rwnd size */ | 296 | #define SCTP_DEFAULT_MAXWINDOW 65535 /* default rwnd size */ |
@@ -312,9 +311,9 @@ enum { SCTP_MAX_GABS = 16 }; | |||
312 | */ | 311 | */ |
313 | 312 | ||
314 | #if defined (CONFIG_SCTP_HMAC_MD5) | 313 | #if defined (CONFIG_SCTP_HMAC_MD5) |
315 | #define SCTP_COOKIE_HMAC_ALG "md5" | 314 | #define SCTP_COOKIE_HMAC_ALG "hmac(md5)" |
316 | #elif defined (CONFIG_SCTP_HMAC_SHA1) | 315 | #elif defined (CONFIG_SCTP_HMAC_SHA1) |
317 | #define SCTP_COOKIE_HMAC_ALG "sha1" | 316 | #define SCTP_COOKIE_HMAC_ALG "hmac(sha1)" |
318 | #else | 317 | #else |
319 | #define SCTP_COOKIE_HMAC_ALG NULL | 318 | #define SCTP_COOKIE_HMAC_ALG NULL |
320 | #endif | 319 | #endif |
diff --git a/include/net/sctp/sctp.h b/include/net/sctp/sctp.h index 92eae0e0f3f1..ee68a3124076 100644 --- a/include/net/sctp/sctp.h +++ b/include/net/sctp/sctp.h | |||
@@ -128,6 +128,8 @@ extern int sctp_copy_local_addr_list(struct sctp_bind_addr *, | |||
128 | int flags); | 128 | int flags); |
129 | extern struct sctp_pf *sctp_get_pf_specific(sa_family_t family); | 129 | extern struct sctp_pf *sctp_get_pf_specific(sa_family_t family); |
130 | extern int sctp_register_pf(struct sctp_pf *, sa_family_t); | 130 | extern int sctp_register_pf(struct sctp_pf *, sa_family_t); |
131 | int sctp_inetaddr_event(struct notifier_block *this, unsigned long ev, | ||
132 | void *ptr); | ||
131 | 133 | ||
132 | /* | 134 | /* |
133 | * sctp/socket.c | 135 | * sctp/socket.c |
@@ -178,6 +180,17 @@ void sctp_backlog_migrate(struct sctp_association *assoc, | |||
178 | struct sock *oldsk, struct sock *newsk); | 180 | struct sock *oldsk, struct sock *newsk); |
179 | 181 | ||
180 | /* | 182 | /* |
183 | * sctp/proc.c | ||
184 | */ | ||
185 | int sctp_snmp_proc_init(void); | ||
186 | void sctp_snmp_proc_exit(void); | ||
187 | int sctp_eps_proc_init(void); | ||
188 | void sctp_eps_proc_exit(void); | ||
189 | int sctp_assocs_proc_init(void); | ||
190 | void sctp_assocs_proc_exit(void); | ||
191 | |||
192 | |||
193 | /* | ||
181 | * Section: Macros, externs, and inlines | 194 | * Section: Macros, externs, and inlines |
182 | */ | 195 | */ |
183 | 196 | ||
@@ -216,6 +229,50 @@ DECLARE_SNMP_STAT(struct sctp_mib, sctp_statistics); | |||
216 | 229 | ||
217 | #endif /* !TEST_FRAME */ | 230 | #endif /* !TEST_FRAME */ |
218 | 231 | ||
232 | /* sctp mib definitions */ | ||
233 | enum | ||
234 | { | ||
235 | SCTP_MIB_NUM = 0, | ||
236 | SCTP_MIB_CURRESTAB, /* CurrEstab */ | ||
237 | SCTP_MIB_ACTIVEESTABS, /* ActiveEstabs */ | ||
238 | SCTP_MIB_PASSIVEESTABS, /* PassiveEstabs */ | ||
239 | SCTP_MIB_ABORTEDS, /* Aborteds */ | ||
240 | SCTP_MIB_SHUTDOWNS, /* Shutdowns */ | ||
241 | SCTP_MIB_OUTOFBLUES, /* OutOfBlues */ | ||
242 | SCTP_MIB_CHECKSUMERRORS, /* ChecksumErrors */ | ||
243 | SCTP_MIB_OUTCTRLCHUNKS, /* OutCtrlChunks */ | ||
244 | SCTP_MIB_OUTORDERCHUNKS, /* OutOrderChunks */ | ||
245 | SCTP_MIB_OUTUNORDERCHUNKS, /* OutUnorderChunks */ | ||
246 | SCTP_MIB_INCTRLCHUNKS, /* InCtrlChunks */ | ||
247 | SCTP_MIB_INORDERCHUNKS, /* InOrderChunks */ | ||
248 | SCTP_MIB_INUNORDERCHUNKS, /* InUnorderChunks */ | ||
249 | SCTP_MIB_FRAGUSRMSGS, /* FragUsrMsgs */ | ||
250 | SCTP_MIB_REASMUSRMSGS, /* ReasmUsrMsgs */ | ||
251 | SCTP_MIB_OUTSCTPPACKS, /* OutSCTPPacks */ | ||
252 | SCTP_MIB_INSCTPPACKS, /* InSCTPPacks */ | ||
253 | SCTP_MIB_T1_INIT_EXPIREDS, | ||
254 | SCTP_MIB_T1_COOKIE_EXPIREDS, | ||
255 | SCTP_MIB_T2_SHUTDOWN_EXPIREDS, | ||
256 | SCTP_MIB_T3_RTX_EXPIREDS, | ||
257 | SCTP_MIB_T4_RTO_EXPIREDS, | ||
258 | SCTP_MIB_T5_SHUTDOWN_GUARD_EXPIREDS, | ||
259 | SCTP_MIB_DELAY_SACK_EXPIREDS, | ||
260 | SCTP_MIB_AUTOCLOSE_EXPIREDS, | ||
261 | SCTP_MIB_T3_RETRANSMITS, | ||
262 | SCTP_MIB_PMTUD_RETRANSMITS, | ||
263 | SCTP_MIB_FAST_RETRANSMITS, | ||
264 | SCTP_MIB_IN_PKT_SOFTIRQ, | ||
265 | SCTP_MIB_IN_PKT_BACKLOG, | ||
266 | SCTP_MIB_IN_PKT_DISCARDS, | ||
267 | SCTP_MIB_IN_DATA_CHUNK_DISCARDS, | ||
268 | __SCTP_MIB_MAX | ||
269 | }; | ||
270 | |||
271 | #define SCTP_MIB_MAX __SCTP_MIB_MAX | ||
272 | struct sctp_mib { | ||
273 | unsigned long mibs[SCTP_MIB_MAX]; | ||
274 | } __SNMP_MIB_ALIGN__; | ||
275 | |||
219 | 276 | ||
220 | /* Print debugging messages. */ | 277 | /* Print debugging messages. */ |
221 | #if SCTP_DEBUG | 278 | #if SCTP_DEBUG |
@@ -330,17 +387,6 @@ static inline void sctp_v6_exit(void) { return; } | |||
330 | 387 | ||
331 | #endif /* #if defined(CONFIG_IPV6) */ | 388 | #endif /* #if defined(CONFIG_IPV6) */ |
332 | 389 | ||
333 | /* Some wrappers, in case crypto not available. */ | ||
334 | #if defined (CONFIG_CRYPTO_HMAC) | ||
335 | #define sctp_crypto_alloc_tfm crypto_alloc_tfm | ||
336 | #define sctp_crypto_free_tfm crypto_free_tfm | ||
337 | #define sctp_crypto_hmac crypto_hmac | ||
338 | #else | ||
339 | #define sctp_crypto_alloc_tfm(x...) NULL | ||
340 | #define sctp_crypto_free_tfm(x...) | ||
341 | #define sctp_crypto_hmac(x...) | ||
342 | #endif | ||
343 | |||
344 | 390 | ||
345 | /* Map an association to an assoc_id. */ | 391 | /* Map an association to an assoc_id. */ |
346 | static inline sctp_assoc_t sctp_assoc2id(const struct sctp_association *asoc) | 392 | static inline sctp_assoc_t sctp_assoc2id(const struct sctp_association *asoc) |
diff --git a/include/net/sctp/structs.h b/include/net/sctp/structs.h index e5aa7ff1f5b5..c6d93bb0dcd2 100644 --- a/include/net/sctp/structs.h +++ b/include/net/sctp/structs.h | |||
@@ -87,6 +87,7 @@ struct sctp_bind_addr; | |||
87 | struct sctp_ulpq; | 87 | struct sctp_ulpq; |
88 | struct sctp_ep_common; | 88 | struct sctp_ep_common; |
89 | struct sctp_ssnmap; | 89 | struct sctp_ssnmap; |
90 | struct crypto_hash; | ||
90 | 91 | ||
91 | 92 | ||
92 | #include <net/sctp/tsnmap.h> | 93 | #include <net/sctp/tsnmap.h> |
@@ -127,9 +128,9 @@ extern struct sctp_globals { | |||
127 | * RTO.Alpha - 1/8 (3 when converted to right shifts.) | 128 | * RTO.Alpha - 1/8 (3 when converted to right shifts.) |
128 | * RTO.Beta - 1/4 (2 when converted to right shifts.) | 129 | * RTO.Beta - 1/4 (2 when converted to right shifts.) |
129 | */ | 130 | */ |
130 | unsigned long rto_initial; | 131 | unsigned int rto_initial; |
131 | unsigned long rto_min; | 132 | unsigned int rto_min; |
132 | unsigned long rto_max; | 133 | unsigned int rto_max; |
133 | 134 | ||
134 | /* Note: rto_alpha and rto_beta are really defined as inverse | 135 | /* Note: rto_alpha and rto_beta are really defined as inverse |
135 | * powers of two to facilitate integer operations. | 136 | * powers of two to facilitate integer operations. |
@@ -144,13 +145,13 @@ extern struct sctp_globals { | |||
144 | int cookie_preserve_enable; | 145 | int cookie_preserve_enable; |
145 | 146 | ||
146 | /* Valid.Cookie.Life - 60 seconds */ | 147 | /* Valid.Cookie.Life - 60 seconds */ |
147 | unsigned long valid_cookie_life; | 148 | unsigned int valid_cookie_life; |
148 | 149 | ||
149 | /* Delayed SACK timeout 200ms default*/ | 150 | /* Delayed SACK timeout 200ms default*/ |
150 | unsigned long sack_timeout; | 151 | unsigned int sack_timeout; |
151 | 152 | ||
152 | /* HB.interval - 30 seconds */ | 153 | /* HB.interval - 30 seconds */ |
153 | unsigned long hb_interval; | 154 | unsigned int hb_interval; |
154 | 155 | ||
155 | /* Association.Max.Retrans - 10 attempts | 156 | /* Association.Max.Retrans - 10 attempts |
156 | * Path.Max.Retrans - 5 attempts (per destination address) | 157 | * Path.Max.Retrans - 5 attempts (per destination address) |
@@ -264,7 +265,7 @@ struct sctp_sock { | |||
264 | struct sctp_pf *pf; | 265 | struct sctp_pf *pf; |
265 | 266 | ||
266 | /* Access to HMAC transform. */ | 267 | /* Access to HMAC transform. */ |
267 | struct crypto_tfm *hmac; | 268 | struct crypto_hash *hmac; |
268 | 269 | ||
269 | /* What is our base endpointer? */ | 270 | /* What is our base endpointer? */ |
270 | struct sctp_endpoint *ep; | 271 | struct sctp_endpoint *ep; |
diff --git a/include/net/snmp.h b/include/net/snmp.h index a36bed8ea210..464970e39ec0 100644 --- a/include/net/snmp.h +++ b/include/net/snmp.h | |||
@@ -100,12 +100,6 @@ struct udp_mib { | |||
100 | unsigned long mibs[UDP_MIB_MAX]; | 100 | unsigned long mibs[UDP_MIB_MAX]; |
101 | } __SNMP_MIB_ALIGN__; | 101 | } __SNMP_MIB_ALIGN__; |
102 | 102 | ||
103 | /* SCTP */ | ||
104 | #define SCTP_MIB_MAX __SCTP_MIB_MAX | ||
105 | struct sctp_mib { | ||
106 | unsigned long mibs[SCTP_MIB_MAX]; | ||
107 | } __SNMP_MIB_ALIGN__; | ||
108 | |||
109 | /* Linux */ | 103 | /* Linux */ |
110 | #define LINUX_MIB_MAX __LINUX_MIB_MAX | 104 | #define LINUX_MIB_MAX __LINUX_MIB_MAX |
111 | struct linux_mib { | 105 | struct linux_mib { |
diff --git a/include/net/sock.h b/include/net/sock.h index 324b3ea233d6..edd4d73ce7f5 100644 --- a/include/net/sock.h +++ b/include/net/sock.h | |||
@@ -862,30 +862,24 @@ extern void sock_init_data(struct socket *sock, struct sock *sk); | |||
862 | * | 862 | * |
863 | */ | 863 | */ |
864 | 864 | ||
865 | static inline int sk_filter(struct sock *sk, struct sk_buff *skb, int needlock) | 865 | static inline int sk_filter(struct sock *sk, struct sk_buff *skb) |
866 | { | 866 | { |
867 | int err; | 867 | int err; |
868 | struct sk_filter *filter; | ||
868 | 869 | ||
869 | err = security_sock_rcv_skb(sk, skb); | 870 | err = security_sock_rcv_skb(sk, skb); |
870 | if (err) | 871 | if (err) |
871 | return err; | 872 | return err; |
872 | 873 | ||
873 | if (sk->sk_filter) { | 874 | rcu_read_lock_bh(); |
874 | struct sk_filter *filter; | 875 | filter = sk->sk_filter; |
875 | 876 | if (filter) { | |
876 | if (needlock) | 877 | unsigned int pkt_len = sk_run_filter(skb, filter->insns, |
877 | bh_lock_sock(sk); | 878 | filter->len); |
878 | 879 | err = pkt_len ? pskb_trim(skb, pkt_len) : -EPERM; | |
879 | filter = sk->sk_filter; | ||
880 | if (filter) { | ||
881 | unsigned int pkt_len = sk_run_filter(skb, filter->insns, | ||
882 | filter->len); | ||
883 | err = pkt_len ? pskb_trim(skb, pkt_len) : -EPERM; | ||
884 | } | ||
885 | |||
886 | if (needlock) | ||
887 | bh_unlock_sock(sk); | ||
888 | } | 880 | } |
881 | rcu_read_unlock_bh(); | ||
882 | |||
889 | return err; | 883 | return err; |
890 | } | 884 | } |
891 | 885 | ||
@@ -897,6 +891,12 @@ static inline int sk_filter(struct sock *sk, struct sk_buff *skb, int needlock) | |||
897 | * Remove a filter from a socket and release its resources. | 891 | * Remove a filter from a socket and release its resources. |
898 | */ | 892 | */ |
899 | 893 | ||
894 | static inline void sk_filter_rcu_free(struct rcu_head *rcu) | ||
895 | { | ||
896 | struct sk_filter *fp = container_of(rcu, struct sk_filter, rcu); | ||
897 | kfree(fp); | ||
898 | } | ||
899 | |||
900 | static inline void sk_filter_release(struct sock *sk, struct sk_filter *fp) | 900 | static inline void sk_filter_release(struct sock *sk, struct sk_filter *fp) |
901 | { | 901 | { |
902 | unsigned int size = sk_filter_len(fp); | 902 | unsigned int size = sk_filter_len(fp); |
@@ -904,7 +904,7 @@ static inline void sk_filter_release(struct sock *sk, struct sk_filter *fp) | |||
904 | atomic_sub(size, &sk->sk_omem_alloc); | 904 | atomic_sub(size, &sk->sk_omem_alloc); |
905 | 905 | ||
906 | if (atomic_dec_and_test(&fp->refcnt)) | 906 | if (atomic_dec_and_test(&fp->refcnt)) |
907 | kfree(fp); | 907 | call_rcu_bh(&fp->rcu, sk_filter_rcu_free); |
908 | } | 908 | } |
909 | 909 | ||
910 | static inline void sk_filter_charge(struct sock *sk, struct sk_filter *fp) | 910 | static inline void sk_filter_charge(struct sock *sk, struct sk_filter *fp) |
@@ -969,9 +969,23 @@ static inline void sock_graft(struct sock *sk, struct socket *parent) | |||
969 | sk->sk_sleep = &parent->wait; | 969 | sk->sk_sleep = &parent->wait; |
970 | parent->sk = sk; | 970 | parent->sk = sk; |
971 | sk->sk_socket = parent; | 971 | sk->sk_socket = parent; |
972 | security_sock_graft(sk, parent); | ||
972 | write_unlock_bh(&sk->sk_callback_lock); | 973 | write_unlock_bh(&sk->sk_callback_lock); |
973 | } | 974 | } |
974 | 975 | ||
976 | static inline void sock_copy(struct sock *nsk, const struct sock *osk) | ||
977 | { | ||
978 | #ifdef CONFIG_SECURITY_NETWORK | ||
979 | void *sptr = nsk->sk_security; | ||
980 | #endif | ||
981 | |||
982 | memcpy(nsk, osk, osk->sk_prot->obj_size); | ||
983 | #ifdef CONFIG_SECURITY_NETWORK | ||
984 | nsk->sk_security = sptr; | ||
985 | security_sk_clone(osk, nsk); | ||
986 | #endif | ||
987 | } | ||
988 | |||
975 | extern int sock_i_uid(struct sock *sk); | 989 | extern int sock_i_uid(struct sock *sk); |
976 | extern unsigned long sock_i_ino(struct sock *sk); | 990 | extern unsigned long sock_i_ino(struct sock *sk); |
977 | 991 | ||
diff --git a/include/net/tc_act/tc_defact.h b/include/net/tc_act/tc_defact.h index 463aa671f95d..65f024b80958 100644 --- a/include/net/tc_act/tc_defact.h +++ b/include/net/tc_act/tc_defact.h | |||
@@ -3,11 +3,12 @@ | |||
3 | 3 | ||
4 | #include <net/act_api.h> | 4 | #include <net/act_api.h> |
5 | 5 | ||
6 | struct tcf_defact | 6 | struct tcf_defact { |
7 | { | 7 | struct tcf_common common; |
8 | tca_gen(defact); | 8 | u32 tcfd_datalen; |
9 | u32 datalen; | 9 | void *tcfd_defdata; |
10 | void *defdata; | ||
11 | }; | 10 | }; |
11 | #define to_defact(pc) \ | ||
12 | container_of(pc, struct tcf_defact, common) | ||
12 | 13 | ||
13 | #endif | 14 | #endif /* __NET_TC_DEF_H */ |
diff --git a/include/net/tc_act/tc_gact.h b/include/net/tc_act/tc_gact.h index 59f0d9628ad1..9e3f6767b80e 100644 --- a/include/net/tc_act/tc_gact.h +++ b/include/net/tc_act/tc_gact.h | |||
@@ -3,15 +3,15 @@ | |||
3 | 3 | ||
4 | #include <net/act_api.h> | 4 | #include <net/act_api.h> |
5 | 5 | ||
6 | struct tcf_gact | 6 | struct tcf_gact { |
7 | { | 7 | struct tcf_common common; |
8 | tca_gen(gact); | ||
9 | #ifdef CONFIG_GACT_PROB | 8 | #ifdef CONFIG_GACT_PROB |
10 | u16 ptype; | 9 | u16 tcfg_ptype; |
11 | u16 pval; | 10 | u16 tcfg_pval; |
12 | int paction; | 11 | int tcfg_paction; |
13 | #endif | 12 | #endif |
14 | |||
15 | }; | 13 | }; |
16 | 14 | #define to_gact(pc) \ | |
17 | #endif | 15 | container_of(pc, struct tcf_gact, common) |
16 | |||
17 | #endif /* __NET_TC_GACT_H */ | ||
diff --git a/include/net/tc_act/tc_ipt.h b/include/net/tc_act/tc_ipt.h index cb37ad08427f..f7d25dfcc4b7 100644 --- a/include/net/tc_act/tc_ipt.h +++ b/include/net/tc_act/tc_ipt.h | |||
@@ -5,12 +5,13 @@ | |||
5 | 5 | ||
6 | struct xt_entry_target; | 6 | struct xt_entry_target; |
7 | 7 | ||
8 | struct tcf_ipt | 8 | struct tcf_ipt { |
9 | { | 9 | struct tcf_common common; |
10 | tca_gen(ipt); | 10 | u32 tcfi_hook; |
11 | u32 hook; | 11 | char *tcfi_tname; |
12 | char *tname; | 12 | struct xt_entry_target *tcfi_t; |
13 | struct xt_entry_target *t; | ||
14 | }; | 13 | }; |
14 | #define to_ipt(pc) \ | ||
15 | container_of(pc, struct tcf_ipt, common) | ||
15 | 16 | ||
16 | #endif | 17 | #endif /* __NET_TC_IPT_H */ |
diff --git a/include/net/tc_act/tc_mirred.h b/include/net/tc_act/tc_mirred.h index b5c32f65c12c..ceac661cdfd5 100644 --- a/include/net/tc_act/tc_mirred.h +++ b/include/net/tc_act/tc_mirred.h | |||
@@ -3,13 +3,14 @@ | |||
3 | 3 | ||
4 | #include <net/act_api.h> | 4 | #include <net/act_api.h> |
5 | 5 | ||
6 | struct tcf_mirred | 6 | struct tcf_mirred { |
7 | { | 7 | struct tcf_common common; |
8 | tca_gen(mirred); | 8 | int tcfm_eaction; |
9 | int eaction; | 9 | int tcfm_ifindex; |
10 | int ifindex; | 10 | int tcfm_ok_push; |
11 | int ok_push; | 11 | struct net_device *tcfm_dev; |
12 | struct net_device *dev; | ||
13 | }; | 12 | }; |
13 | #define to_mirred(pc) \ | ||
14 | container_of(pc, struct tcf_mirred, common) | ||
14 | 15 | ||
15 | #endif | 16 | #endif /* __NET_TC_MIR_H */ |
diff --git a/include/net/tc_act/tc_pedit.h b/include/net/tc_act/tc_pedit.h index eb21689d759d..e6f6e15956f5 100644 --- a/include/net/tc_act/tc_pedit.h +++ b/include/net/tc_act/tc_pedit.h | |||
@@ -3,12 +3,13 @@ | |||
3 | 3 | ||
4 | #include <net/act_api.h> | 4 | #include <net/act_api.h> |
5 | 5 | ||
6 | struct tcf_pedit | 6 | struct tcf_pedit { |
7 | { | 7 | struct tcf_common common; |
8 | tca_gen(pedit); | 8 | unsigned char tcfp_nkeys; |
9 | unsigned char nkeys; | 9 | unsigned char tcfp_flags; |
10 | unsigned char flags; | 10 | struct tc_pedit_key *tcfp_keys; |
11 | struct tc_pedit_key *keys; | ||
12 | }; | 11 | }; |
12 | #define to_pedit(pc) \ | ||
13 | container_of(pc, struct tcf_pedit, common) | ||
13 | 14 | ||
14 | #endif | 15 | #endif /* __NET_TC_PED_H */ |
diff --git a/include/net/udp.h b/include/net/udp.h index 766fba1369ce..db0c05f67546 100644 --- a/include/net/udp.h +++ b/include/net/udp.h | |||
@@ -30,25 +30,9 @@ | |||
30 | 30 | ||
31 | #define UDP_HTABLE_SIZE 128 | 31 | #define UDP_HTABLE_SIZE 128 |
32 | 32 | ||
33 | /* udp.c: This needs to be shared by v4 and v6 because the lookup | ||
34 | * and hashing code needs to work with different AF's yet | ||
35 | * the port space is shared. | ||
36 | */ | ||
37 | extern struct hlist_head udp_hash[UDP_HTABLE_SIZE]; | 33 | extern struct hlist_head udp_hash[UDP_HTABLE_SIZE]; |
38 | extern rwlock_t udp_hash_lock; | 34 | extern rwlock_t udp_hash_lock; |
39 | 35 | ||
40 | extern int udp_port_rover; | ||
41 | |||
42 | static inline int udp_lport_inuse(u16 num) | ||
43 | { | ||
44 | struct sock *sk; | ||
45 | struct hlist_node *node; | ||
46 | |||
47 | sk_for_each(sk, node, &udp_hash[num & (UDP_HTABLE_SIZE - 1)]) | ||
48 | if (inet_sk(sk)->num == num) | ||
49 | return 1; | ||
50 | return 0; | ||
51 | } | ||
52 | 36 | ||
53 | /* Note: this must match 'valbool' in sock_setsockopt */ | 37 | /* Note: this must match 'valbool' in sock_setsockopt */ |
54 | #define UDP_CSUM_NOXMIT 1 | 38 | #define UDP_CSUM_NOXMIT 1 |
@@ -63,6 +47,8 @@ extern struct proto udp_prot; | |||
63 | 47 | ||
64 | struct sk_buff; | 48 | struct sk_buff; |
65 | 49 | ||
50 | extern int udp_get_port(struct sock *sk, unsigned short snum, | ||
51 | int (*saddr_cmp)(const struct sock *, const struct sock *)); | ||
66 | extern void udp_err(struct sk_buff *, u32); | 52 | extern void udp_err(struct sk_buff *, u32); |
67 | 53 | ||
68 | extern int udp_sendmsg(struct kiocb *iocb, struct sock *sk, | 54 | extern int udp_sendmsg(struct kiocb *iocb, struct sock *sk, |
diff --git a/include/net/xfrm.h b/include/net/xfrm.h index 9c5ee9f20b65..11e0b1d6bd47 100644 --- a/include/net/xfrm.h +++ b/include/net/xfrm.h | |||
@@ -8,8 +8,8 @@ | |||
8 | #include <linux/list.h> | 8 | #include <linux/list.h> |
9 | #include <linux/skbuff.h> | 9 | #include <linux/skbuff.h> |
10 | #include <linux/socket.h> | 10 | #include <linux/socket.h> |
11 | #include <linux/crypto.h> | ||
12 | #include <linux/pfkeyv2.h> | 11 | #include <linux/pfkeyv2.h> |
12 | #include <linux/ipsec.h> | ||
13 | #include <linux/in6.h> | 13 | #include <linux/in6.h> |
14 | #include <linux/mutex.h> | 14 | #include <linux/mutex.h> |
15 | 15 | ||
@@ -94,8 +94,9 @@ extern struct mutex xfrm_cfg_mutex; | |||
94 | struct xfrm_state | 94 | struct xfrm_state |
95 | { | 95 | { |
96 | /* Note: bydst is re-used during gc */ | 96 | /* Note: bydst is re-used during gc */ |
97 | struct list_head bydst; | 97 | struct hlist_node bydst; |
98 | struct list_head byspi; | 98 | struct hlist_node bysrc; |
99 | struct hlist_node byspi; | ||
99 | 100 | ||
100 | atomic_t refcnt; | 101 | atomic_t refcnt; |
101 | spinlock_t lock; | 102 | spinlock_t lock; |
@@ -103,6 +104,8 @@ struct xfrm_state | |||
103 | struct xfrm_id id; | 104 | struct xfrm_id id; |
104 | struct xfrm_selector sel; | 105 | struct xfrm_selector sel; |
105 | 106 | ||
107 | u32 genid; | ||
108 | |||
106 | /* Key manger bits */ | 109 | /* Key manger bits */ |
107 | struct { | 110 | struct { |
108 | u8 state; | 111 | u8 state; |
@@ -133,6 +136,9 @@ struct xfrm_state | |||
133 | /* Data for encapsulator */ | 136 | /* Data for encapsulator */ |
134 | struct xfrm_encap_tmpl *encap; | 137 | struct xfrm_encap_tmpl *encap; |
135 | 138 | ||
139 | /* Data for care-of address */ | ||
140 | xfrm_address_t *coaddr; | ||
141 | |||
136 | /* IPComp needs an IPIP tunnel for handling uncompressed packets */ | 142 | /* IPComp needs an IPIP tunnel for handling uncompressed packets */ |
137 | struct xfrm_state *tunnel; | 143 | struct xfrm_state *tunnel; |
138 | 144 | ||
@@ -163,6 +169,9 @@ struct xfrm_state | |||
163 | struct xfrm_lifetime_cur curlft; | 169 | struct xfrm_lifetime_cur curlft; |
164 | struct timer_list timer; | 170 | struct timer_list timer; |
165 | 171 | ||
172 | /* Last used time */ | ||
173 | u64 lastused; | ||
174 | |||
166 | /* Reference to data common to all the instances of this | 175 | /* Reference to data common to all the instances of this |
167 | * transformer. */ | 176 | * transformer. */ |
168 | struct xfrm_type *type; | 177 | struct xfrm_type *type; |
@@ -196,6 +205,7 @@ struct km_event | |||
196 | u32 proto; | 205 | u32 proto; |
197 | u32 byid; | 206 | u32 byid; |
198 | u32 aevent; | 207 | u32 aevent; |
208 | u32 type; | ||
199 | } data; | 209 | } data; |
200 | 210 | ||
201 | u32 seq; | 211 | u32 seq; |
@@ -212,6 +222,7 @@ struct xfrm_policy_afinfo { | |||
212 | struct dst_ops *dst_ops; | 222 | struct dst_ops *dst_ops; |
213 | void (*garbage_collect)(void); | 223 | void (*garbage_collect)(void); |
214 | int (*dst_lookup)(struct xfrm_dst **dst, struct flowi *fl); | 224 | int (*dst_lookup)(struct xfrm_dst **dst, struct flowi *fl); |
225 | int (*get_saddr)(xfrm_address_t *saddr, xfrm_address_t *daddr); | ||
215 | struct dst_entry *(*find_bundle)(struct flowi *fl, struct xfrm_policy *policy); | 226 | struct dst_entry *(*find_bundle)(struct flowi *fl, struct xfrm_policy *policy); |
216 | int (*bundle_create)(struct xfrm_policy *policy, | 227 | int (*bundle_create)(struct xfrm_policy *policy, |
217 | struct xfrm_state **xfrm, | 228 | struct xfrm_state **xfrm, |
@@ -235,16 +246,12 @@ extern int __xfrm_state_delete(struct xfrm_state *x); | |||
235 | 246 | ||
236 | struct xfrm_state_afinfo { | 247 | struct xfrm_state_afinfo { |
237 | unsigned short family; | 248 | unsigned short family; |
238 | struct list_head *state_bydst; | ||
239 | struct list_head *state_byspi; | ||
240 | int (*init_flags)(struct xfrm_state *x); | 249 | int (*init_flags)(struct xfrm_state *x); |
241 | void (*init_tempsel)(struct xfrm_state *x, struct flowi *fl, | 250 | void (*init_tempsel)(struct xfrm_state *x, struct flowi *fl, |
242 | struct xfrm_tmpl *tmpl, | 251 | struct xfrm_tmpl *tmpl, |
243 | xfrm_address_t *daddr, xfrm_address_t *saddr); | 252 | xfrm_address_t *daddr, xfrm_address_t *saddr); |
244 | struct xfrm_state *(*state_lookup)(xfrm_address_t *daddr, u32 spi, u8 proto); | 253 | int (*tmpl_sort)(struct xfrm_tmpl **dst, struct xfrm_tmpl **src, int n); |
245 | struct xfrm_state *(*find_acq)(u8 mode, u32 reqid, u8 proto, | 254 | int (*state_sort)(struct xfrm_state **dst, struct xfrm_state **src, int n); |
246 | xfrm_address_t *daddr, xfrm_address_t *saddr, | ||
247 | int create); | ||
248 | }; | 255 | }; |
249 | 256 | ||
250 | extern int xfrm_state_register_afinfo(struct xfrm_state_afinfo *afinfo); | 257 | extern int xfrm_state_register_afinfo(struct xfrm_state_afinfo *afinfo); |
@@ -257,11 +264,17 @@ struct xfrm_type | |||
257 | char *description; | 264 | char *description; |
258 | struct module *owner; | 265 | struct module *owner; |
259 | __u8 proto; | 266 | __u8 proto; |
267 | __u8 flags; | ||
268 | #define XFRM_TYPE_NON_FRAGMENT 1 | ||
260 | 269 | ||
261 | int (*init_state)(struct xfrm_state *x); | 270 | int (*init_state)(struct xfrm_state *x); |
262 | void (*destructor)(struct xfrm_state *); | 271 | void (*destructor)(struct xfrm_state *); |
263 | int (*input)(struct xfrm_state *, struct sk_buff *skb); | 272 | int (*input)(struct xfrm_state *, struct sk_buff *skb); |
264 | int (*output)(struct xfrm_state *, struct sk_buff *pskb); | 273 | int (*output)(struct xfrm_state *, struct sk_buff *pskb); |
274 | int (*reject)(struct xfrm_state *, struct sk_buff *, struct flowi *); | ||
275 | int (*hdr_offset)(struct xfrm_state *, struct sk_buff *, u8 **); | ||
276 | xfrm_address_t *(*local_addr)(struct xfrm_state *, xfrm_address_t *); | ||
277 | xfrm_address_t *(*remote_addr)(struct xfrm_state *, xfrm_address_t *); | ||
265 | /* Estimate maximal size of result of transformation of a dgram */ | 278 | /* Estimate maximal size of result of transformation of a dgram */ |
266 | u32 (*get_max_size)(struct xfrm_state *, int size); | 279 | u32 (*get_max_size)(struct xfrm_state *, int size); |
267 | }; | 280 | }; |
@@ -273,7 +286,7 @@ extern void xfrm_put_type(struct xfrm_type *type); | |||
273 | 286 | ||
274 | struct xfrm_mode { | 287 | struct xfrm_mode { |
275 | int (*input)(struct xfrm_state *x, struct sk_buff *skb); | 288 | int (*input)(struct xfrm_state *x, struct sk_buff *skb); |
276 | int (*output)(struct sk_buff *skb); | 289 | int (*output)(struct xfrm_state *x,struct sk_buff *skb); |
277 | 290 | ||
278 | struct module *owner; | 291 | struct module *owner; |
279 | unsigned int encap; | 292 | unsigned int encap; |
@@ -299,7 +312,7 @@ struct xfrm_tmpl | |||
299 | 312 | ||
300 | __u32 reqid; | 313 | __u32 reqid; |
301 | 314 | ||
302 | /* Mode: transport/tunnel */ | 315 | /* Mode: transport, tunnel etc. */ |
303 | __u8 mode; | 316 | __u8 mode; |
304 | 317 | ||
305 | /* Sharing mode: unique, this session only, this user only etc. */ | 318 | /* Sharing mode: unique, this session only, this user only etc. */ |
@@ -314,18 +327,20 @@ struct xfrm_tmpl | |||
314 | __u32 calgos; | 327 | __u32 calgos; |
315 | }; | 328 | }; |
316 | 329 | ||
317 | #define XFRM_MAX_DEPTH 4 | 330 | #define XFRM_MAX_DEPTH 6 |
318 | 331 | ||
319 | struct xfrm_policy | 332 | struct xfrm_policy |
320 | { | 333 | { |
321 | struct xfrm_policy *next; | 334 | struct xfrm_policy *next; |
322 | struct list_head list; | 335 | struct hlist_node bydst; |
336 | struct hlist_node byidx; | ||
323 | 337 | ||
324 | /* This lock only affects elements except for entry. */ | 338 | /* This lock only affects elements except for entry. */ |
325 | rwlock_t lock; | 339 | rwlock_t lock; |
326 | atomic_t refcnt; | 340 | atomic_t refcnt; |
327 | struct timer_list timer; | 341 | struct timer_list timer; |
328 | 342 | ||
343 | u8 type; | ||
329 | u32 priority; | 344 | u32 priority; |
330 | u32 index; | 345 | u32 index; |
331 | struct xfrm_selector selector; | 346 | struct xfrm_selector selector; |
@@ -363,16 +378,16 @@ struct xfrm_mgr | |||
363 | char *id; | 378 | char *id; |
364 | int (*notify)(struct xfrm_state *x, struct km_event *c); | 379 | int (*notify)(struct xfrm_state *x, struct km_event *c); |
365 | int (*acquire)(struct xfrm_state *x, struct xfrm_tmpl *, struct xfrm_policy *xp, int dir); | 380 | int (*acquire)(struct xfrm_state *x, struct xfrm_tmpl *, struct xfrm_policy *xp, int dir); |
366 | struct xfrm_policy *(*compile_policy)(u16 family, int opt, u8 *data, int len, int *dir); | 381 | struct xfrm_policy *(*compile_policy)(struct sock *sk, int opt, u8 *data, int len, int *dir); |
367 | int (*new_mapping)(struct xfrm_state *x, xfrm_address_t *ipaddr, u16 sport); | 382 | int (*new_mapping)(struct xfrm_state *x, xfrm_address_t *ipaddr, u16 sport); |
368 | int (*notify_policy)(struct xfrm_policy *x, int dir, struct km_event *c); | 383 | int (*notify_policy)(struct xfrm_policy *x, int dir, struct km_event *c); |
384 | int (*report)(u8 proto, struct xfrm_selector *sel, xfrm_address_t *addr); | ||
369 | }; | 385 | }; |
370 | 386 | ||
371 | extern int xfrm_register_km(struct xfrm_mgr *km); | 387 | extern int xfrm_register_km(struct xfrm_mgr *km); |
372 | extern int xfrm_unregister_km(struct xfrm_mgr *km); | 388 | extern int xfrm_unregister_km(struct xfrm_mgr *km); |
373 | 389 | ||
374 | 390 | extern unsigned int xfrm_policy_count[XFRM_POLICY_MAX*2]; | |
375 | extern struct xfrm_policy *xfrm_policy_list[XFRM_POLICY_MAX*2]; | ||
376 | 391 | ||
377 | static inline void xfrm_pol_hold(struct xfrm_policy *policy) | 392 | static inline void xfrm_pol_hold(struct xfrm_policy *policy) |
378 | { | 393 | { |
@@ -388,67 +403,19 @@ static inline void xfrm_pol_put(struct xfrm_policy *policy) | |||
388 | __xfrm_policy_destroy(policy); | 403 | __xfrm_policy_destroy(policy); |
389 | } | 404 | } |
390 | 405 | ||
391 | #define XFRM_DST_HSIZE 1024 | 406 | #ifdef CONFIG_XFRM_SUB_POLICY |
392 | 407 | static inline void xfrm_pols_put(struct xfrm_policy **pols, int npols) | |
393 | static __inline__ | ||
394 | unsigned __xfrm4_dst_hash(xfrm_address_t *addr) | ||
395 | { | ||
396 | unsigned h; | ||
397 | h = ntohl(addr->a4); | ||
398 | h = (h ^ (h>>16)) % XFRM_DST_HSIZE; | ||
399 | return h; | ||
400 | } | ||
401 | |||
402 | static __inline__ | ||
403 | unsigned __xfrm6_dst_hash(xfrm_address_t *addr) | ||
404 | { | ||
405 | unsigned h; | ||
406 | h = ntohl(addr->a6[2]^addr->a6[3]); | ||
407 | h = (h ^ (h>>16)) % XFRM_DST_HSIZE; | ||
408 | return h; | ||
409 | } | ||
410 | |||
411 | static __inline__ | ||
412 | unsigned xfrm_dst_hash(xfrm_address_t *addr, unsigned short family) | ||
413 | { | ||
414 | switch (family) { | ||
415 | case AF_INET: | ||
416 | return __xfrm4_dst_hash(addr); | ||
417 | case AF_INET6: | ||
418 | return __xfrm6_dst_hash(addr); | ||
419 | } | ||
420 | return 0; | ||
421 | } | ||
422 | |||
423 | static __inline__ | ||
424 | unsigned __xfrm4_spi_hash(xfrm_address_t *addr, u32 spi, u8 proto) | ||
425 | { | 408 | { |
426 | unsigned h; | 409 | int i; |
427 | h = ntohl(addr->a4^spi^proto); | 410 | for (i = npols - 1; i >= 0; --i) |
428 | h = (h ^ (h>>10) ^ (h>>20)) % XFRM_DST_HSIZE; | 411 | xfrm_pol_put(pols[i]); |
429 | return h; | ||
430 | } | 412 | } |
431 | 413 | #else | |
432 | static __inline__ | 414 | static inline void xfrm_pols_put(struct xfrm_policy **pols, int npols) |
433 | unsigned __xfrm6_spi_hash(xfrm_address_t *addr, u32 spi, u8 proto) | ||
434 | { | ||
435 | unsigned h; | ||
436 | h = ntohl(addr->a6[2]^addr->a6[3]^spi^proto); | ||
437 | h = (h ^ (h>>10) ^ (h>>20)) % XFRM_DST_HSIZE; | ||
438 | return h; | ||
439 | } | ||
440 | |||
441 | static __inline__ | ||
442 | unsigned xfrm_spi_hash(xfrm_address_t *addr, u32 spi, u8 proto, unsigned short family) | ||
443 | { | 415 | { |
444 | switch (family) { | 416 | xfrm_pol_put(pols[0]); |
445 | case AF_INET: | ||
446 | return __xfrm4_spi_hash(addr, spi, proto); | ||
447 | case AF_INET6: | ||
448 | return __xfrm6_spi_hash(addr, spi, proto); | ||
449 | } | ||
450 | return 0; /*XXX*/ | ||
451 | } | 417 | } |
418 | #endif | ||
452 | 419 | ||
453 | extern void __xfrm_state_destroy(struct xfrm_state *); | 420 | extern void __xfrm_state_destroy(struct xfrm_state *); |
454 | 421 | ||
@@ -508,6 +475,11 @@ u16 xfrm_flowi_sport(struct flowi *fl) | |||
508 | case IPPROTO_ICMPV6: | 475 | case IPPROTO_ICMPV6: |
509 | port = htons(fl->fl_icmp_type); | 476 | port = htons(fl->fl_icmp_type); |
510 | break; | 477 | break; |
478 | #ifdef CONFIG_IPV6_MIP6 | ||
479 | case IPPROTO_MH: | ||
480 | port = htons(fl->fl_mh_type); | ||
481 | break; | ||
482 | #endif | ||
511 | default: | 483 | default: |
512 | port = 0; /*XXX*/ | 484 | port = 0; /*XXX*/ |
513 | } | 485 | } |
@@ -608,6 +580,7 @@ struct xfrm_dst | |||
608 | struct rt6_info rt6; | 580 | struct rt6_info rt6; |
609 | } u; | 581 | } u; |
610 | struct dst_entry *route; | 582 | struct dst_entry *route; |
583 | u32 genid; | ||
611 | u32 route_mtu_cached; | 584 | u32 route_mtu_cached; |
612 | u32 child_mtu_cached; | 585 | u32 child_mtu_cached; |
613 | u32 route_cookie; | 586 | u32 route_cookie; |
@@ -659,6 +632,18 @@ secpath_reset(struct sk_buff *skb) | |||
659 | } | 632 | } |
660 | 633 | ||
661 | static inline int | 634 | static inline int |
635 | xfrm_addr_any(xfrm_address_t *addr, unsigned short family) | ||
636 | { | ||
637 | switch (family) { | ||
638 | case AF_INET: | ||
639 | return addr->a4 == 0; | ||
640 | case AF_INET6: | ||
641 | return ipv6_addr_any((struct in6_addr *)&addr->a6); | ||
642 | } | ||
643 | return 0; | ||
644 | } | ||
645 | |||
646 | static inline int | ||
662 | __xfrm4_state_addr_cmp(struct xfrm_tmpl *tmpl, struct xfrm_state *x) | 647 | __xfrm4_state_addr_cmp(struct xfrm_tmpl *tmpl, struct xfrm_state *x) |
663 | { | 648 | { |
664 | return (tmpl->saddr.a4 && | 649 | return (tmpl->saddr.a4 && |
@@ -692,8 +677,8 @@ static inline int xfrm_policy_check(struct sock *sk, int dir, struct sk_buff *sk | |||
692 | { | 677 | { |
693 | if (sk && sk->sk_policy[XFRM_POLICY_IN]) | 678 | if (sk && sk->sk_policy[XFRM_POLICY_IN]) |
694 | return __xfrm_policy_check(sk, dir, skb, family); | 679 | return __xfrm_policy_check(sk, dir, skb, family); |
695 | 680 | ||
696 | return (!xfrm_policy_list[dir] && !skb->sp) || | 681 | return (!xfrm_policy_count[dir] && !skb->sp) || |
697 | (skb->dst->flags & DST_NOPOLICY) || | 682 | (skb->dst->flags & DST_NOPOLICY) || |
698 | __xfrm_policy_check(sk, dir, skb, family); | 683 | __xfrm_policy_check(sk, dir, skb, family); |
699 | } | 684 | } |
@@ -713,7 +698,7 @@ extern int __xfrm_route_forward(struct sk_buff *skb, unsigned short family); | |||
713 | 698 | ||
714 | static inline int xfrm_route_forward(struct sk_buff *skb, unsigned short family) | 699 | static inline int xfrm_route_forward(struct sk_buff *skb, unsigned short family) |
715 | { | 700 | { |
716 | return !xfrm_policy_list[XFRM_POLICY_OUT] || | 701 | return !xfrm_policy_count[XFRM_POLICY_OUT] || |
717 | (skb->dst->flags & DST_NOXFRM) || | 702 | (skb->dst->flags & DST_NOXFRM) || |
718 | __xfrm_route_forward(skb, family); | 703 | __xfrm_route_forward(skb, family); |
719 | } | 704 | } |
@@ -831,11 +816,36 @@ xfrm_state_addr_check(struct xfrm_state *x, | |||
831 | return 0; | 816 | return 0; |
832 | } | 817 | } |
833 | 818 | ||
819 | static __inline__ int | ||
820 | xfrm_state_addr_flow_check(struct xfrm_state *x, struct flowi *fl, | ||
821 | unsigned short family) | ||
822 | { | ||
823 | switch (family) { | ||
824 | case AF_INET: | ||
825 | return __xfrm4_state_addr_check(x, | ||
826 | (xfrm_address_t *)&fl->fl4_dst, | ||
827 | (xfrm_address_t *)&fl->fl4_src); | ||
828 | case AF_INET6: | ||
829 | return __xfrm6_state_addr_check(x, | ||
830 | (xfrm_address_t *)&fl->fl6_dst, | ||
831 | (xfrm_address_t *)&fl->fl6_src); | ||
832 | } | ||
833 | return 0; | ||
834 | } | ||
835 | |||
834 | static inline int xfrm_state_kern(struct xfrm_state *x) | 836 | static inline int xfrm_state_kern(struct xfrm_state *x) |
835 | { | 837 | { |
836 | return atomic_read(&x->tunnel_users); | 838 | return atomic_read(&x->tunnel_users); |
837 | } | 839 | } |
838 | 840 | ||
841 | static inline int xfrm_id_proto_match(u8 proto, u8 userproto) | ||
842 | { | ||
843 | return (!userproto || proto == userproto || | ||
844 | (userproto == IPSEC_PROTO_ANY && (proto == IPPROTO_AH || | ||
845 | proto == IPPROTO_ESP || | ||
846 | proto == IPPROTO_COMP))); | ||
847 | } | ||
848 | |||
839 | /* | 849 | /* |
840 | * xfrm algorithm information | 850 | * xfrm algorithm information |
841 | */ | 851 | */ |
@@ -855,6 +865,7 @@ struct xfrm_algo_comp_info { | |||
855 | 865 | ||
856 | struct xfrm_algo_desc { | 866 | struct xfrm_algo_desc { |
857 | char *name; | 867 | char *name; |
868 | char *compat; | ||
858 | u8 available:1; | 869 | u8 available:1; |
859 | union { | 870 | union { |
860 | struct xfrm_algo_auth_info auth; | 871 | struct xfrm_algo_auth_info auth; |
@@ -902,6 +913,25 @@ extern void xfrm_state_insert(struct xfrm_state *x); | |||
902 | extern int xfrm_state_add(struct xfrm_state *x); | 913 | extern int xfrm_state_add(struct xfrm_state *x); |
903 | extern int xfrm_state_update(struct xfrm_state *x); | 914 | extern int xfrm_state_update(struct xfrm_state *x); |
904 | extern struct xfrm_state *xfrm_state_lookup(xfrm_address_t *daddr, u32 spi, u8 proto, unsigned short family); | 915 | extern struct xfrm_state *xfrm_state_lookup(xfrm_address_t *daddr, u32 spi, u8 proto, unsigned short family); |
916 | extern struct xfrm_state *xfrm_state_lookup_byaddr(xfrm_address_t *daddr, xfrm_address_t *saddr, u8 proto, unsigned short family); | ||
917 | #ifdef CONFIG_XFRM_SUB_POLICY | ||
918 | extern int xfrm_tmpl_sort(struct xfrm_tmpl **dst, struct xfrm_tmpl **src, | ||
919 | int n, unsigned short family); | ||
920 | extern int xfrm_state_sort(struct xfrm_state **dst, struct xfrm_state **src, | ||
921 | int n, unsigned short family); | ||
922 | #else | ||
923 | static inline int xfrm_tmpl_sort(struct xfrm_tmpl **dst, struct xfrm_tmpl **src, | ||
924 | int n, unsigned short family) | ||
925 | { | ||
926 | return -ENOSYS; | ||
927 | } | ||
928 | |||
929 | static inline int xfrm_state_sort(struct xfrm_state **dst, struct xfrm_state **src, | ||
930 | int n, unsigned short family) | ||
931 | { | ||
932 | return -ENOSYS; | ||
933 | } | ||
934 | #endif | ||
905 | extern struct xfrm_state *xfrm_find_acq_byseq(u32 seq); | 935 | extern struct xfrm_state *xfrm_find_acq_byseq(u32 seq); |
906 | extern int xfrm_state_delete(struct xfrm_state *x); | 936 | extern int xfrm_state_delete(struct xfrm_state *x); |
907 | extern void xfrm_state_flush(u8 proto); | 937 | extern void xfrm_state_flush(u8 proto); |
@@ -917,12 +947,16 @@ extern int xfrm4_tunnel_register(struct xfrm_tunnel *handler); | |||
917 | extern int xfrm4_tunnel_deregister(struct xfrm_tunnel *handler); | 947 | extern int xfrm4_tunnel_deregister(struct xfrm_tunnel *handler); |
918 | extern int xfrm6_rcv_spi(struct sk_buff *skb, u32 spi); | 948 | extern int xfrm6_rcv_spi(struct sk_buff *skb, u32 spi); |
919 | extern int xfrm6_rcv(struct sk_buff **pskb); | 949 | extern int xfrm6_rcv(struct sk_buff **pskb); |
950 | extern int xfrm6_input_addr(struct sk_buff *skb, xfrm_address_t *daddr, | ||
951 | xfrm_address_t *saddr, u8 proto); | ||
920 | extern int xfrm6_tunnel_register(struct xfrm6_tunnel *handler); | 952 | extern int xfrm6_tunnel_register(struct xfrm6_tunnel *handler); |
921 | extern int xfrm6_tunnel_deregister(struct xfrm6_tunnel *handler); | 953 | extern int xfrm6_tunnel_deregister(struct xfrm6_tunnel *handler); |
922 | extern u32 xfrm6_tunnel_alloc_spi(xfrm_address_t *saddr); | 954 | extern u32 xfrm6_tunnel_alloc_spi(xfrm_address_t *saddr); |
923 | extern void xfrm6_tunnel_free_spi(xfrm_address_t *saddr); | 955 | extern void xfrm6_tunnel_free_spi(xfrm_address_t *saddr); |
924 | extern u32 xfrm6_tunnel_spi_lookup(xfrm_address_t *saddr); | 956 | extern u32 xfrm6_tunnel_spi_lookup(xfrm_address_t *saddr); |
925 | extern int xfrm6_output(struct sk_buff *skb); | 957 | extern int xfrm6_output(struct sk_buff *skb); |
958 | extern int xfrm6_find_1stfragopt(struct xfrm_state *x, struct sk_buff *skb, | ||
959 | u8 **prevhdr); | ||
926 | 960 | ||
927 | #ifdef CONFIG_XFRM | 961 | #ifdef CONFIG_XFRM |
928 | extern int xfrm4_rcv_encap(struct sk_buff *skb, __u16 encap_type); | 962 | extern int xfrm4_rcv_encap(struct sk_buff *skb, __u16 encap_type); |
@@ -947,27 +981,27 @@ static inline int xfrm_dst_lookup(struct xfrm_dst **dst, struct flowi *fl, unsig | |||
947 | #endif | 981 | #endif |
948 | 982 | ||
949 | struct xfrm_policy *xfrm_policy_alloc(gfp_t gfp); | 983 | struct xfrm_policy *xfrm_policy_alloc(gfp_t gfp); |
950 | extern int xfrm_policy_walk(int (*func)(struct xfrm_policy *, int, int, void*), void *); | 984 | extern int xfrm_policy_walk(u8 type, int (*func)(struct xfrm_policy *, int, int, void*), void *); |
951 | int xfrm_policy_insert(int dir, struct xfrm_policy *policy, int excl); | 985 | int xfrm_policy_insert(int dir, struct xfrm_policy *policy, int excl); |
952 | struct xfrm_policy *xfrm_policy_bysel_ctx(int dir, struct xfrm_selector *sel, | 986 | struct xfrm_policy *xfrm_policy_bysel_ctx(u8 type, int dir, |
987 | struct xfrm_selector *sel, | ||
953 | struct xfrm_sec_ctx *ctx, int delete); | 988 | struct xfrm_sec_ctx *ctx, int delete); |
954 | struct xfrm_policy *xfrm_policy_byid(int dir, u32 id, int delete); | 989 | struct xfrm_policy *xfrm_policy_byid(u8, int dir, u32 id, int delete); |
955 | void xfrm_policy_flush(void); | 990 | void xfrm_policy_flush(u8 type); |
956 | u32 xfrm_get_acqseq(void); | 991 | u32 xfrm_get_acqseq(void); |
957 | void xfrm_alloc_spi(struct xfrm_state *x, u32 minspi, u32 maxspi); | 992 | void xfrm_alloc_spi(struct xfrm_state *x, u32 minspi, u32 maxspi); |
958 | struct xfrm_state * xfrm_find_acq(u8 mode, u32 reqid, u8 proto, | 993 | struct xfrm_state * xfrm_find_acq(u8 mode, u32 reqid, u8 proto, |
959 | xfrm_address_t *daddr, xfrm_address_t *saddr, | 994 | xfrm_address_t *daddr, xfrm_address_t *saddr, |
960 | int create, unsigned short family); | 995 | int create, unsigned short family); |
961 | extern void xfrm_policy_flush(void); | 996 | extern void xfrm_policy_flush(u8 type); |
962 | extern int xfrm_sk_policy_insert(struct sock *sk, int dir, struct xfrm_policy *pol); | 997 | extern int xfrm_sk_policy_insert(struct sock *sk, int dir, struct xfrm_policy *pol); |
963 | extern int xfrm_flush_bundles(void); | 998 | extern int xfrm_bundle_ok(struct xfrm_dst *xdst, struct flowi *fl, int family, int strict); |
964 | extern void xfrm_flush_all_bundles(void); | ||
965 | extern int xfrm_bundle_ok(struct xfrm_dst *xdst, struct flowi *fl, int family); | ||
966 | extern void xfrm_init_pmtu(struct dst_entry *dst); | 999 | extern void xfrm_init_pmtu(struct dst_entry *dst); |
967 | 1000 | ||
968 | extern wait_queue_head_t km_waitq; | 1001 | extern wait_queue_head_t km_waitq; |
969 | extern int km_new_mapping(struct xfrm_state *x, xfrm_address_t *ipaddr, u16 sport); | 1002 | extern int km_new_mapping(struct xfrm_state *x, xfrm_address_t *ipaddr, u16 sport); |
970 | extern void km_policy_expired(struct xfrm_policy *pol, int dir, int hard, u32 pid); | 1003 | extern void km_policy_expired(struct xfrm_policy *pol, int dir, int hard, u32 pid); |
1004 | extern int km_report(u8 proto, struct xfrm_selector *sel, xfrm_address_t *addr); | ||
971 | 1005 | ||
972 | extern void xfrm_input_init(void); | 1006 | extern void xfrm_input_init(void); |
973 | extern int xfrm_parse_spi(struct sk_buff *skb, u8 nexthdr, u32 *spi, u32 *seq); | 1007 | extern int xfrm_parse_spi(struct sk_buff *skb, u8 nexthdr, u32 *spi, u32 *seq); |
@@ -984,11 +1018,13 @@ extern struct xfrm_algo_desc *xfrm_aalg_get_byname(char *name, int probe); | |||
984 | extern struct xfrm_algo_desc *xfrm_ealg_get_byname(char *name, int probe); | 1018 | extern struct xfrm_algo_desc *xfrm_ealg_get_byname(char *name, int probe); |
985 | extern struct xfrm_algo_desc *xfrm_calg_get_byname(char *name, int probe); | 1019 | extern struct xfrm_algo_desc *xfrm_calg_get_byname(char *name, int probe); |
986 | 1020 | ||
987 | struct crypto_tfm; | 1021 | struct hash_desc; |
988 | typedef void (icv_update_fn_t)(struct crypto_tfm *, struct scatterlist *, unsigned int); | 1022 | struct scatterlist; |
1023 | typedef int (icv_update_fn_t)(struct hash_desc *, struct scatterlist *, | ||
1024 | unsigned int); | ||
989 | 1025 | ||
990 | extern void skb_icv_walk(const struct sk_buff *skb, struct crypto_tfm *tfm, | 1026 | extern int skb_icv_walk(const struct sk_buff *skb, struct hash_desc *tfm, |
991 | int offset, int len, icv_update_fn_t icv_update); | 1027 | int offset, int len, icv_update_fn_t icv_update); |
992 | 1028 | ||
993 | static inline int xfrm_addr_cmp(xfrm_address_t *a, xfrm_address_t *b, | 1029 | static inline int xfrm_addr_cmp(xfrm_address_t *a, xfrm_address_t *b, |
994 | int family) | 1030 | int family) |
diff --git a/include/rdma/ib_addr.h b/include/rdma/ib_addr.h index 0ff67398928d..81b62307621d 100644 --- a/include/rdma/ib_addr.h +++ b/include/rdma/ib_addr.h | |||
@@ -40,7 +40,7 @@ struct rdma_dev_addr { | |||
40 | unsigned char src_dev_addr[MAX_ADDR_LEN]; | 40 | unsigned char src_dev_addr[MAX_ADDR_LEN]; |
41 | unsigned char dst_dev_addr[MAX_ADDR_LEN]; | 41 | unsigned char dst_dev_addr[MAX_ADDR_LEN]; |
42 | unsigned char broadcast[MAX_ADDR_LEN]; | 42 | unsigned char broadcast[MAX_ADDR_LEN]; |
43 | enum ib_node_type dev_type; | 43 | enum rdma_node_type dev_type; |
44 | }; | 44 | }; |
45 | 45 | ||
46 | /** | 46 | /** |
@@ -72,6 +72,9 @@ int rdma_resolve_ip(struct sockaddr *src_addr, struct sockaddr *dst_addr, | |||
72 | 72 | ||
73 | void rdma_addr_cancel(struct rdma_dev_addr *addr); | 73 | void rdma_addr_cancel(struct rdma_dev_addr *addr); |
74 | 74 | ||
75 | int rdma_copy_addr(struct rdma_dev_addr *dev_addr, struct net_device *dev, | ||
76 | const unsigned char *dst_dev_addr); | ||
77 | |||
75 | static inline int ip_addr_size(struct sockaddr *addr) | 78 | static inline int ip_addr_size(struct sockaddr *addr) |
76 | { | 79 | { |
77 | return addr->sa_family == AF_INET6 ? | 80 | return addr->sa_family == AF_INET6 ? |
@@ -113,4 +116,16 @@ static inline void ib_addr_set_dgid(struct rdma_dev_addr *dev_addr, | |||
113 | memcpy(dev_addr->dst_dev_addr + 4, gid, sizeof *gid); | 116 | memcpy(dev_addr->dst_dev_addr + 4, gid, sizeof *gid); |
114 | } | 117 | } |
115 | 118 | ||
119 | static inline void iw_addr_get_sgid(struct rdma_dev_addr *dev_addr, | ||
120 | union ib_gid *gid) | ||
121 | { | ||
122 | memcpy(gid, dev_addr->src_dev_addr, sizeof *gid); | ||
123 | } | ||
124 | |||
125 | static inline void iw_addr_get_dgid(struct rdma_dev_addr *dev_addr, | ||
126 | union ib_gid *gid) | ||
127 | { | ||
128 | memcpy(gid, dev_addr->dst_dev_addr, sizeof *gid); | ||
129 | } | ||
130 | |||
116 | #endif /* IB_ADDR_H */ | 131 | #endif /* IB_ADDR_H */ |
diff --git a/include/rdma/ib_sa.h b/include/rdma/ib_sa.h index c99e4420fd7e..97715b0c20b6 100644 --- a/include/rdma/ib_sa.h +++ b/include/rdma/ib_sa.h | |||
@@ -1,6 +1,7 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (c) 2004 Topspin Communications. All rights reserved. | 2 | * Copyright (c) 2004 Topspin Communications. All rights reserved. |
3 | * Copyright (c) 2005 Voltaire, Inc. All rights reserved. | 3 | * Copyright (c) 2005 Voltaire, Inc. All rights reserved. |
4 | * Copyright (c) 2006 Intel Corporation. All rights reserved. | ||
4 | * | 5 | * |
5 | * This software is available to you under a choice of one of two | 6 | * This software is available to you under a choice of one of two |
6 | * licenses. You may choose to be licensed under the terms of the GNU | 7 | * licenses. You may choose to be licensed under the terms of the GNU |
@@ -36,8 +37,11 @@ | |||
36 | #ifndef IB_SA_H | 37 | #ifndef IB_SA_H |
37 | #define IB_SA_H | 38 | #define IB_SA_H |
38 | 39 | ||
40 | #include <linux/completion.h> | ||
39 | #include <linux/compiler.h> | 41 | #include <linux/compiler.h> |
40 | 42 | ||
43 | #include <asm/atomic.h> | ||
44 | |||
41 | #include <rdma/ib_verbs.h> | 45 | #include <rdma/ib_verbs.h> |
42 | #include <rdma/ib_mad.h> | 46 | #include <rdma/ib_mad.h> |
43 | 47 | ||
@@ -79,8 +83,8 @@ enum { | |||
79 | }; | 83 | }; |
80 | 84 | ||
81 | enum ib_sa_selector { | 85 | enum ib_sa_selector { |
82 | IB_SA_GTE = 0, | 86 | IB_SA_GT = 0, |
83 | IB_SA_LTE = 1, | 87 | IB_SA_LT = 1, |
84 | IB_SA_EQ = 2, | 88 | IB_SA_EQ = 2, |
85 | /* | 89 | /* |
86 | * The meaning of "best" depends on the attribute: for | 90 | * The meaning of "best" depends on the attribute: for |
@@ -250,11 +254,28 @@ struct ib_sa_service_rec { | |||
250 | u64 data64[2]; | 254 | u64 data64[2]; |
251 | }; | 255 | }; |
252 | 256 | ||
257 | struct ib_sa_client { | ||
258 | atomic_t users; | ||
259 | struct completion comp; | ||
260 | }; | ||
261 | |||
262 | /** | ||
263 | * ib_sa_register_client - Register an SA client. | ||
264 | */ | ||
265 | void ib_sa_register_client(struct ib_sa_client *client); | ||
266 | |||
267 | /** | ||
268 | * ib_sa_unregister_client - Deregister an SA client. | ||
269 | * @client: Client object to deregister. | ||
270 | */ | ||
271 | void ib_sa_unregister_client(struct ib_sa_client *client); | ||
272 | |||
253 | struct ib_sa_query; | 273 | struct ib_sa_query; |
254 | 274 | ||
255 | void ib_sa_cancel_query(int id, struct ib_sa_query *query); | 275 | void ib_sa_cancel_query(int id, struct ib_sa_query *query); |
256 | 276 | ||
257 | int ib_sa_path_rec_get(struct ib_device *device, u8 port_num, | 277 | int ib_sa_path_rec_get(struct ib_sa_client *client, |
278 | struct ib_device *device, u8 port_num, | ||
258 | struct ib_sa_path_rec *rec, | 279 | struct ib_sa_path_rec *rec, |
259 | ib_sa_comp_mask comp_mask, | 280 | ib_sa_comp_mask comp_mask, |
260 | int timeout_ms, gfp_t gfp_mask, | 281 | int timeout_ms, gfp_t gfp_mask, |
@@ -264,7 +285,8 @@ int ib_sa_path_rec_get(struct ib_device *device, u8 port_num, | |||
264 | void *context, | 285 | void *context, |
265 | struct ib_sa_query **query); | 286 | struct ib_sa_query **query); |
266 | 287 | ||
267 | int ib_sa_mcmember_rec_query(struct ib_device *device, u8 port_num, | 288 | int ib_sa_mcmember_rec_query(struct ib_sa_client *client, |
289 | struct ib_device *device, u8 port_num, | ||
268 | u8 method, | 290 | u8 method, |
269 | struct ib_sa_mcmember_rec *rec, | 291 | struct ib_sa_mcmember_rec *rec, |
270 | ib_sa_comp_mask comp_mask, | 292 | ib_sa_comp_mask comp_mask, |
@@ -275,7 +297,8 @@ int ib_sa_mcmember_rec_query(struct ib_device *device, u8 port_num, | |||
275 | void *context, | 297 | void *context, |
276 | struct ib_sa_query **query); | 298 | struct ib_sa_query **query); |
277 | 299 | ||
278 | int ib_sa_service_rec_query(struct ib_device *device, u8 port_num, | 300 | int ib_sa_service_rec_query(struct ib_sa_client *client, |
301 | struct ib_device *device, u8 port_num, | ||
279 | u8 method, | 302 | u8 method, |
280 | struct ib_sa_service_rec *rec, | 303 | struct ib_sa_service_rec *rec, |
281 | ib_sa_comp_mask comp_mask, | 304 | ib_sa_comp_mask comp_mask, |
@@ -288,6 +311,7 @@ int ib_sa_service_rec_query(struct ib_device *device, u8 port_num, | |||
288 | 311 | ||
289 | /** | 312 | /** |
290 | * ib_sa_mcmember_rec_set - Start an MCMember set query | 313 | * ib_sa_mcmember_rec_set - Start an MCMember set query |
314 | * @client:SA client | ||
291 | * @device:device to send query on | 315 | * @device:device to send query on |
292 | * @port_num: port number to send query on | 316 | * @port_num: port number to send query on |
293 | * @rec:MCMember Record to send in query | 317 | * @rec:MCMember Record to send in query |
@@ -311,7 +335,8 @@ int ib_sa_service_rec_query(struct ib_device *device, u8 port_num, | |||
311 | * cancel the query. | 335 | * cancel the query. |
312 | */ | 336 | */ |
313 | static inline int | 337 | static inline int |
314 | ib_sa_mcmember_rec_set(struct ib_device *device, u8 port_num, | 338 | ib_sa_mcmember_rec_set(struct ib_sa_client *client, |
339 | struct ib_device *device, u8 port_num, | ||
315 | struct ib_sa_mcmember_rec *rec, | 340 | struct ib_sa_mcmember_rec *rec, |
316 | ib_sa_comp_mask comp_mask, | 341 | ib_sa_comp_mask comp_mask, |
317 | int timeout_ms, gfp_t gfp_mask, | 342 | int timeout_ms, gfp_t gfp_mask, |
@@ -321,7 +346,7 @@ ib_sa_mcmember_rec_set(struct ib_device *device, u8 port_num, | |||
321 | void *context, | 346 | void *context, |
322 | struct ib_sa_query **query) | 347 | struct ib_sa_query **query) |
323 | { | 348 | { |
324 | return ib_sa_mcmember_rec_query(device, port_num, | 349 | return ib_sa_mcmember_rec_query(client, device, port_num, |
325 | IB_MGMT_METHOD_SET, | 350 | IB_MGMT_METHOD_SET, |
326 | rec, comp_mask, | 351 | rec, comp_mask, |
327 | timeout_ms, gfp_mask, callback, | 352 | timeout_ms, gfp_mask, callback, |
@@ -330,6 +355,7 @@ ib_sa_mcmember_rec_set(struct ib_device *device, u8 port_num, | |||
330 | 355 | ||
331 | /** | 356 | /** |
332 | * ib_sa_mcmember_rec_delete - Start an MCMember delete query | 357 | * ib_sa_mcmember_rec_delete - Start an MCMember delete query |
358 | * @client:SA client | ||
333 | * @device:device to send query on | 359 | * @device:device to send query on |
334 | * @port_num: port number to send query on | 360 | * @port_num: port number to send query on |
335 | * @rec:MCMember Record to send in query | 361 | * @rec:MCMember Record to send in query |
@@ -353,7 +379,8 @@ ib_sa_mcmember_rec_set(struct ib_device *device, u8 port_num, | |||
353 | * cancel the query. | 379 | * cancel the query. |
354 | */ | 380 | */ |
355 | static inline int | 381 | static inline int |
356 | ib_sa_mcmember_rec_delete(struct ib_device *device, u8 port_num, | 382 | ib_sa_mcmember_rec_delete(struct ib_sa_client *client, |
383 | struct ib_device *device, u8 port_num, | ||
357 | struct ib_sa_mcmember_rec *rec, | 384 | struct ib_sa_mcmember_rec *rec, |
358 | ib_sa_comp_mask comp_mask, | 385 | ib_sa_comp_mask comp_mask, |
359 | int timeout_ms, gfp_t gfp_mask, | 386 | int timeout_ms, gfp_t gfp_mask, |
@@ -363,7 +390,7 @@ ib_sa_mcmember_rec_delete(struct ib_device *device, u8 port_num, | |||
363 | void *context, | 390 | void *context, |
364 | struct ib_sa_query **query) | 391 | struct ib_sa_query **query) |
365 | { | 392 | { |
366 | return ib_sa_mcmember_rec_query(device, port_num, | 393 | return ib_sa_mcmember_rec_query(client, device, port_num, |
367 | IB_SA_METHOD_DELETE, | 394 | IB_SA_METHOD_DELETE, |
368 | rec, comp_mask, | 395 | rec, comp_mask, |
369 | timeout_ms, gfp_mask, callback, | 396 | timeout_ms, gfp_mask, callback, |
diff --git a/include/rdma/ib_user_verbs.h b/include/rdma/ib_user_verbs.h index 7b5372010f4b..db1b814b62cc 100644 --- a/include/rdma/ib_user_verbs.h +++ b/include/rdma/ib_user_verbs.h | |||
@@ -275,6 +275,8 @@ struct ib_uverbs_resize_cq { | |||
275 | 275 | ||
276 | struct ib_uverbs_resize_cq_resp { | 276 | struct ib_uverbs_resize_cq_resp { |
277 | __u32 cqe; | 277 | __u32 cqe; |
278 | __u32 reserved; | ||
279 | __u64 driver_data[0]; | ||
278 | }; | 280 | }; |
279 | 281 | ||
280 | struct ib_uverbs_poll_cq { | 282 | struct ib_uverbs_poll_cq { |
diff --git a/include/rdma/ib_verbs.h b/include/rdma/ib_verbs.h index ee1f3a355666..8eacc3510993 100644 --- a/include/rdma/ib_verbs.h +++ b/include/rdma/ib_verbs.h | |||
@@ -56,12 +56,22 @@ union ib_gid { | |||
56 | } global; | 56 | } global; |
57 | }; | 57 | }; |
58 | 58 | ||
59 | enum ib_node_type { | 59 | enum rdma_node_type { |
60 | IB_NODE_CA = 1, | 60 | /* IB values map to NodeInfo:NodeType. */ |
61 | IB_NODE_SWITCH, | 61 | RDMA_NODE_IB_CA = 1, |
62 | IB_NODE_ROUTER | 62 | RDMA_NODE_IB_SWITCH, |
63 | RDMA_NODE_IB_ROUTER, | ||
64 | RDMA_NODE_RNIC | ||
63 | }; | 65 | }; |
64 | 66 | ||
67 | enum rdma_transport_type { | ||
68 | RDMA_TRANSPORT_IB, | ||
69 | RDMA_TRANSPORT_IWARP | ||
70 | }; | ||
71 | |||
72 | enum rdma_transport_type | ||
73 | rdma_node_get_transport(enum rdma_node_type node_type) __attribute_const__; | ||
74 | |||
65 | enum ib_device_cap_flags { | 75 | enum ib_device_cap_flags { |
66 | IB_DEVICE_RESIZE_MAX_WR = 1, | 76 | IB_DEVICE_RESIZE_MAX_WR = 1, |
67 | IB_DEVICE_BAD_PKEY_CNTR = (1<<1), | 77 | IB_DEVICE_BAD_PKEY_CNTR = (1<<1), |
@@ -78,6 +88,9 @@ enum ib_device_cap_flags { | |||
78 | IB_DEVICE_RC_RNR_NAK_GEN = (1<<12), | 88 | IB_DEVICE_RC_RNR_NAK_GEN = (1<<12), |
79 | IB_DEVICE_SRQ_RESIZE = (1<<13), | 89 | IB_DEVICE_SRQ_RESIZE = (1<<13), |
80 | IB_DEVICE_N_NOTIFY_CQ = (1<<14), | 90 | IB_DEVICE_N_NOTIFY_CQ = (1<<14), |
91 | IB_DEVICE_ZERO_STAG = (1<<15), | ||
92 | IB_DEVICE_SEND_W_INV = (1<<16), | ||
93 | IB_DEVICE_MEM_WINDOW = (1<<17) | ||
81 | }; | 94 | }; |
82 | 95 | ||
83 | enum ib_atomic_cap { | 96 | enum ib_atomic_cap { |
@@ -835,6 +848,8 @@ struct ib_cache { | |||
835 | u8 *lmc_cache; | 848 | u8 *lmc_cache; |
836 | }; | 849 | }; |
837 | 850 | ||
851 | struct iw_cm_verbs; | ||
852 | |||
838 | struct ib_device { | 853 | struct ib_device { |
839 | struct device *dma_device; | 854 | struct device *dma_device; |
840 | 855 | ||
@@ -851,6 +866,8 @@ struct ib_device { | |||
851 | 866 | ||
852 | u32 flags; | 867 | u32 flags; |
853 | 868 | ||
869 | struct iw_cm_verbs *iwcm; | ||
870 | |||
854 | int (*query_device)(struct ib_device *device, | 871 | int (*query_device)(struct ib_device *device, |
855 | struct ib_device_attr *device_attr); | 872 | struct ib_device_attr *device_attr); |
856 | int (*query_port)(struct ib_device *device, | 873 | int (*query_port)(struct ib_device *device, |
@@ -888,7 +905,8 @@ struct ib_device { | |||
888 | struct ib_udata *udata); | 905 | struct ib_udata *udata); |
889 | int (*modify_srq)(struct ib_srq *srq, | 906 | int (*modify_srq)(struct ib_srq *srq, |
890 | struct ib_srq_attr *srq_attr, | 907 | struct ib_srq_attr *srq_attr, |
891 | enum ib_srq_attr_mask srq_attr_mask); | 908 | enum ib_srq_attr_mask srq_attr_mask, |
909 | struct ib_udata *udata); | ||
892 | int (*query_srq)(struct ib_srq *srq, | 910 | int (*query_srq)(struct ib_srq *srq, |
893 | struct ib_srq_attr *srq_attr); | 911 | struct ib_srq_attr *srq_attr); |
894 | int (*destroy_srq)(struct ib_srq *srq); | 912 | int (*destroy_srq)(struct ib_srq *srq); |
@@ -900,7 +918,8 @@ struct ib_device { | |||
900 | struct ib_udata *udata); | 918 | struct ib_udata *udata); |
901 | int (*modify_qp)(struct ib_qp *qp, | 919 | int (*modify_qp)(struct ib_qp *qp, |
902 | struct ib_qp_attr *qp_attr, | 920 | struct ib_qp_attr *qp_attr, |
903 | int qp_attr_mask); | 921 | int qp_attr_mask, |
922 | struct ib_udata *udata); | ||
904 | int (*query_qp)(struct ib_qp *qp, | 923 | int (*query_qp)(struct ib_qp *qp, |
905 | struct ib_qp_attr *qp_attr, | 924 | struct ib_qp_attr *qp_attr, |
906 | int qp_attr_mask, | 925 | int qp_attr_mask, |
diff --git a/include/rdma/iw_cm.h b/include/rdma/iw_cm.h new file mode 100644 index 000000000000..aeefa9b740dc --- /dev/null +++ b/include/rdma/iw_cm.h | |||
@@ -0,0 +1,258 @@ | |||
1 | /* | ||
2 | * Copyright (c) 2005 Network Appliance, Inc. All rights reserved. | ||
3 | * Copyright (c) 2005 Open Grid Computing, Inc. All rights reserved. | ||
4 | * | ||
5 | * This software is available to you under a choice of one of two | ||
6 | * licenses. You may choose to be licensed under the terms of the GNU | ||
7 | * General Public License (GPL) Version 2, available from the file | ||
8 | * COPYING in the main directory of this source tree, or the | ||
9 | * OpenIB.org BSD license below: | ||
10 | * | ||
11 | * Redistribution and use in source and binary forms, with or | ||
12 | * without modification, are permitted provided that the following | ||
13 | * conditions are met: | ||
14 | * | ||
15 | * - Redistributions of source code must retain the above | ||
16 | * copyright notice, this list of conditions and the following | ||
17 | * disclaimer. | ||
18 | * | ||
19 | * - Redistributions in binary form must reproduce the above | ||
20 | * copyright notice, this list of conditions and the following | ||
21 | * disclaimer in the documentation and/or other materials | ||
22 | * provided with the distribution. | ||
23 | * | ||
24 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, | ||
25 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF | ||
26 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND | ||
27 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS | ||
28 | * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN | ||
29 | * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN | ||
30 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
31 | * SOFTWARE. | ||
32 | */ | ||
33 | #ifndef IW_CM_H | ||
34 | #define IW_CM_H | ||
35 | |||
36 | #include <linux/in.h> | ||
37 | #include <rdma/ib_cm.h> | ||
38 | |||
39 | struct iw_cm_id; | ||
40 | |||
41 | enum iw_cm_event_type { | ||
42 | IW_CM_EVENT_CONNECT_REQUEST = 1, /* connect request received */ | ||
43 | IW_CM_EVENT_CONNECT_REPLY, /* reply from active connect request */ | ||
44 | IW_CM_EVENT_ESTABLISHED, /* passive side accept successful */ | ||
45 | IW_CM_EVENT_DISCONNECT, /* orderly shutdown */ | ||
46 | IW_CM_EVENT_CLOSE /* close complete */ | ||
47 | }; | ||
48 | |||
49 | enum iw_cm_event_status { | ||
50 | IW_CM_EVENT_STATUS_OK = 0, /* request successful */ | ||
51 | IW_CM_EVENT_STATUS_ACCEPTED = 0, /* connect request accepted */ | ||
52 | IW_CM_EVENT_STATUS_REJECTED, /* connect request rejected */ | ||
53 | IW_CM_EVENT_STATUS_TIMEOUT, /* the operation timed out */ | ||
54 | IW_CM_EVENT_STATUS_RESET, /* reset from remote peer */ | ||
55 | IW_CM_EVENT_STATUS_EINVAL, /* asynchronous failure for bad parm */ | ||
56 | }; | ||
57 | |||
58 | struct iw_cm_event { | ||
59 | enum iw_cm_event_type event; | ||
60 | enum iw_cm_event_status status; | ||
61 | struct sockaddr_in local_addr; | ||
62 | struct sockaddr_in remote_addr; | ||
63 | void *private_data; | ||
64 | u8 private_data_len; | ||
65 | void* provider_data; | ||
66 | }; | ||
67 | |||
68 | /** | ||
69 | * iw_cm_handler - Function to be called by the IW CM when delivering events | ||
70 | * to the client. | ||
71 | * | ||
72 | * @cm_id: The IW CM identifier associated with the event. | ||
73 | * @event: Pointer to the event structure. | ||
74 | */ | ||
75 | typedef int (*iw_cm_handler)(struct iw_cm_id *cm_id, | ||
76 | struct iw_cm_event *event); | ||
77 | |||
78 | /** | ||
79 | * iw_event_handler - Function called by the provider when delivering provider | ||
80 | * events to the IW CM. Returns either 0 indicating the event was processed | ||
81 | * or -errno if the event could not be processed. | ||
82 | * | ||
83 | * @cm_id: The IW CM identifier associated with the event. | ||
84 | * @event: Pointer to the event structure. | ||
85 | */ | ||
86 | typedef int (*iw_event_handler)(struct iw_cm_id *cm_id, | ||
87 | struct iw_cm_event *event); | ||
88 | |||
89 | struct iw_cm_id { | ||
90 | iw_cm_handler cm_handler; /* client callback function */ | ||
91 | void *context; /* client cb context */ | ||
92 | struct ib_device *device; | ||
93 | struct sockaddr_in local_addr; | ||
94 | struct sockaddr_in remote_addr; | ||
95 | void *provider_data; /* provider private data */ | ||
96 | iw_event_handler event_handler; /* cb for provider | ||
97 | events */ | ||
98 | /* Used by provider to add and remove refs on IW cm_id */ | ||
99 | void (*add_ref)(struct iw_cm_id *); | ||
100 | void (*rem_ref)(struct iw_cm_id *); | ||
101 | }; | ||
102 | |||
103 | struct iw_cm_conn_param { | ||
104 | const void *private_data; | ||
105 | u16 private_data_len; | ||
106 | u32 ord; | ||
107 | u32 ird; | ||
108 | u32 qpn; | ||
109 | }; | ||
110 | |||
111 | struct iw_cm_verbs { | ||
112 | void (*add_ref)(struct ib_qp *qp); | ||
113 | |||
114 | void (*rem_ref)(struct ib_qp *qp); | ||
115 | |||
116 | struct ib_qp * (*get_qp)(struct ib_device *device, | ||
117 | int qpn); | ||
118 | |||
119 | int (*connect)(struct iw_cm_id *cm_id, | ||
120 | struct iw_cm_conn_param *conn_param); | ||
121 | |||
122 | int (*accept)(struct iw_cm_id *cm_id, | ||
123 | struct iw_cm_conn_param *conn_param); | ||
124 | |||
125 | int (*reject)(struct iw_cm_id *cm_id, | ||
126 | const void *pdata, u8 pdata_len); | ||
127 | |||
128 | int (*create_listen)(struct iw_cm_id *cm_id, | ||
129 | int backlog); | ||
130 | |||
131 | int (*destroy_listen)(struct iw_cm_id *cm_id); | ||
132 | }; | ||
133 | |||
134 | /** | ||
135 | * iw_create_cm_id - Create an IW CM identifier. | ||
136 | * | ||
137 | * @device: The IB device on which to create the IW CM identier. | ||
138 | * @event_handler: User callback invoked to report events associated with the | ||
139 | * returned IW CM identifier. | ||
140 | * @context: User specified context associated with the id. | ||
141 | */ | ||
142 | struct iw_cm_id *iw_create_cm_id(struct ib_device *device, | ||
143 | iw_cm_handler cm_handler, void *context); | ||
144 | |||
145 | /** | ||
146 | * iw_destroy_cm_id - Destroy an IW CM identifier. | ||
147 | * | ||
148 | * @cm_id: The previously created IW CM identifier to destroy. | ||
149 | * | ||
150 | * The client can assume that no events will be delivered for the CM ID after | ||
151 | * this function returns. | ||
152 | */ | ||
153 | void iw_destroy_cm_id(struct iw_cm_id *cm_id); | ||
154 | |||
155 | /** | ||
156 | * iw_cm_bind_qp - Unbind the specified IW CM identifier and QP | ||
157 | * | ||
158 | * @cm_id: The IW CM idenfier to unbind from the QP. | ||
159 | * @qp: The QP | ||
160 | * | ||
161 | * This is called by the provider when destroying the QP to ensure | ||
162 | * that any references held by the IWCM are released. It may also | ||
163 | * be called by the IWCM when destroying a CM_ID to that any | ||
164 | * references held by the provider are released. | ||
165 | */ | ||
166 | void iw_cm_unbind_qp(struct iw_cm_id *cm_id, struct ib_qp *qp); | ||
167 | |||
168 | /** | ||
169 | * iw_cm_get_qp - Return the ib_qp associated with a QPN | ||
170 | * | ||
171 | * @ib_device: The IB device | ||
172 | * @qpn: The queue pair number | ||
173 | */ | ||
174 | struct ib_qp *iw_cm_get_qp(struct ib_device *device, int qpn); | ||
175 | |||
176 | /** | ||
177 | * iw_cm_listen - Listen for incoming connection requests on the | ||
178 | * specified IW CM id. | ||
179 | * | ||
180 | * @cm_id: The IW CM identifier. | ||
181 | * @backlog: The maximum number of outstanding un-accepted inbound listen | ||
182 | * requests to queue. | ||
183 | * | ||
184 | * The source address and port number are specified in the IW CM identifier | ||
185 | * structure. | ||
186 | */ | ||
187 | int iw_cm_listen(struct iw_cm_id *cm_id, int backlog); | ||
188 | |||
189 | /** | ||
190 | * iw_cm_accept - Called to accept an incoming connect request. | ||
191 | * | ||
192 | * @cm_id: The IW CM identifier associated with the connection request. | ||
193 | * @iw_param: Pointer to a structure containing connection establishment | ||
194 | * parameters. | ||
195 | * | ||
196 | * The specified cm_id will have been provided in the event data for a | ||
197 | * CONNECT_REQUEST event. Subsequent events related to this connection will be | ||
198 | * delivered to the specified IW CM identifier prior and may occur prior to | ||
199 | * the return of this function. If this function returns a non-zero value, the | ||
200 | * client can assume that no events will be delivered to the specified IW CM | ||
201 | * identifier. | ||
202 | */ | ||
203 | int iw_cm_accept(struct iw_cm_id *cm_id, struct iw_cm_conn_param *iw_param); | ||
204 | |||
205 | /** | ||
206 | * iw_cm_reject - Reject an incoming connection request. | ||
207 | * | ||
208 | * @cm_id: Connection identifier associated with the request. | ||
209 | * @private_daa: Pointer to data to deliver to the remote peer as part of the | ||
210 | * reject message. | ||
211 | * @private_data_len: The number of bytes in the private_data parameter. | ||
212 | * | ||
213 | * The client can assume that no events will be delivered to the specified IW | ||
214 | * CM identifier following the return of this function. The private_data | ||
215 | * buffer is available for reuse when this function returns. | ||
216 | */ | ||
217 | int iw_cm_reject(struct iw_cm_id *cm_id, const void *private_data, | ||
218 | u8 private_data_len); | ||
219 | |||
220 | /** | ||
221 | * iw_cm_connect - Called to request a connection to a remote peer. | ||
222 | * | ||
223 | * @cm_id: The IW CM identifier for the connection. | ||
224 | * @iw_param: Pointer to a structure containing connection establishment | ||
225 | * parameters. | ||
226 | * | ||
227 | * Events may be delivered to the specified IW CM identifier prior to the | ||
228 | * return of this function. If this function returns a non-zero value, the | ||
229 | * client can assume that no events will be delivered to the specified IW CM | ||
230 | * identifier. | ||
231 | */ | ||
232 | int iw_cm_connect(struct iw_cm_id *cm_id, struct iw_cm_conn_param *iw_param); | ||
233 | |||
234 | /** | ||
235 | * iw_cm_disconnect - Close the specified connection. | ||
236 | * | ||
237 | * @cm_id: The IW CM identifier to close. | ||
238 | * @abrupt: If 0, the connection will be closed gracefully, otherwise, the | ||
239 | * connection will be reset. | ||
240 | * | ||
241 | * The IW CM identifier is still active until the IW_CM_EVENT_CLOSE event is | ||
242 | * delivered. | ||
243 | */ | ||
244 | int iw_cm_disconnect(struct iw_cm_id *cm_id, int abrupt); | ||
245 | |||
246 | /** | ||
247 | * iw_cm_init_qp_attr - Called to initialize the attributes of the QP | ||
248 | * associated with a IW CM identifier. | ||
249 | * | ||
250 | * @cm_id: The IW CM identifier associated with the QP | ||
251 | * @qp_attr: Pointer to the QP attributes structure. | ||
252 | * @qp_attr_mask: Pointer to a bit vector specifying which QP attributes are | ||
253 | * valid. | ||
254 | */ | ||
255 | int iw_cm_init_qp_attr(struct iw_cm_id *cm_id, struct ib_qp_attr *qp_attr, | ||
256 | int *qp_attr_mask); | ||
257 | |||
258 | #endif /* IW_CM_H */ | ||
diff --git a/include/rdma/rdma_cm.h b/include/rdma/rdma_cm.h index 402c63d7226b..deb5a0a4cee5 100644 --- a/include/rdma/rdma_cm.h +++ b/include/rdma/rdma_cm.h | |||
@@ -117,6 +117,14 @@ struct rdma_cm_id { | |||
117 | struct rdma_cm_id *rdma_create_id(rdma_cm_event_handler event_handler, | 117 | struct rdma_cm_id *rdma_create_id(rdma_cm_event_handler event_handler, |
118 | void *context, enum rdma_port_space ps); | 118 | void *context, enum rdma_port_space ps); |
119 | 119 | ||
120 | /** | ||
121 | * rdma_destroy_id - Destroys an RDMA identifier. | ||
122 | * | ||
123 | * @id: RDMA identifier. | ||
124 | * | ||
125 | * Note: calling this function has the effect of canceling in-flight | ||
126 | * asynchronous operations associated with the id. | ||
127 | */ | ||
120 | void rdma_destroy_id(struct rdma_cm_id *id); | 128 | void rdma_destroy_id(struct rdma_cm_id *id); |
121 | 129 | ||
122 | /** | 130 | /** |
@@ -237,6 +245,10 @@ int rdma_listen(struct rdma_cm_id *id, int backlog); | |||
237 | * Typically, this routine is only called by the listener to accept a connection | 245 | * Typically, this routine is only called by the listener to accept a connection |
238 | * request. It must also be called on the active side of a connection if the | 246 | * request. It must also be called on the active side of a connection if the |
239 | * user is performing their own QP transitions. | 247 | * user is performing their own QP transitions. |
248 | * | ||
249 | * In the case of error, a reject message is sent to the remote side and the | ||
250 | * state of the qp associated with the id is modified to error, such that any | ||
251 | * previously posted receive buffers would be flushed. | ||
240 | */ | 252 | */ |
241 | int rdma_accept(struct rdma_cm_id *id, struct rdma_conn_param *conn_param); | 253 | int rdma_accept(struct rdma_cm_id *id, struct rdma_conn_param *conn_param); |
242 | 254 | ||
diff --git a/include/scsi/libiscsi.h b/include/scsi/libiscsi.h index 41904f611d12..401192e56e50 100644 --- a/include/scsi/libiscsi.h +++ b/include/scsi/libiscsi.h | |||
@@ -102,6 +102,8 @@ struct iscsi_cmd_task { | |||
102 | uint32_t unsol_datasn; | 102 | uint32_t unsol_datasn; |
103 | int imm_count; /* imm-data (bytes) */ | 103 | int imm_count; /* imm-data (bytes) */ |
104 | int unsol_count; /* unsolicited (bytes)*/ | 104 | int unsol_count; /* unsolicited (bytes)*/ |
105 | /* offset in unsolicited stream (bytes); */ | ||
106 | int unsol_offset; | ||
105 | int data_count; /* remaining Data-Out */ | 107 | int data_count; /* remaining Data-Out */ |
106 | struct scsi_cmnd *sc; /* associated SCSI cmd*/ | 108 | struct scsi_cmnd *sc; /* associated SCSI cmd*/ |
107 | int total_length; | 109 | int total_length; |
@@ -110,6 +112,7 @@ struct iscsi_cmd_task { | |||
110 | 112 | ||
111 | /* state set/tested under session->lock */ | 113 | /* state set/tested under session->lock */ |
112 | int state; | 114 | int state; |
115 | atomic_t refcount; | ||
113 | struct list_head running; /* running cmd list */ | 116 | struct list_head running; /* running cmd list */ |
114 | void *dd_data; /* driver/transport data */ | 117 | void *dd_data; /* driver/transport data */ |
115 | }; | 118 | }; |
@@ -290,8 +293,7 @@ extern int iscsi_conn_get_param(struct iscsi_cls_conn *cls_conn, | |||
290 | extern int iscsi_check_assign_cmdsn(struct iscsi_session *, | 293 | extern int iscsi_check_assign_cmdsn(struct iscsi_session *, |
291 | struct iscsi_nopin *); | 294 | struct iscsi_nopin *); |
292 | extern void iscsi_prep_unsolicit_data_pdu(struct iscsi_cmd_task *, | 295 | extern void iscsi_prep_unsolicit_data_pdu(struct iscsi_cmd_task *, |
293 | struct iscsi_data *hdr, | 296 | struct iscsi_data *hdr); |
294 | int transport_data_cnt); | ||
295 | extern int iscsi_conn_send_pdu(struct iscsi_cls_conn *, struct iscsi_hdr *, | 297 | extern int iscsi_conn_send_pdu(struct iscsi_cls_conn *, struct iscsi_hdr *, |
296 | char *, uint32_t); | 298 | char *, uint32_t); |
297 | extern int iscsi_complete_pdu(struct iscsi_conn *, struct iscsi_hdr *, | 299 | extern int iscsi_complete_pdu(struct iscsi_conn *, struct iscsi_hdr *, |
diff --git a/include/scsi/libsas.h b/include/scsi/libsas.h new file mode 100644 index 000000000000..8e39982fc3db --- /dev/null +++ b/include/scsi/libsas.h | |||
@@ -0,0 +1,627 @@ | |||
1 | /* | ||
2 | * SAS host prototypes and structures header file | ||
3 | * | ||
4 | * Copyright (C) 2005 Adaptec, Inc. All rights reserved. | ||
5 | * Copyright (C) 2005 Luben Tuikov <luben_tuikov@adaptec.com> | ||
6 | * | ||
7 | * This file is licensed under GPLv2. | ||
8 | * | ||
9 | * This program is free software; you can redistribute it and/or | ||
10 | * modify it under the terms of the GNU General Public License as | ||
11 | * published by the Free Software Foundation; either version 2 of the | ||
12 | * License, or (at your option) any later version. | ||
13 | * | ||
14 | * This program is distributed in the hope that it will be useful, but | ||
15 | * WITHOUT ANY WARRANTY; without even the implied warranty of | ||
16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
17 | * General Public License for more details. | ||
18 | * | ||
19 | * You should have received a copy of the GNU General Public License | ||
20 | * along with this program; if not, write to the Free Software | ||
21 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 | ||
22 | * USA | ||
23 | * | ||
24 | */ | ||
25 | |||
26 | #ifndef _LIBSAS_H_ | ||
27 | #define _LIBSAS_H_ | ||
28 | |||
29 | |||
30 | #include <linux/timer.h> | ||
31 | #include <linux/pci.h> | ||
32 | #include <scsi/sas.h> | ||
33 | #include <linux/list.h> | ||
34 | #include <asm/semaphore.h> | ||
35 | #include <scsi/scsi_device.h> | ||
36 | #include <scsi/scsi_cmnd.h> | ||
37 | #include <scsi/scsi_transport_sas.h> | ||
38 | |||
39 | struct block_device; | ||
40 | |||
41 | enum sas_class { | ||
42 | SAS, | ||
43 | EXPANDER | ||
44 | }; | ||
45 | |||
46 | enum sas_phy_role { | ||
47 | PHY_ROLE_NONE = 0, | ||
48 | PHY_ROLE_TARGET = 0x40, | ||
49 | PHY_ROLE_INITIATOR = 0x80, | ||
50 | }; | ||
51 | |||
52 | enum sas_phy_type { | ||
53 | PHY_TYPE_PHYSICAL, | ||
54 | PHY_TYPE_VIRTUAL | ||
55 | }; | ||
56 | |||
57 | /* The events are mnemonically described in sas_dump.c | ||
58 | * so when updating/adding events here, please also | ||
59 | * update the other file too. | ||
60 | */ | ||
61 | enum ha_event { | ||
62 | HAE_RESET = 0U, | ||
63 | HA_NUM_EVENTS = 1, | ||
64 | }; | ||
65 | |||
66 | enum port_event { | ||
67 | PORTE_BYTES_DMAED = 0U, | ||
68 | PORTE_BROADCAST_RCVD = 1, | ||
69 | PORTE_LINK_RESET_ERR = 2, | ||
70 | PORTE_TIMER_EVENT = 3, | ||
71 | PORTE_HARD_RESET = 4, | ||
72 | PORT_NUM_EVENTS = 5, | ||
73 | }; | ||
74 | |||
75 | enum phy_event { | ||
76 | PHYE_LOSS_OF_SIGNAL = 0U, | ||
77 | PHYE_OOB_DONE = 1, | ||
78 | PHYE_OOB_ERROR = 2, | ||
79 | PHYE_SPINUP_HOLD = 3, /* hot plug SATA, no COMWAKE sent */ | ||
80 | PHY_NUM_EVENTS = 4, | ||
81 | }; | ||
82 | |||
83 | enum discover_event { | ||
84 | DISCE_DISCOVER_DOMAIN = 0U, | ||
85 | DISCE_REVALIDATE_DOMAIN = 1, | ||
86 | DISCE_PORT_GONE = 2, | ||
87 | DISC_NUM_EVENTS = 3, | ||
88 | }; | ||
89 | |||
90 | /* ---------- Expander Devices ---------- */ | ||
91 | |||
92 | #define ETASK 0xFA | ||
93 | |||
94 | #define to_dom_device(_obj) container_of(_obj, struct domain_device, dev_obj) | ||
95 | #define to_dev_attr(_attr) container_of(_attr, struct domain_dev_attribute,\ | ||
96 | attr) | ||
97 | |||
98 | enum routing_attribute { | ||
99 | DIRECT_ROUTING, | ||
100 | SUBTRACTIVE_ROUTING, | ||
101 | TABLE_ROUTING, | ||
102 | }; | ||
103 | |||
104 | enum ex_phy_state { | ||
105 | PHY_EMPTY, | ||
106 | PHY_VACANT, | ||
107 | PHY_NOT_PRESENT, | ||
108 | PHY_DEVICE_DISCOVERED | ||
109 | }; | ||
110 | |||
111 | struct ex_phy { | ||
112 | int phy_id; | ||
113 | |||
114 | enum ex_phy_state phy_state; | ||
115 | |||
116 | enum sas_dev_type attached_dev_type; | ||
117 | enum sas_linkrate linkrate; | ||
118 | |||
119 | u8 attached_sata_host:1; | ||
120 | u8 attached_sata_dev:1; | ||
121 | u8 attached_sata_ps:1; | ||
122 | |||
123 | enum sas_proto attached_tproto; | ||
124 | enum sas_proto attached_iproto; | ||
125 | |||
126 | u8 attached_sas_addr[SAS_ADDR_SIZE]; | ||
127 | u8 attached_phy_id; | ||
128 | |||
129 | u8 phy_change_count; | ||
130 | enum routing_attribute routing_attr; | ||
131 | u8 virtual:1; | ||
132 | |||
133 | int last_da_index; | ||
134 | |||
135 | struct sas_phy *phy; | ||
136 | struct sas_port *port; | ||
137 | }; | ||
138 | |||
139 | struct expander_device { | ||
140 | struct list_head children; | ||
141 | |||
142 | u16 ex_change_count; | ||
143 | u16 max_route_indexes; | ||
144 | u8 num_phys; | ||
145 | u8 configuring:1; | ||
146 | u8 conf_route_table:1; | ||
147 | u8 enclosure_logical_id[8]; | ||
148 | |||
149 | struct ex_phy *ex_phy; | ||
150 | struct sas_port *parent_port; | ||
151 | }; | ||
152 | |||
153 | /* ---------- SATA device ---------- */ | ||
154 | enum ata_command_set { | ||
155 | ATA_COMMAND_SET = 0, | ||
156 | ATAPI_COMMAND_SET = 1, | ||
157 | }; | ||
158 | |||
159 | struct sata_device { | ||
160 | enum ata_command_set command_set; | ||
161 | struct smp_resp rps_resp; /* report_phy_sata_resp */ | ||
162 | __le16 *identify_device; | ||
163 | __le16 *identify_packet_device; | ||
164 | |||
165 | u8 port_no; /* port number, if this is a PM (Port) */ | ||
166 | struct list_head children; /* PM Ports if this is a PM */ | ||
167 | }; | ||
168 | |||
169 | /* ---------- Domain device ---------- */ | ||
170 | struct domain_device { | ||
171 | enum sas_dev_type dev_type; | ||
172 | |||
173 | enum sas_linkrate linkrate; | ||
174 | enum sas_linkrate min_linkrate; | ||
175 | enum sas_linkrate max_linkrate; | ||
176 | |||
177 | int pathways; | ||
178 | |||
179 | struct domain_device *parent; | ||
180 | struct list_head siblings; /* devices on the same level */ | ||
181 | struct asd_sas_port *port; /* shortcut to root of the tree */ | ||
182 | |||
183 | struct list_head dev_list_node; | ||
184 | |||
185 | enum sas_proto iproto; | ||
186 | enum sas_proto tproto; | ||
187 | |||
188 | struct sas_rphy *rphy; | ||
189 | |||
190 | u8 sas_addr[SAS_ADDR_SIZE]; | ||
191 | u8 hashed_sas_addr[HASHED_SAS_ADDR_SIZE]; | ||
192 | |||
193 | u8 frame_rcvd[32]; | ||
194 | |||
195 | union { | ||
196 | struct expander_device ex_dev; | ||
197 | struct sata_device sata_dev; /* STP & directly attached */ | ||
198 | }; | ||
199 | |||
200 | void *lldd_dev; | ||
201 | }; | ||
202 | |||
203 | struct sas_discovery { | ||
204 | spinlock_t disc_event_lock; | ||
205 | struct work_struct disc_work[DISC_NUM_EVENTS]; | ||
206 | unsigned long pending; | ||
207 | u8 fanout_sas_addr[8]; | ||
208 | u8 eeds_a[8]; | ||
209 | u8 eeds_b[8]; | ||
210 | int max_level; | ||
211 | }; | ||
212 | |||
213 | |||
214 | /* The port struct is Class:RW, driver:RO */ | ||
215 | struct asd_sas_port { | ||
216 | /* private: */ | ||
217 | struct completion port_gone_completion; | ||
218 | |||
219 | struct sas_discovery disc; | ||
220 | struct domain_device *port_dev; | ||
221 | spinlock_t dev_list_lock; | ||
222 | struct list_head dev_list; | ||
223 | enum sas_linkrate linkrate; | ||
224 | |||
225 | struct sas_phy *phy; | ||
226 | struct work_struct work; | ||
227 | |||
228 | /* public: */ | ||
229 | int id; | ||
230 | |||
231 | enum sas_class class; | ||
232 | u8 sas_addr[SAS_ADDR_SIZE]; | ||
233 | u8 attached_sas_addr[SAS_ADDR_SIZE]; | ||
234 | enum sas_proto iproto; | ||
235 | enum sas_proto tproto; | ||
236 | |||
237 | enum sas_oob_mode oob_mode; | ||
238 | |||
239 | spinlock_t phy_list_lock; | ||
240 | struct list_head phy_list; | ||
241 | int num_phys; | ||
242 | u32 phy_mask; | ||
243 | |||
244 | struct sas_ha_struct *ha; | ||
245 | |||
246 | struct sas_port *port; | ||
247 | |||
248 | void *lldd_port; /* not touched by the sas class code */ | ||
249 | }; | ||
250 | |||
251 | /* The phy pretty much is controlled by the LLDD. | ||
252 | * The class only reads those fields. | ||
253 | */ | ||
254 | struct asd_sas_phy { | ||
255 | /* private: */ | ||
256 | /* protected by ha->event_lock */ | ||
257 | struct work_struct port_events[PORT_NUM_EVENTS]; | ||
258 | struct work_struct phy_events[PHY_NUM_EVENTS]; | ||
259 | |||
260 | unsigned long port_events_pending; | ||
261 | unsigned long phy_events_pending; | ||
262 | |||
263 | int error; | ||
264 | |||
265 | struct sas_phy *phy; | ||
266 | |||
267 | /* public: */ | ||
268 | /* The following are class:RO, driver:R/W */ | ||
269 | int enabled; /* must be set */ | ||
270 | |||
271 | int id; /* must be set */ | ||
272 | enum sas_class class; | ||
273 | enum sas_proto iproto; | ||
274 | enum sas_proto tproto; | ||
275 | |||
276 | enum sas_phy_type type; | ||
277 | enum sas_phy_role role; | ||
278 | enum sas_oob_mode oob_mode; | ||
279 | enum sas_linkrate linkrate; | ||
280 | |||
281 | u8 *sas_addr; /* must be set */ | ||
282 | u8 attached_sas_addr[SAS_ADDR_SIZE]; /* class:RO, driver: R/W */ | ||
283 | |||
284 | spinlock_t frame_rcvd_lock; | ||
285 | u8 *frame_rcvd; /* must be set */ | ||
286 | int frame_rcvd_size; | ||
287 | |||
288 | spinlock_t sas_prim_lock; | ||
289 | u32 sas_prim; | ||
290 | |||
291 | struct list_head port_phy_el; /* driver:RO */ | ||
292 | struct asd_sas_port *port; /* Class:RW, driver: RO */ | ||
293 | |||
294 | struct sas_ha_struct *ha; /* may be set; the class sets it anyway */ | ||
295 | |||
296 | void *lldd_phy; /* not touched by the sas_class_code */ | ||
297 | }; | ||
298 | |||
299 | struct scsi_core { | ||
300 | struct Scsi_Host *shost; | ||
301 | |||
302 | spinlock_t task_queue_lock; | ||
303 | struct list_head task_queue; | ||
304 | int task_queue_size; | ||
305 | |||
306 | struct semaphore queue_thread_sema; | ||
307 | int queue_thread_kill; | ||
308 | }; | ||
309 | |||
310 | struct sas_ha_struct { | ||
311 | /* private: */ | ||
312 | spinlock_t event_lock; | ||
313 | struct work_struct ha_events[HA_NUM_EVENTS]; | ||
314 | unsigned long pending; | ||
315 | |||
316 | struct scsi_core core; | ||
317 | |||
318 | /* public: */ | ||
319 | char *sas_ha_name; | ||
320 | struct pci_dev *pcidev; /* should be set */ | ||
321 | struct module *lldd_module; /* should be set */ | ||
322 | |||
323 | u8 *sas_addr; /* must be set */ | ||
324 | u8 hashed_sas_addr[HASHED_SAS_ADDR_SIZE]; | ||
325 | |||
326 | spinlock_t phy_port_lock; | ||
327 | struct asd_sas_phy **sas_phy; /* array of valid pointers, must be set */ | ||
328 | struct asd_sas_port **sas_port; /* array of valid pointers, must be set */ | ||
329 | int num_phys; /* must be set, gt 0, static */ | ||
330 | |||
331 | /* The class calls this to send a task for execution. */ | ||
332 | int lldd_max_execute_num; | ||
333 | int lldd_queue_size; | ||
334 | |||
335 | /* LLDD calls these to notify the class of an event. */ | ||
336 | void (*notify_ha_event)(struct sas_ha_struct *, enum ha_event); | ||
337 | void (*notify_port_event)(struct asd_sas_phy *, enum port_event); | ||
338 | void (*notify_phy_event)(struct asd_sas_phy *, enum phy_event); | ||
339 | |||
340 | void *lldd_ha; /* not touched by sas class code */ | ||
341 | }; | ||
342 | |||
343 | #define SHOST_TO_SAS_HA(_shost) (*(struct sas_ha_struct **)(_shost)->hostdata) | ||
344 | |||
345 | static inline struct domain_device * | ||
346 | starget_to_domain_dev(struct scsi_target *starget) { | ||
347 | return starget->hostdata; | ||
348 | } | ||
349 | |||
350 | static inline struct domain_device * | ||
351 | sdev_to_domain_dev(struct scsi_device *sdev) { | ||
352 | return starget_to_domain_dev(sdev->sdev_target); | ||
353 | } | ||
354 | |||
355 | static inline struct domain_device * | ||
356 | cmd_to_domain_dev(struct scsi_cmnd *cmd) | ||
357 | { | ||
358 | return sdev_to_domain_dev(cmd->device); | ||
359 | } | ||
360 | |||
361 | void sas_hash_addr(u8 *hashed, const u8 *sas_addr); | ||
362 | |||
363 | /* Before calling a notify event, LLDD should use this function | ||
364 | * when the link is severed (possibly from its tasklet). | ||
365 | * The idea is that the Class only reads those, while the LLDD, | ||
366 | * can R/W these (thus avoiding a race). | ||
367 | */ | ||
368 | static inline void sas_phy_disconnected(struct asd_sas_phy *phy) | ||
369 | { | ||
370 | phy->oob_mode = OOB_NOT_CONNECTED; | ||
371 | phy->linkrate = SAS_LINK_RATE_UNKNOWN; | ||
372 | } | ||
373 | |||
374 | /* ---------- Tasks ---------- */ | ||
375 | /* | ||
376 | service_response | SAS_TASK_COMPLETE | SAS_TASK_UNDELIVERED | | ||
377 | exec_status | | | | ||
378 | ---------------------+---------------------+-----------------------+ | ||
379 | SAM_... | X | | | ||
380 | DEV_NO_RESPONSE | X | X | | ||
381 | INTERRUPTED | X | | | ||
382 | QUEUE_FULL | | X | | ||
383 | DEVICE_UNKNOWN | | X | | ||
384 | SG_ERR | | X | | ||
385 | ---------------------+---------------------+-----------------------+ | ||
386 | */ | ||
387 | |||
388 | enum service_response { | ||
389 | SAS_TASK_COMPLETE, | ||
390 | SAS_TASK_UNDELIVERED = -1, | ||
391 | }; | ||
392 | |||
393 | enum exec_status { | ||
394 | SAM_GOOD = 0, | ||
395 | SAM_CHECK_COND = 2, | ||
396 | SAM_COND_MET = 4, | ||
397 | SAM_BUSY = 8, | ||
398 | SAM_INTERMEDIATE = 0x10, | ||
399 | SAM_IM_COND_MET = 0x12, | ||
400 | SAM_RESV_CONFLICT= 0x14, | ||
401 | SAM_TASK_SET_FULL= 0x28, | ||
402 | SAM_ACA_ACTIVE = 0x30, | ||
403 | SAM_TASK_ABORTED = 0x40, | ||
404 | |||
405 | SAS_DEV_NO_RESPONSE = 0x80, | ||
406 | SAS_DATA_UNDERRUN, | ||
407 | SAS_DATA_OVERRUN, | ||
408 | SAS_INTERRUPTED, | ||
409 | SAS_QUEUE_FULL, | ||
410 | SAS_DEVICE_UNKNOWN, | ||
411 | SAS_SG_ERR, | ||
412 | SAS_OPEN_REJECT, | ||
413 | SAS_OPEN_TO, | ||
414 | SAS_PROTO_RESPONSE, | ||
415 | SAS_PHY_DOWN, | ||
416 | SAS_NAK_R_ERR, | ||
417 | SAS_PENDING, | ||
418 | SAS_ABORTED_TASK, | ||
419 | }; | ||
420 | |||
421 | /* When a task finishes with a response, the LLDD examines the | ||
422 | * response: | ||
423 | * - For an ATA task task_status_struct::stat is set to | ||
424 | * SAS_PROTO_RESPONSE, and the task_status_struct::buf is set to the | ||
425 | * contents of struct ata_task_resp. | ||
426 | * - For SSP tasks, if no data is present or status/TMF response | ||
427 | * is valid, task_status_struct::stat is set. If data is present | ||
428 | * (SENSE data), the LLDD copies up to SAS_STATUS_BUF_SIZE, sets | ||
429 | * task_status_struct::buf_valid_size, and task_status_struct::stat is | ||
430 | * set to SAM_CHECK_COND. | ||
431 | * | ||
432 | * "buf" has format SCSI Sense for SSP task, or struct ata_task_resp | ||
433 | * for ATA task. | ||
434 | * | ||
435 | * "frame_len" is the total frame length, which could be more or less | ||
436 | * than actually copied. | ||
437 | * | ||
438 | * Tasks ending with response, always set the residual field. | ||
439 | */ | ||
440 | struct ata_task_resp { | ||
441 | u16 frame_len; | ||
442 | u8 ending_fis[24]; /* dev to host or data-in */ | ||
443 | u32 sstatus; | ||
444 | u32 serror; | ||
445 | u32 scontrol; | ||
446 | u32 sactive; | ||
447 | }; | ||
448 | |||
449 | #define SAS_STATUS_BUF_SIZE 96 | ||
450 | |||
451 | struct task_status_struct { | ||
452 | enum service_response resp; | ||
453 | enum exec_status stat; | ||
454 | int buf_valid_size; | ||
455 | |||
456 | u8 buf[SAS_STATUS_BUF_SIZE]; | ||
457 | |||
458 | u32 residual; | ||
459 | enum sas_open_rej_reason open_rej_reason; | ||
460 | }; | ||
461 | |||
462 | /* ATA and ATAPI task queuable to a SAS LLDD. | ||
463 | */ | ||
464 | struct sas_ata_task { | ||
465 | struct host_to_dev_fis fis; | ||
466 | u8 atapi_packet[16]; /* 0 if not ATAPI task */ | ||
467 | |||
468 | u8 retry_count; /* hardware retry, should be > 0 */ | ||
469 | |||
470 | u8 dma_xfer:1; /* PIO:0 or DMA:1 */ | ||
471 | u8 use_ncq:1; | ||
472 | u8 set_affil_pol:1; | ||
473 | u8 stp_affil_pol:1; | ||
474 | |||
475 | u8 device_control_reg_update:1; | ||
476 | }; | ||
477 | |||
478 | struct sas_smp_task { | ||
479 | struct scatterlist smp_req; | ||
480 | struct scatterlist smp_resp; | ||
481 | }; | ||
482 | |||
483 | enum task_attribute { | ||
484 | TASK_ATTR_SIMPLE = 0, | ||
485 | TASK_ATTR_HOQ = 1, | ||
486 | TASK_ATTR_ORDERED= 2, | ||
487 | TASK_ATTR_ACA = 4, | ||
488 | }; | ||
489 | |||
490 | struct sas_ssp_task { | ||
491 | u8 retry_count; /* hardware retry, should be > 0 */ | ||
492 | |||
493 | u8 LUN[8]; | ||
494 | u8 enable_first_burst:1; | ||
495 | enum task_attribute task_attr; | ||
496 | u8 task_prio; | ||
497 | u8 cdb[16]; | ||
498 | }; | ||
499 | |||
500 | struct sas_task { | ||
501 | struct domain_device *dev; | ||
502 | struct list_head list; | ||
503 | |||
504 | spinlock_t task_state_lock; | ||
505 | unsigned task_state_flags; | ||
506 | |||
507 | enum sas_proto task_proto; | ||
508 | |||
509 | /* Used by the discovery code. */ | ||
510 | struct timer_list timer; | ||
511 | struct completion completion; | ||
512 | |||
513 | union { | ||
514 | struct sas_ata_task ata_task; | ||
515 | struct sas_smp_task smp_task; | ||
516 | struct sas_ssp_task ssp_task; | ||
517 | }; | ||
518 | |||
519 | struct scatterlist *scatter; | ||
520 | int num_scatter; | ||
521 | u32 total_xfer_len; | ||
522 | u8 data_dir:2; /* Use PCI_DMA_... */ | ||
523 | |||
524 | struct task_status_struct task_status; | ||
525 | void (*task_done)(struct sas_task *); | ||
526 | |||
527 | void *lldd_task; /* for use by LLDDs */ | ||
528 | void *uldd_task; | ||
529 | }; | ||
530 | |||
531 | |||
532 | |||
533 | #define SAS_TASK_STATE_PENDING 1 | ||
534 | #define SAS_TASK_STATE_DONE 2 | ||
535 | #define SAS_TASK_STATE_ABORTED 4 | ||
536 | |||
537 | static inline struct sas_task *sas_alloc_task(unsigned long flags) | ||
538 | { | ||
539 | extern kmem_cache_t *sas_task_cache; | ||
540 | struct sas_task *task = kmem_cache_alloc(sas_task_cache, flags); | ||
541 | |||
542 | if (task) { | ||
543 | memset(task, 0, sizeof(*task)); | ||
544 | INIT_LIST_HEAD(&task->list); | ||
545 | spin_lock_init(&task->task_state_lock); | ||
546 | task->task_state_flags = SAS_TASK_STATE_PENDING; | ||
547 | init_timer(&task->timer); | ||
548 | init_completion(&task->completion); | ||
549 | } | ||
550 | |||
551 | return task; | ||
552 | } | ||
553 | |||
554 | static inline void sas_free_task(struct sas_task *task) | ||
555 | { | ||
556 | if (task) { | ||
557 | extern kmem_cache_t *sas_task_cache; | ||
558 | BUG_ON(!list_empty(&task->list)); | ||
559 | kmem_cache_free(sas_task_cache, task); | ||
560 | } | ||
561 | } | ||
562 | |||
563 | struct sas_domain_function_template { | ||
564 | /* The class calls these to notify the LLDD of an event. */ | ||
565 | void (*lldd_port_formed)(struct asd_sas_phy *); | ||
566 | void (*lldd_port_deformed)(struct asd_sas_phy *); | ||
567 | |||
568 | /* The class calls these when a device is found or gone. */ | ||
569 | int (*lldd_dev_found)(struct domain_device *); | ||
570 | void (*lldd_dev_gone)(struct domain_device *); | ||
571 | |||
572 | int (*lldd_execute_task)(struct sas_task *, int num, | ||
573 | unsigned long gfp_flags); | ||
574 | |||
575 | /* Task Management Functions. Must be called from process context. */ | ||
576 | int (*lldd_abort_task)(struct sas_task *); | ||
577 | int (*lldd_abort_task_set)(struct domain_device *, u8 *lun); | ||
578 | int (*lldd_clear_aca)(struct domain_device *, u8 *lun); | ||
579 | int (*lldd_clear_task_set)(struct domain_device *, u8 *lun); | ||
580 | int (*lldd_I_T_nexus_reset)(struct domain_device *); | ||
581 | int (*lldd_lu_reset)(struct domain_device *, u8 *lun); | ||
582 | int (*lldd_query_task)(struct sas_task *); | ||
583 | |||
584 | /* Port and Adapter management */ | ||
585 | int (*lldd_clear_nexus_port)(struct asd_sas_port *); | ||
586 | int (*lldd_clear_nexus_ha)(struct sas_ha_struct *); | ||
587 | |||
588 | /* Phy management */ | ||
589 | int (*lldd_control_phy)(struct asd_sas_phy *, enum phy_func, void *); | ||
590 | }; | ||
591 | |||
592 | extern int sas_register_ha(struct sas_ha_struct *); | ||
593 | extern int sas_unregister_ha(struct sas_ha_struct *); | ||
594 | |||
595 | extern int sas_queuecommand(struct scsi_cmnd *, | ||
596 | void (*scsi_done)(struct scsi_cmnd *)); | ||
597 | extern int sas_target_alloc(struct scsi_target *); | ||
598 | extern int sas_slave_alloc(struct scsi_device *); | ||
599 | extern int sas_slave_configure(struct scsi_device *); | ||
600 | extern void sas_slave_destroy(struct scsi_device *); | ||
601 | extern int sas_change_queue_depth(struct scsi_device *, int new_depth); | ||
602 | extern int sas_change_queue_type(struct scsi_device *, int qt); | ||
603 | extern int sas_bios_param(struct scsi_device *, | ||
604 | struct block_device *, | ||
605 | sector_t capacity, int *hsc); | ||
606 | extern struct scsi_transport_template * | ||
607 | sas_domain_attach_transport(struct sas_domain_function_template *); | ||
608 | extern void sas_domain_release_transport(struct scsi_transport_template *); | ||
609 | |||
610 | int sas_discover_root_expander(struct domain_device *); | ||
611 | |||
612 | void sas_init_ex_attr(void); | ||
613 | |||
614 | int sas_ex_revalidate_domain(struct domain_device *); | ||
615 | |||
616 | void sas_unregister_domain_devices(struct asd_sas_port *port); | ||
617 | void sas_init_disc(struct sas_discovery *disc, struct asd_sas_port *); | ||
618 | int sas_discover_event(struct asd_sas_port *, enum discover_event ev); | ||
619 | |||
620 | int sas_discover_sata(struct domain_device *); | ||
621 | int sas_discover_end_dev(struct domain_device *); | ||
622 | |||
623 | void sas_unregister_dev(struct domain_device *); | ||
624 | |||
625 | void sas_init_dev(struct domain_device *); | ||
626 | |||
627 | #endif /* _SASLIB_H_ */ | ||
diff --git a/include/scsi/sas.h b/include/scsi/sas.h new file mode 100644 index 000000000000..2f4b6afa34fc --- /dev/null +++ b/include/scsi/sas.h | |||
@@ -0,0 +1,631 @@ | |||
1 | /* | ||
2 | * SAS structures and definitions header file | ||
3 | * | ||
4 | * Copyright (C) 2005 Adaptec, Inc. All rights reserved. | ||
5 | * Copyright (C) 2005 Luben Tuikov <luben_tuikov@adaptec.com> | ||
6 | * | ||
7 | * This file is licensed under GPLv2. | ||
8 | * | ||
9 | * This program is free software; you can redistribute it and/or | ||
10 | * modify it under the terms of the GNU General Public License as | ||
11 | * published by the Free Software Foundation; either version 2 of the | ||
12 | * License, or (at your option) any later version. | ||
13 | * | ||
14 | * This program is distributed in the hope that it will be useful, but | ||
15 | * WITHOUT ANY WARRANTY; without even the implied warranty of | ||
16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
17 | * General Public License for more details. | ||
18 | * | ||
19 | * You should have received a copy of the GNU General Public License | ||
20 | * along with this program; if not, write to the Free Software | ||
21 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 | ||
22 | * USA | ||
23 | * | ||
24 | */ | ||
25 | |||
26 | #ifndef _SAS_H_ | ||
27 | #define _SAS_H_ | ||
28 | |||
29 | #include <linux/types.h> | ||
30 | #include <asm/byteorder.h> | ||
31 | |||
32 | #define SAS_ADDR_SIZE 8 | ||
33 | #define HASHED_SAS_ADDR_SIZE 3 | ||
34 | #define SAS_ADDR(_sa) ((unsigned long long) be64_to_cpu(*(__be64 *)(_sa))) | ||
35 | |||
36 | #define SMP_REQUEST 0x40 | ||
37 | #define SMP_RESPONSE 0x41 | ||
38 | |||
39 | #define SSP_DATA 0x01 | ||
40 | #define SSP_XFER_RDY 0x05 | ||
41 | #define SSP_COMMAND 0x06 | ||
42 | #define SSP_RESPONSE 0x07 | ||
43 | #define SSP_TASK 0x16 | ||
44 | |||
45 | #define SMP_REPORT_GENERAL 0x00 | ||
46 | #define SMP_REPORT_MANUF_INFO 0x01 | ||
47 | #define SMP_READ_GPIO_REG 0x02 | ||
48 | #define SMP_DISCOVER 0x10 | ||
49 | #define SMP_REPORT_PHY_ERR_LOG 0x11 | ||
50 | #define SMP_REPORT_PHY_SATA 0x12 | ||
51 | #define SMP_REPORT_ROUTE_INFO 0x13 | ||
52 | #define SMP_WRITE_GPIO_REG 0x82 | ||
53 | #define SMP_CONF_ROUTE_INFO 0x90 | ||
54 | #define SMP_PHY_CONTROL 0x91 | ||
55 | #define SMP_PHY_TEST_FUNCTION 0x92 | ||
56 | |||
57 | #define SMP_RESP_FUNC_ACC 0x00 | ||
58 | #define SMP_RESP_FUNC_UNK 0x01 | ||
59 | #define SMP_RESP_FUNC_FAILED 0x02 | ||
60 | #define SMP_RESP_INV_FRM_LEN 0x03 | ||
61 | #define SMP_RESP_NO_PHY 0x10 | ||
62 | #define SMP_RESP_NO_INDEX 0x11 | ||
63 | #define SMP_RESP_PHY_NO_SATA 0x12 | ||
64 | #define SMP_RESP_PHY_UNK_OP 0x13 | ||
65 | #define SMP_RESP_PHY_UNK_TESTF 0x14 | ||
66 | #define SMP_RESP_PHY_TEST_INPROG 0x15 | ||
67 | #define SMP_RESP_PHY_VACANT 0x16 | ||
68 | |||
69 | /* SAM TMFs */ | ||
70 | #define TMF_ABORT_TASK 0x01 | ||
71 | #define TMF_ABORT_TASK_SET 0x02 | ||
72 | #define TMF_CLEAR_TASK_SET 0x04 | ||
73 | #define TMF_LU_RESET 0x08 | ||
74 | #define TMF_CLEAR_ACA 0x40 | ||
75 | #define TMF_QUERY_TASK 0x80 | ||
76 | |||
77 | /* SAS TMF responses */ | ||
78 | #define TMF_RESP_FUNC_COMPLETE 0x00 | ||
79 | #define TMF_RESP_INVALID_FRAME 0x02 | ||
80 | #define TMF_RESP_FUNC_ESUPP 0x04 | ||
81 | #define TMF_RESP_FUNC_FAILED 0x05 | ||
82 | #define TMF_RESP_FUNC_SUCC 0x08 | ||
83 | #define TMF_RESP_NO_LUN 0x09 | ||
84 | #define TMF_RESP_OVERLAPPED_TAG 0x0A | ||
85 | |||
86 | enum sas_oob_mode { | ||
87 | OOB_NOT_CONNECTED, | ||
88 | SATA_OOB_MODE, | ||
89 | SAS_OOB_MODE | ||
90 | }; | ||
91 | |||
92 | /* See sas_discover.c if you plan on changing these. | ||
93 | */ | ||
94 | enum sas_dev_type { | ||
95 | NO_DEVICE = 0, /* protocol */ | ||
96 | SAS_END_DEV = 1, /* protocol */ | ||
97 | EDGE_DEV = 2, /* protocol */ | ||
98 | FANOUT_DEV = 3, /* protocol */ | ||
99 | SAS_HA = 4, | ||
100 | SATA_DEV = 5, | ||
101 | SATA_PM = 7, | ||
102 | SATA_PM_PORT= 8, | ||
103 | }; | ||
104 | |||
105 | /* Partly from IDENTIFY address frame. */ | ||
106 | enum sas_proto { | ||
107 | SATA_PROTO = 1, | ||
108 | SAS_PROTO_SMP = 2, /* protocol */ | ||
109 | SAS_PROTO_STP = 4, /* protocol */ | ||
110 | SAS_PROTO_SSP = 8, /* protocol */ | ||
111 | SAS_PROTO_ALL = 0xE, | ||
112 | }; | ||
113 | |||
114 | /* From the spec; local phys only */ | ||
115 | enum phy_func { | ||
116 | PHY_FUNC_NOP, | ||
117 | PHY_FUNC_LINK_RESET, /* Enables the phy */ | ||
118 | PHY_FUNC_HARD_RESET, | ||
119 | PHY_FUNC_DISABLE, | ||
120 | PHY_FUNC_CLEAR_ERROR_LOG = 5, | ||
121 | PHY_FUNC_CLEAR_AFFIL, | ||
122 | PHY_FUNC_TX_SATA_PS_SIGNAL, | ||
123 | PHY_FUNC_RELEASE_SPINUP_HOLD = 0x10, /* LOCAL PORT ONLY! */ | ||
124 | PHY_FUNC_SET_LINK_RATE, | ||
125 | }; | ||
126 | |||
127 | /* SAS LLDD would need to report only _very_few_ of those, like BROADCAST. | ||
128 | * Most of those are here for completeness. | ||
129 | */ | ||
130 | enum sas_prim { | ||
131 | SAS_PRIM_AIP_NORMAL = 1, | ||
132 | SAS_PRIM_AIP_R0 = 2, | ||
133 | SAS_PRIM_AIP_R1 = 3, | ||
134 | SAS_PRIM_AIP_R2 = 4, | ||
135 | SAS_PRIM_AIP_WC = 5, | ||
136 | SAS_PRIM_AIP_WD = 6, | ||
137 | SAS_PRIM_AIP_WP = 7, | ||
138 | SAS_PRIM_AIP_RWP = 8, | ||
139 | |||
140 | SAS_PRIM_BC_CH = 9, | ||
141 | SAS_PRIM_BC_RCH0 = 10, | ||
142 | SAS_PRIM_BC_RCH1 = 11, | ||
143 | SAS_PRIM_BC_R0 = 12, | ||
144 | SAS_PRIM_BC_R1 = 13, | ||
145 | SAS_PRIM_BC_R2 = 14, | ||
146 | SAS_PRIM_BC_R3 = 15, | ||
147 | SAS_PRIM_BC_R4 = 16, | ||
148 | |||
149 | SAS_PRIM_NOTIFY_ENSP= 17, | ||
150 | SAS_PRIM_NOTIFY_R0 = 18, | ||
151 | SAS_PRIM_NOTIFY_R1 = 19, | ||
152 | SAS_PRIM_NOTIFY_R2 = 20, | ||
153 | |||
154 | SAS_PRIM_CLOSE_CLAF = 21, | ||
155 | SAS_PRIM_CLOSE_NORM = 22, | ||
156 | SAS_PRIM_CLOSE_R0 = 23, | ||
157 | SAS_PRIM_CLOSE_R1 = 24, | ||
158 | |||
159 | SAS_PRIM_OPEN_RTRY = 25, | ||
160 | SAS_PRIM_OPEN_RJCT = 26, | ||
161 | SAS_PRIM_OPEN_ACPT = 27, | ||
162 | |||
163 | SAS_PRIM_DONE = 28, | ||
164 | SAS_PRIM_BREAK = 29, | ||
165 | |||
166 | SATA_PRIM_DMAT = 33, | ||
167 | SATA_PRIM_PMNAK = 34, | ||
168 | SATA_PRIM_PMACK = 35, | ||
169 | SATA_PRIM_PMREQ_S = 36, | ||
170 | SATA_PRIM_PMREQ_P = 37, | ||
171 | SATA_SATA_R_ERR = 38, | ||
172 | }; | ||
173 | |||
174 | enum sas_open_rej_reason { | ||
175 | /* Abandon open */ | ||
176 | SAS_OREJ_UNKNOWN = 0, | ||
177 | SAS_OREJ_BAD_DEST = 1, | ||
178 | SAS_OREJ_CONN_RATE = 2, | ||
179 | SAS_OREJ_EPROTO = 3, | ||
180 | SAS_OREJ_RESV_AB0 = 4, | ||
181 | SAS_OREJ_RESV_AB1 = 5, | ||
182 | SAS_OREJ_RESV_AB2 = 6, | ||
183 | SAS_OREJ_RESV_AB3 = 7, | ||
184 | SAS_OREJ_WRONG_DEST= 8, | ||
185 | SAS_OREJ_STP_NORES = 9, | ||
186 | |||
187 | /* Retry open */ | ||
188 | SAS_OREJ_NO_DEST = 10, | ||
189 | SAS_OREJ_PATH_BLOCKED = 11, | ||
190 | SAS_OREJ_RSVD_CONT0 = 12, | ||
191 | SAS_OREJ_RSVD_CONT1 = 13, | ||
192 | SAS_OREJ_RSVD_INIT0 = 14, | ||
193 | SAS_OREJ_RSVD_INIT1 = 15, | ||
194 | SAS_OREJ_RSVD_STOP0 = 16, | ||
195 | SAS_OREJ_RSVD_STOP1 = 17, | ||
196 | SAS_OREJ_RSVD_RETRY = 18, | ||
197 | }; | ||
198 | |||
199 | struct dev_to_host_fis { | ||
200 | u8 fis_type; /* 0x34 */ | ||
201 | u8 flags; | ||
202 | u8 status; | ||
203 | u8 error; | ||
204 | |||
205 | u8 lbal; | ||
206 | union { u8 lbam; u8 byte_count_low; }; | ||
207 | union { u8 lbah; u8 byte_count_high; }; | ||
208 | u8 device; | ||
209 | |||
210 | u8 lbal_exp; | ||
211 | u8 lbam_exp; | ||
212 | u8 lbah_exp; | ||
213 | u8 _r_a; | ||
214 | |||
215 | union { u8 sector_count; u8 interrupt_reason; }; | ||
216 | u8 sector_count_exp; | ||
217 | u8 _r_b; | ||
218 | u8 _r_c; | ||
219 | |||
220 | u32 _r_d; | ||
221 | } __attribute__ ((packed)); | ||
222 | |||
223 | struct host_to_dev_fis { | ||
224 | u8 fis_type; /* 0x27 */ | ||
225 | u8 flags; | ||
226 | u8 command; | ||
227 | u8 features; | ||
228 | |||
229 | u8 lbal; | ||
230 | union { u8 lbam; u8 byte_count_low; }; | ||
231 | union { u8 lbah; u8 byte_count_high; }; | ||
232 | u8 device; | ||
233 | |||
234 | u8 lbal_exp; | ||
235 | u8 lbam_exp; | ||
236 | u8 lbah_exp; | ||
237 | u8 features_exp; | ||
238 | |||
239 | union { u8 sector_count; u8 interrupt_reason; }; | ||
240 | u8 sector_count_exp; | ||
241 | u8 _r_a; | ||
242 | u8 control; | ||
243 | |||
244 | u32 _r_b; | ||
245 | } __attribute__ ((packed)); | ||
246 | |||
247 | /* Prefer to have code clarity over header file clarity. | ||
248 | */ | ||
249 | #ifdef __LITTLE_ENDIAN_BITFIELD | ||
250 | struct sas_identify_frame { | ||
251 | /* Byte 0 */ | ||
252 | u8 frame_type:4; | ||
253 | u8 dev_type:3; | ||
254 | u8 _un0:1; | ||
255 | |||
256 | /* Byte 1 */ | ||
257 | u8 _un1; | ||
258 | |||
259 | /* Byte 2 */ | ||
260 | union { | ||
261 | struct { | ||
262 | u8 _un20:1; | ||
263 | u8 smp_iport:1; | ||
264 | u8 stp_iport:1; | ||
265 | u8 ssp_iport:1; | ||
266 | u8 _un247:4; | ||
267 | }; | ||
268 | u8 initiator_bits; | ||
269 | }; | ||
270 | |||
271 | /* Byte 3 */ | ||
272 | union { | ||
273 | struct { | ||
274 | u8 _un30:1; | ||
275 | u8 smp_tport:1; | ||
276 | u8 stp_tport:1; | ||
277 | u8 ssp_tport:1; | ||
278 | u8 _un347:4; | ||
279 | }; | ||
280 | u8 target_bits; | ||
281 | }; | ||
282 | |||
283 | /* Byte 4 - 11 */ | ||
284 | u8 _un4_11[8]; | ||
285 | |||
286 | /* Byte 12 - 19 */ | ||
287 | u8 sas_addr[SAS_ADDR_SIZE]; | ||
288 | |||
289 | /* Byte 20 */ | ||
290 | u8 phy_id; | ||
291 | |||
292 | u8 _un21_27[7]; | ||
293 | |||
294 | __be32 crc; | ||
295 | } __attribute__ ((packed)); | ||
296 | |||
297 | struct ssp_frame_hdr { | ||
298 | u8 frame_type; | ||
299 | u8 hashed_dest_addr[HASHED_SAS_ADDR_SIZE]; | ||
300 | u8 _r_a; | ||
301 | u8 hashed_src_addr[HASHED_SAS_ADDR_SIZE]; | ||
302 | __be16 _r_b; | ||
303 | |||
304 | u8 changing_data_ptr:1; | ||
305 | u8 retransmit:1; | ||
306 | u8 retry_data_frames:1; | ||
307 | u8 _r_c:5; | ||
308 | |||
309 | u8 num_fill_bytes:2; | ||
310 | u8 _r_d:6; | ||
311 | |||
312 | u32 _r_e; | ||
313 | __be16 tag; | ||
314 | __be16 tptt; | ||
315 | __be32 data_offs; | ||
316 | } __attribute__ ((packed)); | ||
317 | |||
318 | struct ssp_response_iu { | ||
319 | u8 _r_a[10]; | ||
320 | |||
321 | u8 datapres:2; | ||
322 | u8 _r_b:6; | ||
323 | |||
324 | u8 status; | ||
325 | |||
326 | u32 _r_c; | ||
327 | |||
328 | __be32 sense_data_len; | ||
329 | __be32 response_data_len; | ||
330 | |||
331 | u8 resp_data[0]; | ||
332 | u8 sense_data[0]; | ||
333 | } __attribute__ ((packed)); | ||
334 | |||
335 | /* ---------- SMP ---------- */ | ||
336 | |||
337 | struct report_general_resp { | ||
338 | __be16 change_count; | ||
339 | __be16 route_indexes; | ||
340 | u8 _r_a; | ||
341 | u8 num_phys; | ||
342 | |||
343 | u8 conf_route_table:1; | ||
344 | u8 configuring:1; | ||
345 | u8 _r_b:6; | ||
346 | |||
347 | u8 _r_c; | ||
348 | |||
349 | u8 enclosure_logical_id[8]; | ||
350 | |||
351 | u8 _r_d[12]; | ||
352 | } __attribute__ ((packed)); | ||
353 | |||
354 | struct discover_resp { | ||
355 | u8 _r_a[5]; | ||
356 | |||
357 | u8 phy_id; | ||
358 | __be16 _r_b; | ||
359 | |||
360 | u8 _r_c:4; | ||
361 | u8 attached_dev_type:3; | ||
362 | u8 _r_d:1; | ||
363 | |||
364 | u8 linkrate:4; | ||
365 | u8 _r_e:4; | ||
366 | |||
367 | u8 attached_sata_host:1; | ||
368 | u8 iproto:3; | ||
369 | u8 _r_f:4; | ||
370 | |||
371 | u8 attached_sata_dev:1; | ||
372 | u8 tproto:3; | ||
373 | u8 _r_g:3; | ||
374 | u8 attached_sata_ps:1; | ||
375 | |||
376 | u8 sas_addr[8]; | ||
377 | u8 attached_sas_addr[8]; | ||
378 | u8 attached_phy_id; | ||
379 | |||
380 | u8 _r_h[7]; | ||
381 | |||
382 | u8 hmin_linkrate:4; | ||
383 | u8 pmin_linkrate:4; | ||
384 | u8 hmax_linkrate:4; | ||
385 | u8 pmax_linkrate:4; | ||
386 | |||
387 | u8 change_count; | ||
388 | |||
389 | u8 pptv:4; | ||
390 | u8 _r_i:3; | ||
391 | u8 virtual:1; | ||
392 | |||
393 | u8 routing_attr:4; | ||
394 | u8 _r_j:4; | ||
395 | |||
396 | u8 conn_type; | ||
397 | u8 conn_el_index; | ||
398 | u8 conn_phy_link; | ||
399 | |||
400 | u8 _r_k[8]; | ||
401 | } __attribute__ ((packed)); | ||
402 | |||
403 | struct report_phy_sata_resp { | ||
404 | u8 _r_a[5]; | ||
405 | |||
406 | u8 phy_id; | ||
407 | u8 _r_b; | ||
408 | |||
409 | u8 affil_valid:1; | ||
410 | u8 affil_supp:1; | ||
411 | u8 _r_c:6; | ||
412 | |||
413 | u32 _r_d; | ||
414 | |||
415 | u8 stp_sas_addr[8]; | ||
416 | |||
417 | struct dev_to_host_fis fis; | ||
418 | |||
419 | u32 _r_e; | ||
420 | |||
421 | u8 affil_stp_ini_addr[8]; | ||
422 | |||
423 | __be32 crc; | ||
424 | } __attribute__ ((packed)); | ||
425 | |||
426 | struct smp_resp { | ||
427 | u8 frame_type; | ||
428 | u8 function; | ||
429 | u8 result; | ||
430 | u8 reserved; | ||
431 | union { | ||
432 | struct report_general_resp rg; | ||
433 | struct discover_resp disc; | ||
434 | struct report_phy_sata_resp rps; | ||
435 | }; | ||
436 | } __attribute__ ((packed)); | ||
437 | |||
438 | #elif defined(__BIG_ENDIAN_BITFIELD) | ||
439 | struct sas_identify_frame { | ||
440 | /* Byte 0 */ | ||
441 | u8 _un0:1; | ||
442 | u8 dev_type:3; | ||
443 | u8 frame_type:4; | ||
444 | |||
445 | /* Byte 1 */ | ||
446 | u8 _un1; | ||
447 | |||
448 | /* Byte 2 */ | ||
449 | union { | ||
450 | struct { | ||
451 | u8 _un247:4; | ||
452 | u8 ssp_iport:1; | ||
453 | u8 stp_iport:1; | ||
454 | u8 smp_iport:1; | ||
455 | u8 _un20:1; | ||
456 | }; | ||
457 | u8 initiator_bits; | ||
458 | }; | ||
459 | |||
460 | /* Byte 3 */ | ||
461 | union { | ||
462 | struct { | ||
463 | u8 _un347:4; | ||
464 | u8 ssp_tport:1; | ||
465 | u8 stp_tport:1; | ||
466 | u8 smp_tport:1; | ||
467 | u8 _un30:1; | ||
468 | }; | ||
469 | u8 target_bits; | ||
470 | }; | ||
471 | |||
472 | /* Byte 4 - 11 */ | ||
473 | u8 _un4_11[8]; | ||
474 | |||
475 | /* Byte 12 - 19 */ | ||
476 | u8 sas_addr[SAS_ADDR_SIZE]; | ||
477 | |||
478 | /* Byte 20 */ | ||
479 | u8 phy_id; | ||
480 | |||
481 | u8 _un21_27[7]; | ||
482 | |||
483 | __be32 crc; | ||
484 | } __attribute__ ((packed)); | ||
485 | |||
486 | struct ssp_frame_hdr { | ||
487 | u8 frame_type; | ||
488 | u8 hashed_dest_addr[HASHED_SAS_ADDR_SIZE]; | ||
489 | u8 _r_a; | ||
490 | u8 hashed_src_addr[HASHED_SAS_ADDR_SIZE]; | ||
491 | __be16 _r_b; | ||
492 | |||
493 | u8 _r_c:5; | ||
494 | u8 retry_data_frames:1; | ||
495 | u8 retransmit:1; | ||
496 | u8 changing_data_ptr:1; | ||
497 | |||
498 | u8 _r_d:6; | ||
499 | u8 num_fill_bytes:2; | ||
500 | |||
501 | u32 _r_e; | ||
502 | __be16 tag; | ||
503 | __be16 tptt; | ||
504 | __be32 data_offs; | ||
505 | } __attribute__ ((packed)); | ||
506 | |||
507 | struct ssp_response_iu { | ||
508 | u8 _r_a[10]; | ||
509 | |||
510 | u8 _r_b:6; | ||
511 | u8 datapres:2; | ||
512 | |||
513 | u8 status; | ||
514 | |||
515 | u32 _r_c; | ||
516 | |||
517 | __be32 sense_data_len; | ||
518 | __be32 response_data_len; | ||
519 | |||
520 | u8 resp_data[0]; | ||
521 | u8 sense_data[0]; | ||
522 | } __attribute__ ((packed)); | ||
523 | |||
524 | /* ---------- SMP ---------- */ | ||
525 | |||
526 | struct report_general_resp { | ||
527 | __be16 change_count; | ||
528 | __be16 route_indexes; | ||
529 | u8 _r_a; | ||
530 | u8 num_phys; | ||
531 | |||
532 | u8 _r_b:6; | ||
533 | u8 configuring:1; | ||
534 | u8 conf_route_table:1; | ||
535 | |||
536 | u8 _r_c; | ||
537 | |||
538 | u8 enclosure_logical_id[8]; | ||
539 | |||
540 | u8 _r_d[12]; | ||
541 | } __attribute__ ((packed)); | ||
542 | |||
543 | struct discover_resp { | ||
544 | u8 _r_a[5]; | ||
545 | |||
546 | u8 phy_id; | ||
547 | __be16 _r_b; | ||
548 | |||
549 | u8 _r_d:1; | ||
550 | u8 attached_dev_type:3; | ||
551 | u8 _r_c:4; | ||
552 | |||
553 | u8 _r_e:4; | ||
554 | u8 linkrate:4; | ||
555 | |||
556 | u8 _r_f:4; | ||
557 | u8 iproto:3; | ||
558 | u8 attached_sata_host:1; | ||
559 | |||
560 | u8 attached_sata_ps:1; | ||
561 | u8 _r_g:3; | ||
562 | u8 tproto:3; | ||
563 | u8 attached_sata_dev:1; | ||
564 | |||
565 | u8 sas_addr[8]; | ||
566 | u8 attached_sas_addr[8]; | ||
567 | u8 attached_phy_id; | ||
568 | |||
569 | u8 _r_h[7]; | ||
570 | |||
571 | u8 pmin_linkrate:4; | ||
572 | u8 hmin_linkrate:4; | ||
573 | u8 pmax_linkrate:4; | ||
574 | u8 hmax_linkrate:4; | ||
575 | |||
576 | u8 change_count; | ||
577 | |||
578 | u8 virtual:1; | ||
579 | u8 _r_i:3; | ||
580 | u8 pptv:4; | ||
581 | |||
582 | u8 _r_j:4; | ||
583 | u8 routing_attr:4; | ||
584 | |||
585 | u8 conn_type; | ||
586 | u8 conn_el_index; | ||
587 | u8 conn_phy_link; | ||
588 | |||
589 | u8 _r_k[8]; | ||
590 | } __attribute__ ((packed)); | ||
591 | |||
592 | struct report_phy_sata_resp { | ||
593 | u8 _r_a[5]; | ||
594 | |||
595 | u8 phy_id; | ||
596 | u8 _r_b; | ||
597 | |||
598 | u8 _r_c:6; | ||
599 | u8 affil_supp:1; | ||
600 | u8 affil_valid:1; | ||
601 | |||
602 | u32 _r_d; | ||
603 | |||
604 | u8 stp_sas_addr[8]; | ||
605 | |||
606 | struct dev_to_host_fis fis; | ||
607 | |||
608 | u32 _r_e; | ||
609 | |||
610 | u8 affil_stp_ini_addr[8]; | ||
611 | |||
612 | __be32 crc; | ||
613 | } __attribute__ ((packed)); | ||
614 | |||
615 | struct smp_resp { | ||
616 | u8 frame_type; | ||
617 | u8 function; | ||
618 | u8 result; | ||
619 | u8 reserved; | ||
620 | union { | ||
621 | struct report_general_resp rg; | ||
622 | struct discover_resp disc; | ||
623 | struct report_phy_sata_resp rps; | ||
624 | }; | ||
625 | } __attribute__ ((packed)); | ||
626 | |||
627 | #else | ||
628 | #error "Bitfield order not defined!" | ||
629 | #endif | ||
630 | |||
631 | #endif /* _SAS_H_ */ | ||
diff --git a/include/scsi/scsi.h b/include/scsi/scsi.h index c60b8ff2f5e4..84a6d5fe0920 100644 --- a/include/scsi/scsi.h +++ b/include/scsi/scsi.h | |||
@@ -25,13 +25,6 @@ extern const unsigned char scsi_command_size[8]; | |||
25 | #define COMMAND_SIZE(opcode) scsi_command_size[((opcode) >> 5) & 7] | 25 | #define COMMAND_SIZE(opcode) scsi_command_size[((opcode) >> 5) & 7] |
26 | 26 | ||
27 | /* | 27 | /* |
28 | * SCSI device types | ||
29 | */ | ||
30 | |||
31 | #define MAX_SCSI_DEVICE_CODE 15 | ||
32 | extern const char *const scsi_device_types[MAX_SCSI_DEVICE_CODE]; | ||
33 | |||
34 | /* | ||
35 | * Special value for scanning to specify scanning or rescanning of all | 28 | * Special value for scanning to specify scanning or rescanning of all |
36 | * possible channels, (target) ids, or luns on a given shost. | 29 | * possible channels, (target) ids, or luns on a given shost. |
37 | */ | 30 | */ |
@@ -225,6 +218,9 @@ static inline int scsi_status_is_good(int status) | |||
225 | #define TYPE_RBC 0x0e | 218 | #define TYPE_RBC 0x0e |
226 | #define TYPE_NO_LUN 0x7f | 219 | #define TYPE_NO_LUN 0x7f |
227 | 220 | ||
221 | /* Returns a human-readable name for the device */ | ||
222 | extern const char * scsi_device_type(unsigned type); | ||
223 | |||
228 | /* | 224 | /* |
229 | * standard mode-select header prepended to all mode-select commands | 225 | * standard mode-select header prepended to all mode-select commands |
230 | */ | 226 | */ |
@@ -433,4 +429,10 @@ struct scsi_lun { | |||
433 | /* Used to obtain the PCI location of a device */ | 429 | /* Used to obtain the PCI location of a device */ |
434 | #define SCSI_IOCTL_GET_PCI 0x5387 | 430 | #define SCSI_IOCTL_GET_PCI 0x5387 |
435 | 431 | ||
432 | /* Pull a u32 out of a SCSI message (using BE SCSI conventions) */ | ||
433 | static inline u32 scsi_to_u32(u8 *ptr) | ||
434 | { | ||
435 | return (ptr[0]<<24) + (ptr[1]<<16) + (ptr[2]<<8) + ptr[3]; | ||
436 | } | ||
437 | |||
436 | #endif /* _SCSI_SCSI_H */ | 438 | #endif /* _SCSI_SCSI_H */ |
diff --git a/include/scsi/scsi_cmnd.h b/include/scsi/scsi_cmnd.h index 58e6444eebee..be117f812deb 100644 --- a/include/scsi/scsi_cmnd.h +++ b/include/scsi/scsi_cmnd.h | |||
@@ -118,20 +118,6 @@ struct scsi_cmnd { | |||
118 | unsigned long pid; /* Process ID, starts at 0. Unique per host. */ | 118 | unsigned long pid; /* Process ID, starts at 0. Unique per host. */ |
119 | }; | 119 | }; |
120 | 120 | ||
121 | /* | ||
122 | * These are the values that scsi_cmd->state can take. | ||
123 | */ | ||
124 | #define SCSI_STATE_TIMEOUT 0x1000 | ||
125 | #define SCSI_STATE_FINISHED 0x1001 | ||
126 | #define SCSI_STATE_FAILED 0x1002 | ||
127 | #define SCSI_STATE_QUEUED 0x1003 | ||
128 | #define SCSI_STATE_UNUSED 0x1006 | ||
129 | #define SCSI_STATE_DISCONNECTING 0x1008 | ||
130 | #define SCSI_STATE_INITIALIZING 0x1009 | ||
131 | #define SCSI_STATE_BHQUEUE 0x100a | ||
132 | #define SCSI_STATE_MLQUEUE 0x100b | ||
133 | |||
134 | |||
135 | extern struct scsi_cmnd *scsi_get_command(struct scsi_device *, gfp_t); | 121 | extern struct scsi_cmnd *scsi_get_command(struct scsi_device *, gfp_t); |
136 | extern void scsi_put_command(struct scsi_cmnd *); | 122 | extern void scsi_put_command(struct scsi_cmnd *); |
137 | extern void scsi_io_completion(struct scsi_cmnd *, unsigned int); | 123 | extern void scsi_io_completion(struct scsi_cmnd *, unsigned int); |
diff --git a/include/scsi/scsi_host.h b/include/scsi/scsi_host.h index b3dd90f3e858..39c6f8cc20c3 100644 --- a/include/scsi/scsi_host.h +++ b/include/scsi/scsi_host.h | |||
@@ -16,6 +16,7 @@ struct scsi_target; | |||
16 | struct Scsi_Host; | 16 | struct Scsi_Host; |
17 | struct scsi_host_cmd_pool; | 17 | struct scsi_host_cmd_pool; |
18 | struct scsi_transport_template; | 18 | struct scsi_transport_template; |
19 | struct blk_queue_tags; | ||
19 | 20 | ||
20 | 21 | ||
21 | /* | 22 | /* |
@@ -466,6 +467,12 @@ struct Scsi_Host { | |||
466 | struct scsi_transport_template *transportt; | 467 | struct scsi_transport_template *transportt; |
467 | 468 | ||
468 | /* | 469 | /* |
470 | * area to keep a shared tag map (if needed, will be | ||
471 | * NULL if not) | ||
472 | */ | ||
473 | struct blk_queue_tag *bqt; | ||
474 | |||
475 | /* | ||
469 | * The following two fields are protected with host_lock; | 476 | * The following two fields are protected with host_lock; |
470 | * however, eh routines can safely access during eh processing | 477 | * however, eh routines can safely access during eh processing |
471 | * without acquiring the lock. | 478 | * without acquiring the lock. |
diff --git a/include/scsi/scsi_netlink.h b/include/scsi/scsi_netlink.h new file mode 100644 index 000000000000..8c1470cc8209 --- /dev/null +++ b/include/scsi/scsi_netlink.h | |||
@@ -0,0 +1,87 @@ | |||
1 | /* | ||
2 | * SCSI Transport Netlink Interface | ||
3 | * Used for the posting of outbound SCSI transport events | ||
4 | * | ||
5 | * Copyright (C) 2006 James Smart, Emulex Corporation | ||
6 | * | ||
7 | * This program is free software; you can redistribute it and/or modify | ||
8 | * it under the terms of the GNU General Public License as published by | ||
9 | * the Free Software Foundation; either version 2 of the License, or | ||
10 | * (at your option) any later version. | ||
11 | * | ||
12 | * This program is distributed in the hope that it will be useful, | ||
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
15 | * GNU General Public License for more details. | ||
16 | * | ||
17 | * You should have received a copy of the GNU General Public License | ||
18 | * along with this program; if not, write to the Free Software | ||
19 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
20 | * | ||
21 | */ | ||
22 | #ifndef SCSI_NETLINK_H | ||
23 | #define SCSI_NETLINK_H | ||
24 | |||
25 | /* | ||
26 | * This file intended to be included by both kernel and user space | ||
27 | */ | ||
28 | |||
29 | /* Single Netlink Message type to send all SCSI Transport messages */ | ||
30 | #define SCSI_TRANSPORT_MSG NLMSG_MIN_TYPE + 1 | ||
31 | |||
32 | /* SCSI Transport Broadcast Groups */ | ||
33 | /* leaving groups 0 and 1 unassigned */ | ||
34 | #define SCSI_NL_GRP_FC_EVENTS (1<<2) /* Group 2 */ | ||
35 | #define SCSI_NL_GRP_CNT 3 | ||
36 | |||
37 | |||
38 | /* SCSI_TRANSPORT_MSG event message header */ | ||
39 | struct scsi_nl_hdr { | ||
40 | uint8_t version; | ||
41 | uint8_t transport; | ||
42 | uint16_t magic; | ||
43 | uint16_t msgtype; | ||
44 | uint16_t msglen; | ||
45 | } __attribute__((aligned(sizeof(uint64_t)))); | ||
46 | |||
47 | /* scsi_nl_hdr->version value */ | ||
48 | #define SCSI_NL_VERSION 1 | ||
49 | |||
50 | /* scsi_nl_hdr->magic value */ | ||
51 | #define SCSI_NL_MAGIC 0xA1B2 | ||
52 | |||
53 | /* scsi_nl_hdr->transport value */ | ||
54 | #define SCSI_NL_TRANSPORT 0 | ||
55 | #define SCSI_NL_TRANSPORT_FC 1 | ||
56 | #define SCSI_NL_MAX_TRANSPORTS 2 | ||
57 | |||
58 | /* scsi_nl_hdr->msgtype values are defined in each transport */ | ||
59 | |||
60 | |||
61 | /* | ||
62 | * Vendor ID: | ||
63 | * If transports post vendor-unique events, they must pass a well-known | ||
64 | * 32-bit vendor identifier. This identifier consists of 8 bits indicating | ||
65 | * the "type" of identifier contained, and 24 bits of id data. | ||
66 | * | ||
67 | * Identifiers for each type: | ||
68 | * PCI : ID data is the 16 bit PCI Registered Vendor ID | ||
69 | */ | ||
70 | #define SCSI_NL_VID_TYPE_SHIFT 56 | ||
71 | #define SCSI_NL_VID_TYPE_MASK ((u64)0xFF << SCSI_NL_VID_TYPE_SHIFT) | ||
72 | #define SCSI_NL_VID_TYPE_PCI ((u64)0x01 << SCSI_NL_VID_TYPE_SHIFT) | ||
73 | #define SCSI_NL_VID_ID_MASK (~ SCSI_NL_VID_TYPE_MASK) | ||
74 | |||
75 | |||
76 | #define INIT_SCSI_NL_HDR(hdr, t, mtype, mlen) \ | ||
77 | { \ | ||
78 | (hdr)->version = SCSI_NL_VERSION; \ | ||
79 | (hdr)->transport = t; \ | ||
80 | (hdr)->magic = SCSI_NL_MAGIC; \ | ||
81 | (hdr)->msgtype = mtype; \ | ||
82 | (hdr)->msglen = mlen; \ | ||
83 | } | ||
84 | |||
85 | |||
86 | #endif /* SCSI_NETLINK_H */ | ||
87 | |||
diff --git a/include/scsi/scsi_netlink_fc.h b/include/scsi/scsi_netlink_fc.h new file mode 100644 index 000000000000..cbf76e479761 --- /dev/null +++ b/include/scsi/scsi_netlink_fc.h | |||
@@ -0,0 +1,71 @@ | |||
1 | /* | ||
2 | * FC Transport Netlink Interface | ||
3 | * | ||
4 | * Copyright (C) 2006 James Smart, Emulex Corporation | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or modify | ||
7 | * it under the terms of the GNU General Public License as published by | ||
8 | * the Free Software Foundation; either version 2 of the License, or | ||
9 | * (at your option) any later version. | ||
10 | * | ||
11 | * This program is distributed in the hope that it will be useful, | ||
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
14 | * GNU General Public License for more details. | ||
15 | * | ||
16 | * You should have received a copy of the GNU General Public License | ||
17 | * along with this program; if not, write to the Free Software | ||
18 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
19 | * | ||
20 | */ | ||
21 | #ifndef SCSI_NETLINK_FC_H | ||
22 | #define SCSI_NETLINK_FC_H | ||
23 | |||
24 | #include <scsi/scsi_netlink.h> | ||
25 | |||
26 | /* | ||
27 | * This file intended to be included by both kernel and user space | ||
28 | */ | ||
29 | |||
30 | /* | ||
31 | * FC Transport Message Types | ||
32 | */ | ||
33 | /* kernel -> user */ | ||
34 | #define FC_NL_ASYNC_EVENT 0x0100 | ||
35 | /* user -> kernel */ | ||
36 | /* none */ | ||
37 | |||
38 | |||
39 | /* | ||
40 | * Message Structures : | ||
41 | */ | ||
42 | |||
43 | /* macro to round up message lengths to 8byte boundary */ | ||
44 | #define FC_NL_MSGALIGN(len) (((len) + 7) & ~7) | ||
45 | |||
46 | |||
47 | /* | ||
48 | * FC Transport Broadcast Event Message : | ||
49 | * FC_NL_ASYNC_EVENT | ||
50 | * | ||
51 | * Note: if Vendor Unique message, &event_data will be start of | ||
52 | * vendor unique payload, and the length of the payload is | ||
53 | * per event_datalen | ||
54 | * | ||
55 | * Note: When specifying vendor_id, be sure to read the Vendor Type and ID | ||
56 | * formatting requirements specified in scsi_netlink.h | ||
57 | */ | ||
58 | struct fc_nl_event { | ||
59 | struct scsi_nl_hdr snlh; /* must be 1st element ! */ | ||
60 | uint64_t seconds; | ||
61 | uint64_t vendor_id; | ||
62 | uint16_t host_no; | ||
63 | uint16_t event_datalen; | ||
64 | uint32_t event_num; | ||
65 | uint32_t event_code; | ||
66 | uint32_t event_data; | ||
67 | } __attribute__((aligned(sizeof(uint64_t)))); | ||
68 | |||
69 | |||
70 | #endif /* SCSI_NETLINK_FC_H */ | ||
71 | |||
diff --git a/include/scsi/scsi_tcq.h b/include/scsi/scsi_tcq.h index e47e36a4ef49..d04d05adfa9b 100644 --- a/include/scsi/scsi_tcq.h +++ b/include/scsi/scsi_tcq.h | |||
@@ -4,6 +4,7 @@ | |||
4 | #include <linux/blkdev.h> | 4 | #include <linux/blkdev.h> |
5 | #include <scsi/scsi_cmnd.h> | 5 | #include <scsi/scsi_cmnd.h> |
6 | #include <scsi/scsi_device.h> | 6 | #include <scsi/scsi_device.h> |
7 | #include <scsi/scsi_host.h> | ||
7 | 8 | ||
8 | 9 | ||
9 | #define MSG_SIMPLE_TAG 0x20 | 10 | #define MSG_SIMPLE_TAG 0x20 |
@@ -66,7 +67,8 @@ static inline void scsi_activate_tcq(struct scsi_device *sdev, int depth) | |||
66 | return; | 67 | return; |
67 | 68 | ||
68 | if (!blk_queue_tagged(sdev->request_queue)) | 69 | if (!blk_queue_tagged(sdev->request_queue)) |
69 | blk_queue_init_tags(sdev->request_queue, depth, NULL); | 70 | blk_queue_init_tags(sdev->request_queue, depth, |
71 | sdev->host->bqt); | ||
70 | 72 | ||
71 | scsi_adjust_queue_depth(sdev, scsi_get_tag_type(sdev), depth); | 73 | scsi_adjust_queue_depth(sdev, scsi_get_tag_type(sdev), depth); |
72 | } | 74 | } |
@@ -131,4 +133,15 @@ static inline struct scsi_cmnd *scsi_find_tag(struct scsi_device *sdev, int tag) | |||
131 | return sdev->current_cmnd; | 133 | return sdev->current_cmnd; |
132 | } | 134 | } |
133 | 135 | ||
136 | /** | ||
137 | * scsi_init_shared_tag_map - create a shared tag map | ||
138 | * @shost: the host to share the tag map among all devices | ||
139 | * @depth: the total depth of the map | ||
140 | */ | ||
141 | static inline int scsi_init_shared_tag_map(struct Scsi_Host *shost, int depth) | ||
142 | { | ||
143 | shost->bqt = blk_init_tags(depth); | ||
144 | return shost->bqt ? 0 : -ENOMEM; | ||
145 | } | ||
146 | |||
134 | #endif /* _SCSI_SCSI_TCQ_H */ | 147 | #endif /* _SCSI_SCSI_TCQ_H */ |
diff --git a/include/scsi/scsi_transport_fc.h b/include/scsi/scsi_transport_fc.h index 6d28b0317657..fd352323378b 100644 --- a/include/scsi/scsi_transport_fc.h +++ b/include/scsi/scsi_transport_fc.h | |||
@@ -29,6 +29,7 @@ | |||
29 | 29 | ||
30 | #include <linux/sched.h> | 30 | #include <linux/sched.h> |
31 | #include <scsi/scsi.h> | 31 | #include <scsi/scsi.h> |
32 | #include <scsi/scsi_netlink.h> | ||
32 | 33 | ||
33 | struct scsi_transport_template; | 34 | struct scsi_transport_template; |
34 | 35 | ||
@@ -194,6 +195,7 @@ struct fc_rport { /* aka fc_starget_attrs */ | |||
194 | u32 roles; | 195 | u32 roles; |
195 | enum fc_port_state port_state; /* Will only be ONLINE or UNKNOWN */ | 196 | enum fc_port_state port_state; /* Will only be ONLINE or UNKNOWN */ |
196 | u32 scsi_target_id; | 197 | u32 scsi_target_id; |
198 | u32 fast_io_fail_tmo; | ||
197 | 199 | ||
198 | /* exported data */ | 200 | /* exported data */ |
199 | void *dd_data; /* Used for driver-specific storage */ | 201 | void *dd_data; /* Used for driver-specific storage */ |
@@ -206,6 +208,7 @@ struct fc_rport { /* aka fc_starget_attrs */ | |||
206 | struct device dev; | 208 | struct device dev; |
207 | struct work_struct dev_loss_work; | 209 | struct work_struct dev_loss_work; |
208 | struct work_struct scan_work; | 210 | struct work_struct scan_work; |
211 | struct work_struct fail_io_work; | ||
209 | struct work_struct stgt_delete_work; | 212 | struct work_struct stgt_delete_work; |
210 | struct work_struct rport_delete_work; | 213 | struct work_struct rport_delete_work; |
211 | } __attribute__((aligned(sizeof(unsigned long)))); | 214 | } __attribute__((aligned(sizeof(unsigned long)))); |
@@ -284,6 +287,30 @@ struct fc_host_statistics { | |||
284 | 287 | ||
285 | 288 | ||
286 | /* | 289 | /* |
290 | * FC Event Codes - Polled and Async, following FC HBAAPI v2.0 guidelines | ||
291 | */ | ||
292 | |||
293 | /* | ||
294 | * fc_host_event_code: If you alter this, you also need to alter | ||
295 | * scsi_transport_fc.c (for the ascii descriptions). | ||
296 | */ | ||
297 | enum fc_host_event_code { | ||
298 | FCH_EVT_LIP = 0x1, | ||
299 | FCH_EVT_LINKUP = 0x2, | ||
300 | FCH_EVT_LINKDOWN = 0x3, | ||
301 | FCH_EVT_LIPRESET = 0x4, | ||
302 | FCH_EVT_RSCN = 0x5, | ||
303 | FCH_EVT_ADAPTER_CHANGE = 0x103, | ||
304 | FCH_EVT_PORT_UNKNOWN = 0x200, | ||
305 | FCH_EVT_PORT_OFFLINE = 0x201, | ||
306 | FCH_EVT_PORT_ONLINE = 0x202, | ||
307 | FCH_EVT_PORT_FABRIC = 0x204, | ||
308 | FCH_EVT_LINK_UNKNOWN = 0x500, | ||
309 | FCH_EVT_VENDOR_UNIQUE = 0xffff, | ||
310 | }; | ||
311 | |||
312 | |||
313 | /* | ||
287 | * FC Local Port (Host) Attributes | 314 | * FC Local Port (Host) Attributes |
288 | * | 315 | * |
289 | * Attributes are based on HBAAPI V2.0 definitions. | 316 | * Attributes are based on HBAAPI V2.0 definitions. |
@@ -312,7 +339,6 @@ struct fc_host_attrs { | |||
312 | u64 permanent_port_name; | 339 | u64 permanent_port_name; |
313 | u32 supported_classes; | 340 | u32 supported_classes; |
314 | u8 supported_fc4s[FC_FC4_LIST_SIZE]; | 341 | u8 supported_fc4s[FC_FC4_LIST_SIZE]; |
315 | char symbolic_name[FC_SYMBOLIC_NAME_SIZE]; | ||
316 | u32 supported_speeds; | 342 | u32 supported_speeds; |
317 | u32 maxframe_size; | 343 | u32 maxframe_size; |
318 | char serial_number[FC_SERIAL_NUMBER_SIZE]; | 344 | char serial_number[FC_SERIAL_NUMBER_SIZE]; |
@@ -324,6 +350,8 @@ struct fc_host_attrs { | |||
324 | u8 active_fc4s[FC_FC4_LIST_SIZE]; | 350 | u8 active_fc4s[FC_FC4_LIST_SIZE]; |
325 | u32 speed; | 351 | u32 speed; |
326 | u64 fabric_name; | 352 | u64 fabric_name; |
353 | char symbolic_name[FC_SYMBOLIC_NAME_SIZE]; | ||
354 | char system_hostname[FC_SYMBOLIC_NAME_SIZE]; | ||
327 | 355 | ||
328 | /* Private (Transport-managed) Attributes */ | 356 | /* Private (Transport-managed) Attributes */ |
329 | enum fc_tgtid_binding_type tgtid_bind_type; | 357 | enum fc_tgtid_binding_type tgtid_bind_type; |
@@ -354,8 +382,6 @@ struct fc_host_attrs { | |||
354 | (((struct fc_host_attrs *)(x)->shost_data)->supported_classes) | 382 | (((struct fc_host_attrs *)(x)->shost_data)->supported_classes) |
355 | #define fc_host_supported_fc4s(x) \ | 383 | #define fc_host_supported_fc4s(x) \ |
356 | (((struct fc_host_attrs *)(x)->shost_data)->supported_fc4s) | 384 | (((struct fc_host_attrs *)(x)->shost_data)->supported_fc4s) |
357 | #define fc_host_symbolic_name(x) \ | ||
358 | (((struct fc_host_attrs *)(x)->shost_data)->symbolic_name) | ||
359 | #define fc_host_supported_speeds(x) \ | 385 | #define fc_host_supported_speeds(x) \ |
360 | (((struct fc_host_attrs *)(x)->shost_data)->supported_speeds) | 386 | (((struct fc_host_attrs *)(x)->shost_data)->supported_speeds) |
361 | #define fc_host_maxframe_size(x) \ | 387 | #define fc_host_maxframe_size(x) \ |
@@ -374,6 +400,10 @@ struct fc_host_attrs { | |||
374 | (((struct fc_host_attrs *)(x)->shost_data)->speed) | 400 | (((struct fc_host_attrs *)(x)->shost_data)->speed) |
375 | #define fc_host_fabric_name(x) \ | 401 | #define fc_host_fabric_name(x) \ |
376 | (((struct fc_host_attrs *)(x)->shost_data)->fabric_name) | 402 | (((struct fc_host_attrs *)(x)->shost_data)->fabric_name) |
403 | #define fc_host_symbolic_name(x) \ | ||
404 | (((struct fc_host_attrs *)(x)->shost_data)->symbolic_name) | ||
405 | #define fc_host_system_hostname(x) \ | ||
406 | (((struct fc_host_attrs *)(x)->shost_data)->system_hostname) | ||
377 | #define fc_host_tgtid_bind_type(x) \ | 407 | #define fc_host_tgtid_bind_type(x) \ |
378 | (((struct fc_host_attrs *)(x)->shost_data)->tgtid_bind_type) | 408 | (((struct fc_host_attrs *)(x)->shost_data)->tgtid_bind_type) |
379 | #define fc_host_rports(x) \ | 409 | #define fc_host_rports(x) \ |
@@ -409,12 +439,17 @@ struct fc_function_template { | |||
409 | void (*get_host_active_fc4s)(struct Scsi_Host *); | 439 | void (*get_host_active_fc4s)(struct Scsi_Host *); |
410 | void (*get_host_speed)(struct Scsi_Host *); | 440 | void (*get_host_speed)(struct Scsi_Host *); |
411 | void (*get_host_fabric_name)(struct Scsi_Host *); | 441 | void (*get_host_fabric_name)(struct Scsi_Host *); |
442 | void (*get_host_symbolic_name)(struct Scsi_Host *); | ||
443 | void (*set_host_system_hostname)(struct Scsi_Host *); | ||
412 | 444 | ||
413 | struct fc_host_statistics * (*get_fc_host_stats)(struct Scsi_Host *); | 445 | struct fc_host_statistics * (*get_fc_host_stats)(struct Scsi_Host *); |
414 | void (*reset_fc_host_stats)(struct Scsi_Host *); | 446 | void (*reset_fc_host_stats)(struct Scsi_Host *); |
415 | 447 | ||
416 | int (*issue_fc_host_lip)(struct Scsi_Host *); | 448 | int (*issue_fc_host_lip)(struct Scsi_Host *); |
417 | 449 | ||
450 | void (*dev_loss_tmo_callbk)(struct fc_rport *); | ||
451 | void (*terminate_rport_io)(struct fc_rport *); | ||
452 | |||
418 | /* allocation lengths for host-specific data */ | 453 | /* allocation lengths for host-specific data */ |
419 | u32 dd_fcrport_size; | 454 | u32 dd_fcrport_size; |
420 | 455 | ||
@@ -445,7 +480,6 @@ struct fc_function_template { | |||
445 | unsigned long show_host_permanent_port_name:1; | 480 | unsigned long show_host_permanent_port_name:1; |
446 | unsigned long show_host_supported_classes:1; | 481 | unsigned long show_host_supported_classes:1; |
447 | unsigned long show_host_supported_fc4s:1; | 482 | unsigned long show_host_supported_fc4s:1; |
448 | unsigned long show_host_symbolic_name:1; | ||
449 | unsigned long show_host_supported_speeds:1; | 483 | unsigned long show_host_supported_speeds:1; |
450 | unsigned long show_host_maxframe_size:1; | 484 | unsigned long show_host_maxframe_size:1; |
451 | unsigned long show_host_serial_number:1; | 485 | unsigned long show_host_serial_number:1; |
@@ -456,6 +490,8 @@ struct fc_function_template { | |||
456 | unsigned long show_host_active_fc4s:1; | 490 | unsigned long show_host_active_fc4s:1; |
457 | unsigned long show_host_speed:1; | 491 | unsigned long show_host_speed:1; |
458 | unsigned long show_host_fabric_name:1; | 492 | unsigned long show_host_fabric_name:1; |
493 | unsigned long show_host_symbolic_name:1; | ||
494 | unsigned long show_host_system_hostname:1; | ||
459 | }; | 495 | }; |
460 | 496 | ||
461 | 497 | ||
@@ -491,6 +527,25 @@ fc_remote_port_chkready(struct fc_rport *rport) | |||
491 | return result; | 527 | return result; |
492 | } | 528 | } |
493 | 529 | ||
530 | static inline u64 wwn_to_u64(u8 *wwn) | ||
531 | { | ||
532 | return (u64)wwn[0] << 56 | (u64)wwn[1] << 48 | | ||
533 | (u64)wwn[2] << 40 | (u64)wwn[3] << 32 | | ||
534 | (u64)wwn[4] << 24 | (u64)wwn[5] << 16 | | ||
535 | (u64)wwn[6] << 8 | (u64)wwn[7]; | ||
536 | } | ||
537 | |||
538 | static inline void u64_to_wwn(u64 inm, u8 *wwn) | ||
539 | { | ||
540 | wwn[0] = (inm >> 56) & 0xff; | ||
541 | wwn[1] = (inm >> 48) & 0xff; | ||
542 | wwn[2] = (inm >> 40) & 0xff; | ||
543 | wwn[3] = (inm >> 32) & 0xff; | ||
544 | wwn[4] = (inm >> 24) & 0xff; | ||
545 | wwn[5] = (inm >> 16) & 0xff; | ||
546 | wwn[6] = (inm >> 8) & 0xff; | ||
547 | wwn[7] = inm & 0xff; | ||
548 | } | ||
494 | 549 | ||
495 | struct scsi_transport_template *fc_attach_transport( | 550 | struct scsi_transport_template *fc_attach_transport( |
496 | struct fc_function_template *); | 551 | struct fc_function_template *); |
@@ -501,13 +556,14 @@ struct fc_rport *fc_remote_port_add(struct Scsi_Host *shost, | |||
501 | void fc_remote_port_delete(struct fc_rport *rport); | 556 | void fc_remote_port_delete(struct fc_rport *rport); |
502 | void fc_remote_port_rolechg(struct fc_rport *rport, u32 roles); | 557 | void fc_remote_port_rolechg(struct fc_rport *rport, u32 roles); |
503 | int scsi_is_fc_rport(const struct device *); | 558 | int scsi_is_fc_rport(const struct device *); |
504 | 559 | u32 fc_get_event_number(void); | |
505 | static inline u64 wwn_to_u64(u8 *wwn) | 560 | void fc_host_post_event(struct Scsi_Host *shost, u32 event_number, |
506 | { | 561 | enum fc_host_event_code event_code, u32 event_data); |
507 | return (u64)wwn[0] << 56 | (u64)wwn[1] << 48 | | 562 | void fc_host_post_vendor_event(struct Scsi_Host *shost, u32 event_number, |
508 | (u64)wwn[2] << 40 | (u64)wwn[3] << 32 | | 563 | u32 data_len, char * data_buf, u64 vendor_id); |
509 | (u64)wwn[4] << 24 | (u64)wwn[5] << 16 | | 564 | /* Note: when specifying vendor_id to fc_host_post_vendor_event() |
510 | (u64)wwn[6] << 8 | (u64)wwn[7]; | 565 | * be sure to read the Vendor Type and ID formatting requirements |
511 | } | 566 | * specified in scsi_netlink.h |
567 | */ | ||
512 | 568 | ||
513 | #endif /* SCSI_TRANSPORT_FC_H */ | 569 | #endif /* SCSI_TRANSPORT_FC_H */ |
diff --git a/include/scsi/scsi_transport_sas.h b/include/scsi/scsi_transport_sas.h index 6cc2314098cf..53024377f3b8 100644 --- a/include/scsi/scsi_transport_sas.h +++ b/include/scsi/scsi_transport_sas.h | |||
@@ -24,15 +24,23 @@ enum sas_protocol { | |||
24 | }; | 24 | }; |
25 | 25 | ||
26 | enum sas_linkrate { | 26 | enum sas_linkrate { |
27 | SAS_LINK_RATE_UNKNOWN, | 27 | /* These Values are defined in the SAS standard */ |
28 | SAS_PHY_DISABLED, | 28 | SAS_LINK_RATE_UNKNOWN = 0, |
29 | SAS_LINK_RATE_FAILED, | 29 | SAS_PHY_DISABLED = 1, |
30 | SAS_SATA_SPINUP_HOLD, | 30 | SAS_PHY_RESET_PROBLEM = 2, |
31 | SAS_SATA_PORT_SELECTOR, | 31 | SAS_SATA_SPINUP_HOLD = 3, |
32 | SAS_LINK_RATE_1_5_GBPS, | 32 | SAS_SATA_PORT_SELECTOR = 4, |
33 | SAS_LINK_RATE_3_0_GBPS, | 33 | SAS_PHY_RESET_IN_PROGRESS = 5, |
34 | SAS_LINK_RATE_6_0_GBPS, | 34 | SAS_LINK_RATE_1_5_GBPS = 8, |
35 | SAS_LINK_VIRTUAL, | 35 | SAS_LINK_RATE_G1 = SAS_LINK_RATE_1_5_GBPS, |
36 | SAS_LINK_RATE_3_0_GBPS = 9, | ||
37 | SAS_LINK_RATE_G2 = SAS_LINK_RATE_3_0_GBPS, | ||
38 | SAS_LINK_RATE_6_0_GBPS = 10, | ||
39 | /* These are virtual to the transport class and may never | ||
40 | * be signalled normally since the standard defined field | ||
41 | * is only 4 bits */ | ||
42 | SAS_LINK_RATE_FAILED = 0x10, | ||
43 | SAS_PHY_VIRTUAL = 0x11, | ||
36 | }; | 44 | }; |
37 | 45 | ||
38 | struct sas_identify { | 46 | struct sas_identify { |
@@ -57,9 +65,6 @@ struct sas_phy { | |||
57 | enum sas_linkrate maximum_linkrate_hw; | 65 | enum sas_linkrate maximum_linkrate_hw; |
58 | enum sas_linkrate maximum_linkrate; | 66 | enum sas_linkrate maximum_linkrate; |
59 | 67 | ||
60 | /* internal state */ | ||
61 | unsigned int local_attached : 1; | ||
62 | |||
63 | /* link error statistics */ | 68 | /* link error statistics */ |
64 | u32 invalid_dword_count; | 69 | u32 invalid_dword_count; |
65 | u32 running_disparity_error_count; | 70 | u32 running_disparity_error_count; |
@@ -145,12 +150,18 @@ struct sas_port { | |||
145 | #define transport_class_to_sas_port(cdev) \ | 150 | #define transport_class_to_sas_port(cdev) \ |
146 | dev_to_sas_port((cdev)->dev) | 151 | dev_to_sas_port((cdev)->dev) |
147 | 152 | ||
153 | struct sas_phy_linkrates { | ||
154 | enum sas_linkrate maximum_linkrate; | ||
155 | enum sas_linkrate minimum_linkrate; | ||
156 | }; | ||
157 | |||
148 | /* The functions by which the transport class and the driver communicate */ | 158 | /* The functions by which the transport class and the driver communicate */ |
149 | struct sas_function_template { | 159 | struct sas_function_template { |
150 | int (*get_linkerrors)(struct sas_phy *); | 160 | int (*get_linkerrors)(struct sas_phy *); |
151 | int (*get_enclosure_identifier)(struct sas_rphy *, u64 *); | 161 | int (*get_enclosure_identifier)(struct sas_rphy *, u64 *); |
152 | int (*get_bay_identifier)(struct sas_rphy *); | 162 | int (*get_bay_identifier)(struct sas_rphy *); |
153 | int (*phy_reset)(struct sas_phy *, int); | 163 | int (*phy_reset)(struct sas_phy *, int); |
164 | int (*set_phy_speed)(struct sas_phy *, struct sas_phy_linkrates *); | ||
154 | }; | 165 | }; |
155 | 166 | ||
156 | 167 | ||
@@ -196,4 +207,6 @@ scsi_is_sas_expander_device(struct device *dev) | |||
196 | rphy->identify.device_type == SAS_EDGE_EXPANDER_DEVICE; | 207 | rphy->identify.device_type == SAS_EDGE_EXPANDER_DEVICE; |
197 | } | 208 | } |
198 | 209 | ||
210 | #define scsi_is_sas_phy_local(phy) scsi_is_host_device((phy)->dev.parent) | ||
211 | |||
199 | #endif /* SCSI_TRANSPORT_SAS_H */ | 212 | #endif /* SCSI_TRANSPORT_SAS_H */ |
diff --git a/include/scsi/scsi_transport_spi.h b/include/scsi/scsi_transport_spi.h index 302680c0c0de..da180f738477 100644 --- a/include/scsi/scsi_transport_spi.h +++ b/include/scsi/scsi_transport_spi.h | |||
@@ -53,7 +53,8 @@ struct spi_transport_attrs { | |||
53 | unsigned int support_ius; /* support Information Units */ | 53 | unsigned int support_ius; /* support Information Units */ |
54 | unsigned int support_qas; /* supports quick arbitration and selection */ | 54 | unsigned int support_qas; /* supports quick arbitration and selection */ |
55 | /* Private Fields */ | 55 | /* Private Fields */ |
56 | unsigned int dv_pending:1; /* Internal flag */ | 56 | unsigned int dv_pending:1; /* Internal flag: DV Requested */ |
57 | unsigned int dv_in_progress:1; /* Internal: DV started */ | ||
57 | struct mutex dv_mutex; /* semaphore to serialise dv */ | 58 | struct mutex dv_mutex; /* semaphore to serialise dv */ |
58 | }; | 59 | }; |
59 | 60 | ||
diff --git a/include/sound/ac97_codec.h b/include/sound/ac97_codec.h index 758f8bf133c7..4c43521cc493 100644 --- a/include/sound/ac97_codec.h +++ b/include/sound/ac97_codec.h | |||
@@ -27,6 +27,7 @@ | |||
27 | 27 | ||
28 | #include <linux/bitops.h> | 28 | #include <linux/bitops.h> |
29 | #include <linux/device.h> | 29 | #include <linux/device.h> |
30 | #include <linux/workqueue.h> | ||
30 | #include "pcm.h" | 31 | #include "pcm.h" |
31 | #include "control.h" | 32 | #include "control.h" |
32 | #include "info.h" | 33 | #include "info.h" |
@@ -140,6 +141,20 @@ | |||
140 | #define AC97_GP_DRSS_1011 0x0000 /* LR(C) 10+11(+12) */ | 141 | #define AC97_GP_DRSS_1011 0x0000 /* LR(C) 10+11(+12) */ |
141 | #define AC97_GP_DRSS_78 0x0400 /* LR 7+8 */ | 142 | #define AC97_GP_DRSS_78 0x0400 /* LR 7+8 */ |
142 | 143 | ||
144 | /* powerdown bits */ | ||
145 | #define AC97_PD_ADC_STATUS 0x0001 /* ADC status (RO) */ | ||
146 | #define AC97_PD_DAC_STATUS 0x0002 /* DAC status (RO) */ | ||
147 | #define AC97_PD_MIXER_STATUS 0x0004 /* Analog mixer status (RO) */ | ||
148 | #define AC97_PD_VREF_STATUS 0x0008 /* Vref status (RO) */ | ||
149 | #define AC97_PD_PR0 0x0100 /* Power down PCM ADCs and input MUX */ | ||
150 | #define AC97_PD_PR1 0x0200 /* Power down PCM front DAC */ | ||
151 | #define AC97_PD_PR2 0x0400 /* Power down Mixer (Vref still on) */ | ||
152 | #define AC97_PD_PR3 0x0800 /* Power down Mixer (Vref off) */ | ||
153 | #define AC97_PD_PR4 0x1000 /* Power down AC-Link */ | ||
154 | #define AC97_PD_PR5 0x2000 /* Disable internal clock usage */ | ||
155 | #define AC97_PD_PR6 0x4000 /* Headphone amplifier */ | ||
156 | #define AC97_PD_EAPD 0x8000 /* External Amplifer Power Down (EAPD) */ | ||
157 | |||
143 | /* extended audio ID bit defines */ | 158 | /* extended audio ID bit defines */ |
144 | #define AC97_EI_VRA 0x0001 /* Variable bit rate supported */ | 159 | #define AC97_EI_VRA 0x0001 /* Variable bit rate supported */ |
145 | #define AC97_EI_DRA 0x0002 /* Double rate supported */ | 160 | #define AC97_EI_DRA 0x0002 /* Double rate supported */ |
@@ -359,6 +374,7 @@ | |||
359 | #define AC97_SCAP_INV_EAPD (1<<7) /* inverted EAPD */ | 374 | #define AC97_SCAP_INV_EAPD (1<<7) /* inverted EAPD */ |
360 | #define AC97_SCAP_DETECT_BY_VENDOR (1<<8) /* use vendor registers for read tests */ | 375 | #define AC97_SCAP_DETECT_BY_VENDOR (1<<8) /* use vendor registers for read tests */ |
361 | #define AC97_SCAP_NO_SPDIF (1<<9) /* don't build SPDIF controls */ | 376 | #define AC97_SCAP_NO_SPDIF (1<<9) /* don't build SPDIF controls */ |
377 | #define AC97_SCAP_EAPD_LED (1<<10) /* EAPD as mute LED */ | ||
362 | 378 | ||
363 | /* ac97->flags */ | 379 | /* ac97->flags */ |
364 | #define AC97_HAS_PC_BEEP (1<<0) /* force PC Speaker usage */ | 380 | #define AC97_HAS_PC_BEEP (1<<0) /* force PC Speaker usage */ |
@@ -491,6 +507,12 @@ struct snd_ac97 { | |||
491 | /* jack-sharing info */ | 507 | /* jack-sharing info */ |
492 | unsigned char indep_surround; | 508 | unsigned char indep_surround; |
493 | unsigned char channel_mode; | 509 | unsigned char channel_mode; |
510 | |||
511 | #ifdef CONFIG_SND_AC97_POWER_SAVE | ||
512 | unsigned int power_up; /* power states */ | ||
513 | struct workqueue_struct *power_workq; | ||
514 | struct work_struct power_work; | ||
515 | #endif | ||
494 | struct device dev; | 516 | struct device dev; |
495 | }; | 517 | }; |
496 | 518 | ||
@@ -532,6 +554,15 @@ unsigned short snd_ac97_read(struct snd_ac97 *ac97, unsigned short reg); | |||
532 | void snd_ac97_write_cache(struct snd_ac97 *ac97, unsigned short reg, unsigned short value); | 554 | void snd_ac97_write_cache(struct snd_ac97 *ac97, unsigned short reg, unsigned short value); |
533 | int snd_ac97_update(struct snd_ac97 *ac97, unsigned short reg, unsigned short value); | 555 | int snd_ac97_update(struct snd_ac97 *ac97, unsigned short reg, unsigned short value); |
534 | int snd_ac97_update_bits(struct snd_ac97 *ac97, unsigned short reg, unsigned short mask, unsigned short value); | 556 | int snd_ac97_update_bits(struct snd_ac97 *ac97, unsigned short reg, unsigned short mask, unsigned short value); |
557 | #ifdef CONFIG_SND_AC97_POWER_SAVE | ||
558 | int snd_ac97_update_power(struct snd_ac97 *ac97, int reg, int powerup); | ||
559 | #else | ||
560 | static inline int snd_ac97_update_power(struct snd_ac97 *ac97, int reg, | ||
561 | int powerup) | ||
562 | { | ||
563 | return 0; | ||
564 | } | ||
565 | #endif | ||
535 | #ifdef CONFIG_PM | 566 | #ifdef CONFIG_PM |
536 | void snd_ac97_suspend(struct snd_ac97 *ac97); | 567 | void snd_ac97_suspend(struct snd_ac97 *ac97); |
537 | void snd_ac97_resume(struct snd_ac97 *ac97); | 568 | void snd_ac97_resume(struct snd_ac97 *ac97); |
@@ -583,6 +614,7 @@ struct ac97_pcm { | |||
583 | copy_flag: 1, /* lowlevel driver must fill all entries */ | 614 | copy_flag: 1, /* lowlevel driver must fill all entries */ |
584 | spdif: 1; /* spdif pcm */ | 615 | spdif: 1; /* spdif pcm */ |
585 | unsigned short aslots; /* active slots */ | 616 | unsigned short aslots; /* active slots */ |
617 | unsigned short cur_dbl; /* current double-rate state */ | ||
586 | unsigned int rates; /* available rates */ | 618 | unsigned int rates; /* available rates */ |
587 | struct { | 619 | struct { |
588 | unsigned short slots; /* driver input: requested AC97 slot numbers */ | 620 | unsigned short slots; /* driver input: requested AC97 slot numbers */ |
diff --git a/include/sound/ad1848.h b/include/sound/ad1848.h index 57af1fe7b309..c8de6f83338f 100644 --- a/include/sound/ad1848.h +++ b/include/sound/ad1848.h | |||
@@ -179,14 +179,13 @@ enum { AD1848_MIX_SINGLE, AD1848_MIX_DOUBLE, AD1848_MIX_CAPTURE }; | |||
179 | #define AD1848_MIXVAL_DOUBLE(left_reg, right_reg, shift_left, shift_right, mask, invert) \ | 179 | #define AD1848_MIXVAL_DOUBLE(left_reg, right_reg, shift_left, shift_right, mask, invert) \ |
180 | ((left_reg) | ((right_reg) << 8) | ((shift_left) << 16) | ((shift_right) << 19) | ((mask) << 24) | ((invert) << 22)) | 180 | ((left_reg) | ((right_reg) << 8) | ((shift_left) << 16) | ((shift_right) << 19) | ((mask) << 24) | ((invert) << 22)) |
181 | 181 | ||
182 | int snd_ad1848_add_ctl(struct snd_ad1848 *chip, const char *name, int index, int type, unsigned long value); | ||
183 | |||
184 | /* for ease of use */ | 182 | /* for ease of use */ |
185 | struct ad1848_mix_elem { | 183 | struct ad1848_mix_elem { |
186 | const char *name; | 184 | const char *name; |
187 | int index; | 185 | int index; |
188 | int type; | 186 | int type; |
189 | unsigned long private_value; | 187 | unsigned long private_value; |
188 | unsigned int *tlv; | ||
190 | }; | 189 | }; |
191 | 190 | ||
192 | #define AD1848_SINGLE(xname, xindex, reg, shift, mask, invert) \ | 191 | #define AD1848_SINGLE(xname, xindex, reg, shift, mask, invert) \ |
@@ -195,15 +194,26 @@ struct ad1848_mix_elem { | |||
195 | .type = AD1848_MIX_SINGLE, \ | 194 | .type = AD1848_MIX_SINGLE, \ |
196 | .private_value = AD1848_MIXVAL_SINGLE(reg, shift, mask, invert) } | 195 | .private_value = AD1848_MIXVAL_SINGLE(reg, shift, mask, invert) } |
197 | 196 | ||
197 | #define AD1848_SINGLE_TLV(xname, xindex, reg, shift, mask, invert, xtlv) \ | ||
198 | { .name = xname, \ | ||
199 | .index = xindex, \ | ||
200 | .type = AD1848_MIX_SINGLE, \ | ||
201 | .private_value = AD1848_MIXVAL_SINGLE(reg, shift, mask, invert), \ | ||
202 | .tlv = xtlv } | ||
203 | |||
198 | #define AD1848_DOUBLE(xname, xindex, left_reg, right_reg, shift_left, shift_right, mask, invert) \ | 204 | #define AD1848_DOUBLE(xname, xindex, left_reg, right_reg, shift_left, shift_right, mask, invert) \ |
199 | { .name = xname, \ | 205 | { .name = xname, \ |
200 | .index = xindex, \ | 206 | .index = xindex, \ |
201 | .type = AD1848_MIX_DOUBLE, \ | 207 | .type = AD1848_MIX_DOUBLE, \ |
202 | .private_value = AD1848_MIXVAL_DOUBLE(left_reg, right_reg, shift_left, shift_right, mask, invert) } | 208 | .private_value = AD1848_MIXVAL_DOUBLE(left_reg, right_reg, shift_left, shift_right, mask, invert) } |
203 | 209 | ||
204 | static inline int snd_ad1848_add_ctl_elem(struct snd_ad1848 *chip, const struct ad1848_mix_elem *c) | 210 | #define AD1848_DOUBLE_TLV(xname, xindex, left_reg, right_reg, shift_left, shift_right, mask, invert, xtlv) \ |
205 | { | 211 | { .name = xname, \ |
206 | return snd_ad1848_add_ctl(chip, c->name, c->index, c->type, c->private_value); | 212 | .index = xindex, \ |
207 | } | 213 | .type = AD1848_MIX_DOUBLE, \ |
214 | .private_value = AD1848_MIXVAL_DOUBLE(left_reg, right_reg, shift_left, shift_right, mask, invert), \ | ||
215 | .tlv = xtlv } | ||
216 | |||
217 | int snd_ad1848_add_ctl_elem(struct snd_ad1848 *chip, const struct ad1848_mix_elem *c); | ||
208 | 218 | ||
209 | #endif /* __SOUND_AD1848_H */ | 219 | #endif /* __SOUND_AD1848_H */ |
diff --git a/include/sound/ak4xxx-adda.h b/include/sound/ak4xxx-adda.h index 3d9888492026..d0deca669b92 100644 --- a/include/sound/ak4xxx-adda.h +++ b/include/sound/ak4xxx-adda.h | |||
@@ -39,26 +39,39 @@ struct snd_ak4xxx_ops { | |||
39 | 39 | ||
40 | #define AK4XXX_IMAGE_SIZE (AK4XXX_MAX_CHIPS * 16) /* 64 bytes */ | 40 | #define AK4XXX_IMAGE_SIZE (AK4XXX_MAX_CHIPS * 16) /* 64 bytes */ |
41 | 41 | ||
42 | /* DAC label and channels */ | ||
43 | struct snd_akm4xxx_dac_channel { | ||
44 | char *name; /* mixer volume name */ | ||
45 | unsigned int num_channels; | ||
46 | }; | ||
47 | |||
48 | /* ADC labels and channels */ | ||
49 | struct snd_akm4xxx_adc_channel { | ||
50 | char *name; /* capture gain volume label */ | ||
51 | char *switch_name; /* capture switch */ | ||
52 | unsigned int num_channels; | ||
53 | }; | ||
54 | |||
42 | struct snd_akm4xxx { | 55 | struct snd_akm4xxx { |
43 | struct snd_card *card; | 56 | struct snd_card *card; |
44 | unsigned int num_adcs; /* AK4524 or AK4528 ADCs */ | 57 | unsigned int num_adcs; /* AK4524 or AK4528 ADCs */ |
45 | unsigned int num_dacs; /* AK4524 or AK4528 DACs */ | 58 | unsigned int num_dacs; /* AK4524 or AK4528 DACs */ |
46 | unsigned char images[AK4XXX_IMAGE_SIZE]; /* saved register image */ | 59 | unsigned char images[AK4XXX_IMAGE_SIZE]; /* saved register image */ |
47 | unsigned char ipga_gain[AK4XXX_MAX_CHIPS][2]; /* saved register image | 60 | unsigned char volumes[AK4XXX_IMAGE_SIZE]; /* saved volume values */ |
48 | * for IPGA (AK4528) | ||
49 | */ | ||
50 | unsigned long private_value[AK4XXX_MAX_CHIPS]; /* helper for driver */ | 61 | unsigned long private_value[AK4XXX_MAX_CHIPS]; /* helper for driver */ |
51 | void *private_data[AK4XXX_MAX_CHIPS]; /* helper for driver */ | 62 | void *private_data[AK4XXX_MAX_CHIPS]; /* helper for driver */ |
52 | /* template should fill the following fields */ | 63 | /* template should fill the following fields */ |
53 | unsigned int idx_offset; /* control index offset */ | 64 | unsigned int idx_offset; /* control index offset */ |
54 | enum { | 65 | enum { |
55 | SND_AK4524, SND_AK4528, SND_AK4529, | 66 | SND_AK4524, SND_AK4528, SND_AK4529, |
56 | SND_AK4355, SND_AK4358, SND_AK4381 | 67 | SND_AK4355, SND_AK4358, SND_AK4381, |
68 | SND_AK5365 | ||
57 | } type; | 69 | } type; |
58 | unsigned int *num_stereo; /* array of combined counts | 70 | |
59 | * for the mixer | 71 | /* (array) information of combined codecs */ |
60 | */ | 72 | struct snd_akm4xxx_dac_channel *dac_info; |
61 | char **channel_names; /* array of mixer channel names */ | 73 | struct snd_akm4xxx_adc_channel *adc_info; |
74 | |||
62 | struct snd_ak4xxx_ops ops; | 75 | struct snd_ak4xxx_ops ops; |
63 | }; | 76 | }; |
64 | 77 | ||
@@ -72,9 +85,9 @@ int snd_akm4xxx_build_controls(struct snd_akm4xxx *ak); | |||
72 | (ak)->images[(chip) * 16 + (reg)] | 85 | (ak)->images[(chip) * 16 + (reg)] |
73 | #define snd_akm4xxx_set(ak,chip,reg,val) \ | 86 | #define snd_akm4xxx_set(ak,chip,reg,val) \ |
74 | ((ak)->images[(chip) * 16 + (reg)] = (val)) | 87 | ((ak)->images[(chip) * 16 + (reg)] = (val)) |
75 | #define snd_akm4xxx_get_ipga(ak,chip,reg) \ | 88 | #define snd_akm4xxx_get_vol(ak,chip,reg) \ |
76 | (ak)->ipga_gain[chip][(reg)-4] | 89 | (ak)->volumes[(chip) * 16 + (reg)] |
77 | #define snd_akm4xxx_set_ipga(ak,chip,reg,val) \ | 90 | #define snd_akm4xxx_set_vol(ak,chip,reg,val) \ |
78 | ((ak)->ipga_gain[chip][(reg)-4] = (val)) | 91 | ((ak)->volumes[(chip) * 16 + (reg)] = (val)) |
79 | 92 | ||
80 | #endif /* __SOUND_AK4XXX_ADDA_H */ | 93 | #endif /* __SOUND_AK4XXX_ADDA_H */ |
diff --git a/include/sound/asound.h b/include/sound/asound.h index 41885f48ad91..c1621c650a9a 100644 --- a/include/sound/asound.h +++ b/include/sound/asound.h | |||
@@ -688,7 +688,7 @@ struct snd_timer_tread { | |||
688 | * * | 688 | * * |
689 | ****************************************************************************/ | 689 | ****************************************************************************/ |
690 | 690 | ||
691 | #define SNDRV_CTL_VERSION SNDRV_PROTOCOL_VERSION(2, 0, 3) | 691 | #define SNDRV_CTL_VERSION SNDRV_PROTOCOL_VERSION(2, 0, 4) |
692 | 692 | ||
693 | struct snd_ctl_card_info { | 693 | struct snd_ctl_card_info { |
694 | int card; /* card number */ | 694 | int card; /* card number */ |
@@ -727,10 +727,15 @@ typedef int __bitwise snd_ctl_elem_iface_t; | |||
727 | #define SNDRV_CTL_ELEM_ACCESS_WRITE (1<<1) | 727 | #define SNDRV_CTL_ELEM_ACCESS_WRITE (1<<1) |
728 | #define SNDRV_CTL_ELEM_ACCESS_READWRITE (SNDRV_CTL_ELEM_ACCESS_READ|SNDRV_CTL_ELEM_ACCESS_WRITE) | 728 | #define SNDRV_CTL_ELEM_ACCESS_READWRITE (SNDRV_CTL_ELEM_ACCESS_READ|SNDRV_CTL_ELEM_ACCESS_WRITE) |
729 | #define SNDRV_CTL_ELEM_ACCESS_VOLATILE (1<<2) /* control value may be changed without a notification */ | 729 | #define SNDRV_CTL_ELEM_ACCESS_VOLATILE (1<<2) /* control value may be changed without a notification */ |
730 | #define SNDRV_CTL_ELEM_ACCESS_TIMESTAMP (1<<2) /* when was control changed */ | 730 | #define SNDRV_CTL_ELEM_ACCESS_TIMESTAMP (1<<3) /* when was control changed */ |
731 | #define SNDRV_CTL_ELEM_ACCESS_TLV_READ (1<<4) /* TLV read is possible */ | ||
732 | #define SNDRV_CTL_ELEM_ACCESS_TLV_WRITE (1<<5) /* TLV write is possible */ | ||
733 | #define SNDRV_CTL_ELEM_ACCESS_TLV_READWRITE (SNDRV_CTL_ELEM_ACCESS_TLV_READ|SNDRV_CTL_ELEM_ACCESS_TLV_WRITE) | ||
734 | #define SNDRV_CTL_ELEM_ACCESS_TLV_COMMAND (1<<6) /* TLV command is possible */ | ||
731 | #define SNDRV_CTL_ELEM_ACCESS_INACTIVE (1<<8) /* control does actually nothing, but may be updated */ | 735 | #define SNDRV_CTL_ELEM_ACCESS_INACTIVE (1<<8) /* control does actually nothing, but may be updated */ |
732 | #define SNDRV_CTL_ELEM_ACCESS_LOCK (1<<9) /* write lock */ | 736 | #define SNDRV_CTL_ELEM_ACCESS_LOCK (1<<9) /* write lock */ |
733 | #define SNDRV_CTL_ELEM_ACCESS_OWNER (1<<10) /* write lock owner */ | 737 | #define SNDRV_CTL_ELEM_ACCESS_OWNER (1<<10) /* write lock owner */ |
738 | #define SNDRV_CTL_ELEM_ACCESS_TLV_CALLBACK (1<<28) /* kernel use a TLV callback */ | ||
734 | #define SNDRV_CTL_ELEM_ACCESS_USER (1<<29) /* user space element */ | 739 | #define SNDRV_CTL_ELEM_ACCESS_USER (1<<29) /* user space element */ |
735 | #define SNDRV_CTL_ELEM_ACCESS_DINDIRECT (1<<30) /* indirect access for matrix dimensions in the info structure */ | 740 | #define SNDRV_CTL_ELEM_ACCESS_DINDIRECT (1<<30) /* indirect access for matrix dimensions in the info structure */ |
736 | #define SNDRV_CTL_ELEM_ACCESS_INDIRECT (1<<31) /* indirect access for element value in the value structure */ | 741 | #define SNDRV_CTL_ELEM_ACCESS_INDIRECT (1<<31) /* indirect access for element value in the value structure */ |
@@ -818,6 +823,12 @@ struct snd_ctl_elem_value { | |||
818 | unsigned char reserved[128-sizeof(struct timespec)]; | 823 | unsigned char reserved[128-sizeof(struct timespec)]; |
819 | }; | 824 | }; |
820 | 825 | ||
826 | struct snd_ctl_tlv { | ||
827 | unsigned int numid; /* control element numeric identification */ | ||
828 | unsigned int length; /* in bytes aligned to 4 */ | ||
829 | unsigned int tlv[0]; /* first TLV */ | ||
830 | }; | ||
831 | |||
821 | enum { | 832 | enum { |
822 | SNDRV_CTL_IOCTL_PVERSION = _IOR('U', 0x00, int), | 833 | SNDRV_CTL_IOCTL_PVERSION = _IOR('U', 0x00, int), |
823 | SNDRV_CTL_IOCTL_CARD_INFO = _IOR('U', 0x01, struct snd_ctl_card_info), | 834 | SNDRV_CTL_IOCTL_CARD_INFO = _IOR('U', 0x01, struct snd_ctl_card_info), |
@@ -831,6 +842,9 @@ enum { | |||
831 | SNDRV_CTL_IOCTL_ELEM_ADD = _IOWR('U', 0x17, struct snd_ctl_elem_info), | 842 | SNDRV_CTL_IOCTL_ELEM_ADD = _IOWR('U', 0x17, struct snd_ctl_elem_info), |
832 | SNDRV_CTL_IOCTL_ELEM_REPLACE = _IOWR('U', 0x18, struct snd_ctl_elem_info), | 843 | SNDRV_CTL_IOCTL_ELEM_REPLACE = _IOWR('U', 0x18, struct snd_ctl_elem_info), |
833 | SNDRV_CTL_IOCTL_ELEM_REMOVE = _IOWR('U', 0x19, struct snd_ctl_elem_id), | 844 | SNDRV_CTL_IOCTL_ELEM_REMOVE = _IOWR('U', 0x19, struct snd_ctl_elem_id), |
845 | SNDRV_CTL_IOCTL_TLV_READ = _IOWR('U', 0x1a, struct snd_ctl_tlv), | ||
846 | SNDRV_CTL_IOCTL_TLV_WRITE = _IOWR('U', 0x1b, struct snd_ctl_tlv), | ||
847 | SNDRV_CTL_IOCTL_TLV_COMMAND = _IOWR('U', 0x1c, struct snd_ctl_tlv), | ||
834 | SNDRV_CTL_IOCTL_HWDEP_NEXT_DEVICE = _IOWR('U', 0x20, int), | 848 | SNDRV_CTL_IOCTL_HWDEP_NEXT_DEVICE = _IOWR('U', 0x20, int), |
835 | SNDRV_CTL_IOCTL_HWDEP_INFO = _IOR('U', 0x21, struct snd_hwdep_info), | 849 | SNDRV_CTL_IOCTL_HWDEP_INFO = _IOR('U', 0x21, struct snd_hwdep_info), |
836 | SNDRV_CTL_IOCTL_PCM_NEXT_DEVICE = _IOR('U', 0x30, int), | 850 | SNDRV_CTL_IOCTL_PCM_NEXT_DEVICE = _IOR('U', 0x30, int), |
@@ -855,6 +869,7 @@ enum sndrv_ctl_event_type { | |||
855 | #define SNDRV_CTL_EVENT_MASK_VALUE (1<<0) /* element value was changed */ | 869 | #define SNDRV_CTL_EVENT_MASK_VALUE (1<<0) /* element value was changed */ |
856 | #define SNDRV_CTL_EVENT_MASK_INFO (1<<1) /* element info was changed */ | 870 | #define SNDRV_CTL_EVENT_MASK_INFO (1<<1) /* element info was changed */ |
857 | #define SNDRV_CTL_EVENT_MASK_ADD (1<<2) /* element was added */ | 871 | #define SNDRV_CTL_EVENT_MASK_ADD (1<<2) /* element was added */ |
872 | #define SNDRV_CTL_EVENT_MASK_TLV (1<<3) /* element TLV tree was changed */ | ||
858 | #define SNDRV_CTL_EVENT_MASK_REMOVE (~0U) /* element was removed */ | 873 | #define SNDRV_CTL_EVENT_MASK_REMOVE (~0U) /* element was removed */ |
859 | 874 | ||
860 | struct snd_ctl_event { | 875 | struct snd_ctl_event { |
diff --git a/include/sound/control.h b/include/sound/control.h index 2489b1eb0110..1de148b0fd94 100644 --- a/include/sound/control.h +++ b/include/sound/control.h | |||
@@ -30,6 +30,11 @@ struct snd_kcontrol; | |||
30 | typedef int (snd_kcontrol_info_t) (struct snd_kcontrol * kcontrol, struct snd_ctl_elem_info * uinfo); | 30 | typedef int (snd_kcontrol_info_t) (struct snd_kcontrol * kcontrol, struct snd_ctl_elem_info * uinfo); |
31 | typedef int (snd_kcontrol_get_t) (struct snd_kcontrol * kcontrol, struct snd_ctl_elem_value * ucontrol); | 31 | typedef int (snd_kcontrol_get_t) (struct snd_kcontrol * kcontrol, struct snd_ctl_elem_value * ucontrol); |
32 | typedef int (snd_kcontrol_put_t) (struct snd_kcontrol * kcontrol, struct snd_ctl_elem_value * ucontrol); | 32 | typedef int (snd_kcontrol_put_t) (struct snd_kcontrol * kcontrol, struct snd_ctl_elem_value * ucontrol); |
33 | typedef int (snd_kcontrol_tlv_rw_t)(struct snd_kcontrol *kcontrol, | ||
34 | int op_flag, /* 0=read,1=write,-1=command */ | ||
35 | unsigned int size, | ||
36 | unsigned int __user *tlv); | ||
37 | |||
33 | 38 | ||
34 | struct snd_kcontrol_new { | 39 | struct snd_kcontrol_new { |
35 | snd_ctl_elem_iface_t iface; /* interface identifier */ | 40 | snd_ctl_elem_iface_t iface; /* interface identifier */ |
@@ -42,6 +47,10 @@ struct snd_kcontrol_new { | |||
42 | snd_kcontrol_info_t *info; | 47 | snd_kcontrol_info_t *info; |
43 | snd_kcontrol_get_t *get; | 48 | snd_kcontrol_get_t *get; |
44 | snd_kcontrol_put_t *put; | 49 | snd_kcontrol_put_t *put; |
50 | union { | ||
51 | snd_kcontrol_tlv_rw_t *c; | ||
52 | unsigned int *p; | ||
53 | } tlv; | ||
45 | unsigned long private_value; | 54 | unsigned long private_value; |
46 | }; | 55 | }; |
47 | 56 | ||
@@ -58,6 +67,10 @@ struct snd_kcontrol { | |||
58 | snd_kcontrol_info_t *info; | 67 | snd_kcontrol_info_t *info; |
59 | snd_kcontrol_get_t *get; | 68 | snd_kcontrol_get_t *get; |
60 | snd_kcontrol_put_t *put; | 69 | snd_kcontrol_put_t *put; |
70 | union { | ||
71 | snd_kcontrol_tlv_rw_t *c; | ||
72 | unsigned int *p; | ||
73 | } tlv; | ||
61 | unsigned long private_value; | 74 | unsigned long private_value; |
62 | void *private_data; | 75 | void *private_data; |
63 | void (*private_free)(struct snd_kcontrol *kcontrol); | 76 | void (*private_free)(struct snd_kcontrol *kcontrol); |
diff --git a/include/sound/core.h b/include/sound/core.h index bab3ff457e40..b056ea925ecf 100644 --- a/include/sound/core.h +++ b/include/sound/core.h | |||
@@ -25,8 +25,8 @@ | |||
25 | #include <linux/sched.h> /* wake_up() */ | 25 | #include <linux/sched.h> /* wake_up() */ |
26 | #include <linux/mutex.h> /* struct mutex */ | 26 | #include <linux/mutex.h> /* struct mutex */ |
27 | #include <linux/rwsem.h> /* struct rw_semaphore */ | 27 | #include <linux/rwsem.h> /* struct rw_semaphore */ |
28 | #include <linux/workqueue.h> /* struct workqueue_struct */ | ||
29 | #include <linux/pm.h> /* pm_message_t */ | 28 | #include <linux/pm.h> /* pm_message_t */ |
29 | #include <linux/device.h> | ||
30 | 30 | ||
31 | /* forward declarations */ | 31 | /* forward declarations */ |
32 | #ifdef CONFIG_PCI | 32 | #ifdef CONFIG_PCI |
@@ -71,7 +71,6 @@ struct snd_device_ops { | |||
71 | int (*dev_free)(struct snd_device *dev); | 71 | int (*dev_free)(struct snd_device *dev); |
72 | int (*dev_register)(struct snd_device *dev); | 72 | int (*dev_register)(struct snd_device *dev); |
73 | int (*dev_disconnect)(struct snd_device *dev); | 73 | int (*dev_disconnect)(struct snd_device *dev); |
74 | int (*dev_unregister)(struct snd_device *dev); | ||
75 | }; | 74 | }; |
76 | 75 | ||
77 | struct snd_device { | 76 | struct snd_device { |
@@ -131,8 +130,8 @@ struct snd_card { | |||
131 | state */ | 130 | state */ |
132 | spinlock_t files_lock; /* lock the files for this card */ | 131 | spinlock_t files_lock; /* lock the files for this card */ |
133 | int shutdown; /* this card is going down */ | 132 | int shutdown; /* this card is going down */ |
133 | int free_on_last_close; /* free in context of file_release */ | ||
134 | wait_queue_head_t shutdown_sleep; | 134 | wait_queue_head_t shutdown_sleep; |
135 | struct work_struct free_workq; /* for free in workqueue */ | ||
136 | struct device *dev; | 135 | struct device *dev; |
137 | 136 | ||
138 | #ifdef CONFIG_PM | 137 | #ifdef CONFIG_PM |
@@ -188,6 +187,7 @@ struct snd_minor { | |||
188 | int device; /* device number */ | 187 | int device; /* device number */ |
189 | const struct file_operations *f_ops; /* file operations */ | 188 | const struct file_operations *f_ops; /* file operations */ |
190 | void *private_data; /* private data for f_ops->open */ | 189 | void *private_data; /* private data for f_ops->open */ |
190 | struct class_device *class_dev; /* class device for sysfs */ | ||
191 | }; | 191 | }; |
192 | 192 | ||
193 | /* sound.c */ | 193 | /* sound.c */ |
@@ -202,6 +202,8 @@ int snd_register_device(int type, struct snd_card *card, int dev, | |||
202 | const char *name); | 202 | const char *name); |
203 | int snd_unregister_device(int type, struct snd_card *card, int dev); | 203 | int snd_unregister_device(int type, struct snd_card *card, int dev); |
204 | void *snd_lookup_minor_data(unsigned int minor, int type); | 204 | void *snd_lookup_minor_data(unsigned int minor, int type); |
205 | int snd_add_device_sysfs_file(int type, struct snd_card *card, int dev, | ||
206 | const struct class_device_attribute *attr); | ||
205 | 207 | ||
206 | #ifdef CONFIG_SND_OSSEMUL | 208 | #ifdef CONFIG_SND_OSSEMUL |
207 | int snd_register_oss_device(int type, struct snd_card *card, int dev, | 209 | int snd_register_oss_device(int type, struct snd_card *card, int dev, |
@@ -244,7 +246,7 @@ struct snd_card *snd_card_new(int idx, const char *id, | |||
244 | struct module *module, int extra_size); | 246 | struct module *module, int extra_size); |
245 | int snd_card_disconnect(struct snd_card *card); | 247 | int snd_card_disconnect(struct snd_card *card); |
246 | int snd_card_free(struct snd_card *card); | 248 | int snd_card_free(struct snd_card *card); |
247 | int snd_card_free_in_thread(struct snd_card *card); | 249 | int snd_card_free_when_closed(struct snd_card *card); |
248 | int snd_card_register(struct snd_card *card); | 250 | int snd_card_register(struct snd_card *card); |
249 | int snd_card_info_init(void); | 251 | int snd_card_info_init(void); |
250 | int snd_card_info_done(void); | 252 | int snd_card_info_done(void); |
diff --git a/include/sound/emu10k1.h b/include/sound/emu10k1.h index 884bbf54cd36..892e310c504d 100644 --- a/include/sound/emu10k1.h +++ b/include/sound/emu10k1.h | |||
@@ -1524,6 +1524,10 @@ struct snd_emu10k1_fx8010_control_gpr { | |||
1524 | unsigned int value[32]; /* initial values */ | 1524 | unsigned int value[32]; /* initial values */ |
1525 | unsigned int min; /* minimum range */ | 1525 | unsigned int min; /* minimum range */ |
1526 | unsigned int max; /* maximum range */ | 1526 | unsigned int max; /* maximum range */ |
1527 | union { | ||
1528 | snd_kcontrol_tlv_rw_t *c; | ||
1529 | unsigned int *p; | ||
1530 | } tlv; | ||
1527 | unsigned int translation; /* translation type (EMU10K1_GPR_TRANSLATION*) */ | 1531 | unsigned int translation; /* translation type (EMU10K1_GPR_TRANSLATION*) */ |
1528 | }; | 1532 | }; |
1529 | 1533 | ||
diff --git a/include/sound/info.h b/include/sound/info.h index 74f6996769c7..97ffc4fb9969 100644 --- a/include/sound/info.h +++ b/include/sound/info.h | |||
@@ -71,7 +71,6 @@ struct snd_info_entry { | |||
71 | mode_t mode; | 71 | mode_t mode; |
72 | long size; | 72 | long size; |
73 | unsigned short content; | 73 | unsigned short content; |
74 | unsigned short disconnected: 1; | ||
75 | union { | 74 | union { |
76 | struct snd_info_entry_text text; | 75 | struct snd_info_entry_text text; |
77 | struct snd_info_entry_ops *ops; | 76 | struct snd_info_entry_ops *ops; |
@@ -83,6 +82,8 @@ struct snd_info_entry { | |||
83 | void (*private_free)(struct snd_info_entry *entry); | 82 | void (*private_free)(struct snd_info_entry *entry); |
84 | struct proc_dir_entry *p; | 83 | struct proc_dir_entry *p; |
85 | struct mutex access; | 84 | struct mutex access; |
85 | struct list_head children; | ||
86 | struct list_head list; | ||
86 | }; | 87 | }; |
87 | 88 | ||
88 | #if defined(CONFIG_SND_OSSEMUL) && defined(CONFIG_PROC_FS) | 89 | #if defined(CONFIG_SND_OSSEMUL) && defined(CONFIG_PROC_FS) |
@@ -122,8 +123,8 @@ int snd_info_restore_text(struct snd_info_entry * entry); | |||
122 | int snd_info_card_create(struct snd_card * card); | 123 | int snd_info_card_create(struct snd_card * card); |
123 | int snd_info_card_register(struct snd_card * card); | 124 | int snd_info_card_register(struct snd_card * card); |
124 | int snd_info_card_free(struct snd_card * card); | 125 | int snd_info_card_free(struct snd_card * card); |
126 | void snd_info_card_disconnect(struct snd_card * card); | ||
125 | int snd_info_register(struct snd_info_entry * entry); | 127 | int snd_info_register(struct snd_info_entry * entry); |
126 | int snd_info_unregister(struct snd_info_entry * entry); | ||
127 | 128 | ||
128 | /* for card drivers */ | 129 | /* for card drivers */ |
129 | int snd_card_proc_new(struct snd_card *card, const char *name, struct snd_info_entry **entryp); | 130 | int snd_card_proc_new(struct snd_card *card, const char *name, struct snd_info_entry **entryp); |
@@ -156,8 +157,8 @@ static inline void snd_info_free_entry(struct snd_info_entry * entry) { ; } | |||
156 | static inline int snd_info_card_create(struct snd_card * card) { return 0; } | 157 | static inline int snd_info_card_create(struct snd_card * card) { return 0; } |
157 | static inline int snd_info_card_register(struct snd_card * card) { return 0; } | 158 | static inline int snd_info_card_register(struct snd_card * card) { return 0; } |
158 | static inline int snd_info_card_free(struct snd_card * card) { return 0; } | 159 | static inline int snd_info_card_free(struct snd_card * card) { return 0; } |
160 | static inline void snd_info_card_disconnect(struct snd_card * card) { } | ||
159 | static inline int snd_info_register(struct snd_info_entry * entry) { return 0; } | 161 | static inline int snd_info_register(struct snd_info_entry * entry) { return 0; } |
160 | static inline int snd_info_unregister(struct snd_info_entry * entry) { return 0; } | ||
161 | 162 | ||
162 | static inline int snd_card_proc_new(struct snd_card *card, const char *name, | 163 | static inline int snd_card_proc_new(struct snd_card *card, const char *name, |
163 | struct snd_info_entry **entryp) { return -EINVAL; } | 164 | struct snd_info_entry **entryp) { return -EINVAL; } |
diff --git a/include/sound/pcm.h b/include/sound/pcm.h index f84d84993a31..60d40b34efc0 100644 --- a/include/sound/pcm.h +++ b/include/sound/pcm.h | |||
@@ -190,7 +190,7 @@ struct snd_pcm_ops { | |||
190 | 190 | ||
191 | struct snd_pcm_file { | 191 | struct snd_pcm_file { |
192 | struct snd_pcm_substream *substream; | 192 | struct snd_pcm_substream *substream; |
193 | struct snd_pcm_file *next; | 193 | int no_compat_mmap; |
194 | }; | 194 | }; |
195 | 195 | ||
196 | struct snd_pcm_hw_rule; | 196 | struct snd_pcm_hw_rule; |
@@ -384,7 +384,6 @@ struct snd_pcm_substream { | |||
384 | struct snd_info_entry *proc_prealloc_entry; | 384 | struct snd_info_entry *proc_prealloc_entry; |
385 | #endif | 385 | #endif |
386 | /* misc flags */ | 386 | /* misc flags */ |
387 | unsigned int no_mmap_ctrl: 1; | ||
388 | unsigned int hw_opened: 1; | 387 | unsigned int hw_opened: 1; |
389 | }; | 388 | }; |
390 | 389 | ||
@@ -402,7 +401,6 @@ struct snd_pcm_str { | |||
402 | /* -- OSS things -- */ | 401 | /* -- OSS things -- */ |
403 | struct snd_pcm_oss_stream oss; | 402 | struct snd_pcm_oss_stream oss; |
404 | #endif | 403 | #endif |
405 | struct snd_pcm_file *files; | ||
406 | #ifdef CONFIG_SND_VERBOSE_PROCFS | 404 | #ifdef CONFIG_SND_VERBOSE_PROCFS |
407 | struct snd_info_entry *proc_root; | 405 | struct snd_info_entry *proc_root; |
408 | struct snd_info_entry *proc_info_entry; | 406 | struct snd_info_entry *proc_info_entry; |
diff --git a/include/sound/timer.h b/include/sound/timer.h index 5ece2bf541dc..d42c083db1da 100644 --- a/include/sound/timer.h +++ b/include/sound/timer.h | |||
@@ -129,7 +129,6 @@ void snd_timer_notify(struct snd_timer *timer, int event, struct timespec *tstam | |||
129 | int snd_timer_global_new(char *id, int device, struct snd_timer **rtimer); | 129 | int snd_timer_global_new(char *id, int device, struct snd_timer **rtimer); |
130 | int snd_timer_global_free(struct snd_timer *timer); | 130 | int snd_timer_global_free(struct snd_timer *timer); |
131 | int snd_timer_global_register(struct snd_timer *timer); | 131 | int snd_timer_global_register(struct snd_timer *timer); |
132 | int snd_timer_global_unregister(struct snd_timer *timer); | ||
133 | 132 | ||
134 | int snd_timer_open(struct snd_timer_instance **ti, char *owner, struct snd_timer_id *tid, unsigned int slave_id); | 133 | int snd_timer_open(struct snd_timer_instance **ti, char *owner, struct snd_timer_id *tid, unsigned int slave_id); |
135 | int snd_timer_close(struct snd_timer_instance *timeri); | 134 | int snd_timer_close(struct snd_timer_instance *timeri); |
diff --git a/include/sound/tlv.h b/include/sound/tlv.h new file mode 100644 index 000000000000..d93a96b91875 --- /dev/null +++ b/include/sound/tlv.h | |||
@@ -0,0 +1,60 @@ | |||
1 | #ifndef __SOUND_TLV_H | ||
2 | #define __SOUND_TLV_H | ||
3 | |||
4 | /* | ||
5 | * Advanced Linux Sound Architecture - ALSA - Driver | ||
6 | * Copyright (c) 2006 by Jaroslav Kysela <perex@suse.cz> | ||
7 | * | ||
8 | * | ||
9 | * This program is free software; you can redistribute it and/or modify | ||
10 | * it under the terms of the GNU General Public License as published by | ||
11 | * the Free Software Foundation; either version 2 of the License, or | ||
12 | * (at your option) any later version. | ||
13 | * | ||
14 | * This program is distributed in the hope that it will be useful, | ||
15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
17 | * GNU General Public License for more details. | ||
18 | * | ||
19 | * You should have received a copy of the GNU General Public License | ||
20 | * along with this program; if not, write to the Free Software | ||
21 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
22 | * | ||
23 | */ | ||
24 | |||
25 | /* | ||
26 | * TLV structure is right behind the struct snd_ctl_tlv: | ||
27 | * unsigned int type - see SNDRV_CTL_TLVT_* | ||
28 | * unsigned int length | ||
29 | * .... data aligned to sizeof(unsigned int), use | ||
30 | * block_length = (length + (sizeof(unsigned int) - 1)) & | ||
31 | * ~(sizeof(unsigned int) - 1)) .... | ||
32 | */ | ||
33 | |||
34 | #define SNDRV_CTL_TLVT_CONTAINER 0 /* one level down - group of TLVs */ | ||
35 | #define SNDRV_CTL_TLVT_DB_SCALE 1 /* dB scale */ | ||
36 | #define SNDRV_CTL_TLVT_DB_LINEAR 2 /* linear volume */ | ||
37 | #define SNDRV_CTL_TLVT_DB_RANGE 3 /* dB range container */ | ||
38 | |||
39 | #define TLV_DB_SCALE_ITEM(min, step, mute) \ | ||
40 | SNDRV_CTL_TLVT_DB_SCALE, 2 * sizeof(unsigned int), \ | ||
41 | (min), ((step) & 0xffff) | ((mute) ? 0x10000 : 0) | ||
42 | #define DECLARE_TLV_DB_SCALE(name, min, step, mute) \ | ||
43 | unsigned int name[] = { TLV_DB_SCALE_ITEM(min, step, mute) } | ||
44 | |||
45 | /* linear volume between min_dB and max_dB (.01dB unit) */ | ||
46 | #define TLV_DB_LINEAR_ITEM(min_dB, max_dB) \ | ||
47 | SNDRV_CTL_TLVT_DB_LINEAR, 2 * sizeof(unsigned int), \ | ||
48 | (min_dB), (max_dB) | ||
49 | #define DECLARE_TLV_DB_LINEAR(name, min_dB, max_dB) \ | ||
50 | unsigned int name[] = { TLV_DB_LINEAR_ITEM(min_dB, max_dB) } | ||
51 | |||
52 | /* dB range container */ | ||
53 | /* Each item is: <min> <max> <TLV> */ | ||
54 | /* The below assumes that each item TLV is 4 words like DB_SCALE or LINEAR */ | ||
55 | #define TLV_DB_RANGE_HEAD(num) \ | ||
56 | SNDRV_CTL_TLVT_DB_RANGE, 6 * (num) * sizeof(unsigned int) | ||
57 | |||
58 | #define TLV_DB_GAIN_MUTE -9999999 | ||
59 | |||
60 | #endif /* __SOUND_TLV_H */ | ||
diff --git a/include/sound/vx_core.h b/include/sound/vx_core.h index 9821a6194caa..dbca14170615 100644 --- a/include/sound/vx_core.h +++ b/include/sound/vx_core.h | |||
@@ -128,6 +128,7 @@ struct snd_vx_hardware { | |||
128 | unsigned int num_ins; | 128 | unsigned int num_ins; |
129 | unsigned int num_outs; | 129 | unsigned int num_outs; |
130 | unsigned int output_level_max; | 130 | unsigned int output_level_max; |
131 | unsigned int *output_level_db_scale; | ||
131 | }; | 132 | }; |
132 | 133 | ||
133 | /* hwdep id string */ | 134 | /* hwdep id string */ |