diff options
Diffstat (limited to 'include')
292 files changed, 4136 insertions, 5317 deletions
diff --git a/include/asm-alpha/compiler.h b/include/asm-alpha/compiler.h index d2768cc3d7a4..da6bb199839c 100644 --- a/include/asm-alpha/compiler.h +++ b/include/asm-alpha/compiler.h | |||
@@ -17,9 +17,6 @@ | |||
17 | # define __kernel_extbl(val, shift) __builtin_alpha_extbl(val, shift) | 17 | # define __kernel_extbl(val, shift) __builtin_alpha_extbl(val, shift) |
18 | # define __kernel_extwl(val, shift) __builtin_alpha_extwl(val, shift) | 18 | # define __kernel_extwl(val, shift) __builtin_alpha_extwl(val, shift) |
19 | # define __kernel_cmpbge(a, b) __builtin_alpha_cmpbge(a, b) | 19 | # define __kernel_cmpbge(a, b) __builtin_alpha_cmpbge(a, b) |
20 | # define __kernel_cttz(x) __builtin_ctzl(x) | ||
21 | # define __kernel_ctlz(x) __builtin_clzl(x) | ||
22 | # define __kernel_ctpop(x) __builtin_popcountl(x) | ||
23 | #else | 20 | #else |
24 | # define __kernel_insbl(val, shift) \ | 21 | # define __kernel_insbl(val, shift) \ |
25 | ({ unsigned long __kir; \ | 22 | ({ unsigned long __kir; \ |
@@ -49,17 +46,39 @@ | |||
49 | ({ unsigned long __kir; \ | 46 | ({ unsigned long __kir; \ |
50 | __asm__("cmpbge %r2,%1,%0" : "=r"(__kir) : "rI"(b), "rJ"(a)); \ | 47 | __asm__("cmpbge %r2,%1,%0" : "=r"(__kir) : "rI"(b), "rJ"(a)); \ |
51 | __kir; }) | 48 | __kir; }) |
49 | #endif | ||
50 | |||
51 | #ifdef __alpha_cix__ | ||
52 | # if __GNUC__ == 3 && __GNUC_MINOR__ >= 4 || __GNUC__ > 3 | ||
53 | # define __kernel_cttz(x) __builtin_ctzl(x) | ||
54 | # define __kernel_ctlz(x) __builtin_clzl(x) | ||
55 | # define __kernel_ctpop(x) __builtin_popcountl(x) | ||
56 | # else | ||
57 | # define __kernel_cttz(x) \ | ||
58 | ({ unsigned long __kir; \ | ||
59 | __asm__("cttz %1,%0" : "=r"(__kir) : "r"(x)); \ | ||
60 | __kir; }) | ||
61 | # define __kernel_ctlz(x) \ | ||
62 | ({ unsigned long __kir; \ | ||
63 | __asm__("ctlz %1,%0" : "=r"(__kir) : "r"(x)); \ | ||
64 | __kir; }) | ||
65 | # define __kernel_ctpop(x) \ | ||
66 | ({ unsigned long __kir; \ | ||
67 | __asm__("ctpop %1,%0" : "=r"(__kir) : "r"(x)); \ | ||
68 | __kir; }) | ||
69 | # endif | ||
70 | #else | ||
52 | # define __kernel_cttz(x) \ | 71 | # define __kernel_cttz(x) \ |
53 | ({ unsigned long __kir; \ | 72 | ({ unsigned long __kir; \ |
54 | __asm__("cttz %1,%0" : "=r"(__kir) : "r"(x)); \ | 73 | __asm__(".arch ev67; cttz %1,%0" : "=r"(__kir) : "r"(x)); \ |
55 | __kir; }) | 74 | __kir; }) |
56 | # define __kernel_ctlz(x) \ | 75 | # define __kernel_ctlz(x) \ |
57 | ({ unsigned long __kir; \ | 76 | ({ unsigned long __kir; \ |
58 | __asm__("ctlz %1,%0" : "=r"(__kir) : "r"(x)); \ | 77 | __asm__(".arch ev67; ctlz %1,%0" : "=r"(__kir) : "r"(x)); \ |
59 | __kir; }) | 78 | __kir; }) |
60 | # define __kernel_ctpop(x) \ | 79 | # define __kernel_ctpop(x) \ |
61 | ({ unsigned long __kir; \ | 80 | ({ unsigned long __kir; \ |
62 | __asm__("ctpop %1,%0" : "=r"(__kir) : "r"(x)); \ | 81 | __asm__(".arch ev67; ctpop %1,%0" : "=r"(__kir) : "r"(x)); \ |
63 | __kir; }) | 82 | __kir; }) |
64 | #endif | 83 | #endif |
65 | 84 | ||
@@ -78,16 +97,20 @@ | |||
78 | #else | 97 | #else |
79 | #define __kernel_ldbu(mem) \ | 98 | #define __kernel_ldbu(mem) \ |
80 | ({ unsigned char __kir; \ | 99 | ({ unsigned char __kir; \ |
81 | __asm__("ldbu %0,%1" : "=r"(__kir) : "m"(mem)); \ | 100 | __asm__(".arch ev56; \ |
101 | ldbu %0,%1" : "=r"(__kir) : "m"(mem)); \ | ||
82 | __kir; }) | 102 | __kir; }) |
83 | #define __kernel_ldwu(mem) \ | 103 | #define __kernel_ldwu(mem) \ |
84 | ({ unsigned short __kir; \ | 104 | ({ unsigned short __kir; \ |
85 | __asm__("ldwu %0,%1" : "=r"(__kir) : "m"(mem)); \ | 105 | __asm__(".arch ev56; \ |
106 | ldwu %0,%1" : "=r"(__kir) : "m"(mem)); \ | ||
86 | __kir; }) | 107 | __kir; }) |
87 | #define __kernel_stb(val,mem) \ | 108 | #define __kernel_stb(val,mem) \ |
88 | __asm__("stb %1,%0" : "=m"(mem) : "r"(val)) | 109 | __asm__(".arch ev56; \ |
89 | #define __kernel_stw(val,mem) \ | 110 | stb %1,%0" : "=m"(mem) : "r"(val)) |
90 | __asm__("stw %1,%0" : "=m"(mem) : "r"(val)) | 111 | #define __kernel_stw(val,mem) \ |
112 | __asm__(".arch ev56; \ | ||
113 | stw %1,%0" : "=m"(mem) : "r"(val)) | ||
91 | #endif | 114 | #endif |
92 | 115 | ||
93 | #ifdef __KERNEL__ | 116 | #ifdef __KERNEL__ |
diff --git a/include/asm-alpha/core_mcpcia.h b/include/asm-alpha/core_mcpcia.h index 980a3c51b18e..525b4f6a7ace 100644 --- a/include/asm-alpha/core_mcpcia.h +++ b/include/asm-alpha/core_mcpcia.h | |||
@@ -72,6 +72,8 @@ | |||
72 | * | 72 | * |
73 | */ | 73 | */ |
74 | 74 | ||
75 | #define MCPCIA_MAX_HOSES 4 | ||
76 | |||
75 | #define MCPCIA_MID(m) ((unsigned long)(m) << 33) | 77 | #define MCPCIA_MID(m) ((unsigned long)(m) << 33) |
76 | 78 | ||
77 | /* Dodge has PCI0 and PCI1 at MID 4 and 5 respectively. | 79 | /* Dodge has PCI0 and PCI1 at MID 4 and 5 respectively. |
diff --git a/include/asm-alpha/io.h b/include/asm-alpha/io.h index 24bdcc8b63aa..21a86f1a05b3 100644 --- a/include/asm-alpha/io.h +++ b/include/asm-alpha/io.h | |||
@@ -113,6 +113,7 @@ static inline unsigned long virt_to_bus(void *address) | |||
113 | unsigned long bus = phys + __direct_map_base; | 113 | unsigned long bus = phys + __direct_map_base; |
114 | return phys <= __direct_map_size ? bus : 0; | 114 | return phys <= __direct_map_size ? bus : 0; |
115 | } | 115 | } |
116 | #define isa_virt_to_bus virt_to_bus | ||
116 | 117 | ||
117 | static inline void *bus_to_virt(unsigned long address) | 118 | static inline void *bus_to_virt(unsigned long address) |
118 | { | 119 | { |
diff --git a/include/asm-alpha/socket.h b/include/asm-alpha/socket.h index d22ab97ea72e..1fede7f92860 100644 --- a/include/asm-alpha/socket.h +++ b/include/asm-alpha/socket.h | |||
@@ -52,6 +52,8 @@ | |||
52 | 52 | ||
53 | #define SO_PEERSEC 30 | 53 | #define SO_PEERSEC 30 |
54 | #define SO_PASSSEC 34 | 54 | #define SO_PASSSEC 34 |
55 | #define SO_TIMESTAMPNS 35 | ||
56 | #define SCM_TIMESTAMPNS SO_TIMESTAMPNS | ||
55 | 57 | ||
56 | /* Security levels - as per NRL IPv6 - don't actually do anything */ | 58 | /* Security levels - as per NRL IPv6 - don't actually do anything */ |
57 | #define SO_SECURITY_AUTHENTICATION 19 | 59 | #define SO_SECURITY_AUTHENTICATION 19 |
diff --git a/include/asm-alpha/sockios.h b/include/asm-alpha/sockios.h index e4961a740e5f..7932c7ab4a4d 100644 --- a/include/asm-alpha/sockios.h +++ b/include/asm-alpha/sockios.h | |||
@@ -10,6 +10,7 @@ | |||
10 | #define SIOCSPGRP _IOW('s', 8, pid_t) | 10 | #define SIOCSPGRP _IOW('s', 8, pid_t) |
11 | #define SIOCGPGRP _IOR('s', 9, pid_t) | 11 | #define SIOCGPGRP _IOR('s', 9, pid_t) |
12 | 12 | ||
13 | #define SIOCGSTAMP 0x8906 /* Get stamp - linux-specific */ | 13 | #define SIOCGSTAMP 0x8906 /* Get stamp (timeval) */ |
14 | #define SIOCGSTAMPNS 0x8907 /* Get stamp (timespec) */ | ||
14 | 15 | ||
15 | #endif /* _ASM_ALPHA_SOCKIOS_H */ | 16 | #endif /* _ASM_ALPHA_SOCKIOS_H */ |
diff --git a/include/asm-alpha/string.h b/include/asm-alpha/string.h index 9e44fea669bf..b02b8a282940 100644 --- a/include/asm-alpha/string.h +++ b/include/asm-alpha/string.h | |||
@@ -61,8 +61,6 @@ extern void * __memsetw(void *dest, unsigned short, size_t count); | |||
61 | ? __constant_c_memset((s),0x0001000100010001UL*(unsigned short)(c),(n)) \ | 61 | ? __constant_c_memset((s),0x0001000100010001UL*(unsigned short)(c),(n)) \ |
62 | : __memsetw((s),(c),(n))) | 62 | : __memsetw((s),(c),(n))) |
63 | 63 | ||
64 | extern int strcasecmp(const char *, const char *); | ||
65 | |||
66 | #endif /* __KERNEL__ */ | 64 | #endif /* __KERNEL__ */ |
67 | 65 | ||
68 | #endif /* __ALPHA_STRING_H__ */ | 66 | #endif /* __ALPHA_STRING_H__ */ |
diff --git a/include/asm-arm/div64.h b/include/asm-arm/div64.h index 37e0a96e8789..0b5f881c3d85 100644 --- a/include/asm-arm/div64.h +++ b/include/asm-arm/div64.h | |||
@@ -2,6 +2,7 @@ | |||
2 | #define __ASM_ARM_DIV64 | 2 | #define __ASM_ARM_DIV64 |
3 | 3 | ||
4 | #include <asm/system.h> | 4 | #include <asm/system.h> |
5 | #include <linux/types.h> | ||
5 | 6 | ||
6 | /* | 7 | /* |
7 | * The semantics of do_div() are: | 8 | * The semantics of do_div() are: |
@@ -223,4 +224,6 @@ | |||
223 | 224 | ||
224 | #endif | 225 | #endif |
225 | 226 | ||
227 | extern uint64_t div64_64(uint64_t dividend, uint64_t divisor); | ||
228 | |||
226 | #endif | 229 | #endif |
diff --git a/include/asm-arm/socket.h b/include/asm-arm/socket.h index 19f7df702b06..65a1a64bf934 100644 --- a/include/asm-arm/socket.h +++ b/include/asm-arm/socket.h | |||
@@ -49,5 +49,7 @@ | |||
49 | 49 | ||
50 | #define SO_PEERSEC 31 | 50 | #define SO_PEERSEC 31 |
51 | #define SO_PASSSEC 34 | 51 | #define SO_PASSSEC 34 |
52 | #define SO_TIMESTAMPNS 35 | ||
53 | #define SCM_TIMESTAMPNS SO_TIMESTAMPNS | ||
52 | 54 | ||
53 | #endif /* _ASM_SOCKET_H */ | 55 | #endif /* _ASM_SOCKET_H */ |
diff --git a/include/asm-arm/sockios.h b/include/asm-arm/sockios.h index 77c34087d513..a2588a2512df 100644 --- a/include/asm-arm/sockios.h +++ b/include/asm-arm/sockios.h | |||
@@ -7,6 +7,7 @@ | |||
7 | #define FIOGETOWN 0x8903 | 7 | #define FIOGETOWN 0x8903 |
8 | #define SIOCGPGRP 0x8904 | 8 | #define SIOCGPGRP 0x8904 |
9 | #define SIOCATMARK 0x8905 | 9 | #define SIOCATMARK 0x8905 |
10 | #define SIOCGSTAMP 0x8906 /* Get stamp */ | 10 | #define SIOCGSTAMP 0x8906 /* Get stamp (timeval) */ |
11 | #define SIOCGSTAMPNS 0x8907 /* Get stamp (timespec) */ | ||
11 | 12 | ||
12 | #endif | 13 | #endif |
diff --git a/include/asm-arm26/socket.h b/include/asm-arm26/socket.h index 19f7df702b06..65a1a64bf934 100644 --- a/include/asm-arm26/socket.h +++ b/include/asm-arm26/socket.h | |||
@@ -49,5 +49,7 @@ | |||
49 | 49 | ||
50 | #define SO_PEERSEC 31 | 50 | #define SO_PEERSEC 31 |
51 | #define SO_PASSSEC 34 | 51 | #define SO_PASSSEC 34 |
52 | #define SO_TIMESTAMPNS 35 | ||
53 | #define SCM_TIMESTAMPNS SO_TIMESTAMPNS | ||
52 | 54 | ||
53 | #endif /* _ASM_SOCKET_H */ | 55 | #endif /* _ASM_SOCKET_H */ |
diff --git a/include/asm-arm26/sockios.h b/include/asm-arm26/sockios.h index 77c34087d513..a2588a2512df 100644 --- a/include/asm-arm26/sockios.h +++ b/include/asm-arm26/sockios.h | |||
@@ -7,6 +7,7 @@ | |||
7 | #define FIOGETOWN 0x8903 | 7 | #define FIOGETOWN 0x8903 |
8 | #define SIOCGPGRP 0x8904 | 8 | #define SIOCGPGRP 0x8904 |
9 | #define SIOCATMARK 0x8905 | 9 | #define SIOCATMARK 0x8905 |
10 | #define SIOCGSTAMP 0x8906 /* Get stamp */ | 10 | #define SIOCGSTAMP 0x8906 /* Get stamp (timeval) */ |
11 | #define SIOCGSTAMPNS 0x8907 /* Get stamp (timespec) */ | ||
11 | 12 | ||
12 | #endif | 13 | #endif |
diff --git a/include/asm-avr32/arch-at32ap/io.h b/include/asm-avr32/arch-at32ap/io.h new file mode 100644 index 000000000000..ee59e401f041 --- /dev/null +++ b/include/asm-avr32/arch-at32ap/io.h | |||
@@ -0,0 +1,39 @@ | |||
1 | #ifndef __ASM_AVR32_ARCH_AT32AP_IO_H | ||
2 | #define __ASM_AVR32_ARCH_AT32AP_IO_H | ||
3 | |||
4 | /* For "bizarre" halfword swapping */ | ||
5 | #include <linux/byteorder/swabb.h> | ||
6 | |||
7 | #if defined(CONFIG_AP7000_32_BIT_SMC) | ||
8 | # define __swizzle_addr_b(addr) (addr ^ 3UL) | ||
9 | # define __swizzle_addr_w(addr) (addr ^ 2UL) | ||
10 | # define __swizzle_addr_l(addr) (addr) | ||
11 | # define ioswabb(a, x) (x) | ||
12 | # define ioswabw(a, x) (x) | ||
13 | # define ioswabl(a, x) (x) | ||
14 | # define __mem_ioswabb(a, x) (x) | ||
15 | # define __mem_ioswabw(a, x) swab16(x) | ||
16 | # define __mem_ioswabl(a, x) swab32(x) | ||
17 | #elif defined(CONFIG_AP7000_16_BIT_SMC) | ||
18 | # define __swizzle_addr_b(addr) (addr ^ 1UL) | ||
19 | # define __swizzle_addr_w(addr) (addr) | ||
20 | # define __swizzle_addr_l(addr) (addr) | ||
21 | # define ioswabb(a, x) (x) | ||
22 | # define ioswabw(a, x) (x) | ||
23 | # define ioswabl(a, x) swahw32(x) | ||
24 | # define __mem_ioswabb(a, x) (x) | ||
25 | # define __mem_ioswabw(a, x) swab16(x) | ||
26 | # define __mem_ioswabl(a, x) swahb32(x) | ||
27 | #else | ||
28 | # define __swizzle_addr_b(addr) (addr) | ||
29 | # define __swizzle_addr_w(addr) (addr) | ||
30 | # define __swizzle_addr_l(addr) (addr) | ||
31 | # define ioswabb(a, x) (x) | ||
32 | # define ioswabw(a, x) swab16(x) | ||
33 | # define ioswabl(a, x) swab32(x) | ||
34 | # define __mem_ioswabb(a, x) (x) | ||
35 | # define __mem_ioswabw(a, x) (x) | ||
36 | # define __mem_ioswabl(a, x) (x) | ||
37 | #endif | ||
38 | |||
39 | #endif /* __ASM_AVR32_ARCH_AT32AP_IO_H */ | ||
diff --git a/include/asm-avr32/arch-at32ap/smc.h b/include/asm-avr32/arch-at32ap/smc.h index 3732b328303d..07152b7fd9c9 100644 --- a/include/asm-avr32/arch-at32ap/smc.h +++ b/include/asm-avr32/arch-at32ap/smc.h | |||
@@ -48,10 +48,32 @@ struct smc_config { | |||
48 | unsigned int nwe_controlled:1; | 48 | unsigned int nwe_controlled:1; |
49 | 49 | ||
50 | /* | 50 | /* |
51 | * 0: NWAIT is disabled | ||
52 | * 1: Reserved | ||
53 | * 2: NWAIT is frozen mode | ||
54 | * 3: NWAIT in ready mode | ||
55 | */ | ||
56 | unsigned int nwait_mode:2; | ||
57 | |||
58 | /* | ||
51 | * 0: Byte select access type | 59 | * 0: Byte select access type |
52 | * 1: Byte write access type | 60 | * 1: Byte write access type |
53 | */ | 61 | */ |
54 | unsigned int byte_write:1; | 62 | unsigned int byte_write:1; |
63 | |||
64 | /* | ||
65 | * Number of clock cycles before data is released after | ||
66 | * the rising edge of the read controlling signal | ||
67 | * | ||
68 | * Total cycles from SMC is tdf_cycles + 1 | ||
69 | */ | ||
70 | unsigned int tdf_cycles:4; | ||
71 | |||
72 | /* | ||
73 | * 0: TDF optimization disabled | ||
74 | * 1: TDF optimization enabled | ||
75 | */ | ||
76 | unsigned int tdf_mode:1; | ||
55 | }; | 77 | }; |
56 | 78 | ||
57 | extern int smc_set_configuration(int cs, const struct smc_config *config); | 79 | extern int smc_set_configuration(int cs, const struct smc_config *config); |
diff --git a/include/asm-avr32/arch-at32ap/time.h b/include/asm-avr32/arch-at32ap/time.h new file mode 100644 index 000000000000..cc8a43418a4d --- /dev/null +++ b/include/asm-avr32/arch-at32ap/time.h | |||
@@ -0,0 +1,112 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2007 Atmel 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 version 2 as | ||
6 | * published by the Free Software Foundation. | ||
7 | */ | ||
8 | |||
9 | #ifndef _ASM_AVR32_ARCH_AT32AP_TIME_H | ||
10 | #define _ASM_AVR32_ARCH_AT32AP_TIME_H | ||
11 | |||
12 | #include <linux/platform_device.h> | ||
13 | |||
14 | extern struct irqaction timer_irqaction; | ||
15 | extern struct platform_device at32_systc0_device; | ||
16 | extern void local_timer_interrupt(int irq, void *dev_id); | ||
17 | |||
18 | #define TIMER_BCR 0x000000c0 | ||
19 | #define TIMER_BCR_SYNC 0 | ||
20 | #define TIMER_BMR 0x000000c4 | ||
21 | #define TIMER_BMR_TC0XC0S 0 | ||
22 | #define TIMER_BMR_TC1XC1S 2 | ||
23 | #define TIMER_BMR_TC2XC2S 4 | ||
24 | #define TIMER_CCR 0x00000000 | ||
25 | #define TIMER_CCR_CLKDIS 1 | ||
26 | #define TIMER_CCR_CLKEN 0 | ||
27 | #define TIMER_CCR_SWTRG 2 | ||
28 | #define TIMER_CMR 0x00000004 | ||
29 | #define TIMER_CMR_ABETRG 10 | ||
30 | #define TIMER_CMR_ACPA 16 | ||
31 | #define TIMER_CMR_ACPC 18 | ||
32 | #define TIMER_CMR_AEEVT 20 | ||
33 | #define TIMER_CMR_ASWTRG 22 | ||
34 | #define TIMER_CMR_BCPB 24 | ||
35 | #define TIMER_CMR_BCPC 26 | ||
36 | #define TIMER_CMR_BEEVT 28 | ||
37 | #define TIMER_CMR_BSWTRG 30 | ||
38 | #define TIMER_CMR_BURST 4 | ||
39 | #define TIMER_CMR_CLKI 3 | ||
40 | #define TIMER_CMR_CPCDIS 7 | ||
41 | #define TIMER_CMR_CPCSTOP 6 | ||
42 | #define TIMER_CMR_CPCTRG 14 | ||
43 | #define TIMER_CMR_EEVT 10 | ||
44 | #define TIMER_CMR_EEVTEDG 8 | ||
45 | #define TIMER_CMR_ENETRG 12 | ||
46 | #define TIMER_CMR_ETRGEDG 8 | ||
47 | #define TIMER_CMR_LDBDIS 7 | ||
48 | #define TIMER_CMR_LDBSTOP 6 | ||
49 | #define TIMER_CMR_LDRA 16 | ||
50 | #define TIMER_CMR_LDRB 18 | ||
51 | #define TIMER_CMR_TCCLKS 0 | ||
52 | #define TIMER_CMR_WAVE 15 | ||
53 | #define TIMER_CMR_WAVSEL 13 | ||
54 | #define TIMER_CV 0x00000010 | ||
55 | #define TIMER_CV_CV 0 | ||
56 | #define TIMER_IDR 0x00000028 | ||
57 | #define TIMER_IDR_COVFS 0 | ||
58 | #define TIMER_IDR_CPAS 2 | ||
59 | #define TIMER_IDR_CPBS 3 | ||
60 | #define TIMER_IDR_CPCS 4 | ||
61 | #define TIMER_IDR_ETRGS 7 | ||
62 | #define TIMER_IDR_LDRAS 5 | ||
63 | #define TIMER_IDR_LDRBS 6 | ||
64 | #define TIMER_IDR_LOVRS 1 | ||
65 | #define TIMER_IER 0x00000024 | ||
66 | #define TIMER_IER_COVFS 0 | ||
67 | #define TIMER_IER_CPAS 2 | ||
68 | #define TIMER_IER_CPBS 3 | ||
69 | #define TIMER_IER_CPCS 4 | ||
70 | #define TIMER_IER_ETRGS 7 | ||
71 | #define TIMER_IER_LDRAS 5 | ||
72 | #define TIMER_IER_LDRBS 6 | ||
73 | #define TIMER_IER_LOVRS 1 | ||
74 | #define TIMER_IMR 0x0000002c | ||
75 | #define TIMER_IMR_COVFS 0 | ||
76 | #define TIMER_IMR_CPAS 2 | ||
77 | #define TIMER_IMR_CPBS 3 | ||
78 | #define TIMER_IMR_CPCS 4 | ||
79 | #define TIMER_IMR_ETRGS 7 | ||
80 | #define TIMER_IMR_LDRAS 5 | ||
81 | #define TIMER_IMR_LDRBS 6 | ||
82 | #define TIMER_IMR_LOVRS 1 | ||
83 | #define TIMER_RA 0x00000014 | ||
84 | #define TIMER_RA_RA 0 | ||
85 | #define TIMER_RB 0x00000018 | ||
86 | #define TIMER_RB_RB 0 | ||
87 | #define TIMER_RC 0x0000001c | ||
88 | #define TIMER_RC_RC 0 | ||
89 | #define TIMER_SR 0x00000020 | ||
90 | #define TIMER_SR_CLKSTA 16 | ||
91 | #define TIMER_SR_COVFS 0 | ||
92 | #define TIMER_SR_CPAS 2 | ||
93 | #define TIMER_SR_CPBS 3 | ||
94 | #define TIMER_SR_CPCS 4 | ||
95 | #define TIMER_SR_ETRGS 7 | ||
96 | #define TIMER_SR_LDRAS 5 | ||
97 | #define TIMER_SR_LDRBS 6 | ||
98 | #define TIMER_SR_LOVRS 1 | ||
99 | #define TIMER_SR_MTIOA 17 | ||
100 | #define TIMER_SR_MTIOB 18 | ||
101 | |||
102 | /* Bit manipulation macros */ | ||
103 | #define TIMER_BIT(name) (1 << TIMER_##name) | ||
104 | #define TIMER_BF(name,value) ((value) << TIMER_##name) | ||
105 | |||
106 | /* Register access macros */ | ||
107 | #define timer_read(port,instance,reg) \ | ||
108 | __raw_readl(port + (0x40 * instance) + TIMER_##reg) | ||
109 | #define timer_write(port,instance,reg,value) \ | ||
110 | __raw_writel((value), port + (0x40 * instance) + TIMER_##reg) | ||
111 | |||
112 | #endif /* _ASM_AVR32_ARCH_AT32AP_TIME_H */ | ||
diff --git a/include/asm-avr32/atomic.h b/include/asm-avr32/atomic.h index c40b6032c480..b9c2548a52f3 100644 --- a/include/asm-avr32/atomic.h +++ b/include/asm-avr32/atomic.h | |||
@@ -173,7 +173,7 @@ static inline int atomic_sub_if_positive(int i, atomic_t *v) | |||
173 | } | 173 | } |
174 | 174 | ||
175 | #define atomic_xchg(v, new) (xchg(&((v)->counter), new)) | 175 | #define atomic_xchg(v, new) (xchg(&((v)->counter), new)) |
176 | #define atomic_cmpxchg(v, o, n) ((int)cmpxchg(&((v)->counter), (o), (n))) | 176 | #define atomic_cmpxchg(v, o, n) (cmpxchg(&((v)->counter), (o), (n))) |
177 | 177 | ||
178 | #define atomic_sub(i, v) (void)atomic_sub_return(i, v) | 178 | #define atomic_sub(i, v) (void)atomic_sub_return(i, v) |
179 | #define atomic_add(i, v) (void)atomic_add_return(i, v) | 179 | #define atomic_add(i, v) (void)atomic_add_return(i, v) |
diff --git a/include/asm-avr32/bug.h b/include/asm-avr32/bug.h index 521766bc9366..afdcd79a2966 100644 --- a/include/asm-avr32/bug.h +++ b/include/asm-avr32/bug.h | |||
@@ -18,27 +18,53 @@ | |||
18 | 18 | ||
19 | #ifdef CONFIG_DEBUG_BUGVERBOSE | 19 | #ifdef CONFIG_DEBUG_BUGVERBOSE |
20 | 20 | ||
21 | #define BUG() \ | 21 | #define _BUG_OR_WARN(flags) \ |
22 | do { \ | 22 | asm volatile( \ |
23 | asm volatile(".hword %0\n\t" \ | 23 | "1: .hword %0\n" \ |
24 | ".hword %1\n\t" \ | 24 | " .section __bug_table,\"a\",@progbits\n" \ |
25 | ".long %2" \ | 25 | "2: .long 1b\n" \ |
26 | : \ | 26 | " .long %1\n" \ |
27 | : "n"(AVR32_BUG_OPCODE), \ | 27 | " .short %2\n" \ |
28 | "i"(__LINE__), "X"(__FILE__)); \ | 28 | " .short %3\n" \ |
29 | } while (0) | 29 | " .org 2b + %4\n" \ |
30 | " .previous" \ | ||
31 | : \ | ||
32 | : "i"(AVR32_BUG_OPCODE), "i"(__FILE__), \ | ||
33 | "i"(__LINE__), "i"(flags), \ | ||
34 | "i"(sizeof(struct bug_entry))) | ||
30 | 35 | ||
31 | #else | 36 | #else |
32 | 37 | ||
38 | #define _BUG_OR_WARN(flags) \ | ||
39 | asm volatile( \ | ||
40 | "1: .hword %0\n" \ | ||
41 | " .section __bug_table,\"a\",@progbits\n" \ | ||
42 | "2: .long 1b\n" \ | ||
43 | " .short %1\n" \ | ||
44 | " .org 2b + %2\n" \ | ||
45 | " .previous" \ | ||
46 | : \ | ||
47 | : "i"(AVR32_BUG_OPCODE), "i"(flags), \ | ||
48 | "i"(sizeof(struct bug_entry))) | ||
49 | |||
50 | #endif /* CONFIG_DEBUG_BUGVERBOSE */ | ||
51 | |||
33 | #define BUG() \ | 52 | #define BUG() \ |
34 | do { \ | 53 | do { \ |
35 | asm volatile(".hword %0\n\t" \ | 54 | _BUG_OR_WARN(0); \ |
36 | : : "n"(AVR32_BUG_OPCODE)); \ | 55 | for (;;); \ |
37 | } while (0) | 56 | } while (0) |
38 | 57 | ||
39 | #endif /* CONFIG_DEBUG_BUGVERBOSE */ | 58 | #define WARN_ON(condition) \ |
59 | ({ \ | ||
60 | typeof(condition) __ret_warn_on = (condition); \ | ||
61 | if (unlikely(__ret_warn_on)) \ | ||
62 | _BUG_OR_WARN(BUGFLAG_WARNING); \ | ||
63 | unlikely(__ret_warn_on); \ | ||
64 | }) | ||
40 | 65 | ||
41 | #define HAVE_ARCH_BUG | 66 | #define HAVE_ARCH_BUG |
67 | #define HAVE_ARCH_WARN_ON | ||
42 | 68 | ||
43 | #endif /* CONFIG_BUG */ | 69 | #endif /* CONFIG_BUG */ |
44 | 70 | ||
diff --git a/include/asm-avr32/io.h b/include/asm-avr32/io.h index c08e81048393..e30d4b3bd836 100644 --- a/include/asm-avr32/io.h +++ b/include/asm-avr32/io.h | |||
@@ -1,13 +1,15 @@ | |||
1 | #ifndef __ASM_AVR32_IO_H | 1 | #ifndef __ASM_AVR32_IO_H |
2 | #define __ASM_AVR32_IO_H | 2 | #define __ASM_AVR32_IO_H |
3 | 3 | ||
4 | #include <linux/kernel.h> | ||
4 | #include <linux/string.h> | 5 | #include <linux/string.h> |
5 | 6 | #include <linux/types.h> | |
6 | #ifdef __KERNEL__ | ||
7 | 7 | ||
8 | #include <asm/addrspace.h> | 8 | #include <asm/addrspace.h> |
9 | #include <asm/byteorder.h> | 9 | #include <asm/byteorder.h> |
10 | 10 | ||
11 | #include <asm/arch/io.h> | ||
12 | |||
11 | /* virt_to_phys will only work when address is in P1 or P2 */ | 13 | /* virt_to_phys will only work when address is in P1 or P2 */ |
12 | static __inline__ unsigned long virt_to_phys(volatile void *address) | 14 | static __inline__ unsigned long virt_to_phys(volatile void *address) |
13 | { | 15 | { |
@@ -36,104 +38,215 @@ extern void __raw_readsb(const void __iomem *addr, void *data, int bytelen); | |||
36 | extern void __raw_readsw(const void __iomem *addr, void *data, int wordlen); | 38 | extern void __raw_readsw(const void __iomem *addr, void *data, int wordlen); |
37 | extern void __raw_readsl(const void __iomem *addr, void *data, int longlen); | 39 | extern void __raw_readsl(const void __iomem *addr, void *data, int longlen); |
38 | 40 | ||
39 | static inline void writeb(unsigned char b, volatile void __iomem *addr) | 41 | static inline void __raw_writeb(u8 v, volatile void __iomem *addr) |
40 | { | 42 | { |
41 | *(volatile unsigned char __force *)addr = b; | 43 | *(volatile u8 __force *)addr = v; |
42 | } | 44 | } |
43 | static inline void writew(unsigned short b, volatile void __iomem *addr) | 45 | static inline void __raw_writew(u16 v, volatile void __iomem *addr) |
44 | { | 46 | { |
45 | *(volatile unsigned short __force *)addr = b; | 47 | *(volatile u16 __force *)addr = v; |
46 | } | 48 | } |
47 | static inline void writel(unsigned int b, volatile void __iomem *addr) | 49 | static inline void __raw_writel(u32 v, volatile void __iomem *addr) |
48 | { | 50 | { |
49 | *(volatile unsigned int __force *)addr = b; | 51 | *(volatile u32 __force *)addr = v; |
50 | } | 52 | } |
51 | #define __raw_writeb writeb | ||
52 | #define __raw_writew writew | ||
53 | #define __raw_writel writel | ||
54 | 53 | ||
55 | static inline unsigned char readb(const volatile void __iomem *addr) | 54 | static inline u8 __raw_readb(const volatile void __iomem *addr) |
56 | { | 55 | { |
57 | return *(const volatile unsigned char __force *)addr; | 56 | return *(const volatile u8 __force *)addr; |
58 | } | 57 | } |
59 | static inline unsigned short readw(const volatile void __iomem *addr) | 58 | static inline u16 __raw_readw(const volatile void __iomem *addr) |
60 | { | 59 | { |
61 | return *(const volatile unsigned short __force *)addr; | 60 | return *(const volatile u16 __force *)addr; |
62 | } | 61 | } |
63 | static inline unsigned int readl(const volatile void __iomem *addr) | 62 | static inline u32 __raw_readl(const volatile void __iomem *addr) |
64 | { | 63 | { |
65 | return *(const volatile unsigned int __force *)addr; | 64 | return *(const volatile u32 __force *)addr; |
65 | } | ||
66 | |||
67 | /* Convert I/O port address to virtual address */ | ||
68 | #ifndef __io | ||
69 | # define __io(p) ((void *)phys_to_uncached(p)) | ||
70 | #endif | ||
71 | |||
72 | /* | ||
73 | * Not really sure about the best way to slow down I/O on | ||
74 | * AVR32. Defining it as a no-op until we have an actual test case. | ||
75 | */ | ||
76 | #define SLOW_DOWN_IO do { } while (0) | ||
77 | |||
78 | #define __BUILD_MEMORY_SINGLE(pfx, bwl, type) \ | ||
79 | static inline void \ | ||
80 | pfx##write##bwl(type val, volatile void __iomem *addr) \ | ||
81 | { \ | ||
82 | volatile type *__addr; \ | ||
83 | type __val; \ | ||
84 | \ | ||
85 | __addr = (void *)__swizzle_addr_##bwl((unsigned long)(addr)); \ | ||
86 | __val = pfx##ioswab##bwl(__addr, val); \ | ||
87 | \ | ||
88 | BUILD_BUG_ON(sizeof(type) > sizeof(unsigned long)); \ | ||
89 | \ | ||
90 | *__addr = __val; \ | ||
91 | } \ | ||
92 | \ | ||
93 | static inline type pfx##read##bwl(const volatile void __iomem *addr) \ | ||
94 | { \ | ||
95 | volatile type *__addr; \ | ||
96 | type __val; \ | ||
97 | \ | ||
98 | __addr = (void *)__swizzle_addr_##bwl((unsigned long)(addr)); \ | ||
99 | \ | ||
100 | BUILD_BUG_ON(sizeof(type) > sizeof(unsigned long)); \ | ||
101 | \ | ||
102 | __val = *__addr; \ | ||
103 | return pfx##ioswab##bwl(__addr, __val); \ | ||
104 | } | ||
105 | |||
106 | #define __BUILD_IOPORT_SINGLE(pfx, bwl, type, p, slow) \ | ||
107 | static inline void pfx##out##bwl##p(type val, unsigned long port) \ | ||
108 | { \ | ||
109 | volatile type *__addr; \ | ||
110 | type __val; \ | ||
111 | \ | ||
112 | __addr = __io(__swizzle_addr_##bwl(port)); \ | ||
113 | __val = pfx##ioswab##bwl(__addr, val); \ | ||
114 | \ | ||
115 | BUILD_BUG_ON(sizeof(type) > sizeof(unsigned long)); \ | ||
116 | \ | ||
117 | *__addr = __val; \ | ||
118 | slow; \ | ||
119 | } \ | ||
120 | \ | ||
121 | static inline type pfx##in##bwl##p(unsigned long port) \ | ||
122 | { \ | ||
123 | volatile type *__addr; \ | ||
124 | type __val; \ | ||
125 | \ | ||
126 | __addr = __io(__swizzle_addr_##bwl(port)); \ | ||
127 | \ | ||
128 | BUILD_BUG_ON(sizeof(type) > sizeof(unsigned long)); \ | ||
129 | \ | ||
130 | __val = *__addr; \ | ||
131 | slow; \ | ||
132 | \ | ||
133 | return pfx##ioswab##bwl(__addr, __val); \ | ||
134 | } | ||
135 | |||
136 | #define __BUILD_MEMORY_PFX(bus, bwl, type) \ | ||
137 | __BUILD_MEMORY_SINGLE(bus, bwl, type) | ||
138 | |||
139 | #define BUILDIO_MEM(bwl, type) \ | ||
140 | __BUILD_MEMORY_PFX(, bwl, type) \ | ||
141 | __BUILD_MEMORY_PFX(__mem_, bwl, type) | ||
142 | |||
143 | #define __BUILD_IOPORT_PFX(bus, bwl, type) \ | ||
144 | __BUILD_IOPORT_SINGLE(bus, bwl, type, ,) \ | ||
145 | __BUILD_IOPORT_SINGLE(bus, bwl, type, _p, SLOW_DOWN_IO) | ||
146 | |||
147 | #define BUILDIO_IOPORT(bwl, type) \ | ||
148 | __BUILD_IOPORT_PFX(, bwl, type) \ | ||
149 | __BUILD_IOPORT_PFX(__mem_, bwl, type) | ||
150 | |||
151 | BUILDIO_MEM(b, u8) | ||
152 | BUILDIO_MEM(w, u16) | ||
153 | BUILDIO_MEM(l, u32) | ||
154 | |||
155 | BUILDIO_IOPORT(b, u8) | ||
156 | BUILDIO_IOPORT(w, u16) | ||
157 | BUILDIO_IOPORT(l, u32) | ||
158 | |||
159 | #define readb_relaxed readb | ||
160 | #define readw_relaxed readw | ||
161 | #define readl_relaxed readl | ||
162 | |||
163 | #define __BUILD_MEMORY_STRING(bwl, type) \ | ||
164 | static inline void writes##bwl(volatile void __iomem *addr, \ | ||
165 | const void *data, unsigned int count) \ | ||
166 | { \ | ||
167 | const type *__data = data; \ | ||
168 | \ | ||
169 | while (count--) \ | ||
170 | __mem_write##bwl(*__data++, addr); \ | ||
171 | } \ | ||
172 | \ | ||
173 | static inline void reads##bwl(const volatile void __iomem *addr, \ | ||
174 | void *data, unsigned int count) \ | ||
175 | { \ | ||
176 | type *__data = data; \ | ||
177 | \ | ||
178 | while (count--) \ | ||
179 | *__data++ = __mem_read##bwl(addr); \ | ||
66 | } | 180 | } |
67 | #define __raw_readb readb | ||
68 | #define __raw_readw readw | ||
69 | #define __raw_readl readl | ||
70 | 181 | ||
71 | #define writesb(p, d, l) __raw_writesb((unsigned int)p, d, l) | 182 | #define __BUILD_IOPORT_STRING(bwl, type) \ |
72 | #define writesw(p, d, l) __raw_writesw((unsigned int)p, d, l) | 183 | static inline void outs##bwl(unsigned long port, const void *data, \ |
73 | #define writesl(p, d, l) __raw_writesl((unsigned int)p, d, l) | 184 | unsigned int count) \ |
185 | { \ | ||
186 | const type *__data = data; \ | ||
187 | \ | ||
188 | while (count--) \ | ||
189 | __mem_out##bwl(*__data++, port); \ | ||
190 | } \ | ||
191 | \ | ||
192 | static inline void ins##bwl(unsigned long port, void *data, \ | ||
193 | unsigned int count) \ | ||
194 | { \ | ||
195 | type *__data = data; \ | ||
196 | \ | ||
197 | while (count--) \ | ||
198 | *__data++ = __mem_in##bwl(port); \ | ||
199 | } | ||
74 | 200 | ||
75 | #define readsb(p, d, l) __raw_readsb((unsigned int)p, d, l) | 201 | #define BUILDSTRING(bwl, type) \ |
76 | #define readsw(p, d, l) __raw_readsw((unsigned int)p, d, l) | 202 | __BUILD_MEMORY_STRING(bwl, type) \ |
77 | #define readsl(p, d, l) __raw_readsl((unsigned int)p, d, l) | 203 | __BUILD_IOPORT_STRING(bwl, type) |
78 | 204 | ||
205 | BUILDSTRING(b, u8) | ||
206 | BUILDSTRING(w, u16) | ||
207 | BUILDSTRING(l, u32) | ||
79 | 208 | ||
80 | /* | 209 | /* |
81 | * io{read,write}{8,16,32} macros in both le (for PCI style consumers) and native be | 210 | * io{read,write}{8,16,32} macros in both le (for PCI style consumers) and native be |
82 | */ | 211 | */ |
83 | #ifndef ioread8 | 212 | #ifndef ioread8 |
84 | 213 | ||
85 | #define ioread8(p) ({ unsigned int __v = __raw_readb(p); __v; }) | 214 | #define ioread8(p) ((unsigned int)readb(p)) |
86 | 215 | ||
87 | #define ioread16(p) ({ unsigned int __v = le16_to_cpu(__raw_readw(p)); __v; }) | 216 | #define ioread16(p) ((unsigned int)readw(p)) |
88 | #define ioread16be(p) ({ unsigned int __v = be16_to_cpu(__raw_readw(p)); __v; }) | 217 | #define ioread16be(p) ((unsigned int)__raw_readw(p)) |
89 | 218 | ||
90 | #define ioread32(p) ({ unsigned int __v = le32_to_cpu(__raw_readl(p)); __v; }) | 219 | #define ioread32(p) ((unsigned int)readl(p)) |
91 | #define ioread32be(p) ({ unsigned int __v = be32_to_cpu(__raw_readl(p)); __v; }) | 220 | #define ioread32be(p) ((unsigned int)__raw_readl(p)) |
92 | 221 | ||
93 | #define iowrite8(v,p) __raw_writeb(v, p) | 222 | #define iowrite8(v,p) writeb(v, p) |
94 | 223 | ||
95 | #define iowrite16(v,p) __raw_writew(cpu_to_le16(v), p) | 224 | #define iowrite16(v,p) writew(v, p) |
96 | #define iowrite16be(v,p) __raw_writew(cpu_to_be16(v), p) | 225 | #define iowrite16be(v,p) __raw_writew(v, p) |
97 | 226 | ||
98 | #define iowrite32(v,p) __raw_writel(cpu_to_le32(v), p) | 227 | #define iowrite32(v,p) writel(v, p) |
99 | #define iowrite32be(v,p) __raw_writel(cpu_to_be32(v), p) | 228 | #define iowrite32be(v,p) __raw_writel(v, p) |
100 | 229 | ||
101 | #define ioread8_rep(p,d,c) __raw_readsb(p,d,c) | 230 | #define ioread8_rep(p,d,c) readsb(p,d,c) |
102 | #define ioread16_rep(p,d,c) __raw_readsw(p,d,c) | 231 | #define ioread16_rep(p,d,c) readsw(p,d,c) |
103 | #define ioread32_rep(p,d,c) __raw_readsl(p,d,c) | 232 | #define ioread32_rep(p,d,c) readsl(p,d,c) |
104 | 233 | ||
105 | #define iowrite8_rep(p,s,c) __raw_writesb(p,s,c) | 234 | #define iowrite8_rep(p,s,c) writesb(p,s,c) |
106 | #define iowrite16_rep(p,s,c) __raw_writesw(p,s,c) | 235 | #define iowrite16_rep(p,s,c) writesw(p,s,c) |
107 | #define iowrite32_rep(p,s,c) __raw_writesl(p,s,c) | 236 | #define iowrite32_rep(p,s,c) writesl(p,s,c) |
108 | 237 | ||
109 | #endif | 238 | #endif |
110 | 239 | ||
111 | |||
112 | /* | ||
113 | * These two are only here because ALSA _thinks_ it needs them... | ||
114 | */ | ||
115 | static inline void memcpy_fromio(void * to, const volatile void __iomem *from, | 240 | static inline void memcpy_fromio(void * to, const volatile void __iomem *from, |
116 | unsigned long count) | 241 | unsigned long count) |
117 | { | 242 | { |
118 | char *p = to; | 243 | memcpy(to, (const void __force *)from, count); |
119 | while (count) { | ||
120 | count--; | ||
121 | *p = readb(from); | ||
122 | p++; | ||
123 | from++; | ||
124 | } | ||
125 | } | 244 | } |
126 | 245 | ||
127 | static inline void memcpy_toio(volatile void __iomem *to, const void * from, | 246 | static inline void memcpy_toio(volatile void __iomem *to, const void * from, |
128 | unsigned long count) | 247 | unsigned long count) |
129 | { | 248 | { |
130 | const char *p = from; | 249 | memcpy((void __force *)to, from, count); |
131 | while (count) { | ||
132 | count--; | ||
133 | writeb(*p, to); | ||
134 | p++; | ||
135 | to++; | ||
136 | } | ||
137 | } | 250 | } |
138 | 251 | ||
139 | static inline void memset_io(volatile void __iomem *addr, unsigned char val, | 252 | static inline void memset_io(volatile void __iomem *addr, unsigned char val, |
@@ -142,99 +255,8 @@ static inline void memset_io(volatile void __iomem *addr, unsigned char val, | |||
142 | memset((void __force *)addr, val, count); | 255 | memset((void __force *)addr, val, count); |
143 | } | 256 | } |
144 | 257 | ||
145 | /* | ||
146 | * Bad read/write accesses... | ||
147 | */ | ||
148 | extern void __readwrite_bug(const char *fn); | ||
149 | |||
150 | #define IO_SPACE_LIMIT 0xffffffff | 258 | #define IO_SPACE_LIMIT 0xffffffff |
151 | 259 | ||
152 | /* Convert I/O port address to virtual address */ | ||
153 | #define __io(p) ((void __iomem *)phys_to_uncached(p)) | ||
154 | |||
155 | /* | ||
156 | * IO port access primitives | ||
157 | * ------------------------- | ||
158 | * | ||
159 | * The AVR32 doesn't have special IO access instructions; all IO is memory | ||
160 | * mapped. Note that these are defined to perform little endian accesses | ||
161 | * only. Their primary purpose is to access PCI and ISA peripherals. | ||
162 | * | ||
163 | * Note that for a big endian machine, this implies that the following | ||
164 | * big endian mode connectivity is in place. | ||
165 | * | ||
166 | * The machine specific io.h include defines __io to translate an "IO" | ||
167 | * address to a memory address. | ||
168 | * | ||
169 | * Note that we prevent GCC re-ordering or caching values in expressions | ||
170 | * by introducing sequence points into the in*() definitions. Note that | ||
171 | * __raw_* do not guarantee this behaviour. | ||
172 | * | ||
173 | * The {in,out}[bwl] macros are for emulating x86-style PCI/ISA IO space. | ||
174 | */ | ||
175 | #define outb(v, p) __raw_writeb(v, __io(p)) | ||
176 | #define outw(v, p) __raw_writew(cpu_to_le16(v), __io(p)) | ||
177 | #define outl(v, p) __raw_writel(cpu_to_le32(v), __io(p)) | ||
178 | |||
179 | #define inb(p) __raw_readb(__io(p)) | ||
180 | #define inw(p) le16_to_cpu(__raw_readw(__io(p))) | ||
181 | #define inl(p) le32_to_cpu(__raw_readl(__io(p))) | ||
182 | |||
183 | static inline void __outsb(unsigned long port, void *addr, unsigned int count) | ||
184 | { | ||
185 | while (count--) { | ||
186 | outb(*(u8 *)addr, port); | ||
187 | addr++; | ||
188 | } | ||
189 | } | ||
190 | |||
191 | static inline void __insb(unsigned long port, void *addr, unsigned int count) | ||
192 | { | ||
193 | while (count--) { | ||
194 | *(u8 *)addr = inb(port); | ||
195 | addr++; | ||
196 | } | ||
197 | } | ||
198 | |||
199 | static inline void __outsw(unsigned long port, void *addr, unsigned int count) | ||
200 | { | ||
201 | while (count--) { | ||
202 | outw(*(u16 *)addr, port); | ||
203 | addr += 2; | ||
204 | } | ||
205 | } | ||
206 | |||
207 | static inline void __insw(unsigned long port, void *addr, unsigned int count) | ||
208 | { | ||
209 | while (count--) { | ||
210 | *(u16 *)addr = inw(port); | ||
211 | addr += 2; | ||
212 | } | ||
213 | } | ||
214 | |||
215 | static inline void __outsl(unsigned long port, void *addr, unsigned int count) | ||
216 | { | ||
217 | while (count--) { | ||
218 | outl(*(u32 *)addr, port); | ||
219 | addr += 4; | ||
220 | } | ||
221 | } | ||
222 | |||
223 | static inline void __insl(unsigned long port, void *addr, unsigned int count) | ||
224 | { | ||
225 | while (count--) { | ||
226 | *(u32 *)addr = inl(port); | ||
227 | addr += 4; | ||
228 | } | ||
229 | } | ||
230 | |||
231 | #define outsb(port, addr, count) __outsb(port, addr, count) | ||
232 | #define insb(port, addr, count) __insb(port, addr, count) | ||
233 | #define outsw(port, addr, count) __outsw(port, addr, count) | ||
234 | #define insw(port, addr, count) __insw(port, addr, count) | ||
235 | #define outsl(port, addr, count) __outsl(port, addr, count) | ||
236 | #define insl(port, addr, count) __insl(port, addr, count) | ||
237 | |||
238 | extern void __iomem *__ioremap(unsigned long offset, size_t size, | 260 | extern void __iomem *__ioremap(unsigned long offset, size_t size, |
239 | unsigned long flags); | 261 | unsigned long flags); |
240 | extern void __iounmap(void __iomem *addr); | 262 | extern void __iounmap(void __iomem *addr); |
@@ -292,6 +314,4 @@ extern void __iounmap(void __iomem *addr); | |||
292 | */ | 314 | */ |
293 | #define xlate_dev_kmem_ptr(p) p | 315 | #define xlate_dev_kmem_ptr(p) p |
294 | 316 | ||
295 | #endif /* __KERNEL__ */ | ||
296 | |||
297 | #endif /* __ASM_AVR32_IO_H */ | 317 | #endif /* __ASM_AVR32_IO_H */ |
diff --git a/include/asm-avr32/processor.h b/include/asm-avr32/processor.h index f6913778a45f..6a64833756a6 100644 --- a/include/asm-avr32/processor.h +++ b/include/asm-avr32/processor.h | |||
@@ -40,6 +40,14 @@ enum tlb_config { | |||
40 | TLB_INVALID | 40 | TLB_INVALID |
41 | }; | 41 | }; |
42 | 42 | ||
43 | #define AVR32_FEATURE_RMW (1 << 0) | ||
44 | #define AVR32_FEATURE_DSP (1 << 1) | ||
45 | #define AVR32_FEATURE_SIMD (1 << 2) | ||
46 | #define AVR32_FEATURE_OCD (1 << 3) | ||
47 | #define AVR32_FEATURE_PCTR (1 << 4) | ||
48 | #define AVR32_FEATURE_JAVA (1 << 5) | ||
49 | #define AVR32_FEATURE_FPU (1 << 6) | ||
50 | |||
43 | struct avr32_cpuinfo { | 51 | struct avr32_cpuinfo { |
44 | struct clk *clk; | 52 | struct clk *clk; |
45 | unsigned long loops_per_jiffy; | 53 | unsigned long loops_per_jiffy; |
@@ -48,6 +56,7 @@ struct avr32_cpuinfo { | |||
48 | unsigned short arch_revision; | 56 | unsigned short arch_revision; |
49 | unsigned short cpu_revision; | 57 | unsigned short cpu_revision; |
50 | enum tlb_config tlb_config; | 58 | enum tlb_config tlb_config; |
59 | unsigned long features; | ||
51 | 60 | ||
52 | struct cache_info icache; | 61 | struct cache_info icache; |
53 | struct cache_info dcache; | 62 | struct cache_info dcache; |
@@ -125,10 +134,10 @@ extern int kernel_thread(int (*fn)(void *), void *arg, unsigned long flags); | |||
125 | #define thread_saved_pc(tsk) ((tsk)->thread.cpu_context.pc) | 134 | #define thread_saved_pc(tsk) ((tsk)->thread.cpu_context.pc) |
126 | 135 | ||
127 | struct pt_regs; | 136 | struct pt_regs; |
128 | void show_trace(struct task_struct *task, unsigned long *stack, | ||
129 | struct pt_regs *regs); | ||
130 | |||
131 | extern unsigned long get_wchan(struct task_struct *p); | 137 | extern unsigned long get_wchan(struct task_struct *p); |
138 | extern void show_regs_log_lvl(struct pt_regs *regs, const char *log_lvl); | ||
139 | extern void show_stack_log_lvl(struct task_struct *tsk, unsigned long sp, | ||
140 | struct pt_regs *regs, const char *log_lvl); | ||
132 | 141 | ||
133 | #define KSTK_EIP(tsk) ((tsk)->thread.cpu_context.pc) | 142 | #define KSTK_EIP(tsk) ((tsk)->thread.cpu_context.pc) |
134 | #define KSTK_ESP(tsk) ((tsk)->thread.cpu_context.ksp) | 143 | #define KSTK_ESP(tsk) ((tsk)->thread.cpu_context.ksp) |
diff --git a/include/asm-avr32/setup.h b/include/asm-avr32/setup.h index 0a5224245e44..1ff1a217015d 100644 --- a/include/asm-avr32/setup.h +++ b/include/asm-avr32/setup.h | |||
@@ -124,19 +124,12 @@ struct tagtable { | |||
124 | #define for_each_tag(t,base) \ | 124 | #define for_each_tag(t,base) \ |
125 | for (t = base; t->hdr.size; t = tag_next(t)) | 125 | for (t = base; t->hdr.size; t = tag_next(t)) |
126 | 126 | ||
127 | extern struct tag_mem_range *mem_phys; | ||
128 | extern struct tag_mem_range *mem_reserved; | ||
129 | extern struct tag_mem_range *mem_ramdisk; | ||
130 | |||
131 | extern struct tag *bootloader_tags; | 127 | extern struct tag *bootloader_tags; |
132 | 128 | ||
133 | extern void setup_bootmem(void); | 129 | extern resource_size_t fbmem_start; |
134 | extern void setup_processor(void); | 130 | extern resource_size_t fbmem_size; |
135 | extern void board_setup_fbmem(unsigned long fbmem_start, | ||
136 | unsigned long fbmem_size); | ||
137 | 131 | ||
138 | /* Chip-specific hook to enable the use of SDRAM */ | 132 | void setup_processor(void); |
139 | void chip_enable_sdram(void); | ||
140 | 133 | ||
141 | #endif /* !__ASSEMBLY__ */ | 134 | #endif /* !__ASSEMBLY__ */ |
142 | 135 | ||
diff --git a/include/asm-avr32/socket.h b/include/asm-avr32/socket.h index 543229de8173..a0d0507a5034 100644 --- a/include/asm-avr32/socket.h +++ b/include/asm-avr32/socket.h | |||
@@ -49,5 +49,7 @@ | |||
49 | 49 | ||
50 | #define SO_PEERSEC 31 | 50 | #define SO_PEERSEC 31 |
51 | #define SO_PASSSEC 34 | 51 | #define SO_PASSSEC 34 |
52 | #define SO_TIMESTAMPNS 35 | ||
53 | #define SCM_TIMESTAMPNS SO_TIMESTAMPNS | ||
52 | 54 | ||
53 | #endif /* __ASM_AVR32_SOCKET_H */ | 55 | #endif /* __ASM_AVR32_SOCKET_H */ |
diff --git a/include/asm-avr32/sockios.h b/include/asm-avr32/sockios.h index 84f3d65b3b3b..0802d742f97d 100644 --- a/include/asm-avr32/sockios.h +++ b/include/asm-avr32/sockios.h | |||
@@ -7,6 +7,7 @@ | |||
7 | #define FIOGETOWN 0x8903 | 7 | #define FIOGETOWN 0x8903 |
8 | #define SIOCGPGRP 0x8904 | 8 | #define SIOCGPGRP 0x8904 |
9 | #define SIOCATMARK 0x8905 | 9 | #define SIOCATMARK 0x8905 |
10 | #define SIOCGSTAMP 0x8906 /* Get stamp */ | 10 | #define SIOCGSTAMP 0x8906 /* Get stamp (timeval) */ |
11 | #define SIOCGSTAMPNS 0x8907 /* Get stamp (timespec) */ | ||
11 | 12 | ||
12 | #endif /* __ASM_AVR32_SOCKIOS_H */ | 13 | #endif /* __ASM_AVR32_SOCKIOS_H */ |
diff --git a/include/asm-avr32/sysreg.h b/include/asm-avr32/sysreg.h index f91975f330f6..c02bc8304b13 100644 --- a/include/asm-avr32/sysreg.h +++ b/include/asm-avr32/sysreg.h | |||
@@ -7,326 +7,281 @@ | |||
7 | * it under the terms of the GNU General Public License version 2 as | 7 | * it under the terms of the GNU General Public License version 2 as |
8 | * published by the Free Software Foundation. | 8 | * published by the Free Software Foundation. |
9 | */ | 9 | */ |
10 | #ifndef __ASM_AVR32_SYSREG_H__ | 10 | #ifndef __ASM_AVR32_SYSREG_H |
11 | #define __ASM_AVR32_SYSREG_H__ | 11 | #define __ASM_AVR32_SYSREG_H |
12 | 12 | ||
13 | /* sysreg register offsets */ | 13 | /* sysreg register offsets */ |
14 | #define SYSREG_SR 0x0000 | 14 | #define SYSREG_SR 0x0000 |
15 | #define SYSREG_EVBA 0x0004 | 15 | #define SYSREG_EVBA 0x0004 |
16 | #define SYSREG_ACBA 0x0008 | 16 | #define SYSREG_ACBA 0x0008 |
17 | #define SYSREG_CPUCR 0x000c | 17 | #define SYSREG_CPUCR 0x000c |
18 | #define SYSREG_ECR 0x0010 | 18 | #define SYSREG_ECR 0x0010 |
19 | #define SYSREG_RSR_SUP 0x0014 | 19 | #define SYSREG_RSR_SUP 0x0014 |
20 | #define SYSREG_RSR_INT0 0x0018 | 20 | #define SYSREG_RSR_INT0 0x0018 |
21 | #define SYSREG_RSR_INT1 0x001c | 21 | #define SYSREG_RSR_INT1 0x001c |
22 | #define SYSREG_RSR_INT2 0x0020 | 22 | #define SYSREG_RSR_INT2 0x0020 |
23 | #define SYSREG_RSR_INT3 0x0024 | 23 | #define SYSREG_RSR_INT3 0x0024 |
24 | #define SYSREG_RSR_EX 0x0028 | 24 | #define SYSREG_RSR_EX 0x0028 |
25 | #define SYSREG_RSR_NMI 0x002c | 25 | #define SYSREG_RSR_NMI 0x002c |
26 | #define SYSREG_RSR_DBG 0x0030 | 26 | #define SYSREG_RSR_DBG 0x0030 |
27 | #define SYSREG_RAR_SUP 0x0034 | 27 | #define SYSREG_RAR_SUP 0x0034 |
28 | #define SYSREG_RAR_INT0 0x0038 | 28 | #define SYSREG_RAR_INT0 0x0038 |
29 | #define SYSREG_RAR_INT1 0x003c | 29 | #define SYSREG_RAR_INT1 0x003c |
30 | #define SYSREG_RAR_INT2 0x0040 | 30 | #define SYSREG_RAR_INT2 0x0040 |
31 | #define SYSREG_RAR_INT3 0x0044 | 31 | #define SYSREG_RAR_INT3 0x0044 |
32 | #define SYSREG_RAR_EX 0x0048 | 32 | #define SYSREG_RAR_EX 0x0048 |
33 | #define SYSREG_RAR_NMI 0x004c | 33 | #define SYSREG_RAR_NMI 0x004c |
34 | #define SYSREG_RAR_DBG 0x0050 | 34 | #define SYSREG_RAR_DBG 0x0050 |
35 | #define SYSREG_JECR 0x0054 | 35 | #define SYSREG_JECR 0x0054 |
36 | #define SYSREG_JOSP 0x0058 | 36 | #define SYSREG_JOSP 0x0058 |
37 | #define SYSREG_JAVA_LV0 0x005c | 37 | #define SYSREG_JAVA_LV0 0x005c |
38 | #define SYSREG_JAVA_LV1 0x0060 | 38 | #define SYSREG_JAVA_LV1 0x0060 |
39 | #define SYSREG_JAVA_LV2 0x0064 | 39 | #define SYSREG_JAVA_LV2 0x0064 |
40 | #define SYSREG_JAVA_LV3 0x0068 | 40 | #define SYSREG_JAVA_LV3 0x0068 |
41 | #define SYSREG_JAVA_LV4 0x006c | 41 | #define SYSREG_JAVA_LV4 0x006c |
42 | #define SYSREG_JAVA_LV5 0x0070 | 42 | #define SYSREG_JAVA_LV5 0x0070 |
43 | #define SYSREG_JAVA_LV6 0x0074 | 43 | #define SYSREG_JAVA_LV6 0x0074 |
44 | #define SYSREG_JAVA_LV7 0x0078 | 44 | #define SYSREG_JAVA_LV7 0x0078 |
45 | #define SYSREG_JTBA 0x007c | 45 | #define SYSREG_JTBA 0x007c |
46 | #define SYSREG_JBCR 0x0080 | 46 | #define SYSREG_JBCR 0x0080 |
47 | #define SYSREG_CONFIG0 0x0100 | 47 | #define SYSREG_CONFIG0 0x0100 |
48 | #define SYSREG_CONFIG1 0x0104 | 48 | #define SYSREG_CONFIG1 0x0104 |
49 | #define SYSREG_COUNT 0x0108 | 49 | #define SYSREG_COUNT 0x0108 |
50 | #define SYSREG_COMPARE 0x010c | 50 | #define SYSREG_COMPARE 0x010c |
51 | #define SYSREG_TLBEHI 0x0110 | 51 | #define SYSREG_TLBEHI 0x0110 |
52 | #define SYSREG_TLBELO 0x0114 | 52 | #define SYSREG_TLBELO 0x0114 |
53 | #define SYSREG_PTBR 0x0118 | 53 | #define SYSREG_PTBR 0x0118 |
54 | #define SYSREG_TLBEAR 0x011c | 54 | #define SYSREG_TLBEAR 0x011c |
55 | #define SYSREG_MMUCR 0x0120 | 55 | #define SYSREG_MMUCR 0x0120 |
56 | #define SYSREG_TLBARLO 0x0124 | 56 | #define SYSREG_TLBARLO 0x0124 |
57 | #define SYSREG_TLBARHI 0x0128 | 57 | #define SYSREG_TLBARHI 0x0128 |
58 | #define SYSREG_PCCNT 0x012c | 58 | #define SYSREG_PCCNT 0x012c |
59 | #define SYSREG_PCNT0 0x0130 | 59 | #define SYSREG_PCNT0 0x0130 |
60 | #define SYSREG_PCNT1 0x0134 | 60 | #define SYSREG_PCNT1 0x0134 |
61 | #define SYSREG_PCCR 0x0138 | 61 | #define SYSREG_PCCR 0x0138 |
62 | #define SYSREG_BEAR 0x013c | 62 | #define SYSREG_BEAR 0x013c |
63 | #define SYSREG_SABAL 0x0300 | ||
64 | #define SYSREG_SABAH 0x0304 | ||
65 | #define SYSREG_SABD 0x0308 | ||
63 | 66 | ||
64 | /* Bitfields in SR */ | 67 | /* Bitfields in SR */ |
65 | #define SYSREG_SR_C_OFFSET 0 | 68 | #define SYSREG_SR_C_OFFSET 0 |
66 | #define SYSREG_SR_C_SIZE 1 | 69 | #define SYSREG_SR_C_SIZE 1 |
67 | #define SYSREG_Z_OFFSET 1 | 70 | #define SYSREG_Z_OFFSET 1 |
68 | #define SYSREG_Z_SIZE 1 | 71 | #define SYSREG_Z_SIZE 1 |
69 | #define SYSREG_SR_N_OFFSET 2 | 72 | #define SYSREG_SR_N_OFFSET 2 |
70 | #define SYSREG_SR_N_SIZE 1 | 73 | #define SYSREG_SR_N_SIZE 1 |
71 | #define SYSREG_SR_V_OFFSET 3 | 74 | #define SYSREG_SR_V_OFFSET 3 |
72 | #define SYSREG_SR_V_SIZE 1 | 75 | #define SYSREG_SR_V_SIZE 1 |
73 | #define SYSREG_Q_OFFSET 4 | 76 | #define SYSREG_Q_OFFSET 4 |
74 | #define SYSREG_Q_SIZE 1 | 77 | #define SYSREG_Q_SIZE 1 |
75 | #define SYSREG_GM_OFFSET 16 | 78 | #define SYSREG_L_OFFSET 5 |
76 | #define SYSREG_GM_SIZE 1 | 79 | #define SYSREG_L_SIZE 1 |
77 | #define SYSREG_I0M_OFFSET 17 | 80 | #define SYSREG_T_OFFSET 14 |
78 | #define SYSREG_I0M_SIZE 1 | 81 | #define SYSREG_T_SIZE 1 |
79 | #define SYSREG_I1M_OFFSET 18 | 82 | #define SYSREG_SR_R_OFFSET 15 |
80 | #define SYSREG_I1M_SIZE 1 | 83 | #define SYSREG_SR_R_SIZE 1 |
81 | #define SYSREG_I2M_OFFSET 19 | 84 | #define SYSREG_GM_OFFSET 16 |
82 | #define SYSREG_I2M_SIZE 1 | 85 | #define SYSREG_GM_SIZE 1 |
83 | #define SYSREG_I3M_OFFSET 20 | 86 | #define SYSREG_I0M_OFFSET 17 |
84 | #define SYSREG_I3M_SIZE 1 | 87 | #define SYSREG_I0M_SIZE 1 |
85 | #define SYSREG_EM_OFFSET 21 | 88 | #define SYSREG_I1M_OFFSET 18 |
86 | #define SYSREG_EM_SIZE 1 | 89 | #define SYSREG_I1M_SIZE 1 |
87 | #define SYSREG_M0_OFFSET 22 | 90 | #define SYSREG_I2M_OFFSET 19 |
88 | #define SYSREG_M0_SIZE 1 | 91 | #define SYSREG_I2M_SIZE 1 |
89 | #define SYSREG_M1_OFFSET 23 | 92 | #define SYSREG_I3M_OFFSET 20 |
90 | #define SYSREG_M1_SIZE 1 | 93 | #define SYSREG_I3M_SIZE 1 |
91 | #define SYSREG_M2_OFFSET 24 | 94 | #define SYSREG_EM_OFFSET 21 |
92 | #define SYSREG_M2_SIZE 1 | 95 | #define SYSREG_EM_SIZE 1 |
93 | #define SYSREG_SR_D_OFFSET 26 | 96 | #define SYSREG_M0_OFFSET 22 |
94 | #define SYSREG_SR_D_SIZE 1 | 97 | #define SYSREG_M0_SIZE 1 |
95 | #define SYSREG_DM_OFFSET 27 | 98 | #define SYSREG_M1_OFFSET 23 |
96 | #define SYSREG_DM_SIZE 1 | 99 | #define SYSREG_M1_SIZE 1 |
97 | #define SYSREG_SR_J_OFFSET 28 | 100 | #define SYSREG_M2_OFFSET 24 |
98 | #define SYSREG_SR_J_SIZE 1 | 101 | #define SYSREG_M2_SIZE 1 |
99 | #define SYSREG_R_OFFSET 29 | 102 | #define SYSREG_SR_D_OFFSET 26 |
100 | #define SYSREG_R_SIZE 1 | 103 | #define SYSREG_SR_D_SIZE 1 |
101 | #define SYSREG_H_OFFSET 30 | 104 | #define SYSREG_DM_OFFSET 27 |
102 | #define SYSREG_H_SIZE 1 | 105 | #define SYSREG_DM_SIZE 1 |
103 | 106 | #define SYSREG_SR_J_OFFSET 28 | |
104 | /* Bitfields in EVBA */ | 107 | #define SYSREG_SR_J_SIZE 1 |
105 | 108 | #define SYSREG_H_OFFSET 29 | |
106 | /* Bitfields in ACBA */ | 109 | #define SYSREG_H_SIZE 1 |
107 | 110 | ||
108 | /* Bitfields in CPUCR */ | 111 | /* Bitfields in CPUCR */ |
109 | #define SYSREG_BI_OFFSET 0 | 112 | #define SYSREG_BI_OFFSET 0 |
110 | #define SYSREG_BI_SIZE 1 | 113 | #define SYSREG_BI_SIZE 1 |
111 | #define SYSREG_BE_OFFSET 1 | 114 | #define SYSREG_BE_OFFSET 1 |
112 | #define SYSREG_BE_SIZE 1 | 115 | #define SYSREG_BE_SIZE 1 |
113 | #define SYSREG_FE_OFFSET 2 | 116 | #define SYSREG_FE_OFFSET 2 |
114 | #define SYSREG_FE_SIZE 1 | 117 | #define SYSREG_FE_SIZE 1 |
115 | #define SYSREG_RE_OFFSET 3 | 118 | #define SYSREG_RE_OFFSET 3 |
116 | #define SYSREG_RE_SIZE 1 | 119 | #define SYSREG_RE_SIZE 1 |
117 | #define SYSREG_IBE_OFFSET 4 | 120 | #define SYSREG_IBE_OFFSET 4 |
118 | #define SYSREG_IBE_SIZE 1 | 121 | #define SYSREG_IBE_SIZE 1 |
119 | #define SYSREG_IEE_OFFSET 5 | 122 | #define SYSREG_IEE_OFFSET 5 |
120 | #define SYSREG_IEE_SIZE 1 | 123 | #define SYSREG_IEE_SIZE 1 |
121 | |||
122 | /* Bitfields in ECR */ | ||
123 | #define SYSREG_ECR_OFFSET 0 | ||
124 | #define SYSREG_ECR_SIZE 32 | ||
125 | |||
126 | /* Bitfields in RSR_SUP */ | ||
127 | |||
128 | /* Bitfields in RSR_INT0 */ | ||
129 | |||
130 | /* Bitfields in RSR_INT1 */ | ||
131 | |||
132 | /* Bitfields in RSR_INT2 */ | ||
133 | |||
134 | /* Bitfields in RSR_INT3 */ | ||
135 | |||
136 | /* Bitfields in RSR_EX */ | ||
137 | |||
138 | /* Bitfields in RSR_NMI */ | ||
139 | |||
140 | /* Bitfields in RSR_DBG */ | ||
141 | |||
142 | /* Bitfields in RAR_SUP */ | ||
143 | |||
144 | /* Bitfields in RAR_INT0 */ | ||
145 | |||
146 | /* Bitfields in RAR_INT1 */ | ||
147 | |||
148 | /* Bitfields in RAR_INT2 */ | ||
149 | |||
150 | /* Bitfields in RAR_INT3 */ | ||
151 | |||
152 | /* Bitfields in RAR_EX */ | ||
153 | |||
154 | /* Bitfields in RAR_NMI */ | ||
155 | |||
156 | /* Bitfields in RAR_DBG */ | ||
157 | |||
158 | /* Bitfields in JECR */ | ||
159 | |||
160 | /* Bitfields in JOSP */ | ||
161 | |||
162 | /* Bitfields in JAVA_LV0 */ | ||
163 | |||
164 | /* Bitfields in JAVA_LV1 */ | ||
165 | |||
166 | /* Bitfields in JAVA_LV2 */ | ||
167 | |||
168 | /* Bitfields in JAVA_LV3 */ | ||
169 | |||
170 | /* Bitfields in JAVA_LV4 */ | ||
171 | |||
172 | /* Bitfields in JAVA_LV5 */ | ||
173 | |||
174 | /* Bitfields in JAVA_LV6 */ | ||
175 | |||
176 | /* Bitfields in JAVA_LV7 */ | ||
177 | |||
178 | /* Bitfields in JTBA */ | ||
179 | |||
180 | /* Bitfields in JBCR */ | ||
181 | 124 | ||
182 | /* Bitfields in CONFIG0 */ | 125 | /* Bitfields in CONFIG0 */ |
183 | #define SYSREG_CONFIG0_D_OFFSET 1 | 126 | #define SYSREG_CONFIG0_R_OFFSET 0 |
184 | #define SYSREG_CONFIG0_D_SIZE 1 | 127 | #define SYSREG_CONFIG0_R_SIZE 1 |
185 | #define SYSREG_CONFIG0_S_OFFSET 2 | 128 | #define SYSREG_CONFIG0_D_OFFSET 1 |
186 | #define SYSREG_CONFIG0_S_SIZE 1 | 129 | #define SYSREG_CONFIG0_D_SIZE 1 |
187 | #define SYSREG_O_OFFSET 3 | 130 | #define SYSREG_CONFIG0_S_OFFSET 2 |
188 | #define SYSREG_O_SIZE 1 | 131 | #define SYSREG_CONFIG0_S_SIZE 1 |
189 | #define SYSREG_P_OFFSET 4 | 132 | #define SYSREG_CONFIG0_O_OFFSET 3 |
190 | #define SYSREG_P_SIZE 1 | 133 | #define SYSREG_CONFIG0_O_SIZE 1 |
191 | #define SYSREG_CONFIG0_J_OFFSET 5 | 134 | #define SYSREG_CONFIG0_P_OFFSET 4 |
192 | #define SYSREG_CONFIG0_J_SIZE 1 | 135 | #define SYSREG_CONFIG0_P_SIZE 1 |
193 | #define SYSREG_F_OFFSET 6 | 136 | #define SYSREG_CONFIG0_J_OFFSET 5 |
194 | #define SYSREG_F_SIZE 1 | 137 | #define SYSREG_CONFIG0_J_SIZE 1 |
195 | #define SYSREG_MMUT_OFFSET 7 | 138 | #define SYSREG_CONFIG0_F_OFFSET 6 |
196 | #define SYSREG_MMUT_SIZE 3 | 139 | #define SYSREG_CONFIG0_F_SIZE 1 |
197 | #define SYSREG_AR_OFFSET 10 | 140 | #define SYSREG_MMUT_OFFSET 7 |
198 | #define SYSREG_AR_SIZE 3 | 141 | #define SYSREG_MMUT_SIZE 3 |
199 | #define SYSREG_AT_OFFSET 13 | 142 | #define SYSREG_AR_OFFSET 10 |
200 | #define SYSREG_AT_SIZE 3 | 143 | #define SYSREG_AR_SIZE 3 |
201 | #define SYSREG_PROCESSORREVISION_OFFSET 16 | 144 | #define SYSREG_AT_OFFSET 13 |
202 | #define SYSREG_PROCESSORREVISION_SIZE 8 | 145 | #define SYSREG_AT_SIZE 3 |
203 | #define SYSREG_PROCESSORID_OFFSET 24 | 146 | #define SYSREG_PROCESSORREVISION_OFFSET 16 |
204 | #define SYSREG_PROCESSORID_SIZE 8 | 147 | #define SYSREG_PROCESSORREVISION_SIZE 8 |
148 | #define SYSREG_PROCESSORID_OFFSET 24 | ||
149 | #define SYSREG_PROCESSORID_SIZE 8 | ||
205 | 150 | ||
206 | /* Bitfields in CONFIG1 */ | 151 | /* Bitfields in CONFIG1 */ |
207 | #define SYSREG_DASS_OFFSET 0 | 152 | #define SYSREG_DASS_OFFSET 0 |
208 | #define SYSREG_DASS_SIZE 3 | 153 | #define SYSREG_DASS_SIZE 3 |
209 | #define SYSREG_DLSZ_OFFSET 3 | 154 | #define SYSREG_DLSZ_OFFSET 3 |
210 | #define SYSREG_DLSZ_SIZE 3 | 155 | #define SYSREG_DLSZ_SIZE 3 |
211 | #define SYSREG_DSET_OFFSET 6 | 156 | #define SYSREG_DSET_OFFSET 6 |
212 | #define SYSREG_DSET_SIZE 4 | 157 | #define SYSREG_DSET_SIZE 4 |
213 | #define SYSREG_IASS_OFFSET 10 | 158 | #define SYSREG_IASS_OFFSET 10 |
214 | #define SYSREG_IASS_SIZE 2 | 159 | #define SYSREG_IASS_SIZE 3 |
215 | #define SYSREG_ILSZ_OFFSET 13 | 160 | #define SYSREG_ILSZ_OFFSET 13 |
216 | #define SYSREG_ILSZ_SIZE 3 | 161 | #define SYSREG_ILSZ_SIZE 3 |
217 | #define SYSREG_ISET_OFFSET 16 | 162 | #define SYSREG_ISET_OFFSET 16 |
218 | #define SYSREG_ISET_SIZE 4 | 163 | #define SYSREG_ISET_SIZE 4 |
219 | #define SYSREG_DMMUSZ_OFFSET 20 | 164 | #define SYSREG_DMMUSZ_OFFSET 20 |
220 | #define SYSREG_DMMUSZ_SIZE 6 | 165 | #define SYSREG_DMMUSZ_SIZE 6 |
221 | #define SYSREG_IMMUSZ_OFFSET 26 | 166 | #define SYSREG_IMMUSZ_OFFSET 26 |
222 | #define SYSREG_IMMUSZ_SIZE 6 | 167 | #define SYSREG_IMMUSZ_SIZE 6 |
223 | |||
224 | /* Bitfields in COUNT */ | ||
225 | |||
226 | /* Bitfields in COMPARE */ | ||
227 | 168 | ||
228 | /* Bitfields in TLBEHI */ | 169 | /* Bitfields in TLBEHI */ |
229 | #define SYSREG_ASID_OFFSET 0 | 170 | #define SYSREG_ASID_OFFSET 0 |
230 | #define SYSREG_ASID_SIZE 8 | 171 | #define SYSREG_ASID_SIZE 8 |
231 | #define SYSREG_TLBEHI_I_OFFSET 8 | 172 | #define SYSREG_TLBEHI_I_OFFSET 8 |
232 | #define SYSREG_TLBEHI_I_SIZE 1 | 173 | #define SYSREG_TLBEHI_I_SIZE 1 |
233 | #define SYSREG_TLBEHI_V_OFFSET 9 | 174 | #define SYSREG_TLBEHI_V_OFFSET 9 |
234 | #define SYSREG_TLBEHI_V_SIZE 1 | 175 | #define SYSREG_TLBEHI_V_SIZE 1 |
235 | #define SYSREG_VPN_OFFSET 10 | 176 | #define SYSREG_VPN_OFFSET 10 |
236 | #define SYSREG_VPN_SIZE 22 | 177 | #define SYSREG_VPN_SIZE 22 |
237 | 178 | ||
238 | /* Bitfields in TLBELO */ | 179 | /* Bitfields in TLBELO */ |
239 | #define SYSREG_W_OFFSET 0 | 180 | #define SYSREG_W_OFFSET 0 |
240 | #define SYSREG_W_SIZE 1 | 181 | #define SYSREG_W_SIZE 1 |
241 | #define SYSREG_TLBELO_D_OFFSET 1 | 182 | #define SYSREG_TLBELO_D_OFFSET 1 |
242 | #define SYSREG_TLBELO_D_SIZE 1 | 183 | #define SYSREG_TLBELO_D_SIZE 1 |
243 | #define SYSREG_SZ_OFFSET 2 | 184 | #define SYSREG_SZ_OFFSET 2 |
244 | #define SYSREG_SZ_SIZE 2 | 185 | #define SYSREG_SZ_SIZE 2 |
245 | #define SYSREG_AP_OFFSET 4 | 186 | #define SYSREG_AP_OFFSET 4 |
246 | #define SYSREG_AP_SIZE 3 | 187 | #define SYSREG_AP_SIZE 3 |
247 | #define SYSREG_B_OFFSET 7 | 188 | #define SYSREG_B_OFFSET 7 |
248 | #define SYSREG_B_SIZE 1 | 189 | #define SYSREG_B_SIZE 1 |
249 | #define SYSREG_G_OFFSET 8 | 190 | #define SYSREG_G_OFFSET 8 |
250 | #define SYSREG_G_SIZE 1 | 191 | #define SYSREG_G_SIZE 1 |
251 | #define SYSREG_TLBELO_C_OFFSET 9 | 192 | #define SYSREG_TLBELO_C_OFFSET 9 |
252 | #define SYSREG_TLBELO_C_SIZE 1 | 193 | #define SYSREG_TLBELO_C_SIZE 1 |
253 | #define SYSREG_PFN_OFFSET 10 | 194 | #define SYSREG_PFN_OFFSET 10 |
254 | #define SYSREG_PFN_SIZE 22 | 195 | #define SYSREG_PFN_SIZE 22 |
255 | |||
256 | /* Bitfields in PTBR */ | ||
257 | |||
258 | /* Bitfields in TLBEAR */ | ||
259 | 196 | ||
260 | /* Bitfields in MMUCR */ | 197 | /* Bitfields in MMUCR */ |
261 | #define SYSREG_E_OFFSET 0 | 198 | #define SYSREG_E_OFFSET 0 |
262 | #define SYSREG_E_SIZE 1 | 199 | #define SYSREG_E_SIZE 1 |
263 | #define SYSREG_M_OFFSET 1 | 200 | #define SYSREG_M_OFFSET 1 |
264 | #define SYSREG_M_SIZE 1 | 201 | #define SYSREG_M_SIZE 1 |
265 | #define SYSREG_MMUCR_I_OFFSET 2 | 202 | #define SYSREG_MMUCR_I_OFFSET 2 |
266 | #define SYSREG_MMUCR_I_SIZE 1 | 203 | #define SYSREG_MMUCR_I_SIZE 1 |
267 | #define SYSREG_MMUCR_N_OFFSET 3 | 204 | #define SYSREG_MMUCR_N_OFFSET 3 |
268 | #define SYSREG_MMUCR_N_SIZE 1 | 205 | #define SYSREG_MMUCR_N_SIZE 1 |
269 | #define SYSREG_MMUCR_S_OFFSET 4 | 206 | #define SYSREG_MMUCR_S_OFFSET 4 |
270 | #define SYSREG_MMUCR_S_SIZE 1 | 207 | #define SYSREG_MMUCR_S_SIZE 1 |
271 | #define SYSREG_DLA_OFFSET 8 | 208 | #define SYSREG_DLA_OFFSET 8 |
272 | #define SYSREG_DLA_SIZE 6 | 209 | #define SYSREG_DLA_SIZE 6 |
273 | #define SYSREG_DRP_OFFSET 14 | 210 | #define SYSREG_DRP_OFFSET 14 |
274 | #define SYSREG_DRP_SIZE 6 | 211 | #define SYSREG_DRP_SIZE 6 |
275 | #define SYSREG_ILA_OFFSET 20 | 212 | #define SYSREG_ILA_OFFSET 20 |
276 | #define SYSREG_ILA_SIZE 6 | 213 | #define SYSREG_ILA_SIZE 6 |
277 | #define SYSREG_IRP_OFFSET 26 | 214 | #define SYSREG_IRP_OFFSET 26 |
278 | #define SYSREG_IRP_SIZE 6 | 215 | #define SYSREG_IRP_SIZE 6 |
279 | |||
280 | /* Bitfields in TLBARLO */ | ||
281 | |||
282 | /* Bitfields in TLBARHI */ | ||
283 | |||
284 | /* Bitfields in PCCNT */ | ||
285 | |||
286 | /* Bitfields in PCNT0 */ | ||
287 | |||
288 | /* Bitfields in PCNT1 */ | ||
289 | 216 | ||
290 | /* Bitfields in PCCR */ | 217 | /* Bitfields in PCCR */ |
291 | 218 | #define SYSREG_PCCR_R_OFFSET 1 | |
292 | /* Bitfields in BEAR */ | 219 | #define SYSREG_PCCR_R_SIZE 1 |
220 | #define SYSREG_PCCR_C_OFFSET 2 | ||
221 | #define SYSREG_PCCR_C_SIZE 1 | ||
222 | #define SYSREG_PCCR_S_OFFSET 3 | ||
223 | #define SYSREG_PCCR_S_SIZE 1 | ||
224 | #define SYSREG_IEC_OFFSET 4 | ||
225 | #define SYSREG_IEC_SIZE 1 | ||
226 | #define SYSREG_IE0_OFFSET 5 | ||
227 | #define SYSREG_IE0_SIZE 1 | ||
228 | #define SYSREG_IE1_OFFSET 6 | ||
229 | #define SYSREG_IE1_SIZE 1 | ||
230 | #define SYSREG_FC_OFFSET 8 | ||
231 | #define SYSREG_FC_SIZE 1 | ||
232 | #define SYSREG_F0_OFFSET 9 | ||
233 | #define SYSREG_F0_SIZE 1 | ||
234 | #define SYSREG_F1_OFFSET 10 | ||
235 | #define SYSREG_F1_SIZE 1 | ||
236 | #define SYSREG_CONF0_OFFSET 12 | ||
237 | #define SYSREG_CONF0_SIZE 6 | ||
238 | #define SYSREG_CONF1_OFFSET 18 | ||
239 | #define SYSREG_CONF1_SIZE 6 | ||
293 | 240 | ||
294 | /* Constants for ECR */ | 241 | /* Constants for ECR */ |
295 | #define ECR_UNRECOVERABLE 0 | 242 | #define ECR_UNRECOVERABLE 0 |
296 | #define ECR_TLB_MULTIPLE 1 | 243 | #define ECR_TLB_MULTIPLE 1 |
297 | #define ECR_BUS_ERROR_WRITE 2 | 244 | #define ECR_BUS_ERROR_WRITE 2 |
298 | #define ECR_BUS_ERROR_READ 3 | 245 | #define ECR_BUS_ERROR_READ 3 |
299 | #define ECR_NMI 4 | 246 | #define ECR_NMI 4 |
300 | #define ECR_ADDR_ALIGN_X 5 | 247 | #define ECR_ADDR_ALIGN_X 5 |
301 | #define ECR_PROTECTION_X 6 | 248 | #define ECR_PROTECTION_X 6 |
302 | #define ECR_DEBUG 7 | 249 | #define ECR_DEBUG 7 |
303 | #define ECR_ILLEGAL_OPCODE 8 | 250 | #define ECR_ILLEGAL_OPCODE 8 |
304 | #define ECR_UNIMPL_INSTRUCTION 9 | 251 | #define ECR_UNIMPL_INSTRUCTION 9 |
305 | #define ECR_PRIVILEGE_VIOLATION 10 | 252 | #define ECR_PRIVILEGE_VIOLATION 10 |
306 | #define ECR_FPE 11 | 253 | #define ECR_FPE 11 |
307 | #define ECR_COPROC_ABSENT 12 | 254 | #define ECR_COPROC_ABSENT 12 |
308 | #define ECR_ADDR_ALIGN_R 13 | 255 | #define ECR_ADDR_ALIGN_R 13 |
309 | #define ECR_ADDR_ALIGN_W 14 | 256 | #define ECR_ADDR_ALIGN_W 14 |
310 | #define ECR_PROTECTION_R 15 | 257 | #define ECR_PROTECTION_R 15 |
311 | #define ECR_PROTECTION_W 16 | 258 | #define ECR_PROTECTION_W 16 |
312 | #define ECR_DTLB_MODIFIED 17 | 259 | #define ECR_DTLB_MODIFIED 17 |
313 | #define ECR_TLB_MISS_X 20 | 260 | #define ECR_TLB_MISS_X 20 |
314 | #define ECR_TLB_MISS_R 24 | 261 | #define ECR_TLB_MISS_R 24 |
315 | #define ECR_TLB_MISS_W 28 | 262 | #define ECR_TLB_MISS_W 28 |
316 | 263 | ||
317 | /* Bit manipulation macros */ | 264 | /* Bit manipulation macros */ |
318 | #define SYSREG_BIT(name) (1 << SYSREG_##name##_OFFSET) | 265 | #define SYSREG_BIT(name) \ |
319 | #define SYSREG_BF(name,value) (((value) & ((1 << SYSREG_##name##_SIZE) - 1)) << SYSREG_##name##_OFFSET) | 266 | (1 << SYSREG_##name##_OFFSET) |
320 | #define SYSREG_BFEXT(name,value) (((value) >> SYSREG_##name##_OFFSET) & ((1 << SYSREG_##name##_SIZE) - 1)) | 267 | #define SYSREG_BF(name,value) \ |
321 | #define SYSREG_BFINS(name,value,old) (((old) & ~(((1 << SYSREG_##name##_SIZE) - 1) << SYSREG_##name##_OFFSET)) | SYSREG_BF(name,value)) | 268 | (((value) & ((1 << SYSREG_##name##_SIZE) - 1)) \ |
269 | << SYSREG_##name##_OFFSET) | ||
270 | #define SYSREG_BFEXT(name,value)\ | ||
271 | (((value) >> SYSREG_##name##_OFFSET) \ | ||
272 | & ((1 << SYSREG_##name##_SIZE) - 1)) | ||
273 | #define SYSREG_BFINS(name,value,old) \ | ||
274 | (((old) & ~(((1 << SYSREG_##name##_SIZE) - 1) \ | ||
275 | << SYSREG_##name##_OFFSET)) \ | ||
276 | | SYSREG_BF(name,value)) | ||
322 | 277 | ||
278 | /* Register access macros */ | ||
323 | #ifdef __CHECKER__ | 279 | #ifdef __CHECKER__ |
324 | extern unsigned long __builtin_mfsr(unsigned long reg); | 280 | extern unsigned long __builtin_mfsr(unsigned long reg); |
325 | extern void __builtin_mtsr(unsigned long reg, unsigned long value); | 281 | extern void __builtin_mtsr(unsigned long reg, unsigned long value); |
326 | #endif | 282 | #endif |
327 | 283 | ||
328 | /* Register access macros */ | 284 | #define sysreg_read(reg) __builtin_mfsr(SYSREG_##reg) |
329 | #define sysreg_read(reg) __builtin_mfsr(SYSREG_##reg) | 285 | #define sysreg_write(reg, value) __builtin_mtsr(SYSREG_##reg, value) |
330 | #define sysreg_write(reg, value) __builtin_mtsr(SYSREG_##reg, value) | ||
331 | 286 | ||
332 | #endif /* __ASM_AVR32_SYSREG_H__ */ | 287 | #endif /* __ASM_AVR32_SYSREG_H */ |
diff --git a/include/asm-avr32/system.h b/include/asm-avr32/system.h index ac596058697d..a8236bacc878 100644 --- a/include/asm-avr32/system.h +++ b/include/asm-avr32/system.h | |||
@@ -9,6 +9,7 @@ | |||
9 | #define __ASM_AVR32_SYSTEM_H | 9 | #define __ASM_AVR32_SYSTEM_H |
10 | 10 | ||
11 | #include <linux/compiler.h> | 11 | #include <linux/compiler.h> |
12 | #include <linux/linkage.h> | ||
12 | #include <linux/types.h> | 13 | #include <linux/types.h> |
13 | 14 | ||
14 | #include <asm/ptrace.h> | 15 | #include <asm/ptrace.h> |
@@ -140,15 +141,9 @@ static inline unsigned long __cmpxchg(volatile void *ptr, unsigned long old, | |||
140 | sizeof(*(ptr)))) | 141 | sizeof(*(ptr)))) |
141 | 142 | ||
142 | struct pt_regs; | 143 | struct pt_regs; |
143 | extern void __die(const char *, struct pt_regs *, unsigned long, | 144 | void NORET_TYPE die(const char *str, struct pt_regs *regs, long err); |
144 | const char *, const char *, unsigned long); | 145 | void _exception(long signr, struct pt_regs *regs, int code, |
145 | extern void __die_if_kernel(const char *, struct pt_regs *, unsigned long, | 146 | unsigned long addr); |
146 | const char *, const char *, unsigned long); | ||
147 | |||
148 | #define die(msg, regs, err) \ | ||
149 | __die(msg, regs, err, __FILE__ ":", __FUNCTION__, __LINE__) | ||
150 | #define die_if_kernel(msg, regs, err) \ | ||
151 | __die_if_kernel(msg, regs, err, __FILE__ ":", __FUNCTION__, __LINE__) | ||
152 | 147 | ||
153 | #define arch_align_stack(x) (x) | 148 | #define arch_align_stack(x) (x) |
154 | 149 | ||
diff --git a/include/asm-avr32/thread_info.h b/include/asm-avr32/thread_info.h index d1f5b35ebd54..a2e606dd4f4a 100644 --- a/include/asm-avr32/thread_info.h +++ b/include/asm-avr32/thread_info.h | |||
@@ -83,6 +83,7 @@ static inline struct thread_info *current_thread_info(void) | |||
83 | #define TIF_SINGLE_STEP 6 /* single step after next break */ | 83 | #define TIF_SINGLE_STEP 6 /* single step after next break */ |
84 | #define TIF_MEMDIE 7 | 84 | #define TIF_MEMDIE 7 |
85 | #define TIF_RESTORE_SIGMASK 8 /* restore signal mask in do_signal */ | 85 | #define TIF_RESTORE_SIGMASK 8 /* restore signal mask in do_signal */ |
86 | #define TIF_CPU_GOING_TO_SLEEP 9 /* CPU is entering sleep 0 mode */ | ||
86 | #define TIF_USERSPACE 31 /* true if FS sets userspace */ | 87 | #define TIF_USERSPACE 31 /* true if FS sets userspace */ |
87 | 88 | ||
88 | #define _TIF_SYSCALL_TRACE (1 << TIF_SYSCALL_TRACE) | 89 | #define _TIF_SYSCALL_TRACE (1 << TIF_SYSCALL_TRACE) |
@@ -94,6 +95,7 @@ static inline struct thread_info *current_thread_info(void) | |||
94 | #define _TIF_SINGLE_STEP (1 << TIF_SINGLE_STEP) | 95 | #define _TIF_SINGLE_STEP (1 << TIF_SINGLE_STEP) |
95 | #define _TIF_MEMDIE (1 << TIF_MEMDIE) | 96 | #define _TIF_MEMDIE (1 << TIF_MEMDIE) |
96 | #define _TIF_RESTORE_SIGMASK (1 << TIF_RESTORE_SIGMASK) | 97 | #define _TIF_RESTORE_SIGMASK (1 << TIF_RESTORE_SIGMASK) |
98 | #define _TIF_CPU_GOING_TO_SLEEP (1 << TIF_CPU_GOING_TO_SLEEP) | ||
97 | 99 | ||
98 | /* XXX: These two masks must never span more than 16 bits! */ | 100 | /* XXX: These two masks must never span more than 16 bits! */ |
99 | /* work to do on interrupt/exception return */ | 101 | /* work to do on interrupt/exception return */ |
diff --git a/include/asm-avr32/uaccess.h b/include/asm-avr32/uaccess.h index 74a679e9098c..ed092395215e 100644 --- a/include/asm-avr32/uaccess.h +++ b/include/asm-avr32/uaccess.h | |||
@@ -181,24 +181,23 @@ extern int __put_user_bad(void); | |||
181 | 181 | ||
182 | #define __get_user_nocheck(x, ptr, size) \ | 182 | #define __get_user_nocheck(x, ptr, size) \ |
183 | ({ \ | 183 | ({ \ |
184 | typeof(*(ptr)) __gu_val = (typeof(*(ptr)) __force)0; \ | 184 | unsigned long __gu_val = 0; \ |
185 | int __gu_err = 0; \ | 185 | int __gu_err = 0; \ |
186 | \ | 186 | \ |
187 | switch (size) { \ | 187 | switch (size) { \ |
188 | case 1: __get_user_asm("ub", __gu_val, ptr, __gu_err); break; \ | 188 | case 1: __get_user_asm("ub", __gu_val, ptr, __gu_err); break; \ |
189 | case 2: __get_user_asm("uh", __gu_val, ptr, __gu_err); break; \ | 189 | case 2: __get_user_asm("uh", __gu_val, ptr, __gu_err); break; \ |
190 | case 4: __get_user_asm("w", __gu_val, ptr, __gu_err); break; \ | 190 | case 4: __get_user_asm("w", __gu_val, ptr, __gu_err); break; \ |
191 | case 8: __get_user_asm("d", __gu_val, ptr, __gu_err); break; \ | ||
192 | default: __gu_err = __get_user_bad(); break; \ | 191 | default: __gu_err = __get_user_bad(); break; \ |
193 | } \ | 192 | } \ |
194 | \ | 193 | \ |
195 | x = __gu_val; \ | 194 | x = (typeof(*(ptr)))__gu_val; \ |
196 | __gu_err; \ | 195 | __gu_err; \ |
197 | }) | 196 | }) |
198 | 197 | ||
199 | #define __get_user_check(x, ptr, size) \ | 198 | #define __get_user_check(x, ptr, size) \ |
200 | ({ \ | 199 | ({ \ |
201 | typeof(*(ptr)) __gu_val = (typeof(*(ptr)) __force)0; \ | 200 | unsigned long __gu_val = 0; \ |
202 | const typeof(*(ptr)) __user * __gu_addr = (ptr); \ | 201 | const typeof(*(ptr)) __user * __gu_addr = (ptr); \ |
203 | int __gu_err = 0; \ | 202 | int __gu_err = 0; \ |
204 | \ | 203 | \ |
@@ -216,10 +215,6 @@ extern int __put_user_bad(void); | |||
216 | __get_user_asm("w", __gu_val, __gu_addr, \ | 215 | __get_user_asm("w", __gu_val, __gu_addr, \ |
217 | __gu_err); \ | 216 | __gu_err); \ |
218 | break; \ | 217 | break; \ |
219 | case 8: \ | ||
220 | __get_user_asm("d", __gu_val, __gu_addr, \ | ||
221 | __gu_err); \ | ||
222 | break; \ | ||
223 | default: \ | 218 | default: \ |
224 | __gu_err = __get_user_bad(); \ | 219 | __gu_err = __get_user_bad(); \ |
225 | break; \ | 220 | break; \ |
@@ -227,7 +222,7 @@ extern int __put_user_bad(void); | |||
227 | } else { \ | 222 | } else { \ |
228 | __gu_err = -EFAULT; \ | 223 | __gu_err = -EFAULT; \ |
229 | } \ | 224 | } \ |
230 | x = __gu_val; \ | 225 | x = (typeof(*(ptr)))__gu_val; \ |
231 | __gu_err; \ | 226 | __gu_err; \ |
232 | }) | 227 | }) |
233 | 228 | ||
diff --git a/include/asm-cris/socket.h b/include/asm-cris/socket.h index 01cfdf1d6d33..5b18dfdf1748 100644 --- a/include/asm-cris/socket.h +++ b/include/asm-cris/socket.h | |||
@@ -51,6 +51,8 @@ | |||
51 | 51 | ||
52 | #define SO_PEERSEC 31 | 52 | #define SO_PEERSEC 31 |
53 | #define SO_PASSSEC 34 | 53 | #define SO_PASSSEC 34 |
54 | #define SO_TIMESTAMPNS 35 | ||
55 | #define SCM_TIMESTAMPNS SO_TIMESTAMPNS | ||
54 | 56 | ||
55 | #endif /* _ASM_SOCKET_H */ | 57 | #endif /* _ASM_SOCKET_H */ |
56 | 58 | ||
diff --git a/include/asm-cris/sockios.h b/include/asm-cris/sockios.h index 6c4012f0b29f..cfe7bfecf599 100644 --- a/include/asm-cris/sockios.h +++ b/include/asm-cris/sockios.h | |||
@@ -7,6 +7,7 @@ | |||
7 | #define FIOGETOWN 0x8903 | 7 | #define FIOGETOWN 0x8903 |
8 | #define SIOCGPGRP 0x8904 | 8 | #define SIOCGPGRP 0x8904 |
9 | #define SIOCATMARK 0x8905 | 9 | #define SIOCATMARK 0x8905 |
10 | #define SIOCGSTAMP 0x8906 /* Get stamp */ | 10 | #define SIOCGSTAMP 0x8906 /* Get stamp (timeval) */ |
11 | #define SIOCGSTAMPNS 0x8907 /* Get stamp (timespec) */ | ||
11 | 12 | ||
12 | #endif | 13 | #endif |
diff --git a/include/asm-frv/socket.h b/include/asm-frv/socket.h index 31db18fc871f..a823befd11dd 100644 --- a/include/asm-frv/socket.h +++ b/include/asm-frv/socket.h | |||
@@ -49,6 +49,8 @@ | |||
49 | 49 | ||
50 | #define SO_PEERSEC 31 | 50 | #define SO_PEERSEC 31 |
51 | #define SO_PASSSEC 34 | 51 | #define SO_PASSSEC 34 |
52 | #define SO_TIMESTAMPNS 35 | ||
53 | #define SCM_TIMESTAMPNS SO_TIMESTAMPNS | ||
52 | 54 | ||
53 | #endif /* _ASM_SOCKET_H */ | 55 | #endif /* _ASM_SOCKET_H */ |
54 | 56 | ||
diff --git a/include/asm-frv/sockios.h b/include/asm-frv/sockios.h index 8a6e4b2074b7..5dbdd13e6de3 100644 --- a/include/asm-frv/sockios.h +++ b/include/asm-frv/sockios.h | |||
@@ -7,7 +7,8 @@ | |||
7 | #define FIOGETOWN 0x8903 | 7 | #define FIOGETOWN 0x8903 |
8 | #define SIOCGPGRP 0x8904 | 8 | #define SIOCGPGRP 0x8904 |
9 | #define SIOCATMARK 0x8905 | 9 | #define SIOCATMARK 0x8905 |
10 | #define SIOCGSTAMP 0x8906 /* Get stamp */ | 10 | #define SIOCGSTAMP 0x8906 /* Get stamp (timeval) */ |
11 | #define SIOCGSTAMPNS 0x8907 /* Get stamp (timespec) */ | ||
11 | 12 | ||
12 | #endif /* _ASM_SOCKIOS__ */ | 13 | #endif /* _ASM_SOCKIOS__ */ |
13 | 14 | ||
diff --git a/include/asm-generic/div64.h b/include/asm-generic/div64.h index 8f4e3193342e..a4a49370793c 100644 --- a/include/asm-generic/div64.h +++ b/include/asm-generic/div64.h | |||
@@ -30,6 +30,11 @@ | |||
30 | __rem; \ | 30 | __rem; \ |
31 | }) | 31 | }) |
32 | 32 | ||
33 | static inline uint64_t div64_64(uint64_t dividend, uint64_t divisor) | ||
34 | { | ||
35 | return dividend / divisor; | ||
36 | } | ||
37 | |||
33 | #elif BITS_PER_LONG == 32 | 38 | #elif BITS_PER_LONG == 32 |
34 | 39 | ||
35 | extern uint32_t __div64_32(uint64_t *dividend, uint32_t divisor); | 40 | extern uint32_t __div64_32(uint64_t *dividend, uint32_t divisor); |
@@ -49,6 +54,8 @@ extern uint32_t __div64_32(uint64_t *dividend, uint32_t divisor); | |||
49 | __rem; \ | 54 | __rem; \ |
50 | }) | 55 | }) |
51 | 56 | ||
57 | extern uint64_t div64_64(uint64_t dividend, uint64_t divisor); | ||
58 | |||
52 | #else /* BITS_PER_LONG == ?? */ | 59 | #else /* BITS_PER_LONG == ?? */ |
53 | 60 | ||
54 | # error do_div() does not yet support the C64 | 61 | # error do_div() does not yet support the C64 |
diff --git a/include/asm-generic/pgtable.h b/include/asm-generic/pgtable.h index 6d7e279b1490..dc8f99ee305f 100644 --- a/include/asm-generic/pgtable.h +++ b/include/asm-generic/pgtable.h | |||
@@ -139,8 +139,15 @@ static inline void ptep_set_wrprotect(struct mm_struct *mm, unsigned long addres | |||
139 | #define pte_same(A,B) (pte_val(A) == pte_val(B)) | 139 | #define pte_same(A,B) (pte_val(A) == pte_val(B)) |
140 | #endif | 140 | #endif |
141 | 141 | ||
142 | #ifndef __HAVE_ARCH_PAGE_TEST_AND_CLEAR_DIRTY | 142 | #ifndef __HAVE_ARCH_PAGE_TEST_DIRTY |
143 | #define page_test_and_clear_dirty(page) (0) | 143 | #define page_test_dirty(page) (0) |
144 | #endif | ||
145 | |||
146 | #ifndef __HAVE_ARCH_PAGE_CLEAR_DIRTY | ||
147 | #define page_clear_dirty(page) do { } while (0) | ||
148 | #endif | ||
149 | |||
150 | #ifndef __HAVE_ARCH_PAGE_TEST_DIRTY | ||
144 | #define pte_maybe_dirty(pte) pte_dirty(pte) | 151 | #define pte_maybe_dirty(pte) pte_dirty(pte) |
145 | #else | 152 | #else |
146 | #define pte_maybe_dirty(pte) (1) | 153 | #define pte_maybe_dirty(pte) (1) |
diff --git a/include/asm-h8300/socket.h b/include/asm-h8300/socket.h index ebc830fee0d0..39911d8c9684 100644 --- a/include/asm-h8300/socket.h +++ b/include/asm-h8300/socket.h | |||
@@ -49,5 +49,7 @@ | |||
49 | 49 | ||
50 | #define SO_PEERSEC 31 | 50 | #define SO_PEERSEC 31 |
51 | #define SO_PASSSEC 34 | 51 | #define SO_PASSSEC 34 |
52 | #define SO_TIMESTAMPNS 35 | ||
53 | #define SCM_TIMESTAMPNS SO_TIMESTAMPNS | ||
52 | 54 | ||
53 | #endif /* _ASM_SOCKET_H */ | 55 | #endif /* _ASM_SOCKET_H */ |
diff --git a/include/asm-h8300/sockios.h b/include/asm-h8300/sockios.h index d005d9594cc6..e9c7ec810c23 100644 --- a/include/asm-h8300/sockios.h +++ b/include/asm-h8300/sockios.h | |||
@@ -7,6 +7,7 @@ | |||
7 | #define FIOGETOWN 0x8903 | 7 | #define FIOGETOWN 0x8903 |
8 | #define SIOCGPGRP 0x8904 | 8 | #define SIOCGPGRP 0x8904 |
9 | #define SIOCATMARK 0x8905 | 9 | #define SIOCATMARK 0x8905 |
10 | #define SIOCGSTAMP 0x8906 /* Get stamp */ | 10 | #define SIOCGSTAMP 0x8906 /* Get stamp (timeval) */ |
11 | #define SIOCGSTAMPNS 0x8907 /* Get stamp (timespec) */ | ||
11 | 12 | ||
12 | #endif /* __ARCH_H8300_SOCKIOS__ */ | 13 | #endif /* __ARCH_H8300_SOCKIOS__ */ |
diff --git a/include/asm-i386/div64.h b/include/asm-i386/div64.h index 75c67c785bb8..438e980068bd 100644 --- a/include/asm-i386/div64.h +++ b/include/asm-i386/div64.h | |||
@@ -1,6 +1,8 @@ | |||
1 | #ifndef __I386_DIV64 | 1 | #ifndef __I386_DIV64 |
2 | #define __I386_DIV64 | 2 | #define __I386_DIV64 |
3 | 3 | ||
4 | #include <linux/types.h> | ||
5 | |||
4 | /* | 6 | /* |
5 | * do_div() is NOT a C function. It wants to return | 7 | * do_div() is NOT a C function. It wants to return |
6 | * two values (the quotient and the remainder), but | 8 | * two values (the quotient and the remainder), but |
@@ -45,4 +47,6 @@ div_ll_X_l_rem(long long divs, long div, long *rem) | |||
45 | return dum2; | 47 | return dum2; |
46 | 48 | ||
47 | } | 49 | } |
50 | |||
51 | extern uint64_t div64_64(uint64_t dividend, uint64_t divisor); | ||
48 | #endif | 52 | #endif |
diff --git a/include/asm-i386/socket.h b/include/asm-i386/socket.h index 5755d57c4e95..99ca648b94c5 100644 --- a/include/asm-i386/socket.h +++ b/include/asm-i386/socket.h | |||
@@ -49,5 +49,7 @@ | |||
49 | 49 | ||
50 | #define SO_PEERSEC 31 | 50 | #define SO_PEERSEC 31 |
51 | #define SO_PASSSEC 34 | 51 | #define SO_PASSSEC 34 |
52 | #define SO_TIMESTAMPNS 35 | ||
53 | #define SCM_TIMESTAMPNS SO_TIMESTAMPNS | ||
52 | 54 | ||
53 | #endif /* _ASM_SOCKET_H */ | 55 | #endif /* _ASM_SOCKET_H */ |
diff --git a/include/asm-i386/sockios.h b/include/asm-i386/sockios.h index 6b747f8e228b..ff528c7d255c 100644 --- a/include/asm-i386/sockios.h +++ b/include/asm-i386/sockios.h | |||
@@ -7,6 +7,7 @@ | |||
7 | #define FIOGETOWN 0x8903 | 7 | #define FIOGETOWN 0x8903 |
8 | #define SIOCGPGRP 0x8904 | 8 | #define SIOCGPGRP 0x8904 |
9 | #define SIOCATMARK 0x8905 | 9 | #define SIOCATMARK 0x8905 |
10 | #define SIOCGSTAMP 0x8906 /* Get stamp */ | 10 | #define SIOCGSTAMP 0x8906 /* Get stamp (timeval) */ |
11 | #define SIOCGSTAMPNS 0x8907 /* Get stamp (timespec) */ | ||
11 | 12 | ||
12 | #endif | 13 | #endif |
diff --git a/include/asm-ia64/socket.h b/include/asm-ia64/socket.h index d638ef3d50c3..9e42ce43cfbe 100644 --- a/include/asm-ia64/socket.h +++ b/include/asm-ia64/socket.h | |||
@@ -58,5 +58,7 @@ | |||
58 | 58 | ||
59 | #define SO_PEERSEC 31 | 59 | #define SO_PEERSEC 31 |
60 | #define SO_PASSSEC 34 | 60 | #define SO_PASSSEC 34 |
61 | #define SO_TIMESTAMPNS 35 | ||
62 | #define SCM_TIMESTAMPNS SO_TIMESTAMPNS | ||
61 | 63 | ||
62 | #endif /* _ASM_IA64_SOCKET_H */ | 64 | #endif /* _ASM_IA64_SOCKET_H */ |
diff --git a/include/asm-ia64/sockios.h b/include/asm-ia64/sockios.h index cf94857c8a54..15c92468ad38 100644 --- a/include/asm-ia64/sockios.h +++ b/include/asm-ia64/sockios.h | |||
@@ -14,6 +14,7 @@ | |||
14 | #define FIOGETOWN 0x8903 | 14 | #define FIOGETOWN 0x8903 |
15 | #define SIOCGPGRP 0x8904 | 15 | #define SIOCGPGRP 0x8904 |
16 | #define SIOCATMARK 0x8905 | 16 | #define SIOCATMARK 0x8905 |
17 | #define SIOCGSTAMP 0x8906 /* Get stamp */ | 17 | #define SIOCGSTAMP 0x8906 /* Get stamp (timeval) */ |
18 | #define SIOCGSTAMPNS 0x8907 /* Get stamp (timespec) */ | ||
18 | 19 | ||
19 | #endif /* _ASM_IA64_SOCKIOS_H */ | 20 | #endif /* _ASM_IA64_SOCKIOS_H */ |
diff --git a/include/asm-m32r/socket.h b/include/asm-m32r/socket.h index acdf748fcdc8..793d5d30c850 100644 --- a/include/asm-m32r/socket.h +++ b/include/asm-m32r/socket.h | |||
@@ -49,5 +49,7 @@ | |||
49 | 49 | ||
50 | #define SO_PEERSEC 31 | 50 | #define SO_PEERSEC 31 |
51 | #define SO_PASSSEC 34 | 51 | #define SO_PASSSEC 34 |
52 | #define SO_TIMESTAMPNS 35 | ||
53 | #define SCM_TIMESTAMPNS SO_TIMESTAMPNS | ||
52 | 54 | ||
53 | #endif /* _ASM_M32R_SOCKET_H */ | 55 | #endif /* _ASM_M32R_SOCKET_H */ |
diff --git a/include/asm-m32r/sockios.h b/include/asm-m32r/sockios.h index f89962e231fe..6c1fb9b43bdb 100644 --- a/include/asm-m32r/sockios.h +++ b/include/asm-m32r/sockios.h | |||
@@ -7,6 +7,7 @@ | |||
7 | #define FIOGETOWN 0x8903 | 7 | #define FIOGETOWN 0x8903 |
8 | #define SIOCGPGRP 0x8904 | 8 | #define SIOCGPGRP 0x8904 |
9 | #define SIOCATMARK 0x8905 | 9 | #define SIOCATMARK 0x8905 |
10 | #define SIOCGSTAMP 0x8906 /* Get stamp */ | 10 | #define SIOCGSTAMP 0x8906 /* Get stamp (timeval) */ |
11 | #define SIOCGSTAMPNS 0x8907 /* Get stamp (timespec) */ | ||
11 | 12 | ||
12 | #endif /* _ASM_M32R_SOCKIOS_H */ | 13 | #endif /* _ASM_M32R_SOCKIOS_H */ |
diff --git a/include/asm-m68k/div64.h b/include/asm-m68k/div64.h index 9f65de1a2480..33caad1628d4 100644 --- a/include/asm-m68k/div64.h +++ b/include/asm-m68k/div64.h | |||
@@ -1,6 +1,8 @@ | |||
1 | #ifndef _M68K_DIV64_H | 1 | #ifndef _M68K_DIV64_H |
2 | #define _M68K_DIV64_H | 2 | #define _M68K_DIV64_H |
3 | 3 | ||
4 | #include <linux/types.h> | ||
5 | |||
4 | /* n = n / base; return rem; */ | 6 | /* n = n / base; return rem; */ |
5 | 7 | ||
6 | #define do_div(n, base) ({ \ | 8 | #define do_div(n, base) ({ \ |
@@ -23,4 +25,5 @@ | |||
23 | __rem; \ | 25 | __rem; \ |
24 | }) | 26 | }) |
25 | 27 | ||
28 | extern uint64_t div64_64(uint64_t dividend, uint64_t divisor); | ||
26 | #endif /* _M68K_DIV64_H */ | 29 | #endif /* _M68K_DIV64_H */ |
diff --git a/include/asm-m68k/socket.h b/include/asm-m68k/socket.h index a5966ec005ae..6d21b90863ad 100644 --- a/include/asm-m68k/socket.h +++ b/include/asm-m68k/socket.h | |||
@@ -49,5 +49,7 @@ | |||
49 | 49 | ||
50 | #define SO_PEERSEC 31 | 50 | #define SO_PEERSEC 31 |
51 | #define SO_PASSSEC 34 | 51 | #define SO_PASSSEC 34 |
52 | #define SO_TIMESTAMPNS 35 | ||
53 | #define SCM_TIMESTAMPNS SO_TIMESTAMPNS | ||
52 | 54 | ||
53 | #endif /* _ASM_SOCKET_H */ | 55 | #endif /* _ASM_SOCKET_H */ |
diff --git a/include/asm-m68k/sockios.h b/include/asm-m68k/sockios.h index 9b9ed973c24e..c04a23943cb7 100644 --- a/include/asm-m68k/sockios.h +++ b/include/asm-m68k/sockios.h | |||
@@ -7,6 +7,7 @@ | |||
7 | #define FIOGETOWN 0x8903 | 7 | #define FIOGETOWN 0x8903 |
8 | #define SIOCGPGRP 0x8904 | 8 | #define SIOCGPGRP 0x8904 |
9 | #define SIOCATMARK 0x8905 | 9 | #define SIOCATMARK 0x8905 |
10 | #define SIOCGSTAMP 0x8906 /* Get stamp */ | 10 | #define SIOCGSTAMP 0x8906 /* Get stamp (timeval) */ |
11 | #define SIOCGSTAMPNS 0x8907 /* Get stamp (timespec) */ | ||
11 | 12 | ||
12 | #endif /* __ARCH_M68K_SOCKIOS__ */ | 13 | #endif /* __ARCH_M68K_SOCKIOS__ */ |
diff --git a/include/asm-mips/bug.h b/include/asm-mips/bug.h index 4d560a533940..7eb63de808bc 100644 --- a/include/asm-mips/bug.h +++ b/include/asm-mips/bug.h | |||
@@ -18,7 +18,8 @@ do { \ | |||
18 | 18 | ||
19 | #define BUG_ON(condition) \ | 19 | #define BUG_ON(condition) \ |
20 | do { \ | 20 | do { \ |
21 | __asm__ __volatile__("tne $0, %0" : : "r" (condition)); \ | 21 | __asm__ __volatile__("tne $0, %0, %1" \ |
22 | : : "r" (condition), "i" (BRK_BUG)); \ | ||
22 | } while (0) | 23 | } while (0) |
23 | 24 | ||
24 | #define HAVE_ARCH_BUG_ON | 25 | #define HAVE_ARCH_BUG_ON |
diff --git a/include/asm-mips/cacheflush.h b/include/asm-mips/cacheflush.h index 28d907d4347a..4933b4947ed0 100644 --- a/include/asm-mips/cacheflush.h +++ b/include/asm-mips/cacheflush.h | |||
@@ -96,6 +96,6 @@ extern void (*flush_data_cache_page)(unsigned long addr); | |||
96 | unsigned long __init run_uncached(void *func); | 96 | unsigned long __init run_uncached(void *func); |
97 | 97 | ||
98 | extern void *kmap_coherent(struct page *page, unsigned long addr); | 98 | extern void *kmap_coherent(struct page *page, unsigned long addr); |
99 | extern void kunmap_coherent(struct page *page); | 99 | extern void kunmap_coherent(void); |
100 | 100 | ||
101 | #endif /* _ASM_CACHEFLUSH_H */ | 101 | #endif /* _ASM_CACHEFLUSH_H */ |
diff --git a/include/asm-mips/checksum.h b/include/asm-mips/checksum.h index 20a81e1548f5..290485ac5407 100644 --- a/include/asm-mips/checksum.h +++ b/include/asm-mips/checksum.h | |||
@@ -166,7 +166,7 @@ static inline __wsum csum_tcpudp_nofold(__be32 saddr, | |||
166 | #else | 166 | #else |
167 | "r" (proto + len), | 167 | "r" (proto + len), |
168 | #endif | 168 | #endif |
169 | "r" (sum)); | 169 | "r" ((__force unsigned long)sum)); |
170 | 170 | ||
171 | return sum; | 171 | return sum; |
172 | } | 172 | } |
diff --git a/include/asm-mips/div64.h b/include/asm-mips/div64.h index d107832de1b6..66189f5f6399 100644 --- a/include/asm-mips/div64.h +++ b/include/asm-mips/div64.h | |||
@@ -1,6 +1,6 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (C) 2000, 2004 Maciej W. Rozycki | 2 | * Copyright (C) 2000, 2004 Maciej W. Rozycki |
3 | * Copyright (C) 2003 Ralf Baechle | 3 | * Copyright (C) 2003, 07 Ralf Baechle (ralf@linux-mips.org) |
4 | * | 4 | * |
5 | * This file is subject to the terms and conditions of the GNU General Public | 5 | * This file is subject to the terms and conditions of the GNU General Public |
6 | * License. See the file "COPYING" in the main directory of this archive | 6 | * License. See the file "COPYING" in the main directory of this archive |
@@ -9,6 +9,8 @@ | |||
9 | #ifndef _ASM_DIV64_H | 9 | #ifndef _ASM_DIV64_H |
10 | #define _ASM_DIV64_H | 10 | #define _ASM_DIV64_H |
11 | 11 | ||
12 | #include <linux/types.h> | ||
13 | |||
12 | #if (_MIPS_SZLONG == 32) | 14 | #if (_MIPS_SZLONG == 32) |
13 | 15 | ||
14 | #include <asm/compiler.h> | 16 | #include <asm/compiler.h> |
@@ -78,6 +80,8 @@ | |||
78 | __quot = __quot << 32 | __low; \ | 80 | __quot = __quot << 32 | __low; \ |
79 | (n) = __quot; \ | 81 | (n) = __quot; \ |
80 | __mod; }) | 82 | __mod; }) |
83 | |||
84 | extern uint64_t div64_64(uint64_t dividend, uint64_t divisor); | ||
81 | #endif /* (_MIPS_SZLONG == 32) */ | 85 | #endif /* (_MIPS_SZLONG == 32) */ |
82 | 86 | ||
83 | #if (_MIPS_SZLONG == 64) | 87 | #if (_MIPS_SZLONG == 64) |
@@ -101,6 +105,11 @@ | |||
101 | (n) = __quot; \ | 105 | (n) = __quot; \ |
102 | __mod; }) | 106 | __mod; }) |
103 | 107 | ||
108 | static inline uint64_t div64_64(uint64_t dividend, uint64_t divisor) | ||
109 | { | ||
110 | return dividend / divisor; | ||
111 | } | ||
112 | |||
104 | #endif /* (_MIPS_SZLONG == 64) */ | 113 | #endif /* (_MIPS_SZLONG == 64) */ |
105 | 114 | ||
106 | #endif /* _ASM_DIV64_H */ | 115 | #endif /* _ASM_DIV64_H */ |
diff --git a/include/asm-mips/fpu.h b/include/asm-mips/fpu.h index 4e12d1f9534f..b414a7d9db43 100644 --- a/include/asm-mips/fpu.h +++ b/include/asm-mips/fpu.h | |||
@@ -68,8 +68,6 @@ do { \ | |||
68 | /* We don't care about the c0 hazard here */ \ | 68 | /* We don't care about the c0 hazard here */ \ |
69 | } while (0) | 69 | } while (0) |
70 | 70 | ||
71 | #define __fpu_enabled() (read_c0_status() & ST0_CU1) | ||
72 | |||
73 | #define enable_fpu() \ | 71 | #define enable_fpu() \ |
74 | do { \ | 72 | do { \ |
75 | if (cpu_has_fpu) \ | 73 | if (cpu_has_fpu) \ |
@@ -102,14 +100,19 @@ static inline void __own_fpu(void) | |||
102 | set_thread_flag(TIF_USEDFPU); | 100 | set_thread_flag(TIF_USEDFPU); |
103 | } | 101 | } |
104 | 102 | ||
105 | static inline void own_fpu(int restore) | 103 | static inline void own_fpu_inatomic(int restore) |
106 | { | 104 | { |
107 | preempt_disable(); | ||
108 | if (cpu_has_fpu && !__is_fpu_owner()) { | 105 | if (cpu_has_fpu && !__is_fpu_owner()) { |
109 | __own_fpu(); | 106 | __own_fpu(); |
110 | if (restore) | 107 | if (restore) |
111 | _restore_fp(current); | 108 | _restore_fp(current); |
112 | } | 109 | } |
110 | } | ||
111 | |||
112 | static inline void own_fpu(int restore) | ||
113 | { | ||
114 | preempt_disable(); | ||
115 | own_fpu_inatomic(restore); | ||
113 | preempt_enable(); | 116 | preempt_enable(); |
114 | } | 117 | } |
115 | 118 | ||
@@ -162,18 +165,4 @@ static inline fpureg_t *get_fpu_regs(struct task_struct *tsk) | |||
162 | return tsk->thread.fpu.fpr; | 165 | return tsk->thread.fpu.fpr; |
163 | } | 166 | } |
164 | 167 | ||
165 | static inline void enable_fp_in_kernel(void) | ||
166 | { | ||
167 | set_thread_flag(TIF_ALLOW_FP_IN_KERNEL); | ||
168 | /* make sure CU1 and FPU ownership are consistent */ | ||
169 | if (!__is_fpu_owner() && __fpu_enabled()) | ||
170 | __disable_fpu(); | ||
171 | } | ||
172 | |||
173 | static inline void disable_fp_in_kernel(void) | ||
174 | { | ||
175 | BUG_ON(!__is_fpu_owner() && __fpu_enabled()); | ||
176 | clear_thread_flag(TIF_ALLOW_FP_IN_KERNEL); | ||
177 | } | ||
178 | |||
179 | #endif /* _ASM_FPU_H */ | 168 | #endif /* _ASM_FPU_H */ |
diff --git a/include/asm-mips/jmr3927/irq.h b/include/asm-mips/jmr3927/irq.h deleted file mode 100644 index e3e7ed38da6c..000000000000 --- a/include/asm-mips/jmr3927/irq.h +++ /dev/null | |||
@@ -1,57 +0,0 @@ | |||
1 | /* | ||
2 | * linux/include/asm-mips/tx3927/irq.h | ||
3 | * | ||
4 | * This file is subject to the terms and conditions of the GNU General Public | ||
5 | * License. See the file "COPYING" in the main directory of this archive | ||
6 | * for more details. | ||
7 | * | ||
8 | * Copyright (C) 2001 Toshiba Corporation | ||
9 | */ | ||
10 | #ifndef __ASM_TX3927_IRQ_H | ||
11 | #define __ASM_TX3927_IRQ_H | ||
12 | |||
13 | #ifndef __ASSEMBLY__ | ||
14 | |||
15 | #include <asm/irq.h> | ||
16 | |||
17 | struct tb_irq_space { | ||
18 | struct tb_irq_space* next; | ||
19 | int start_irqno; | ||
20 | int nr_irqs; | ||
21 | void (*mask_func)(int irq_nr, int space_id); | ||
22 | void (*unmask_func)(int irq_no, int space_id); | ||
23 | const char *name; | ||
24 | int space_id; | ||
25 | int can_share; | ||
26 | }; | ||
27 | extern struct tb_irq_space* tb_irq_spaces; | ||
28 | |||
29 | static __inline__ void add_tb_irq_space(struct tb_irq_space* sp) | ||
30 | { | ||
31 | sp->next = tb_irq_spaces; | ||
32 | tb_irq_spaces = sp; | ||
33 | } | ||
34 | |||
35 | |||
36 | struct pt_regs; | ||
37 | extern void | ||
38 | toshibaboards_spurious(struct pt_regs *regs, int irq); | ||
39 | extern void | ||
40 | toshibaboards_irqdispatch(struct pt_regs *regs, int irq); | ||
41 | |||
42 | extern struct irqaction * | ||
43 | toshibaboards_get_irq_action(int irq); | ||
44 | extern int | ||
45 | toshibaboards_setup_irq(int irq, struct irqaction * new); | ||
46 | |||
47 | |||
48 | extern int (*toshibaboards_gen_iack)(void); | ||
49 | |||
50 | #endif /* !__ASSEMBLY__ */ | ||
51 | |||
52 | #define NR_ISA_IRQS 16 | ||
53 | #define TB_IRQ_IS_ISA(irq) \ | ||
54 | (0 <= (irq) && (irq) < NR_ISA_IRQS) | ||
55 | #define TB_IRQ_TO_ISA_IRQ(irq) (irq) | ||
56 | |||
57 | #endif /* __ASM_TX3927_IRQ_H */ | ||
diff --git a/include/asm-mips/jmr3927/jmr3927.h b/include/asm-mips/jmr3927/jmr3927.h index c50e68ffa3af..958e29706e2d 100644 --- a/include/asm-mips/jmr3927/jmr3927.h +++ b/include/asm-mips/jmr3927/jmr3927.h | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * Defines for the TJSYS JMR-TX3927/JMI-3927IO2/JMY-1394IF. | 2 | * Defines for the TJSYS JMR-TX3927 |
3 | * | 3 | * |
4 | * This file is subject to the terms and conditions of the GNU General Public | 4 | * This file is subject to the terms and conditions of the GNU General Public |
5 | * License. See the file "COPYING" in the main directory of this archive | 5 | * License. See the file "COPYING" in the main directory of this archive |
@@ -12,10 +12,7 @@ | |||
12 | 12 | ||
13 | #include <asm/jmr3927/tx3927.h> | 13 | #include <asm/jmr3927/tx3927.h> |
14 | #include <asm/addrspace.h> | 14 | #include <asm/addrspace.h> |
15 | #include <asm/jmr3927/irq.h> | ||
16 | #ifndef __ASSEMBLY__ | ||
17 | #include <asm/system.h> | 15 | #include <asm/system.h> |
18 | #endif | ||
19 | 16 | ||
20 | /* CS */ | 17 | /* CS */ |
21 | #define JMR3927_ROMCE0 0x1fc00000 /* 4M */ | 18 | #define JMR3927_ROMCE0 0x1fc00000 /* 4M */ |
@@ -35,28 +32,10 @@ | |||
35 | #define JMR3927_SDRAM_SIZE 0x02000000 /* 32M */ | 32 | #define JMR3927_SDRAM_SIZE 0x02000000 /* 32M */ |
36 | #define JMR3927_PORT_BASE KSEG1 | 33 | #define JMR3927_PORT_BASE KSEG1 |
37 | 34 | ||
38 | /* select indirect initiator access per errata */ | ||
39 | #define JMR3927_INIT_INDIRECT_PCI | ||
40 | #define PCI_ISTAT_IDICC 0x1000 | ||
41 | #define PCI_IPCIBE_IBE_LONG 0 | ||
42 | #define PCI_IPCIBE_ICMD_IOREAD 2 | ||
43 | #define PCI_IPCIBE_ICMD_IOWRITE 3 | ||
44 | #define PCI_IPCIBE_ICMD_MEMREAD 6 | ||
45 | #define PCI_IPCIBE_ICMD_MEMWRITE 7 | ||
46 | #define PCI_IPCIBE_ICMD_SHIFT 4 | ||
47 | |||
48 | /* Address map (virtual address) */ | 35 | /* Address map (virtual address) */ |
49 | #define JMR3927_ROM0_BASE (KSEG1 + JMR3927_ROMCE0) | 36 | #define JMR3927_ROM0_BASE (KSEG1 + JMR3927_ROMCE0) |
50 | #define JMR3927_ROM1_BASE (KSEG1 + JMR3927_ROMCE1) | 37 | #define JMR3927_ROM1_BASE (KSEG1 + JMR3927_ROMCE1) |
51 | #define JMR3927_IOC_BASE (KSEG1 + JMR3927_ROMCE2) | 38 | #define JMR3927_IOC_BASE (KSEG1 + JMR3927_ROMCE2) |
52 | #define JMR3927_IOB_BASE (KSEG1 + JMR3927_ROMCE3) | ||
53 | #define JMR3927_ISAMEM_BASE (JMR3927_IOB_BASE) | ||
54 | #define JMR3927_ISAIO_BASE (JMR3927_IOB_BASE + 0x01000000) | ||
55 | #define JMR3927_ISAC_BASE (JMR3927_IOB_BASE + 0x02000000) | ||
56 | #define JMR3927_LCDVGA_REG_BASE (JMR3927_IOB_BASE + 0x03000000) | ||
57 | #define JMR3927_LCDVGA_MEM_BASE (JMR3927_IOB_BASE + 0x03800000) | ||
58 | #define JMR3927_JMY1394_BASE (KSEG1 + JMR3927_ROMCE5) | ||
59 | #define JMR3927_PREMIER3_BASE (JMR3927_JMY1394_BASE + 0x00100000) | ||
60 | #define JMR3927_PCIMEM_BASE (KSEG1 + JMR3927_PCIMEM) | 39 | #define JMR3927_PCIMEM_BASE (KSEG1 + JMR3927_PCIMEM) |
61 | #define JMR3927_PCIIO_BASE (KSEG1 + JMR3927_PCIIO) | 40 | #define JMR3927_PCIIO_BASE (KSEG1 + JMR3927_PCIIO) |
62 | 41 | ||
@@ -72,25 +51,14 @@ | |||
72 | #define JMR3927_IOC_INTP_ADDR (JMR3927_IOC_BASE + 0x000b0000) | 51 | #define JMR3927_IOC_INTP_ADDR (JMR3927_IOC_BASE + 0x000b0000) |
73 | #define JMR3927_IOC_RESET_ADDR (JMR3927_IOC_BASE + 0x000f0000) | 52 | #define JMR3927_IOC_RESET_ADDR (JMR3927_IOC_BASE + 0x000f0000) |
74 | 53 | ||
75 | #define JMR3927_ISAC_REV_ADDR (JMR3927_ISAC_BASE + 0x00000000) | ||
76 | #define JMR3927_ISAC_EINTS_ADDR (JMR3927_ISAC_BASE + 0x00200000) | ||
77 | #define JMR3927_ISAC_EINTM_ADDR (JMR3927_ISAC_BASE + 0x00300000) | ||
78 | #define JMR3927_ISAC_NMI_ADDR (JMR3927_ISAC_BASE + 0x00400000) | ||
79 | #define JMR3927_ISAC_LED_ADDR (JMR3927_ISAC_BASE + 0x00500000) | ||
80 | #define JMR3927_ISAC_INTP_ADDR (JMR3927_ISAC_BASE + 0x00800000) | ||
81 | #define JMR3927_ISAC_INTS1_ADDR (JMR3927_ISAC_BASE + 0x00900000) | ||
82 | #define JMR3927_ISAC_INTS2_ADDR (JMR3927_ISAC_BASE + 0x00a00000) | ||
83 | #define JMR3927_ISAC_INTM_ADDR (JMR3927_ISAC_BASE + 0x00b00000) | ||
84 | |||
85 | /* Flash ROM */ | 54 | /* Flash ROM */ |
86 | #define JMR3927_FLASH_BASE (JMR3927_ROM0_BASE) | 55 | #define JMR3927_FLASH_BASE (JMR3927_ROM0_BASE) |
87 | #define JMR3927_FLASH_SIZE 0x00400000 | 56 | #define JMR3927_FLASH_SIZE 0x00400000 |
88 | 57 | ||
89 | /* bits for IOC_REV/IOC_BREV/ISAC_REV (high byte) */ | 58 | /* bits for IOC_REV/IOC_BREV (high byte) */ |
90 | #define JMR3927_IDT_MASK 0xfc | 59 | #define JMR3927_IDT_MASK 0xfc |
91 | #define JMR3927_REV_MASK 0x03 | 60 | #define JMR3927_REV_MASK 0x03 |
92 | #define JMR3927_IOC_IDT 0xe0 | 61 | #define JMR3927_IOC_IDT 0xe0 |
93 | #define JMR3927_ISAC_IDT 0x20 | ||
94 | 62 | ||
95 | /* bits for IOC_INTS1/IOC_INTS2/IOC_INTM/IOC_INTP (high byte) */ | 63 | /* bits for IOC_INTS1/IOC_INTS2/IOC_INTM/IOC_INTP (high byte) */ |
96 | #define JMR3927_IOC_INTB_PCIA 0 | 64 | #define JMR3927_IOC_INTB_PCIA 0 |
@@ -114,40 +82,6 @@ | |||
114 | #define JMR3927_IOC_RESET_CPU 1 | 82 | #define JMR3927_IOC_RESET_CPU 1 |
115 | #define JMR3927_IOC_RESET_PCI 2 | 83 | #define JMR3927_IOC_RESET_PCI 2 |
116 | 84 | ||
117 | /* bits for ISAC_EINTS/ISAC_EINTM (high byte) */ | ||
118 | #define JMR3927_ISAC_EINTB_IOCHK 2 | ||
119 | #define JMR3927_ISAC_EINTB_BWTH 4 | ||
120 | #define JMR3927_ISAC_EINTF_IOCHK (1 << JMR3927_ISAC_EINTB_IOCHK) | ||
121 | #define JMR3927_ISAC_EINTF_BWTH (1 << JMR3927_ISAC_EINTB_BWTH) | ||
122 | |||
123 | /* bits for ISAC_LED (high byte) */ | ||
124 | #define JMR3927_ISAC_LED_ISALED 0x01 | ||
125 | #define JMR3927_ISAC_LED_USRLED 0x02 | ||
126 | |||
127 | /* bits for ISAC_INTS/ISAC_INTM/ISAC_INTP (high byte) */ | ||
128 | #define JMR3927_ISAC_INTB_IRQ5 0 | ||
129 | #define JMR3927_ISAC_INTB_IRQKB 1 | ||
130 | #define JMR3927_ISAC_INTB_IRQMOUSE 2 | ||
131 | #define JMR3927_ISAC_INTB_IRQ4 3 | ||
132 | #define JMR3927_ISAC_INTB_IRQ12 4 | ||
133 | #define JMR3927_ISAC_INTB_IRQ3 5 | ||
134 | #define JMR3927_ISAC_INTB_IRQ10 6 | ||
135 | #define JMR3927_ISAC_INTB_ISAER 7 | ||
136 | #define JMR3927_ISAC_INTF_IRQ5 (1 << JMR3927_ISAC_INTB_IRQ5) | ||
137 | #define JMR3927_ISAC_INTF_IRQKB (1 << JMR3927_ISAC_INTB_IRQKB) | ||
138 | #define JMR3927_ISAC_INTF_IRQMOUSE (1 << JMR3927_ISAC_INTB_IRQMOUSE) | ||
139 | #define JMR3927_ISAC_INTF_IRQ4 (1 << JMR3927_ISAC_INTB_IRQ4) | ||
140 | #define JMR3927_ISAC_INTF_IRQ12 (1 << JMR3927_ISAC_INTB_IRQ12) | ||
141 | #define JMR3927_ISAC_INTF_IRQ3 (1 << JMR3927_ISAC_INTB_IRQ3) | ||
142 | #define JMR3927_ISAC_INTF_IRQ10 (1 << JMR3927_ISAC_INTB_IRQ10) | ||
143 | #define JMR3927_ISAC_INTF_ISAER (1 << JMR3927_ISAC_INTB_ISAER) | ||
144 | |||
145 | #ifndef __ASSEMBLY__ | ||
146 | |||
147 | #if 0 | ||
148 | #define jmr3927_ioc_reg_out(d, a) ((*(volatile unsigned short *)(a)) = (d) << 8) | ||
149 | #define jmr3927_ioc_reg_in(a) (((*(volatile unsigned short *)(a)) >> 8) & 0xff) | ||
150 | #else | ||
151 | #if defined(__BIG_ENDIAN) | 85 | #if defined(__BIG_ENDIAN) |
152 | #define jmr3927_ioc_reg_out(d, a) ((*(volatile unsigned char *)(a)) = (d)) | 86 | #define jmr3927_ioc_reg_out(d, a) ((*(volatile unsigned char *)(a)) = (d)) |
153 | #define jmr3927_ioc_reg_in(a) (*(volatile unsigned char *)(a)) | 87 | #define jmr3927_ioc_reg_in(a) (*(volatile unsigned char *)(a)) |
@@ -157,31 +91,9 @@ | |||
157 | #else | 91 | #else |
158 | #error "No Endian" | 92 | #error "No Endian" |
159 | #endif | 93 | #endif |
160 | #endif | ||
161 | #define jmr3927_isac_reg_out(d, a) ((*(volatile unsigned char *)(a)) = (d)) | ||
162 | #define jmr3927_isac_reg_in(a) (*(volatile unsigned char *)(a)) | ||
163 | |||
164 | static inline int jmr3927_have_isac(void) | ||
165 | { | ||
166 | unsigned char idt; | ||
167 | unsigned long flags; | ||
168 | unsigned long romcr3; | ||
169 | |||
170 | local_irq_save(flags); | ||
171 | romcr3 = tx3927_romcptr->cr[3]; | ||
172 | tx3927_romcptr->cr[3] &= 0xffffefff; /* do not wait infinitely */ | ||
173 | idt = jmr3927_isac_reg_in(JMR3927_ISAC_REV_ADDR) & JMR3927_IDT_MASK; | ||
174 | tx3927_romcptr->cr[3] = romcr3; | ||
175 | local_irq_restore(flags); | ||
176 | |||
177 | return idt == JMR3927_ISAC_IDT; | ||
178 | } | ||
179 | #define jmr3927_have_nvram() \ | ||
180 | ((jmr3927_ioc_reg_in(JMR3927_IOC_REV_ADDR) & JMR3927_IDT_MASK) == JMR3927_IOC_IDT) | ||
181 | 94 | ||
182 | /* LED macro */ | 95 | /* LED macro */ |
183 | #define jmr3927_led_set(n/*0-16*/) jmr3927_ioc_reg_out(~(n), JMR3927_IOC_LED_ADDR) | 96 | #define jmr3927_led_set(n/*0-16*/) jmr3927_ioc_reg_out(~(n), JMR3927_IOC_LED_ADDR) |
184 | #define jmr3927_io_led_set(n/*0-3*/) jmr3927_isac_reg_out((n), JMR3927_ISAC_LED_ADDR) | ||
185 | 97 | ||
186 | #define jmr3927_led_and_set(n/*0-16*/) jmr3927_ioc_reg_out((~(n)) & jmr3927_ioc_reg_in(JMR3927_IOC_LED_ADDR), JMR3927_IOC_LED_ADDR) | 98 | #define jmr3927_led_and_set(n/*0-16*/) jmr3927_ioc_reg_out((~(n)) & jmr3927_ioc_reg_in(JMR3927_IOC_LED_ADDR), JMR3927_IOC_LED_ADDR) |
187 | 99 | ||
@@ -190,10 +102,6 @@ static inline int jmr3927_have_isac(void) | |||
190 | #define jmr3927_dipsw2() ((tx3927_pioptr->din & (1 << 10)) == 0) | 102 | #define jmr3927_dipsw2() ((tx3927_pioptr->din & (1 << 10)) == 0) |
191 | #define jmr3927_dipsw3() ((jmr3927_ioc_reg_in(JMR3927_IOC_DIPSW_ADDR) & 2) == 0) | 103 | #define jmr3927_dipsw3() ((jmr3927_ioc_reg_in(JMR3927_IOC_DIPSW_ADDR) & 2) == 0) |
192 | #define jmr3927_dipsw4() ((jmr3927_ioc_reg_in(JMR3927_IOC_DIPSW_ADDR) & 1) == 0) | 104 | #define jmr3927_dipsw4() ((jmr3927_ioc_reg_in(JMR3927_IOC_DIPSW_ADDR) & 1) == 0) |
193 | #define jmr3927_io_dipsw() (jmr3927_isac_reg_in(JMR3927_ISAC_LED_ADDR) >> 4) | ||
194 | |||
195 | |||
196 | #endif /* !__ASSEMBLY__ */ | ||
197 | 105 | ||
198 | /* | 106 | /* |
199 | * IRQ mappings | 107 | * IRQ mappings |
@@ -206,16 +114,10 @@ static inline int jmr3927_have_isac(void) | |||
206 | */ | 114 | */ |
207 | #define JMR3927_NR_IRQ_IRC 16 /* On-Chip IRC */ | 115 | #define JMR3927_NR_IRQ_IRC 16 /* On-Chip IRC */ |
208 | #define JMR3927_NR_IRQ_IOC 8 /* PCI/MODEM/INT[6:7] */ | 116 | #define JMR3927_NR_IRQ_IOC 8 /* PCI/MODEM/INT[6:7] */ |
209 | #define JMR3927_NR_IRQ_ISAC 8 /* ISA */ | ||
210 | 117 | ||
211 | 118 | #define JMR3927_IRQ_IRC 16 | |
212 | #define JMR3927_IRQ_IRC NR_ISA_IRQS | ||
213 | #define JMR3927_IRQ_IOC (JMR3927_IRQ_IRC + JMR3927_NR_IRQ_IRC) | 119 | #define JMR3927_IRQ_IOC (JMR3927_IRQ_IRC + JMR3927_NR_IRQ_IRC) |
214 | #define JMR3927_IRQ_ISAC (JMR3927_IRQ_IOC + JMR3927_NR_IRQ_IOC) | 120 | #define JMR3927_IRQ_END (JMR3927_IRQ_IOC + JMR3927_NR_IRQ_IOC) |
215 | #define JMR3927_IRQ_END (JMR3927_IRQ_ISAC + JMR3927_NR_IRQ_ISAC) | ||
216 | #define JMR3927_IRQ_IS_IRC(irq) (JMR3927_IRQ_IRC <= (irq) && (irq) < JMR3927_IRQ_IOC) | ||
217 | #define JMR3927_IRQ_IS_IOC(irq) (JMR3927_IRQ_IOC <= (irq) && (irq) < JMR3927_IRQ_ISAC) | ||
218 | #define JMR3927_IRQ_IS_ISAC(irq) (JMR3927_IRQ_ISAC <= (irq) && (irq) < JMR3927_IRQ_END) | ||
219 | 121 | ||
220 | #define JMR3927_IRQ_IRC_INT0 (JMR3927_IRQ_IRC + TX3927_IR_INT0) | 122 | #define JMR3927_IRQ_IRC_INT0 (JMR3927_IRQ_IRC + TX3927_IR_INT0) |
221 | #define JMR3927_IRQ_IRC_INT1 (JMR3927_IRQ_IRC + TX3927_IR_INT1) | 123 | #define JMR3927_IRQ_IRC_INT1 (JMR3927_IRQ_IRC + TX3927_IR_INT1) |
@@ -240,37 +142,13 @@ static inline int jmr3927_have_isac(void) | |||
240 | #define JMR3927_IRQ_IOC_INT6 (JMR3927_IRQ_IOC + JMR3927_IOC_INTB_INT6) | 142 | #define JMR3927_IRQ_IOC_INT6 (JMR3927_IRQ_IOC + JMR3927_IOC_INTB_INT6) |
241 | #define JMR3927_IRQ_IOC_INT7 (JMR3927_IRQ_IOC + JMR3927_IOC_INTB_INT7) | 143 | #define JMR3927_IRQ_IOC_INT7 (JMR3927_IRQ_IOC + JMR3927_IOC_INTB_INT7) |
242 | #define JMR3927_IRQ_IOC_SOFT (JMR3927_IRQ_IOC + JMR3927_IOC_INTB_SOFT) | 144 | #define JMR3927_IRQ_IOC_SOFT (JMR3927_IRQ_IOC + JMR3927_IOC_INTB_SOFT) |
243 | #define JMR3927_IRQ_ISAC_IRQ5 (JMR3927_IRQ_ISAC + JMR3927_ISAC_INTB_IRQ5) | ||
244 | #define JMR3927_IRQ_ISAC_IRQKB (JMR3927_IRQ_ISAC + JMR3927_ISAC_INTB_IRQKB) | ||
245 | #define JMR3927_IRQ_ISAC_IRQMOUSE (JMR3927_IRQ_ISAC + JMR3927_ISAC_INTB_IRQMOUSE) | ||
246 | #define JMR3927_IRQ_ISAC_IRQ4 (JMR3927_IRQ_ISAC + JMR3927_ISAC_INTB_IRQ4) | ||
247 | #define JMR3927_IRQ_ISAC_IRQ12 (JMR3927_IRQ_ISAC + JMR3927_ISAC_INTB_IRQ12) | ||
248 | #define JMR3927_IRQ_ISAC_IRQ3 (JMR3927_IRQ_ISAC + JMR3927_ISAC_INTB_IRQ3) | ||
249 | #define JMR3927_IRQ_ISAC_IRQ10 (JMR3927_IRQ_ISAC + JMR3927_ISAC_INTB_IRQ10) | ||
250 | #define JMR3927_IRQ_ISAC_ISAER (JMR3927_IRQ_ISAC + JMR3927_ISAC_INTB_ISAER) | ||
251 | 145 | ||
252 | #if 0 /* auto detect */ | ||
253 | /* RTL8019AS 10M Ether (JMI-3927IO2:JPW2:1-2 Short) */ | ||
254 | #define JMR3927_IRQ_ETHER1 JMR3927_IRQ_IRC_INT0 | ||
255 | #endif | ||
256 | /* IOC (PCI, MODEM) */ | 146 | /* IOC (PCI, MODEM) */ |
257 | #define JMR3927_IRQ_IOCINT JMR3927_IRQ_IRC_INT1 | 147 | #define JMR3927_IRQ_IOCINT JMR3927_IRQ_IRC_INT1 |
258 | /* ISAC (ISA, PCMCIA, KEYBOARD, MOUSE) */ | ||
259 | #define JMR3927_IRQ_ISACINT JMR3927_IRQ_IRC_INT2 | ||
260 | /* TC35815 100M Ether (JMR-TX3912:JPW4:2-3 Short) */ | 148 | /* TC35815 100M Ether (JMR-TX3912:JPW4:2-3 Short) */ |
261 | #define JMR3927_IRQ_ETHER0 JMR3927_IRQ_IRC_INT3 | 149 | #define JMR3927_IRQ_ETHER0 JMR3927_IRQ_IRC_INT3 |
262 | /* Clock Tick (10ms) */ | 150 | /* Clock Tick (10ms) */ |
263 | #define JMR3927_IRQ_TICK JMR3927_IRQ_IRC_TMR0 | 151 | #define JMR3927_IRQ_TICK JMR3927_IRQ_IRC_TMR0 |
264 | #define JMR3927_IRQ_IDE JMR3927_IRQ_ISAC_IRQ12 | ||
265 | |||
266 | /* IEEE1394 (Note that this may conflicts with RTL8019AS 10M Ether...) */ | ||
267 | #define JMR3927_IRQ_PREMIER3 JMR3927_IRQ_IRC_INT0 | ||
268 | |||
269 | /* I/O Ports */ | ||
270 | /* RTL8019AS 10M Ether */ | ||
271 | #define JMR3927_ETHER1_PORT (JMR3927_ISAIO_BASE - JMR3927_PORT_BASE + 0x280) | ||
272 | #define JMR3927_KBD_PORT (JMR3927_ISAIO_BASE - JMR3927_PORT_BASE + 0x00800060) | ||
273 | #define JMR3927_IDE_PORT (JMR3927_ISAIO_BASE - JMR3927_PORT_BASE + 0x001001f0) | ||
274 | 152 | ||
275 | /* Clocks */ | 153 | /* Clocks */ |
276 | #define JMR3927_CORECLK 132710400 /* 132.7MHz */ | 154 | #define JMR3927_CORECLK 132710400 /* 132.7MHz */ |
diff --git a/include/asm-mips/jmr3927/tx3927.h b/include/asm-mips/jmr3927/tx3927.h index b3d67c75d9ac..0b9073bfb759 100644 --- a/include/asm-mips/jmr3927/tx3927.h +++ b/include/asm-mips/jmr3927/tx3927.h | |||
@@ -22,8 +22,6 @@ | |||
22 | #define TX3927_SIO_REG(ch) (0xfffef300 + (ch) * 0x100) | 22 | #define TX3927_SIO_REG(ch) (0xfffef300 + (ch) * 0x100) |
23 | #define TX3927_PIO_REG 0xfffef500 | 23 | #define TX3927_PIO_REG 0xfffef500 |
24 | 24 | ||
25 | #ifndef __ASSEMBLY__ | ||
26 | |||
27 | struct tx3927_sdramc_reg { | 25 | struct tx3927_sdramc_reg { |
28 | volatile unsigned long cr[8]; | 26 | volatile unsigned long cr[8]; |
29 | volatile unsigned long tr[3]; | 27 | volatile unsigned long tr[3]; |
@@ -164,8 +162,6 @@ struct tx3927_ccfg_reg { | |||
164 | volatile unsigned long pdcr; | 162 | volatile unsigned long pdcr; |
165 | }; | 163 | }; |
166 | 164 | ||
167 | #endif /* !__ASSEMBLY__ */ | ||
168 | |||
169 | /* | 165 | /* |
170 | * SDRAMC | 166 | * SDRAMC |
171 | */ | 167 | */ |
@@ -348,8 +344,6 @@ struct tx3927_ccfg_reg { | |||
348 | #define TX3927_PCFG_SELDMA_ALL 0x0000000f | 344 | #define TX3927_PCFG_SELDMA_ALL 0x0000000f |
349 | #define TX3927_PCFG_SELDMA(ch) (0x00000001<<(ch)) | 345 | #define TX3927_PCFG_SELDMA(ch) (0x00000001<<(ch)) |
350 | 346 | ||
351 | #ifndef __ASSEMBLY__ | ||
352 | |||
353 | #define tx3927_sdramcptr ((struct tx3927_sdramc_reg *)TX3927_SDRAMC_REG) | 347 | #define tx3927_sdramcptr ((struct tx3927_sdramc_reg *)TX3927_SDRAMC_REG) |
354 | #define tx3927_romcptr ((struct tx3927_romc_reg *)TX3927_ROMC_REG) | 348 | #define tx3927_romcptr ((struct tx3927_romc_reg *)TX3927_ROMC_REG) |
355 | #define tx3927_dmaptr ((struct tx3927_dma_reg *)TX3927_DMA_REG) | 349 | #define tx3927_dmaptr ((struct tx3927_dma_reg *)TX3927_DMA_REG) |
@@ -360,6 +354,4 @@ struct tx3927_ccfg_reg { | |||
360 | #define tx3927_sioptr(ch) ((struct txx927_sio_reg *)TX3927_SIO_REG(ch)) | 354 | #define tx3927_sioptr(ch) ((struct txx927_sio_reg *)TX3927_SIO_REG(ch)) |
361 | #define tx3927_pioptr ((struct txx927_pio_reg *)TX3927_PIO_REG) | 355 | #define tx3927_pioptr ((struct txx927_pio_reg *)TX3927_PIO_REG) |
362 | 356 | ||
363 | #endif /* !__ASSEMBLY__ */ | ||
364 | |||
365 | #endif /* __ASM_TX3927_H */ | 357 | #endif /* __ASM_TX3927_H */ |
diff --git a/include/asm-mips/jmr3927/txx927.h b/include/asm-mips/jmr3927/txx927.h index 9d5792eab452..58a8ff6be815 100644 --- a/include/asm-mips/jmr3927/txx927.h +++ b/include/asm-mips/jmr3927/txx927.h | |||
@@ -10,8 +10,6 @@ | |||
10 | #ifndef __ASM_TXX927_H | 10 | #ifndef __ASM_TXX927_H |
11 | #define __ASM_TXX927_H | 11 | #define __ASM_TXX927_H |
12 | 12 | ||
13 | #ifndef __ASSEMBLY__ | ||
14 | |||
15 | struct txx927_tmr_reg { | 13 | struct txx927_tmr_reg { |
16 | volatile unsigned long tcr; | 14 | volatile unsigned long tcr; |
17 | volatile unsigned long tisr; | 15 | volatile unsigned long tisr; |
@@ -52,9 +50,6 @@ struct txx927_pio_reg { | |||
52 | volatile unsigned long maskext; | 50 | volatile unsigned long maskext; |
53 | }; | 51 | }; |
54 | 52 | ||
55 | #endif /* !__ASSEMBLY__ */ | ||
56 | |||
57 | |||
58 | /* | 53 | /* |
59 | * TMR | 54 | * TMR |
60 | */ | 55 | */ |
diff --git a/include/asm-mips/paccess.h b/include/asm-mips/paccess.h index 147844ef103b..8c08fa904b2c 100644 --- a/include/asm-mips/paccess.h +++ b/include/asm-mips/paccess.h | |||
@@ -34,7 +34,7 @@ struct __large_pstruct { unsigned long buf[100]; }; | |||
34 | #define __get_dbe(x,ptr,size) \ | 34 | #define __get_dbe(x,ptr,size) \ |
35 | ({ \ | 35 | ({ \ |
36 | long __gu_err; \ | 36 | long __gu_err; \ |
37 | __typeof(*(ptr)) __gu_val; \ | 37 | __typeof__(*(ptr)) __gu_val; \ |
38 | unsigned long __gu_addr; \ | 38 | unsigned long __gu_addr; \ |
39 | __asm__("":"=r" (__gu_val)); \ | 39 | __asm__("":"=r" (__gu_val)); \ |
40 | __gu_addr = (unsigned long) (ptr); \ | 40 | __gu_addr = (unsigned long) (ptr); \ |
diff --git a/include/asm-mips/sgi/hpc3.h b/include/asm-mips/sgi/hpc3.h index fcec52bafb25..c4729f531919 100644 --- a/include/asm-mips/sgi/hpc3.h +++ b/include/asm-mips/sgi/hpc3.h | |||
@@ -206,7 +206,7 @@ struct hpc3_regs { | |||
206 | #define HPC3_GIOMISC_ERTIME 0x1 /* Enable external timer real time. */ | 206 | #define HPC3_GIOMISC_ERTIME 0x1 /* Enable external timer real time. */ |
207 | #define HPC3_GIOMISC_DENDIAN 0x2 /* dma descriptor endian, 1=lit 0=big */ | 207 | #define HPC3_GIOMISC_DENDIAN 0x2 /* dma descriptor endian, 1=lit 0=big */ |
208 | 208 | ||
209 | volatile u32 eeprom; /* EEPROM data reg. */ | 209 | u32 eeprom; /* EEPROM data reg. */ |
210 | #define HPC3_EEPROM_EPROT 0x01 /* Protect register enable */ | 210 | #define HPC3_EEPROM_EPROT 0x01 /* Protect register enable */ |
211 | #define HPC3_EEPROM_CSEL 0x02 /* Chip select */ | 211 | #define HPC3_EEPROM_CSEL 0x02 /* Chip select */ |
212 | #define HPC3_EEPROM_ECLK 0x04 /* EEPROM clock */ | 212 | #define HPC3_EEPROM_ECLK 0x04 /* EEPROM clock */ |
diff --git a/include/asm-mips/sgi/ip22.h b/include/asm-mips/sgi/ip22.h index 6592f3bd1999..f4981c4f16bb 100644 --- a/include/asm-mips/sgi/ip22.h +++ b/include/asm-mips/sgi/ip22.h | |||
@@ -72,7 +72,7 @@ | |||
72 | 72 | ||
73 | #define ip22_is_fullhouse() (sgioc->sysid & SGIOC_SYSID_FULLHOUSE) | 73 | #define ip22_is_fullhouse() (sgioc->sysid & SGIOC_SYSID_FULLHOUSE) |
74 | 74 | ||
75 | extern unsigned short ip22_eeprom_read(volatile unsigned int *ctrl, int reg); | 75 | extern unsigned short ip22_eeprom_read(unsigned int *ctrl, int reg); |
76 | extern unsigned short ip22_nvram_read(int reg); | 76 | extern unsigned short ip22_nvram_read(int reg); |
77 | 77 | ||
78 | #endif | 78 | #endif |
diff --git a/include/asm-mips/sgi/mc.h b/include/asm-mips/sgi/mc.h index c52f7834c7c8..1576c2394de8 100644 --- a/include/asm-mips/sgi/mc.h +++ b/include/asm-mips/sgi/mc.h | |||
@@ -57,7 +57,7 @@ struct sgimc_regs { | |||
57 | volatile u32 divider; /* Divider reg for RPSS */ | 57 | volatile u32 divider; /* Divider reg for RPSS */ |
58 | 58 | ||
59 | u32 _unused5; | 59 | u32 _unused5; |
60 | volatile u32 eeprom; /* EEPROM byte reg for r4k */ | 60 | u32 eeprom; /* EEPROM byte reg for r4k */ |
61 | #define SGIMC_EEPROM_PRE 0x00000001 /* eeprom chip PRE pin assertion */ | 61 | #define SGIMC_EEPROM_PRE 0x00000001 /* eeprom chip PRE pin assertion */ |
62 | #define SGIMC_EEPROM_CSEL 0x00000002 /* Active high, eeprom chip select */ | 62 | #define SGIMC_EEPROM_CSEL 0x00000002 /* Active high, eeprom chip select */ |
63 | #define SGIMC_EEPROM_SECLOCK 0x00000004 /* EEPROM serial clock */ | 63 | #define SGIMC_EEPROM_SECLOCK 0x00000004 /* EEPROM serial clock */ |
diff --git a/include/asm-mips/sibyte/bcm1480_int.h b/include/asm-mips/sibyte/bcm1480_int.h index 42d4cf00efd3..c0d5206020fd 100644 --- a/include/asm-mips/sibyte/bcm1480_int.h +++ b/include/asm-mips/sibyte/bcm1480_int.h | |||
@@ -157,6 +157,7 @@ | |||
157 | * Mask values for each interrupt | 157 | * Mask values for each interrupt |
158 | */ | 158 | */ |
159 | 159 | ||
160 | #define _BCM1480_INT_MASK(w,n) _SB_MAKEMASK(w,((n) & 0x3F)) | ||
160 | #define _BCM1480_INT_MASK1(n) _SB_MAKEMASK1(((n) & 0x3F)) | 161 | #define _BCM1480_INT_MASK1(n) _SB_MAKEMASK1(((n) & 0x3F)) |
161 | #define _BCM1480_INT_OFFSET(n) (((n) & 0x40) << 6) | 162 | #define _BCM1480_INT_OFFSET(n) (((n) & 0x40) << 6) |
162 | 163 | ||
@@ -195,6 +196,7 @@ | |||
195 | #define M_BCM1480_INT_PMI_HIGH _BCM1480_INT_MASK1(K_BCM1480_INT_PMI_HIGH) | 196 | #define M_BCM1480_INT_PMI_HIGH _BCM1480_INT_MASK1(K_BCM1480_INT_PMI_HIGH) |
196 | #define M_BCM1480_INT_PMO_LOW _BCM1480_INT_MASK1(K_BCM1480_INT_PMO_LOW) | 197 | #define M_BCM1480_INT_PMO_LOW _BCM1480_INT_MASK1(K_BCM1480_INT_PMO_LOW) |
197 | #define M_BCM1480_INT_PMO_HIGH _BCM1480_INT_MASK1(K_BCM1480_INT_PMO_HIGH) | 198 | #define M_BCM1480_INT_PMO_HIGH _BCM1480_INT_MASK1(K_BCM1480_INT_PMO_HIGH) |
199 | #define M_BCM1480_INT_MBOX_ALL _BCM1480_INT_MASK(8,K_BCM1480_INT_MBOX_0_0) | ||
198 | #define M_BCM1480_INT_MBOX_0_0 _BCM1480_INT_MASK1(K_BCM1480_INT_MBOX_0_0) | 200 | #define M_BCM1480_INT_MBOX_0_0 _BCM1480_INT_MASK1(K_BCM1480_INT_MBOX_0_0) |
199 | #define M_BCM1480_INT_MBOX_0_1 _BCM1480_INT_MASK1(K_BCM1480_INT_MBOX_0_1) | 201 | #define M_BCM1480_INT_MBOX_0_1 _BCM1480_INT_MASK1(K_BCM1480_INT_MBOX_0_1) |
200 | #define M_BCM1480_INT_MBOX_0_2 _BCM1480_INT_MASK1(K_BCM1480_INT_MBOX_0_2) | 202 | #define M_BCM1480_INT_MBOX_0_2 _BCM1480_INT_MASK1(K_BCM1480_INT_MBOX_0_2) |
diff --git a/include/asm-mips/sibyte/bcm1480_mc.h b/include/asm-mips/sibyte/bcm1480_mc.h index 6bdc941afc91..a6a437451da4 100644 --- a/include/asm-mips/sibyte/bcm1480_mc.h +++ b/include/asm-mips/sibyte/bcm1480_mc.h | |||
@@ -382,6 +382,10 @@ | |||
382 | #define M_BCM1480_MC_CS6 _SB_MAKEMASK1(10) | 382 | #define M_BCM1480_MC_CS6 _SB_MAKEMASK1(10) |
383 | #define M_BCM1480_MC_CS7 _SB_MAKEMASK1(11) | 383 | #define M_BCM1480_MC_CS7 _SB_MAKEMASK1(11) |
384 | 384 | ||
385 | #define M_BCM1480_MC_CS _SB_MAKEMASK(8,S_BCM1480_MC_CS0) | ||
386 | #define V_BCM1480_MC_CS(x) _SB_MAKEVALUE(x,S_BCM1480_MC_CS0) | ||
387 | #define G_BCM1480_MC_CS(x) _SB_GETVALUE(x,S_BCM1480_MC_CS0,M_BCM1480_MC_CS0) | ||
388 | |||
385 | #define M_BCM1480_MC_CMD_ACTIVE _SB_MAKEMASK1(16) | 389 | #define M_BCM1480_MC_CMD_ACTIVE _SB_MAKEMASK1(16) |
386 | 390 | ||
387 | /* | 391 | /* |
@@ -412,6 +416,8 @@ | |||
412 | #define K_BCM1480_MC_DRAM_TYPE_DDR2 2 | 416 | #define K_BCM1480_MC_DRAM_TYPE_DDR2 2 |
413 | #endif | 417 | #endif |
414 | 418 | ||
419 | #define K_BCM1480_MC_DRAM_TYPE_DDR2_PASS1 0 | ||
420 | |||
415 | #define V_BCM1480_MC_DRAM_TYPE_JEDEC V_BCM1480_MC_DRAM_TYPE(K_BCM1480_MC_DRAM_TYPE_JEDEC) | 421 | #define V_BCM1480_MC_DRAM_TYPE_JEDEC V_BCM1480_MC_DRAM_TYPE(K_BCM1480_MC_DRAM_TYPE_JEDEC) |
416 | #define V_BCM1480_MC_DRAM_TYPE_FCRAM V_BCM1480_MC_DRAM_TYPE(K_BCM1480_MC_DRAM_TYPE_FCRAM) | 422 | #define V_BCM1480_MC_DRAM_TYPE_FCRAM V_BCM1480_MC_DRAM_TYPE(K_BCM1480_MC_DRAM_TYPE_FCRAM) |
417 | 423 | ||
@@ -511,6 +517,22 @@ | |||
511 | #define M_BCM1480_MC_WR_ODT6_CS6 _SB_MAKEMASK1(31) | 517 | #define M_BCM1480_MC_WR_ODT6_CS6 _SB_MAKEMASK1(31) |
512 | 518 | ||
513 | #define M_BCM1480_MC_CS_ODD_ODT_EN _SB_MAKEMASK1(32) | 519 | #define M_BCM1480_MC_CS_ODD_ODT_EN _SB_MAKEMASK1(32) |
520 | |||
521 | #define S_BCM1480_MC_ODT0 0 | ||
522 | #define M_BCM1480_MC_ODT0 _SB_MAKEMASK(8,S_BCM1480_MC_ODT0) | ||
523 | #define V_BCM1480_MC_ODT0(x) _SB_MAKEVALUE(x,S_BCM1480_MC_ODT0) | ||
524 | |||
525 | #define S_BCM1480_MC_ODT2 8 | ||
526 | #define M_BCM1480_MC_ODT2 _SB_MAKEMASK(8,S_BCM1480_MC_ODT2) | ||
527 | #define V_BCM1480_MC_ODT2(x) _SB_MAKEVALUE(x,S_BCM1480_MC_ODT2) | ||
528 | |||
529 | #define S_BCM1480_MC_ODT4 16 | ||
530 | #define M_BCM1480_MC_ODT4 _SB_MAKEMASK(8,S_BCM1480_MC_ODT4) | ||
531 | #define V_BCM1480_MC_ODT4(x) _SB_MAKEVALUE(x,S_BCM1480_MC_ODT4) | ||
532 | |||
533 | #define S_BCM1480_MC_ODT6 24 | ||
534 | #define M_BCM1480_MC_ODT6 _SB_MAKEMASK(8,S_BCM1480_MC_ODT6) | ||
535 | #define V_BCM1480_MC_ODT6(x) _SB_MAKEVALUE(x,S_BCM1480_MC_ODT6) | ||
514 | #endif | 536 | #endif |
515 | 537 | ||
516 | /* | 538 | /* |
@@ -588,11 +610,11 @@ | |||
588 | #define M_BCM1480_MC_DQO_SHIFT _SB_MAKEMASK1(47) | 610 | #define M_BCM1480_MC_DQO_SHIFT _SB_MAKEMASK1(47) |
589 | #endif | 611 | #endif |
590 | 612 | ||
591 | #define S_BCM1480_MC_DLL_DEFAULT 48 | 613 | #define S_BCM1480_MC_DLL_DEFAULT 48 |
592 | #define M_BCM1480_MC_DLL_DEFAULT _SB_MAKEMASK(6,S_BCM1480_MC_DLL_DEFAULT) | 614 | #define M_BCM1480_MC_DLL_DEFAULT _SB_MAKEMASK(6,S_BCM1480_MC_DLL_DEFAULT) |
593 | #define V_BCM1480_MC_DLL_DEFAULT(x) _SB_MAKEVALUE(x,S_BCM1480_MC_DLL_DEFAULT) | 615 | #define V_BCM1480_MC_DLL_DEFAULT(x) _SB_MAKEVALUE(x,S_BCM1480_MC_DLL_DEFAULT) |
594 | #define G_BCM1480_MC_DLL_DEFAULT(x) _SB_GETVALUE(x,S_BCM1480_MC_DLL_DEFAULT,M_BCM1480_MC_DLL_DEFAULT) | 616 | #define G_BCM1480_MC_DLL_DEFAULT(x) _SB_GETVALUE(x,S_BCM1480_MC_DLL_DEFAULT,M_BCM1480_MC_DLL_DEFAULT) |
595 | #define V_BCM1480_MC_DLL_DEFAULT_DEFAULT V_BCM1480_MC_DLL_DEFAULT(0x10) | 617 | #define V_BCM1480_MC_DLL_DEFAULT_DEFAULT V_BCM1480_MC_DLL_DEFAULT(0x10) |
596 | 618 | ||
597 | #if SIBYTE_HDR_FEATURE(1480, PASS2) | 619 | #if SIBYTE_HDR_FEATURE(1480, PASS2) |
598 | #define S_BCM1480_MC_DLL_REGCTRL 54 | 620 | #define S_BCM1480_MC_DLL_REGCTRL 54 |
diff --git a/include/asm-mips/sibyte/bcm1480_regs.h b/include/asm-mips/sibyte/bcm1480_regs.h index c2dd2fe3047c..bda391d3af85 100644 --- a/include/asm-mips/sibyte/bcm1480_regs.h +++ b/include/asm-mips/sibyte/bcm1480_regs.h | |||
@@ -230,6 +230,7 @@ | |||
230 | 230 | ||
231 | #define A_BCM1480_DUART_IMRREG(chan) (A_BCM1480_DUART(chan) + R_BCM1480_DUART_IMRREG(chan)) | 231 | #define A_BCM1480_DUART_IMRREG(chan) (A_BCM1480_DUART(chan) + R_BCM1480_DUART_IMRREG(chan)) |
232 | #define A_BCM1480_DUART_ISRREG(chan) (A_BCM1480_DUART(chan) + R_BCM1480_DUART_ISRREG(chan)) | 232 | #define A_BCM1480_DUART_ISRREG(chan) (A_BCM1480_DUART(chan) + R_BCM1480_DUART_ISRREG(chan)) |
233 | #define A_BCM1480_DUART_IN_PORT(chan) (A_BCM1480_DUART(chan) + R_DUART_INP_ORT) | ||
233 | 234 | ||
234 | /* | 235 | /* |
235 | * These constants are the absolute addresses. | 236 | * These constants are the absolute addresses. |
@@ -404,6 +405,21 @@ | |||
404 | #define R_BCM1480_IMR_ALIAS_MAILBOX_0 0x0000 /* 0x0x0 */ | 405 | #define R_BCM1480_IMR_ALIAS_MAILBOX_0 0x0000 /* 0x0x0 */ |
405 | #define R_BCM1480_IMR_ALIAS_MAILBOX_0_SET 0x0008 /* 0x0x8 */ | 406 | #define R_BCM1480_IMR_ALIAS_MAILBOX_0_SET 0x0008 /* 0x0x8 */ |
406 | 407 | ||
408 | /* | ||
409 | * these macros work together to build the address of a mailbox | ||
410 | * register, e.g., A_BCM1480_MAILBOX_REGISTER(0,R_BCM1480_IMR_MAILBOX_SET,2) | ||
411 | * for mbox_0_set_cpu2 returns 0x00100240C8 | ||
412 | */ | ||
413 | #define R_BCM1480_IMR_MAILBOX_CPU 0x00 | ||
414 | #define R_BCM1480_IMR_MAILBOX_SET 0x08 | ||
415 | #define R_BCM1480_IMR_MAILBOX_CLR 0x10 | ||
416 | #define R_BCM1480_IMR_MAILBOX_NUM_SPACING 0x20 | ||
417 | #define A_BCM1480_MAILBOX_REGISTER(num,reg,cpu) \ | ||
418 | (A_BCM1480_IMR_CPU0_BASE + \ | ||
419 | (num * R_BCM1480_IMR_MAILBOX_NUM_SPACING) + \ | ||
420 | (cpu * BCM1480_IMR_REGISTER_SPACING) + \ | ||
421 | (R_BCM1480_IMR_MAILBOX_0_CPU + reg)) | ||
422 | |||
407 | /* ********************************************************************* | 423 | /* ********************************************************************* |
408 | * System Performance Counter Registers (Section 4.7) | 424 | * System Performance Counter Registers (Section 4.7) |
409 | ********************************************************************* */ | 425 | ********************************************************************* */ |
@@ -428,6 +444,10 @@ | |||
428 | #define A_BCM1480_SCD_PERF_CNT_6 0x0010020500 | 444 | #define A_BCM1480_SCD_PERF_CNT_6 0x0010020500 |
429 | #define A_BCM1480_SCD_PERF_CNT_7 0x0010020508 | 445 | #define A_BCM1480_SCD_PERF_CNT_7 0x0010020508 |
430 | 446 | ||
447 | #define BCM1480_SCD_NUM_PERF_CNT 8 | ||
448 | #define BCM1480_SCD_PERF_CNT_SPACING 8 | ||
449 | #define A_BCM1480_SCD_PERF_CNT(n) (A_SCD_PERF_CNT_0+(n*BCM1480_SCD_PERF_CNT_SPACING)) | ||
450 | |||
431 | /* ********************************************************************* | 451 | /* ********************************************************************* |
432 | * System Bus Watcher Registers (Section 4.8) | 452 | * System Bus Watcher Registers (Section 4.8) |
433 | ********************************************************************* */ | 453 | ********************************************************************* */ |
diff --git a/include/asm-mips/sibyte/bcm1480_scd.h b/include/asm-mips/sibyte/bcm1480_scd.h index 648bed96780f..6111d6dcf117 100644 --- a/include/asm-mips/sibyte/bcm1480_scd.h +++ b/include/asm-mips/sibyte/bcm1480_scd.h | |||
@@ -10,7 +10,7 @@ | |||
10 | * | 10 | * |
11 | ********************************************************************* | 11 | ********************************************************************* |
12 | * | 12 | * |
13 | * Copyright 2000,2001,2002,2003 | 13 | * Copyright 2000,2001,2002,2003,2004,2005 |
14 | * Broadcom Corporation. All rights reserved. | 14 | * Broadcom Corporation. All rights reserved. |
15 | * | 15 | * |
16 | * This program is free software; you can redistribute it and/or | 16 | * This program is free software; you can redistribute it and/or |
@@ -78,6 +78,7 @@ | |||
78 | #define K_SYS_PART_BCM1280 0x1206 | 78 | #define K_SYS_PART_BCM1280 0x1206 |
79 | #define K_SYS_PART_BCM1455 0x1407 | 79 | #define K_SYS_PART_BCM1455 0x1407 |
80 | #define K_SYS_PART_BCM1255 0x1257 | 80 | #define K_SYS_PART_BCM1255 0x1257 |
81 | #define K_SYS_PART_BCM1158 0x1156 | ||
81 | 82 | ||
82 | /* | 83 | /* |
83 | * Manufacturing Information Register (Table 14) | 84 | * Manufacturing Information Register (Table 14) |
@@ -237,58 +238,42 @@ | |||
237 | * System Performance Counter Configuration Register (Table 31) | 238 | * System Performance Counter Configuration Register (Table 31) |
238 | * Register: PERF_CNT_CFG_0 | 239 | * Register: PERF_CNT_CFG_0 |
239 | * | 240 | * |
240 | * Since the clear/enable bits are moved compared to the | 241 | * SPC_CFG_SRC[0-3] is the same as the 1250. |
241 | * 1250 and there are more fields, this register will be BCM1480 specific. | 242 | * SPC_CFG_SRC[4-7] only exist on the 1480 |
243 | * The clear/enable bits are in different locations on the 1250 and 1480. | ||
242 | */ | 244 | */ |
243 | 245 | ||
244 | #define S_BCM1480_SPC_CFG_SRC0 0 | 246 | #define S_SPC_CFG_SRC4 32 |
245 | #define M_BCM1480_SPC_CFG_SRC0 _SB_MAKEMASK(8,S_BCM1480_SPC_CFG_SRC0) | 247 | #define M_SPC_CFG_SRC4 _SB_MAKEMASK(8,S_SPC_CFG_SRC4) |
246 | #define V_BCM1480_SPC_CFG_SRC0(x) _SB_MAKEVALUE(x,S_BCM1480_SPC_CFG_SRC0) | 248 | #define V_SPC_CFG_SRC4(x) _SB_MAKEVALUE(x,S_SPC_CFG_SRC4) |
247 | #define G_BCM1480_SPC_CFG_SRC0(x) _SB_GETVALUE(x,S_BCM1480_SPC_CFG_SRC0,M_BCM1480_SPC_CFG_SRC0) | 249 | #define G_SPC_CFG_SRC4(x) _SB_GETVALUE(x,S_SPC_CFG_SRC4,M_SPC_CFG_SRC4) |
248 | 250 | ||
249 | #define S_BCM1480_SPC_CFG_SRC1 8 | 251 | #define S_SPC_CFG_SRC5 40 |
250 | #define M_BCM1480_SPC_CFG_SRC1 _SB_MAKEMASK(8,S_BCM1480_SPC_CFG_SRC1) | 252 | #define M_SPC_CFG_SRC5 _SB_MAKEMASK(8,S_SPC_CFG_SRC5) |
251 | #define V_BCM1480_SPC_CFG_SRC1(x) _SB_MAKEVALUE(x,S_BCM1480_SPC_CFG_SRC1) | 253 | #define V_SPC_CFG_SRC5(x) _SB_MAKEVALUE(x,S_SPC_CFG_SRC5) |
252 | #define G_BCM1480_SPC_CFG_SRC1(x) _SB_GETVALUE(x,S_BCM1480_SPC_CFG_SRC1,M_BCM1480_SPC_CFG_SRC1) | 254 | #define G_SPC_CFG_SRC5(x) _SB_GETVALUE(x,S_SPC_CFG_SRC5,M_SPC_CFG_SRC5) |
253 | 255 | ||
254 | #define S_BCM1480_SPC_CFG_SRC2 16 | 256 | #define S_SPC_CFG_SRC6 48 |
255 | #define M_BCM1480_SPC_CFG_SRC2 _SB_MAKEMASK(8,S_BCM1480_SPC_CFG_SRC2) | 257 | #define M_SPC_CFG_SRC6 _SB_MAKEMASK(8,S_SPC_CFG_SRC6) |
256 | #define V_BCM1480_SPC_CFG_SRC2(x) _SB_MAKEVALUE(x,S_BCM1480_SPC_CFG_SRC2) | 258 | #define V_SPC_CFG_SRC6(x) _SB_MAKEVALUE(x,S_SPC_CFG_SRC6) |
257 | #define G_BCM1480_SPC_CFG_SRC2(x) _SB_GETVALUE(x,S_BCM1480_SPC_CFG_SRC2,M_BCM1480_SPC_CFG_SRC2) | 259 | #define G_SPC_CFG_SRC6(x) _SB_GETVALUE(x,S_SPC_CFG_SRC6,M_SPC_CFG_SRC6) |
258 | 260 | ||
259 | #define S_BCM1480_SPC_CFG_SRC3 24 | 261 | #define S_SPC_CFG_SRC7 56 |
260 | #define M_BCM1480_SPC_CFG_SRC3 _SB_MAKEMASK(8,S_BCM1480_SPC_CFG_SRC3) | 262 | #define M_SPC_CFG_SRC7 _SB_MAKEMASK(8,S_SPC_CFG_SRC7) |
261 | #define V_BCM1480_SPC_CFG_SRC3(x) _SB_MAKEVALUE(x,S_BCM1480_SPC_CFG_SRC3) | 263 | #define V_SPC_CFG_SRC7(x) _SB_MAKEVALUE(x,S_SPC_CFG_SRC7) |
262 | #define G_BCM1480_SPC_CFG_SRC3(x) _SB_GETVALUE(x,S_BCM1480_SPC_CFG_SRC3,M_BCM1480_SPC_CFG_SRC3) | 264 | #define G_SPC_CFG_SRC7(x) _SB_GETVALUE(x,S_SPC_CFG_SRC7,M_SPC_CFG_SRC7) |
263 | |||
264 | #define S_BCM1480_SPC_CFG_SRC4 32 | ||
265 | #define M_BCM1480_SPC_CFG_SRC4 _SB_MAKEMASK(8,S_BCM1480_SPC_CFG_SRC4) | ||
266 | #define V_BCM1480_SPC_CFG_SRC4(x) _SB_MAKEVALUE(x,S_BCM1480_SPC_CFG_SRC4) | ||
267 | #define G_BCM1480_SPC_CFG_SRC4(x) _SB_GETVALUE(x,S_BCM1480_SPC_CFG_SRC4,M_BCM1480_SPC_CFG_SRC4) | ||
268 | |||
269 | #define S_BCM1480_SPC_CFG_SRC5 40 | ||
270 | #define M_BCM1480_SPC_CFG_SRC5 _SB_MAKEMASK(8,S_BCM1480_SPC_CFG_SRC5) | ||
271 | #define V_BCM1480_SPC_CFG_SRC5(x) _SB_MAKEVALUE(x,S_BCM1480_SPC_CFG_SRC5) | ||
272 | #define G_BCM1480_SPC_CFG_SRC5(x) _SB_GETVALUE(x,S_BCM1480_SPC_CFG_SRC5,M_BCM1480_SPC_CFG_SRC5) | ||
273 | |||
274 | #define S_BCM1480_SPC_CFG_SRC6 48 | ||
275 | #define M_BCM1480_SPC_CFG_SRC6 _SB_MAKEMASK(8,S_BCM1480_SPC_CFG_SRC6) | ||
276 | #define V_BCM1480_SPC_CFG_SRC6(x) _SB_MAKEVALUE(x,S_BCM1480_SPC_CFG_SRC6) | ||
277 | #define G_BCM1480_SPC_CFG_SRC6(x) _SB_GETVALUE(x,S_BCM1480_SPC_CFG_SRC6,M_BCM1480_SPC_CFG_SRC6) | ||
278 | |||
279 | #define S_BCM1480_SPC_CFG_SRC7 56 | ||
280 | #define M_BCM1480_SPC_CFG_SRC7 _SB_MAKEMASK(8,S_BCM1480_SPC_CFG_SRC7) | ||
281 | #define V_BCM1480_SPC_CFG_SRC7(x) _SB_MAKEVALUE(x,S_BCM1480_SPC_CFG_SRC7) | ||
282 | #define G_BCM1480_SPC_CFG_SRC7(x) _SB_GETVALUE(x,S_BCM1480_SPC_CFG_SRC7,M_BCM1480_SPC_CFG_SRC7) | ||
283 | 265 | ||
284 | /* | 266 | /* |
285 | * System Performance Counter Control Register (Table 32) | 267 | * System Performance Counter Control Register (Table 32) |
286 | * Register: PERF_CNT_CFG_1 | 268 | * Register: PERF_CNT_CFG_1 |
287 | * BCM1480 specific | 269 | * BCM1480 specific |
288 | */ | 270 | */ |
289 | 271 | #define M_BCM1480_SPC_CFG_CLEAR _SB_MAKEMASK1(0) | |
290 | #define M_BCM1480_SPC_CFG_CLEAR _SB_MAKEMASK1(0) | 272 | #define M_BCM1480_SPC_CFG_ENABLE _SB_MAKEMASK1(1) |
291 | #define M_BCM1480_SPC_CFG_ENABLE _SB_MAKEMASK1(1) | 273 | #if SIBYTE_HDR_FEATURE_CHIP(1480) |
274 | #define M_SPC_CFG_CLEAR M_BCM1480_SPC_CFG_CLEAR | ||
275 | #define M_SPC_CFG_ENABLE M_BCM1480_SPC_CFG_ENABLE | ||
276 | #endif | ||
292 | 277 | ||
293 | /* | 278 | /* |
294 | * System Performance Counters (Table 33) | 279 | * System Performance Counters (Table 33) |
@@ -405,20 +390,10 @@ | |||
405 | * Trace Control Register (Table 49) | 390 | * Trace Control Register (Table 49) |
406 | * Register: TRACE_CFG | 391 | * Register: TRACE_CFG |
407 | * | 392 | * |
408 | * Bits 0..8 are the same as the BCM1250, rest are different. | 393 | * BCM1480 changes to this register (other than location of the CUR_ADDR field) |
409 | * Entire register is redefined below. | 394 | * are defined below. |
410 | */ | 395 | */ |
411 | 396 | ||
412 | #define M_BCM1480_SCD_TRACE_CFG_RESET _SB_MAKEMASK1(0) | ||
413 | #define M_BCM1480_SCD_TRACE_CFG_START_READ _SB_MAKEMASK1(1) | ||
414 | #define M_BCM1480_SCD_TRACE_CFG_START _SB_MAKEMASK1(2) | ||
415 | #define M_BCM1480_SCD_TRACE_CFG_STOP _SB_MAKEMASK1(3) | ||
416 | #define M_BCM1480_SCD_TRACE_CFG_FREEZE _SB_MAKEMASK1(4) | ||
417 | #define M_BCM1480_SCD_TRACE_CFG_FREEZE_FULL _SB_MAKEMASK1(5) | ||
418 | #define M_BCM1480_SCD_TRACE_CFG_DEBUG_FULL _SB_MAKEMASK1(6) | ||
419 | #define M_BCM1480_SCD_TRACE_CFG_FULL _SB_MAKEMASK1(7) | ||
420 | #define M_BCM1480_SCD_TRACE_CFG_FORCE_CNT _SB_MAKEMASK1(8) | ||
421 | |||
422 | #define S_BCM1480_SCD_TRACE_CFG_MODE 16 | 397 | #define S_BCM1480_SCD_TRACE_CFG_MODE 16 |
423 | #define M_BCM1480_SCD_TRACE_CFG_MODE _SB_MAKEMASK(2,S_BCM1480_SCD_TRACE_CFG_MODE) | 398 | #define M_BCM1480_SCD_TRACE_CFG_MODE _SB_MAKEMASK(2,S_BCM1480_SCD_TRACE_CFG_MODE) |
424 | #define V_BCM1480_SCD_TRACE_CFG_MODE(x) _SB_MAKEVALUE(x,S_BCM1480_SCD_TRACE_CFG_MODE) | 399 | #define V_BCM1480_SCD_TRACE_CFG_MODE(x) _SB_MAKEVALUE(x,S_BCM1480_SCD_TRACE_CFG_MODE) |
@@ -428,9 +403,4 @@ | |||
428 | #define K_BCM1480_SCD_TRACE_CFG_MODE_BYTEEN_INT 1 | 403 | #define K_BCM1480_SCD_TRACE_CFG_MODE_BYTEEN_INT 1 |
429 | #define K_BCM1480_SCD_TRACE_CFG_MODE_FLOW_ID 2 | 404 | #define K_BCM1480_SCD_TRACE_CFG_MODE_FLOW_ID 2 |
430 | 405 | ||
431 | #define S_BCM1480_SCD_TRACE_CFG_CUR_ADDR 24 | ||
432 | #define M_BCM1480_SCD_TRACE_CFG_CUR_ADDR _SB_MAKEMASK(8,S_BCM1480_SCD_TRACE_CFG_CUR_ADDR) | ||
433 | #define V_BCM1480_SCD_TRACE_CFG_CUR_ADDR(x) _SB_MAKEVALUE(x,S_BCM1480_SCD_TRACE_CFG_CUR_ADDR) | ||
434 | #define G_BCM1480_SCD_TRACE_CFG_CUR_ADDR(x) _SB_GETVALUE(x,S_BCM1480_SCD_TRACE_CFG_CUR_ADDR,M_BCM1480_SCD_TRACE_CFG_CUR_ADDR) | ||
435 | |||
436 | #endif /* _BCM1480_SCD_H */ | 406 | #endif /* _BCM1480_SCD_H */ |
diff --git a/include/asm-mips/sibyte/board.h b/include/asm-mips/sibyte/board.h index 3dfe29ed42a8..73bce901a378 100644 --- a/include/asm-mips/sibyte/board.h +++ b/include/asm-mips/sibyte/board.h | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (C) 2000, 2001, 2002, 2003 Broadcom Corporation | 2 | * Copyright (C) 2000,2001,2002,2003,2004 Broadcom Corporation |
3 | * | 3 | * |
4 | * This program is free software; you can redistribute it and/or | 4 | * This program is free software; you can redistribute it and/or |
5 | * modify it under the terms of the GNU General Public License | 5 | * modify it under the terms of the GNU General Public License |
@@ -19,8 +19,8 @@ | |||
19 | #ifndef _SIBYTE_BOARD_H | 19 | #ifndef _SIBYTE_BOARD_H |
20 | #define _SIBYTE_BOARD_H | 20 | #define _SIBYTE_BOARD_H |
21 | 21 | ||
22 | |||
23 | #if defined(CONFIG_SIBYTE_SWARM) || defined(CONFIG_SIBYTE_PTSWARM) || \ | 22 | #if defined(CONFIG_SIBYTE_SWARM) || defined(CONFIG_SIBYTE_PTSWARM) || \ |
23 | defined(CONFIG_SIBYTE_PT1120) || defined(CONFIG_SIBYTE_PT1125) || \ | ||
24 | defined(CONFIG_SIBYTE_CRHONE) || defined(CONFIG_SIBYTE_CRHINE) || \ | 24 | defined(CONFIG_SIBYTE_CRHONE) || defined(CONFIG_SIBYTE_CRHINE) || \ |
25 | defined(CONFIG_SIBYTE_LITTLESUR) | 25 | defined(CONFIG_SIBYTE_LITTLESUR) |
26 | #include <asm/sibyte/swarm.h> | 26 | #include <asm/sibyte/swarm.h> |
@@ -55,6 +55,16 @@ | |||
55 | #define setleds(t0,t1,c0,c1,c2,c3) | 55 | #define setleds(t0,t1,c0,c1,c2,c3) |
56 | #endif /* LEDS_PHYS */ | 56 | #endif /* LEDS_PHYS */ |
57 | 57 | ||
58 | #else | ||
59 | |||
60 | void swarm_setup(void); | ||
61 | |||
62 | #ifdef LEDS_PHYS | ||
63 | extern void setleds(char *str); | ||
64 | #else | ||
65 | #define setleds(s) do { } while (0) | ||
66 | #endif /* LEDS_PHYS */ | ||
67 | |||
58 | #endif /* __ASSEMBLY__ */ | 68 | #endif /* __ASSEMBLY__ */ |
59 | 69 | ||
60 | #endif /* _SIBYTE_BOARD_H */ | 70 | #endif /* _SIBYTE_BOARD_H */ |
diff --git a/include/asm-mips/sibyte/carmel.h b/include/asm-mips/sibyte/carmel.h index 57c53e62a37a..11cad71323e8 100644 --- a/include/asm-mips/sibyte/carmel.h +++ b/include/asm-mips/sibyte/carmel.h | |||
@@ -18,7 +18,6 @@ | |||
18 | #ifndef __ASM_SIBYTE_CARMEL_H | 18 | #ifndef __ASM_SIBYTE_CARMEL_H |
19 | #define __ASM_SIBYTE_CARMEL_H | 19 | #define __ASM_SIBYTE_CARMEL_H |
20 | 20 | ||
21 | |||
22 | #include <asm/sibyte/sb1250.h> | 21 | #include <asm/sibyte/sb1250.h> |
23 | #include <asm/sibyte/sb1250_int.h> | 22 | #include <asm/sibyte/sb1250_int.h> |
24 | 23 | ||
diff --git a/include/asm-mips/sibyte/sb1250_int.h b/include/asm-mips/sibyte/sb1250_int.h index 05c7b39f1b02..94e8299b0a2a 100644 --- a/include/asm-mips/sibyte/sb1250_int.h +++ b/include/asm-mips/sibyte/sb1250_int.h | |||
@@ -45,8 +45,6 @@ | |||
45 | * First, the interrupt numbers. | 45 | * First, the interrupt numbers. |
46 | */ | 46 | */ |
47 | 47 | ||
48 | #if SIBYTE_HDR_FEATURE_1250_112x | ||
49 | |||
50 | #define K_INT_SOURCES 64 | 48 | #define K_INT_SOURCES 64 |
51 | 49 | ||
52 | #define K_INT_WATCHDOG_TIMER_0 0 | 50 | #define K_INT_WATCHDOG_TIMER_0 0 |
@@ -152,6 +150,7 @@ | |||
152 | #define M_INT_MBOX_1 _SB_MAKEMASK1(K_INT_MBOX_1) | 150 | #define M_INT_MBOX_1 _SB_MAKEMASK1(K_INT_MBOX_1) |
153 | #define M_INT_MBOX_2 _SB_MAKEMASK1(K_INT_MBOX_2) | 151 | #define M_INT_MBOX_2 _SB_MAKEMASK1(K_INT_MBOX_2) |
154 | #define M_INT_MBOX_3 _SB_MAKEMASK1(K_INT_MBOX_3) | 152 | #define M_INT_MBOX_3 _SB_MAKEMASK1(K_INT_MBOX_3) |
153 | #define M_INT_MBOX_ALL _SB_MAKEMASK(4,K_INT_MBOX_0) | ||
155 | #if SIBYTE_HDR_FEATURE(1250, PASS2) || SIBYTE_HDR_FEATURE(112x, PASS1) | 154 | #if SIBYTE_HDR_FEATURE(1250, PASS2) || SIBYTE_HDR_FEATURE(112x, PASS1) |
156 | #define M_INT_CYCLE_CP0_INT _SB_MAKEMASK1(K_INT_CYCLE_CP0_INT) | 155 | #define M_INT_CYCLE_CP0_INT _SB_MAKEMASK1(K_INT_CYCLE_CP0_INT) |
157 | #define M_INT_CYCLE_CP1_INT _SB_MAKEMASK1(K_INT_CYCLE_CP1_INT) | 156 | #define M_INT_CYCLE_CP1_INT _SB_MAKEMASK1(K_INT_CYCLE_CP1_INT) |
@@ -247,5 +246,3 @@ | |||
247 | 246 | ||
248 | 247 | ||
249 | #endif /* 1250/112x */ | 248 | #endif /* 1250/112x */ |
250 | |||
251 | #endif | ||
diff --git a/include/asm-mips/sibyte/sb1250_mac.h b/include/asm-mips/sibyte/sb1250_mac.h index adfc688fa559..833c8b59d687 100644 --- a/include/asm-mips/sibyte/sb1250_mac.h +++ b/include/asm-mips/sibyte/sb1250_mac.h | |||
@@ -129,9 +129,9 @@ | |||
129 | #define M_MAC_BYPASS_16 _SB_MAKEMASK1(42) | 129 | #define M_MAC_BYPASS_16 _SB_MAKEMASK1(42) |
130 | #define M_MAC_BYPASS_FCS_CHK _SB_MAKEMASK1(43) | 130 | #define M_MAC_BYPASS_FCS_CHK _SB_MAKEMASK1(43) |
131 | 131 | ||
132 | #if SIBYTE_HDR_FEATURE(1250, PASS2) || SIBYTE_HDR_FEATURE(112x, PASS1) | 132 | #if SIBYTE_HDR_FEATURE(1250, PASS2) || SIBYTE_HDR_FEATURE(112x, PASS1) || SIBYTE_HDR_FEATURE_CHIP(1480) |
133 | #define M_MAC_RX_CH_SEL_MSB _SB_MAKEMASK1(44) | 133 | #define M_MAC_RX_CH_SEL_MSB _SB_MAKEMASK1(44) |
134 | #endif /* 1250 PASS2 || 112x PASS1 */ | 134 | #endif /* 1250 PASS2 || 112x PASS1 || 1480*/ |
135 | 135 | ||
136 | #if SIBYTE_HDR_FEATURE(1250, PASS3) || SIBYTE_HDR_FEATURE(112x, PASS1) || SIBYTE_HDR_FEATURE_CHIP(1480) | 136 | #if SIBYTE_HDR_FEATURE(1250, PASS3) || SIBYTE_HDR_FEATURE(112x, PASS1) || SIBYTE_HDR_FEATURE_CHIP(1480) |
137 | #define M_MAC_SPLIT_CH_SEL _SB_MAKEMASK1(45) | 137 | #define M_MAC_SPLIT_CH_SEL _SB_MAKEMASK1(45) |
@@ -223,9 +223,9 @@ | |||
223 | /* XXX: Can't enable, as it has the same name as a pass2+ define below. */ | 223 | /* XXX: Can't enable, as it has the same name as a pass2+ define below. */ |
224 | /* #define M_MAC_TX_WR_THRSH _SB_MAKEMASK(6,S_MAC_TX_WR_THRSH) */ | 224 | /* #define M_MAC_TX_WR_THRSH _SB_MAKEMASK(6,S_MAC_TX_WR_THRSH) */ |
225 | #endif /* up to 1250 PASS1 */ | 225 | #endif /* up to 1250 PASS1 */ |
226 | #if SIBYTE_HDR_FEATURE(1250, PASS2) || SIBYTE_HDR_FEATURE(112x, PASS1) | 226 | #if SIBYTE_HDR_FEATURE(1250, PASS2) || SIBYTE_HDR_FEATURE(112x, PASS1) || SIBYTE_HDR_FEATURE_CHIP(1480) |
227 | #define M_MAC_TX_WR_THRSH _SB_MAKEMASK(7,S_MAC_TX_WR_THRSH) | 227 | #define M_MAC_TX_WR_THRSH _SB_MAKEMASK(7,S_MAC_TX_WR_THRSH) |
228 | #endif /* 1250 PASS2 || 112x PASS1 */ | 228 | #endif /* 1250 PASS2 || 112x PASS1 || 1480 */ |
229 | #define V_MAC_TX_WR_THRSH(x) _SB_MAKEVALUE(x,S_MAC_TX_WR_THRSH) | 229 | #define V_MAC_TX_WR_THRSH(x) _SB_MAKEVALUE(x,S_MAC_TX_WR_THRSH) |
230 | #define G_MAC_TX_WR_THRSH(x) _SB_GETVALUE(x,S_MAC_TX_WR_THRSH,M_MAC_TX_WR_THRSH) | 230 | #define G_MAC_TX_WR_THRSH(x) _SB_GETVALUE(x,S_MAC_TX_WR_THRSH,M_MAC_TX_WR_THRSH) |
231 | 231 | ||
@@ -234,9 +234,9 @@ | |||
234 | /* XXX: Can't enable, as it has the same name as a pass2+ define below. */ | 234 | /* XXX: Can't enable, as it has the same name as a pass2+ define below. */ |
235 | /* #define M_MAC_TX_RD_THRSH _SB_MAKEMASK(6,S_MAC_TX_RD_THRSH) */ | 235 | /* #define M_MAC_TX_RD_THRSH _SB_MAKEMASK(6,S_MAC_TX_RD_THRSH) */ |
236 | #endif /* up to 1250 PASS1 */ | 236 | #endif /* up to 1250 PASS1 */ |
237 | #if SIBYTE_HDR_FEATURE(1250, PASS2) || SIBYTE_HDR_FEATURE(112x, PASS1) | 237 | #if SIBYTE_HDR_FEATURE(1250, PASS2) || SIBYTE_HDR_FEATURE(112x, PASS1) || SIBYTE_HDR_FEATURE_CHIP(1480) |
238 | #define M_MAC_TX_RD_THRSH _SB_MAKEMASK(7,S_MAC_TX_RD_THRSH) | 238 | #define M_MAC_TX_RD_THRSH _SB_MAKEMASK(7,S_MAC_TX_RD_THRSH) |
239 | #endif /* 1250 PASS2 || 112x PASS1 */ | 239 | #endif /* 1250 PASS2 || 112x PASS1 || 1480 */ |
240 | #define V_MAC_TX_RD_THRSH(x) _SB_MAKEVALUE(x,S_MAC_TX_RD_THRSH) | 240 | #define V_MAC_TX_RD_THRSH(x) _SB_MAKEVALUE(x,S_MAC_TX_RD_THRSH) |
241 | #define G_MAC_TX_RD_THRSH(x) _SB_GETVALUE(x,S_MAC_TX_RD_THRSH,M_MAC_TX_RD_THRSH) | 241 | #define G_MAC_TX_RD_THRSH(x) _SB_GETVALUE(x,S_MAC_TX_RD_THRSH,M_MAC_TX_RD_THRSH) |
242 | 242 | ||
@@ -260,12 +260,12 @@ | |||
260 | #define V_MAC_RX_RL_THRSH(x) _SB_MAKEVALUE(x,S_MAC_RX_RL_THRSH) | 260 | #define V_MAC_RX_RL_THRSH(x) _SB_MAKEVALUE(x,S_MAC_RX_RL_THRSH) |
261 | #define G_MAC_RX_RL_THRSH(x) _SB_GETVALUE(x,S_MAC_RX_RL_THRSH,M_MAC_RX_RL_THRSH) | 261 | #define G_MAC_RX_RL_THRSH(x) _SB_GETVALUE(x,S_MAC_RX_RL_THRSH,M_MAC_RX_RL_THRSH) |
262 | 262 | ||
263 | #if SIBYTE_HDR_FEATURE(1250, PASS2) || SIBYTE_HDR_FEATURE(112x, PASS1) | 263 | #if SIBYTE_HDR_FEATURE(1250, PASS2) || SIBYTE_HDR_FEATURE(112x, PASS1) || SIBYTE_HDR_FEATURE_CHIP(1480) |
264 | #define S_MAC_ENC_FC_THRSH _SB_MAKE64(56) | 264 | #define S_MAC_ENC_FC_THRSH _SB_MAKE64(56) |
265 | #define M_MAC_ENC_FC_THRSH _SB_MAKEMASK(6,S_MAC_ENC_FC_THRSH) | 265 | #define M_MAC_ENC_FC_THRSH _SB_MAKEMASK(6,S_MAC_ENC_FC_THRSH) |
266 | #define V_MAC_ENC_FC_THRSH(x) _SB_MAKEVALUE(x,S_MAC_ENC_FC_THRSH) | 266 | #define V_MAC_ENC_FC_THRSH(x) _SB_MAKEVALUE(x,S_MAC_ENC_FC_THRSH) |
267 | #define G_MAC_ENC_FC_THRSH(x) _SB_GETVALUE(x,S_MAC_ENC_FC_THRSH,M_MAC_ENC_FC_THRSH) | 267 | #define G_MAC_ENC_FC_THRSH(x) _SB_GETVALUE(x,S_MAC_ENC_FC_THRSH,M_MAC_ENC_FC_THRSH) |
268 | #endif /* 1250 PASS2 || 112x PASS1 */ | 268 | #endif /* 1250 PASS2 || 112x PASS1 || 1480 */ |
269 | 269 | ||
270 | /* | 270 | /* |
271 | * MAC Frame Configuration Registers (Table 9-15) | 271 | * MAC Frame Configuration Registers (Table 9-15) |
@@ -462,9 +462,9 @@ | |||
462 | #define M_MAC_LTCOL_ERR _SB_MAKEMASK1(44) | 462 | #define M_MAC_LTCOL_ERR _SB_MAKEMASK1(44) |
463 | #define M_MAC_EXCOL_ERR _SB_MAKEMASK1(45) | 463 | #define M_MAC_EXCOL_ERR _SB_MAKEMASK1(45) |
464 | #define M_MAC_CNTR_OVRFL_ERR _SB_MAKEMASK1(46) | 464 | #define M_MAC_CNTR_OVRFL_ERR _SB_MAKEMASK1(46) |
465 | #if SIBYTE_HDR_FEATURE(1250, PASS2) || SIBYTE_HDR_FEATURE(112x, PASS1) | 465 | #if SIBYTE_HDR_FEATURE(1250, PASS2) || SIBYTE_HDR_FEATURE(112x, PASS1) || SIBYTE_HDR_FEATURE_CHIP(1480) |
466 | #define M_MAC_SPLIT_EN _SB_MAKEMASK1(47) /* interrupt mask only */ | 466 | #define M_MAC_SPLIT_EN _SB_MAKEMASK1(47) /* interrupt mask only */ |
467 | #endif /* 1250 PASS2 || 112x PASS1 */ | 467 | #endif /* 1250 PASS2 || 112x PASS1 || 1480 */ |
468 | 468 | ||
469 | #define S_MAC_COUNTER_ADDR _SB_MAKE64(47) | 469 | #define S_MAC_COUNTER_ADDR _SB_MAKE64(47) |
470 | #define M_MAC_COUNTER_ADDR _SB_MAKEMASK(5,S_MAC_COUNTER_ADDR) | 470 | #define M_MAC_COUNTER_ADDR _SB_MAKEMASK(5,S_MAC_COUNTER_ADDR) |
@@ -598,9 +598,9 @@ | |||
598 | #define M_MAC_MCAST_INV _SB_MAKEMASK1(4) | 598 | #define M_MAC_MCAST_INV _SB_MAKEMASK1(4) |
599 | #define M_MAC_BCAST_EN _SB_MAKEMASK1(5) | 599 | #define M_MAC_BCAST_EN _SB_MAKEMASK1(5) |
600 | #define M_MAC_DIRECT_INV _SB_MAKEMASK1(6) | 600 | #define M_MAC_DIRECT_INV _SB_MAKEMASK1(6) |
601 | #if SIBYTE_HDR_FEATURE(1250, PASS2) || SIBYTE_HDR_FEATURE(112x, PASS1) | 601 | #if SIBYTE_HDR_FEATURE(1250, PASS2) || SIBYTE_HDR_FEATURE(112x, PASS1) || SIBYTE_HDR_FEATURE_CHIP(1480) |
602 | #define M_MAC_ALLMCAST_EN _SB_MAKEMASK1(7) | 602 | #define M_MAC_ALLMCAST_EN _SB_MAKEMASK1(7) |
603 | #endif /* 1250 PASS2 || 112x PASS1 */ | 603 | #endif /* 1250 PASS2 || 112x PASS1 || 1480 */ |
604 | 604 | ||
605 | #define S_MAC_IPHDR_OFFSET _SB_MAKE64(8) | 605 | #define S_MAC_IPHDR_OFFSET _SB_MAKE64(8) |
606 | #define M_MAC_IPHDR_OFFSET _SB_MAKEMASK(8,S_MAC_IPHDR_OFFSET) | 606 | #define M_MAC_IPHDR_OFFSET _SB_MAKEMASK(8,S_MAC_IPHDR_OFFSET) |
diff --git a/include/asm-mips/sibyte/sb1250_mc.h b/include/asm-mips/sibyte/sb1250_mc.h index 26e421498c97..4fe848ffbc31 100644 --- a/include/asm-mips/sibyte/sb1250_mc.h +++ b/include/asm-mips/sibyte/sb1250_mc.h | |||
@@ -295,7 +295,7 @@ | |||
295 | 295 | ||
296 | #if SIBYTE_HDR_FEATURE(1250, PASS3) || SIBYTE_HDR_FEATURE(112x, PASS1) | 296 | #if SIBYTE_HDR_FEATURE(1250, PASS3) || SIBYTE_HDR_FEATURE(112x, PASS1) |
297 | #define M_MC_PRE_ON_A8 _SB_MAKEMASK1(36) | 297 | #define M_MC_PRE_ON_A8 _SB_MAKEMASK1(36) |
298 | #define M_MC_RAM_WITH_A13 _SB_MAKEMASK1(38) | 298 | #define M_MC_RAM_WITH_A13 _SB_MAKEMASK1(37) |
299 | #endif /* 1250 PASS3 || 112x PASS1 */ | 299 | #endif /* 1250 PASS3 || 112x PASS1 */ |
300 | 300 | ||
301 | 301 | ||
diff --git a/include/asm-mips/sibyte/sb1250_regs.h b/include/asm-mips/sibyte/sb1250_regs.h index bab3a4580a36..da7c188993c9 100644 --- a/include/asm-mips/sibyte/sb1250_regs.h +++ b/include/asm-mips/sibyte/sb1250_regs.h | |||
@@ -131,6 +131,7 @@ | |||
131 | 131 | ||
132 | #endif | 132 | #endif |
133 | 133 | ||
134 | |||
134 | /* ********************************************************************* | 135 | /* ********************************************************************* |
135 | * PCI Interface Registers | 136 | * PCI Interface Registers |
136 | ********************************************************************* */ | 137 | ********************************************************************* */ |
@@ -239,14 +240,14 @@ | |||
239 | #define R_MAC_VLANTAG 0x00000110 | 240 | #define R_MAC_VLANTAG 0x00000110 |
240 | #define R_MAC_FRAMECFG 0x00000118 | 241 | #define R_MAC_FRAMECFG 0x00000118 |
241 | #define R_MAC_EOPCNT 0x00000120 | 242 | #define R_MAC_EOPCNT 0x00000120 |
242 | #define R_MAC_FIFO_PTRS 0x00000130 | 243 | #define R_MAC_FIFO_PTRS 0x00000128 |
243 | #define R_MAC_ADFILTER_CFG 0x00000200 | 244 | #define R_MAC_ADFILTER_CFG 0x00000200 |
244 | #define R_MAC_ETHERNET_ADDR 0x00000208 | 245 | #define R_MAC_ETHERNET_ADDR 0x00000208 |
245 | #define R_MAC_PKT_TYPE 0x00000210 | 246 | #define R_MAC_PKT_TYPE 0x00000210 |
246 | #if SIBYTE_HDR_FEATURE(1250, PASS3) || SIBYTE_HDR_FEATURE(112x, PASS1) | 247 | #if SIBYTE_HDR_FEATURE(1250, PASS3) || SIBYTE_HDR_FEATURE(112x, PASS1) || SIBYTE_HDR_FEATURE_CHIP(1480) |
247 | #define R_MAC_ADMASK0 0x00000218 | 248 | #define R_MAC_ADMASK0 0x00000218 |
248 | #define R_MAC_ADMASK1 0x00000220 | 249 | #define R_MAC_ADMASK1 0x00000220 |
249 | #endif /* 1250 PASS3 || 112x PASS1 */ | 250 | #endif /* 1250 PASS3 || 112x PASS1 || 1480 */ |
250 | #define R_MAC_HASH_BASE 0x00000240 | 251 | #define R_MAC_HASH_BASE 0x00000240 |
251 | #define R_MAC_ADDR_BASE 0x00000280 | 252 | #define R_MAC_ADDR_BASE 0x00000280 |
252 | #define R_MAC_CHLO0_BASE 0x00000300 | 253 | #define R_MAC_CHLO0_BASE 0x00000300 |
@@ -256,9 +257,9 @@ | |||
256 | #define R_MAC_INT_MASK 0x00000410 | 257 | #define R_MAC_INT_MASK 0x00000410 |
257 | #define R_MAC_TXD_CTL 0x00000420 | 258 | #define R_MAC_TXD_CTL 0x00000420 |
258 | #define R_MAC_MDIO 0x00000428 | 259 | #define R_MAC_MDIO 0x00000428 |
259 | #if SIBYTE_HDR_FEATURE(1250, PASS2) || SIBYTE_HDR_FEATURE(112x, PASS1) | 260 | #if SIBYTE_HDR_FEATURE(1250, PASS2) || SIBYTE_HDR_FEATURE(112x, PASS1) || SIBYTE_HDR_FEATURE_CHIP(1480) |
260 | #define R_MAC_STATUS1 0x00000430 | 261 | #define R_MAC_STATUS1 0x00000430 |
261 | #endif /* 1250 PASS2 || 112x PASS1 */ | 262 | #endif /* 1250 PASS2 || 112x PASS1 || 1480 */ |
262 | #define R_MAC_DEBUG_STATUS 0x00000448 | 263 | #define R_MAC_DEBUG_STATUS 0x00000448 |
263 | 264 | ||
264 | #define MAC_HASH_COUNT 8 | 265 | #define MAC_HASH_COUNT 8 |
@@ -289,11 +290,11 @@ | |||
289 | #define R_DUART_RX_HOLD 0x160 | 290 | #define R_DUART_RX_HOLD 0x160 |
290 | #define R_DUART_TX_HOLD 0x170 | 291 | #define R_DUART_TX_HOLD 0x170 |
291 | 292 | ||
292 | #if SIBYTE_HDR_FEATURE(1250, PASS2) || SIBYTE_HDR_FEATURE(112x, PASS1) | 293 | #if SIBYTE_HDR_FEATURE(1250, PASS2) || SIBYTE_HDR_FEATURE(112x, PASS1) || SIBYTE_HDR_FEATURE_CHIP(1480) |
293 | #define R_DUART_FULL_CTL 0x140 | 294 | #define R_DUART_FULL_CTL 0x140 |
294 | #define R_DUART_OPCR_X 0x180 | 295 | #define R_DUART_OPCR_X 0x180 |
295 | #define R_DUART_AUXCTL_X 0x190 | 296 | #define R_DUART_AUXCTL_X 0x190 |
296 | #endif /* 1250 PASS2 || 112x PASS1 */ | 297 | #endif /* 1250 PASS2 || 112x PASS1 || 1480*/ |
297 | 298 | ||
298 | 299 | ||
299 | /* | 300 | /* |
@@ -308,6 +309,7 @@ | |||
308 | #define R_DUART_IMR_B 0x350 | 309 | #define R_DUART_IMR_B 0x350 |
309 | #define R_DUART_OUT_PORT 0x360 | 310 | #define R_DUART_OUT_PORT 0x360 |
310 | #define R_DUART_OPCR 0x370 | 311 | #define R_DUART_OPCR 0x370 |
312 | #define R_DUART_IN_PORT 0x380 | ||
311 | 313 | ||
312 | #define R_DUART_SET_OPR 0x3B0 | 314 | #define R_DUART_SET_OPR 0x3B0 |
313 | #define R_DUART_CLEAR_OPR 0x3C0 | 315 | #define R_DUART_CLEAR_OPR 0x3C0 |
@@ -685,12 +687,17 @@ | |||
685 | #define A_ADDR_TRAP_REG_DEBUG 0x0010020460 | 687 | #define A_ADDR_TRAP_REG_DEBUG 0x0010020460 |
686 | #endif /* 1250 PASS2 || 112x PASS1 || 1480 */ | 688 | #endif /* 1250 PASS2 || 112x PASS1 || 1480 */ |
687 | 689 | ||
690 | #define ADDR_TRAP_SPACING 8 | ||
691 | #define NUM_ADDR_TRAP 4 | ||
692 | #define A_ADDR_TRAP_UP(n) (A_ADDR_TRAP_UP_0 + ((n) * ADDR_TRAP_SPACING)) | ||
693 | #define A_ADDR_TRAP_DOWN(n) (A_ADDR_TRAP_DOWN_0 + ((n) * ADDR_TRAP_SPACING)) | ||
694 | #define A_ADDR_TRAP_CFG(n) (A_ADDR_TRAP_CFG_0 + ((n) * ADDR_TRAP_SPACING)) | ||
695 | |||
688 | 696 | ||
689 | /* ********************************************************************* | 697 | /* ********************************************************************* |
690 | * System Interrupt Mapper Registers | 698 | * System Interrupt Mapper Registers |
691 | ********************************************************************* */ | 699 | ********************************************************************* */ |
692 | 700 | ||
693 | #if SIBYTE_HDR_FEATURE_1250_112x | ||
694 | #define A_IMR_CPU0_BASE 0x0010020000 | 701 | #define A_IMR_CPU0_BASE 0x0010020000 |
695 | #define A_IMR_CPU1_BASE 0x0010022000 | 702 | #define A_IMR_CPU1_BASE 0x0010022000 |
696 | #define IMR_REGISTER_SPACING 0x2000 | 703 | #define IMR_REGISTER_SPACING 0x2000 |
@@ -700,6 +707,7 @@ | |||
700 | #define A_IMR_REGISTER(cpu,reg) (A_IMR_MAPPER(cpu)+(reg)) | 707 | #define A_IMR_REGISTER(cpu,reg) (A_IMR_MAPPER(cpu)+(reg)) |
701 | 708 | ||
702 | #define R_IMR_INTERRUPT_DIAG 0x0010 | 709 | #define R_IMR_INTERRUPT_DIAG 0x0010 |
710 | #define R_IMR_INTERRUPT_LDT 0x0018 | ||
703 | #define R_IMR_INTERRUPT_MASK 0x0028 | 711 | #define R_IMR_INTERRUPT_MASK 0x0028 |
704 | #define R_IMR_INTERRUPT_TRACE 0x0038 | 712 | #define R_IMR_INTERRUPT_TRACE 0x0038 |
705 | #define R_IMR_INTERRUPT_SOURCE_STATUS 0x0040 | 713 | #define R_IMR_INTERRUPT_SOURCE_STATUS 0x0040 |
@@ -715,7 +723,14 @@ | |||
715 | #define R_IMR_INTERRUPT_STATUS_COUNT 7 | 723 | #define R_IMR_INTERRUPT_STATUS_COUNT 7 |
716 | #define R_IMR_INTERRUPT_MAP_BASE 0x0200 | 724 | #define R_IMR_INTERRUPT_MAP_BASE 0x0200 |
717 | #define R_IMR_INTERRUPT_MAP_COUNT 64 | 725 | #define R_IMR_INTERRUPT_MAP_COUNT 64 |
718 | #endif /* 1250/112x */ | 726 | |
727 | /* | ||
728 | * these macros work together to build the address of a mailbox | ||
729 | * register, e.g., A_MAILBOX_REGISTER(R_IMR_MAILBOX_SET_CPU,1) | ||
730 | * for mbox_0_set_cpu2 returns 0x00100240C8 | ||
731 | */ | ||
732 | #define A_MAILBOX_REGISTER(reg,cpu) \ | ||
733 | (A_IMR_CPU0_BASE + (cpu * IMR_REGISTER_SPACING) + reg) | ||
719 | 734 | ||
720 | /* ********************************************************************* | 735 | /* ********************************************************************* |
721 | * System Performance Counter Registers | 736 | * System Performance Counter Registers |
@@ -727,6 +742,10 @@ | |||
727 | #define A_SCD_PERF_CNT_2 0x00100204E0 | 742 | #define A_SCD_PERF_CNT_2 0x00100204E0 |
728 | #define A_SCD_PERF_CNT_3 0x00100204E8 | 743 | #define A_SCD_PERF_CNT_3 0x00100204E8 |
729 | 744 | ||
745 | #define SCD_NUM_PERF_CNT 4 | ||
746 | #define SCD_PERF_CNT_SPACING 8 | ||
747 | #define A_SCD_PERF_CNT(n) (A_SCD_PERF_CNT_0+(n*SCD_PERF_CNT_SPACING)) | ||
748 | |||
730 | /* ********************************************************************* | 749 | /* ********************************************************************* |
731 | * System Bus Watcher Registers | 750 | * System Bus Watcher Registers |
732 | ********************************************************************* */ | 751 | ********************************************************************* */ |
@@ -772,6 +791,15 @@ | |||
772 | #define A_SCD_TRACE_SEQUENCE_6 0x0010020A90 | 791 | #define A_SCD_TRACE_SEQUENCE_6 0x0010020A90 |
773 | #define A_SCD_TRACE_SEQUENCE_7 0x0010020A98 | 792 | #define A_SCD_TRACE_SEQUENCE_7 0x0010020A98 |
774 | 793 | ||
794 | #define TRACE_REGISTER_SPACING 8 | ||
795 | #define TRACE_NUM_REGISTERS 8 | ||
796 | #define A_SCD_TRACE_EVENT(n) (((n) & 4) ? \ | ||
797 | (A_SCD_TRACE_EVENT_4 + (((n) & 3) * TRACE_REGISTER_SPACING)) : \ | ||
798 | (A_SCD_TRACE_EVENT_0 + ((n) * TRACE_REGISTER_SPACING))) | ||
799 | #define A_SCD_TRACE_SEQUENCE(n) (((n) & 4) ? \ | ||
800 | (A_SCD_TRACE_SEQUENCE_4 + (((n) & 3) * TRACE_REGISTER_SPACING)) : \ | ||
801 | (A_SCD_TRACE_SEQUENCE_0 + ((n) * TRACE_REGISTER_SPACING))) | ||
802 | |||
775 | /* ********************************************************************* | 803 | /* ********************************************************************* |
776 | * System Generic DMA Registers | 804 | * System Generic DMA Registers |
777 | ********************************************************************* */ | 805 | ********************************************************************* */ |
diff --git a/include/asm-mips/sibyte/sb1250_scd.h b/include/asm-mips/sibyte/sb1250_scd.h index 7ed0bb611e56..9ea3da367ab6 100644 --- a/include/asm-mips/sibyte/sb1250_scd.h +++ b/include/asm-mips/sibyte/sb1250_scd.h | |||
@@ -10,7 +10,7 @@ | |||
10 | * | 10 | * |
11 | ********************************************************************* | 11 | ********************************************************************* |
12 | * | 12 | * |
13 | * Copyright 2000,2001,2002,2003 | 13 | * Copyright 2000,2001,2002,2003,2004,2005 |
14 | * Broadcom Corporation. All rights reserved. | 14 | * Broadcom Corporation. All rights reserved. |
15 | * | 15 | * |
16 | * This program is free software; you can redistribute it and/or | 16 | * This program is free software; you can redistribute it and/or |
@@ -84,6 +84,7 @@ | |||
84 | #define K_SYS_REVISION_BCM112x_A2 0x21 | 84 | #define K_SYS_REVISION_BCM112x_A2 0x21 |
85 | #define K_SYS_REVISION_BCM112x_A3 0x22 | 85 | #define K_SYS_REVISION_BCM112x_A3 0x22 |
86 | #define K_SYS_REVISION_BCM112x_A4 0x23 | 86 | #define K_SYS_REVISION_BCM112x_A4 0x23 |
87 | #define K_SYS_REVISION_BCM112x_B0 0x30 | ||
87 | 88 | ||
88 | #define K_SYS_REVISION_BCM1480_S0 0x01 | 89 | #define K_SYS_REVISION_BCM1480_S0 0x01 |
89 | #define K_SYS_REVISION_BCM1480_A1 0x02 | 90 | #define K_SYS_REVISION_BCM1480_A1 0x02 |
@@ -149,7 +150,7 @@ | |||
149 | * (For the assembler version, sysrev and dest may be the same register. | 150 | * (For the assembler version, sysrev and dest may be the same register. |
150 | * Also, it clobbers AT.) | 151 | * Also, it clobbers AT.) |
151 | */ | 152 | */ |
152 | #ifdef __ASSEMBLY__ | 153 | #ifdef __ASSEMBLER__ |
153 | #define SYS_SOC_TYPE(dest, sysrev) \ | 154 | #define SYS_SOC_TYPE(dest, sysrev) \ |
154 | .set push ; \ | 155 | .set push ; \ |
155 | .set reorder ; \ | 156 | .set reorder ; \ |
@@ -213,6 +214,7 @@ | |||
213 | #define G_SYS_YPOS(x) _SB_GETVALUE(x,S_SYS_YPOS,M_SYS_YPOS) | 214 | #define G_SYS_YPOS(x) _SB_GETVALUE(x,S_SYS_YPOS,M_SYS_YPOS) |
214 | #endif | 215 | #endif |
215 | 216 | ||
217 | |||
216 | /* | 218 | /* |
217 | * System Config Register (Table 4-2) | 219 | * System Config Register (Table 4-2) |
218 | * Register: SCD_SYSTEM_CFG | 220 | * Register: SCD_SYSTEM_CFG |
@@ -359,13 +361,13 @@ | |||
359 | */ | 361 | */ |
360 | 362 | ||
361 | #define V_SCD_TIMER_FREQ 1000000 | 363 | #define V_SCD_TIMER_FREQ 1000000 |
362 | #define V_SCD_TIMER_WIDTH 23 | ||
363 | 364 | ||
364 | #define S_SCD_TIMER_INIT 0 | 365 | #define S_SCD_TIMER_INIT 0 |
365 | #define M_SCD_TIMER_INIT _SB_MAKEMASK(V_SCD_TIMER_WIDTH,S_SCD_TIMER_INIT) | 366 | #define M_SCD_TIMER_INIT _SB_MAKEMASK(23,S_SCD_TIMER_INIT) |
366 | #define V_SCD_TIMER_INIT(x) _SB_MAKEVALUE(x,S_SCD_TIMER_INIT) | 367 | #define V_SCD_TIMER_INIT(x) _SB_MAKEVALUE(x,S_SCD_TIMER_INIT) |
367 | #define G_SCD_TIMER_INIT(x) _SB_GETVALUE(x,S_SCD_TIMER_INIT,M_SCD_TIMER_INIT) | 368 | #define G_SCD_TIMER_INIT(x) _SB_GETVALUE(x,S_SCD_TIMER_INIT,M_SCD_TIMER_INIT) |
368 | 369 | ||
370 | #define V_SCD_TIMER_WIDTH 23 | ||
369 | #define S_SCD_TIMER_CNT 0 | 371 | #define S_SCD_TIMER_CNT 0 |
370 | #define M_SCD_TIMER_CNT _SB_MAKEMASK(V_SCD_TIMER_WIDTH,S_SCD_TIMER_CNT) | 372 | #define M_SCD_TIMER_CNT _SB_MAKEMASK(V_SCD_TIMER_WIDTH,S_SCD_TIMER_CNT) |
371 | #define V_SCD_TIMER_CNT(x) _SB_MAKEVALUE(x,S_SCD_TIMER_CNT) | 373 | #define V_SCD_TIMER_CNT(x) _SB_MAKEVALUE(x,S_SCD_TIMER_CNT) |
@@ -379,7 +381,6 @@ | |||
379 | * System Performance Counters | 381 | * System Performance Counters |
380 | */ | 382 | */ |
381 | 383 | ||
382 | #if SIBYTE_HDR_FEATURE_1250_112x | ||
383 | #define S_SPC_CFG_SRC0 0 | 384 | #define S_SPC_CFG_SRC0 0 |
384 | #define M_SPC_CFG_SRC0 _SB_MAKEMASK(8,S_SPC_CFG_SRC0) | 385 | #define M_SPC_CFG_SRC0 _SB_MAKEMASK(8,S_SPC_CFG_SRC0) |
385 | #define V_SPC_CFG_SRC0(x) _SB_MAKEVALUE(x,S_SPC_CFG_SRC0) | 386 | #define V_SPC_CFG_SRC0(x) _SB_MAKEVALUE(x,S_SPC_CFG_SRC0) |
@@ -400,6 +401,7 @@ | |||
400 | #define V_SPC_CFG_SRC3(x) _SB_MAKEVALUE(x,S_SPC_CFG_SRC3) | 401 | #define V_SPC_CFG_SRC3(x) _SB_MAKEVALUE(x,S_SPC_CFG_SRC3) |
401 | #define G_SPC_CFG_SRC3(x) _SB_GETVALUE(x,S_SPC_CFG_SRC3,M_SPC_CFG_SRC3) | 402 | #define G_SPC_CFG_SRC3(x) _SB_GETVALUE(x,S_SPC_CFG_SRC3,M_SPC_CFG_SRC3) |
402 | 403 | ||
404 | #if SIBYTE_HDR_FEATURE_1250_112x | ||
403 | #define M_SPC_CFG_CLEAR _SB_MAKEMASK1(32) | 405 | #define M_SPC_CFG_CLEAR _SB_MAKEMASK1(32) |
404 | #define M_SPC_CFG_ENABLE _SB_MAKEMASK1(33) | 406 | #define M_SPC_CFG_ENABLE _SB_MAKEMASK1(33) |
405 | #endif | 407 | #endif |
@@ -515,8 +517,6 @@ | |||
515 | * Trace Buffer Config register | 517 | * Trace Buffer Config register |
516 | */ | 518 | */ |
517 | 519 | ||
518 | #if SIBYTE_HDR_FEATURE_1250_112x | ||
519 | |||
520 | #define M_SCD_TRACE_CFG_RESET _SB_MAKEMASK1(0) | 520 | #define M_SCD_TRACE_CFG_RESET _SB_MAKEMASK1(0) |
521 | #define M_SCD_TRACE_CFG_START_READ _SB_MAKEMASK1(1) | 521 | #define M_SCD_TRACE_CFG_START_READ _SB_MAKEMASK1(1) |
522 | #define M_SCD_TRACE_CFG_START _SB_MAKEMASK1(2) | 522 | #define M_SCD_TRACE_CFG_START _SB_MAKEMASK1(2) |
@@ -525,17 +525,26 @@ | |||
525 | #define M_SCD_TRACE_CFG_FREEZE_FULL _SB_MAKEMASK1(5) | 525 | #define M_SCD_TRACE_CFG_FREEZE_FULL _SB_MAKEMASK1(5) |
526 | #define M_SCD_TRACE_CFG_DEBUG_FULL _SB_MAKEMASK1(6) | 526 | #define M_SCD_TRACE_CFG_DEBUG_FULL _SB_MAKEMASK1(6) |
527 | #define M_SCD_TRACE_CFG_FULL _SB_MAKEMASK1(7) | 527 | #define M_SCD_TRACE_CFG_FULL _SB_MAKEMASK1(7) |
528 | #if SIBYTE_HDR_FEATURE(1250, PASS2) || SIBYTE_HDR_FEATURE(112x, PASS1) | 528 | #if SIBYTE_HDR_FEATURE(1250, PASS2) || SIBYTE_HDR_FEATURE(112x, PASS1) || SIBYTE_HDR_FEATURE_CHIP(1480) |
529 | #define M_SCD_TRACE_CFG_FORCECNT _SB_MAKEMASK1(8) | 529 | #define M_SCD_TRACE_CFG_FORCECNT _SB_MAKEMASK1(8) |
530 | #endif /* 1250 PASS2 || 112x PASS1 */ | 530 | #endif /* 1250 PASS2 || 112x PASS1 || 1480 */ |
531 | 531 | ||
532 | /* | ||
533 | * This field is the same on the 1250/112x and 1480, just located in | ||
534 | * a slightly different place in the register. | ||
535 | */ | ||
536 | #if SIBYTE_HDR_FEATURE_1250_112x | ||
532 | #define S_SCD_TRACE_CFG_CUR_ADDR 10 | 537 | #define S_SCD_TRACE_CFG_CUR_ADDR 10 |
538 | #else | ||
539 | #if SIBYTE_HDR_FEATURE_CHIP(1480) | ||
540 | #define S_SCD_TRACE_CFG_CUR_ADDR 24 | ||
541 | #endif /* 1480 */ | ||
542 | #endif /* 1250/112x */ | ||
543 | |||
533 | #define M_SCD_TRACE_CFG_CUR_ADDR _SB_MAKEMASK(8,S_SCD_TRACE_CFG_CUR_ADDR) | 544 | #define M_SCD_TRACE_CFG_CUR_ADDR _SB_MAKEMASK(8,S_SCD_TRACE_CFG_CUR_ADDR) |
534 | #define V_SCD_TRACE_CFG_CUR_ADDR(x) _SB_MAKEVALUE(x,S_SCD_TRACE_CFG_CUR_ADDR) | 545 | #define V_SCD_TRACE_CFG_CUR_ADDR(x) _SB_MAKEVALUE(x,S_SCD_TRACE_CFG_CUR_ADDR) |
535 | #define G_SCD_TRACE_CFG_CUR_ADDR(x) _SB_GETVALUE(x,S_SCD_TRACE_CFG_CUR_ADDR,M_SCD_TRACE_CFG_CUR_ADDR) | 546 | #define G_SCD_TRACE_CFG_CUR_ADDR(x) _SB_GETVALUE(x,S_SCD_TRACE_CFG_CUR_ADDR,M_SCD_TRACE_CFG_CUR_ADDR) |
536 | 547 | ||
537 | #endif /* 1250/112x */ | ||
538 | |||
539 | /* | 548 | /* |
540 | * Trace Event registers | 549 | * Trace Event registers |
541 | */ | 550 | */ |
diff --git a/include/asm-mips/sibyte/swarm.h b/include/asm-mips/sibyte/swarm.h index 86db37e5ad85..540865fa7ec3 100644 --- a/include/asm-mips/sibyte/swarm.h +++ b/include/asm-mips/sibyte/swarm.h | |||
@@ -32,6 +32,18 @@ | |||
32 | #define SIBYTE_HAVE_IDE 1 | 32 | #define SIBYTE_HAVE_IDE 1 |
33 | #define SIBYTE_DEFAULT_CONSOLE "ttyS0,115200" | 33 | #define SIBYTE_DEFAULT_CONSOLE "ttyS0,115200" |
34 | #endif | 34 | #endif |
35 | #ifdef CONFIG_SIBYTE_PT1120 | ||
36 | #define SIBYTE_BOARD_NAME "PT1120" | ||
37 | #define SIBYTE_HAVE_PCMCIA 1 | ||
38 | #define SIBYTE_HAVE_IDE 1 | ||
39 | #define SIBYTE_DEFAULT_CONSOLE "ttyS0,115200" | ||
40 | #endif | ||
41 | #ifdef CONFIG_SIBYTE_PT1125 | ||
42 | #define SIBYTE_BOARD_NAME "PT1125" | ||
43 | #define SIBYTE_HAVE_PCMCIA 1 | ||
44 | #define SIBYTE_HAVE_IDE 1 | ||
45 | #define SIBYTE_DEFAULT_CONSOLE "ttyS0,115200" | ||
46 | #endif | ||
35 | #ifdef CONFIG_SIBYTE_LITTLESUR | 47 | #ifdef CONFIG_SIBYTE_LITTLESUR |
36 | #define SIBYTE_BOARD_NAME "BCM91250C2 (LittleSur)" | 48 | #define SIBYTE_BOARD_NAME "BCM91250C2 (LittleSur)" |
37 | #define SIBYTE_HAVE_PCMCIA 0 | 49 | #define SIBYTE_HAVE_PCMCIA 0 |
diff --git a/include/asm-mips/socket.h b/include/asm-mips/socket.h index 36ebe4e186a7..95945689b1c6 100644 --- a/include/asm-mips/socket.h +++ b/include/asm-mips/socket.h | |||
@@ -70,6 +70,8 @@ To add: #define SO_REUSEPORT 0x0200 /* Allow local address and port reuse. */ | |||
70 | #define SO_SNDBUFFORCE 31 | 70 | #define SO_SNDBUFFORCE 31 |
71 | #define SO_RCVBUFFORCE 33 | 71 | #define SO_RCVBUFFORCE 33 |
72 | #define SO_PASSSEC 34 | 72 | #define SO_PASSSEC 34 |
73 | #define SO_TIMESTAMPNS 35 | ||
74 | #define SCM_TIMESTAMPNS SO_TIMESTAMPNS | ||
73 | 75 | ||
74 | #ifdef __KERNEL__ | 76 | #ifdef __KERNEL__ |
75 | 77 | ||
diff --git a/include/asm-mips/sockios.h b/include/asm-mips/sockios.h index 87a50bf039ed..ed1a5f78d22f 100644 --- a/include/asm-mips/sockios.h +++ b/include/asm-mips/sockios.h | |||
@@ -20,6 +20,7 @@ | |||
20 | #define SIOCSPGRP _IOW('s', 8, pid_t) | 20 | #define SIOCSPGRP _IOW('s', 8, pid_t) |
21 | #define SIOCGPGRP _IOR('s', 9, pid_t) | 21 | #define SIOCGPGRP _IOR('s', 9, pid_t) |
22 | 22 | ||
23 | #define SIOCGSTAMP 0x8906 /* Get stamp - linux-specific */ | 23 | #define SIOCGSTAMP 0x8906 /* Get stamp (timeval) */ |
24 | #define SIOCGSTAMPNS 0x8907 /* Get stamp (timespec) */ | ||
24 | 25 | ||
25 | #endif /* _ASM_SOCKIOS_H */ | 26 | #endif /* _ASM_SOCKIOS_H */ |
diff --git a/include/asm-mips/thread_info.h b/include/asm-mips/thread_info.h index 6cf05f4a4e7e..fbcda8204473 100644 --- a/include/asm-mips/thread_info.h +++ b/include/asm-mips/thread_info.h | |||
@@ -119,7 +119,6 @@ register struct thread_info *__current_thread_info __asm__("$28"); | |||
119 | #define TIF_POLLING_NRFLAG 17 /* true if poll_idle() is polling TIF_NEED_RESCHED */ | 119 | #define TIF_POLLING_NRFLAG 17 /* true if poll_idle() is polling TIF_NEED_RESCHED */ |
120 | #define TIF_MEMDIE 18 | 120 | #define TIF_MEMDIE 18 |
121 | #define TIF_FREEZE 19 | 121 | #define TIF_FREEZE 19 |
122 | #define TIF_ALLOW_FP_IN_KERNEL 20 | ||
123 | #define TIF_SYSCALL_TRACE 31 /* syscall trace active */ | 122 | #define TIF_SYSCALL_TRACE 31 /* syscall trace active */ |
124 | 123 | ||
125 | #define _TIF_SYSCALL_TRACE (1<<TIF_SYSCALL_TRACE) | 124 | #define _TIF_SYSCALL_TRACE (1<<TIF_SYSCALL_TRACE) |
diff --git a/include/asm-parisc/socket.h b/include/asm-parisc/socket.h index ce2eae1708b5..99e868f6a8f5 100644 --- a/include/asm-parisc/socket.h +++ b/include/asm-parisc/socket.h | |||
@@ -33,6 +33,8 @@ | |||
33 | #define SO_PEERCRED 0x4011 | 33 | #define SO_PEERCRED 0x4011 |
34 | #define SO_TIMESTAMP 0x4012 | 34 | #define SO_TIMESTAMP 0x4012 |
35 | #define SCM_TIMESTAMP SO_TIMESTAMP | 35 | #define SCM_TIMESTAMP SO_TIMESTAMP |
36 | #define SO_TIMESTAMPNS 0x4013 | ||
37 | #define SCM_TIMESTAMPNS SO_TIMESTAMPNS | ||
36 | 38 | ||
37 | /* Security levels - as per NRL IPv6 - don't actually do anything */ | 39 | /* Security levels - as per NRL IPv6 - don't actually do anything */ |
38 | #define SO_SECURITY_AUTHENTICATION 0x4016 | 40 | #define SO_SECURITY_AUTHENTICATION 0x4016 |
diff --git a/include/asm-parisc/sockios.h b/include/asm-parisc/sockios.h index aace49629949..dabfbc7483f6 100644 --- a/include/asm-parisc/sockios.h +++ b/include/asm-parisc/sockios.h | |||
@@ -7,6 +7,7 @@ | |||
7 | #define FIOGETOWN 0x8903 | 7 | #define FIOGETOWN 0x8903 |
8 | #define SIOCGPGRP 0x8904 | 8 | #define SIOCGPGRP 0x8904 |
9 | #define SIOCATMARK 0x8905 | 9 | #define SIOCATMARK 0x8905 |
10 | #define SIOCGSTAMP 0x8906 /* Get stamp */ | 10 | #define SIOCGSTAMP 0x8906 /* Get stamp (timeval) */ |
11 | #define SIOCGSTAMPNS 0x8907 /* Get stamp (timespec) */ | ||
11 | 12 | ||
12 | #endif | 13 | #endif |
diff --git a/include/asm-powerpc/socket.h b/include/asm-powerpc/socket.h index c8b1da50e72d..403e9fde2eb5 100644 --- a/include/asm-powerpc/socket.h +++ b/include/asm-powerpc/socket.h | |||
@@ -56,5 +56,7 @@ | |||
56 | 56 | ||
57 | #define SO_PEERSEC 31 | 57 | #define SO_PEERSEC 31 |
58 | #define SO_PASSSEC 34 | 58 | #define SO_PASSSEC 34 |
59 | #define SO_TIMESTAMPNS 35 | ||
60 | #define SCM_TIMESTAMPNS SO_TIMESTAMPNS | ||
59 | 61 | ||
60 | #endif /* _ASM_POWERPC_SOCKET_H */ | 62 | #endif /* _ASM_POWERPC_SOCKET_H */ |
diff --git a/include/asm-powerpc/sockios.h b/include/asm-powerpc/sockios.h index 590078d8ed28..55cef7675a31 100644 --- a/include/asm-powerpc/sockios.h +++ b/include/asm-powerpc/sockios.h | |||
@@ -14,6 +14,7 @@ | |||
14 | #define FIOGETOWN 0x8903 | 14 | #define FIOGETOWN 0x8903 |
15 | #define SIOCGPGRP 0x8904 | 15 | #define SIOCGPGRP 0x8904 |
16 | #define SIOCATMARK 0x8905 | 16 | #define SIOCATMARK 0x8905 |
17 | #define SIOCGSTAMP 0x8906 /* Get stamp */ | 17 | #define SIOCGSTAMP 0x8906 /* Get stamp (timeval) */ |
18 | #define SIOCGSTAMPNS 0x8907 /* Get stamp (timespec) */ | ||
18 | 19 | ||
19 | #endif /* _ASM_POWERPC_SOCKIOS_H */ | 20 | #endif /* _ASM_POWERPC_SOCKIOS_H */ |
diff --git a/include/asm-powerpc/string.h b/include/asm-powerpc/string.h index faa407f33c6b..aa40f92c298d 100644 --- a/include/asm-powerpc/string.h +++ b/include/asm-powerpc/string.h | |||
@@ -14,8 +14,6 @@ | |||
14 | #define __HAVE_ARCH_MEMCMP | 14 | #define __HAVE_ARCH_MEMCMP |
15 | #define __HAVE_ARCH_MEMCHR | 15 | #define __HAVE_ARCH_MEMCHR |
16 | 16 | ||
17 | extern int strcasecmp(const char *, const char *); | ||
18 | extern int strncasecmp(const char *, const char *, __kernel_size_t); | ||
19 | extern char * strcpy(char *,const char *); | 17 | extern char * strcpy(char *,const char *); |
20 | extern char * strncpy(char *,const char *, __kernel_size_t); | 18 | extern char * strncpy(char *,const char *, __kernel_size_t); |
21 | extern __kernel_size_t strlen(const char *); | 19 | extern __kernel_size_t strlen(const char *); |
diff --git a/include/asm-powerpc/systbl.h b/include/asm-powerpc/systbl.h index 8d853c554631..0b00068313f9 100644 --- a/include/asm-powerpc/systbl.h +++ b/include/asm-powerpc/systbl.h | |||
@@ -288,7 +288,7 @@ COMPAT_SYS(ppoll) | |||
288 | SYSCALL_SPU(unshare) | 288 | SYSCALL_SPU(unshare) |
289 | SYSCALL_SPU(splice) | 289 | SYSCALL_SPU(splice) |
290 | SYSCALL_SPU(tee) | 290 | SYSCALL_SPU(tee) |
291 | SYSCALL_SPU(vmsplice) | 291 | COMPAT_SYS_SPU(vmsplice) |
292 | COMPAT_SYS_SPU(openat) | 292 | COMPAT_SYS_SPU(openat) |
293 | SYSCALL_SPU(mkdirat) | 293 | SYSCALL_SPU(mkdirat) |
294 | SYSCALL_SPU(mknodat) | 294 | SYSCALL_SPU(mknodat) |
diff --git a/include/asm-s390/bug.h b/include/asm-s390/bug.h index 876898363944..838684dc6d35 100644 --- a/include/asm-s390/bug.h +++ b/include/asm-s390/bug.h | |||
@@ -1,27 +1,70 @@ | |||
1 | #ifndef _S390_BUG_H | 1 | #ifndef _ASM_S390_BUG_H |
2 | #define _S390_BUG_H | 2 | #define _ASM_S390_BUG_H |
3 | 3 | ||
4 | #include <linux/kernel.h> | 4 | #include <linux/kernel.h> |
5 | 5 | ||
6 | #ifdef CONFIG_BUG | 6 | #ifdef CONFIG_BUG |
7 | 7 | ||
8 | static inline __attribute__((noreturn)) void __do_illegal_op(void) | 8 | #ifdef CONFIG_64BIT |
9 | { | 9 | #define S390_LONG ".quad" |
10 | #if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 3) | ||
11 | __builtin_trap(); | ||
12 | #else | 10 | #else |
13 | asm volatile(".long 0"); | 11 | #define S390_LONG ".long" |
14 | #endif | 12 | #endif |
15 | } | ||
16 | 13 | ||
17 | #define BUG() do { \ | 14 | #ifdef CONFIG_DEBUG_BUGVERBOSE |
18 | printk("kernel BUG at %s:%d!\n", __FILE__, __LINE__); \ | 15 | |
19 | __do_illegal_op(); \ | 16 | #define __EMIT_BUG(x) do { \ |
17 | asm volatile( \ | ||
18 | "0: j 0b+2\n" \ | ||
19 | "1:\n" \ | ||
20 | ".section .rodata.str,\"aMS\",@progbits,1\n" \ | ||
21 | "2: .asciz \""__FILE__"\"\n" \ | ||
22 | ".previous\n" \ | ||
23 | ".section __bug_table,\"a\"\n" \ | ||
24 | "3:\t" S390_LONG "\t1b,2b\n" \ | ||
25 | " .short %0,%1\n" \ | ||
26 | " .org 3b+%2\n" \ | ||
27 | ".previous\n" \ | ||
28 | : : "i" (__LINE__), \ | ||
29 | "i" (x), \ | ||
30 | "i" (sizeof(struct bug_entry))); \ | ||
20 | } while (0) | 31 | } while (0) |
21 | 32 | ||
33 | #else /* CONFIG_DEBUG_BUGVERBOSE */ | ||
34 | |||
35 | #define __EMIT_BUG(x) do { \ | ||
36 | asm volatile( \ | ||
37 | "0: j 0b+2\n" \ | ||
38 | "1:\n" \ | ||
39 | ".section __bug_table,\"a\"\n" \ | ||
40 | "2:\t" S390_LONG "\t1b\n" \ | ||
41 | " .short %0\n" \ | ||
42 | " .org 2b+%1\n" \ | ||
43 | ".previous\n" \ | ||
44 | : : "i" (x), \ | ||
45 | "i" (sizeof(struct bug_entry))); \ | ||
46 | } while (0) | ||
47 | |||
48 | #endif /* CONFIG_DEBUG_BUGVERBOSE */ | ||
49 | |||
50 | #define BUG() __EMIT_BUG(0) | ||
51 | |||
52 | #define WARN_ON(x) ({ \ | ||
53 | typeof(x) __ret_warn_on = (x); \ | ||
54 | if (__builtin_constant_p(__ret_warn_on)) { \ | ||
55 | if (__ret_warn_on) \ | ||
56 | __EMIT_BUG(BUGFLAG_WARNING); \ | ||
57 | } else { \ | ||
58 | if (unlikely(__ret_warn_on)) \ | ||
59 | __EMIT_BUG(BUGFLAG_WARNING); \ | ||
60 | } \ | ||
61 | unlikely(__ret_warn_on); \ | ||
62 | }) | ||
63 | |||
22 | #define HAVE_ARCH_BUG | 64 | #define HAVE_ARCH_BUG |
23 | #endif | 65 | #define HAVE_ARCH_WARN_ON |
66 | #endif /* CONFIG_BUG */ | ||
24 | 67 | ||
25 | #include <asm-generic/bug.h> | 68 | #include <asm-generic/bug.h> |
26 | 69 | ||
27 | #endif | 70 | #endif /* _ASM_S390_BUG_H */ |
diff --git a/include/asm-s390/ccwgroup.h b/include/asm-s390/ccwgroup.h index d2f9c0d53a97..925b3ddfa141 100644 --- a/include/asm-s390/ccwgroup.h +++ b/include/asm-s390/ccwgroup.h | |||
@@ -11,6 +11,7 @@ struct ccwgroup_device { | |||
11 | CCWGROUP_ONLINE, | 11 | CCWGROUP_ONLINE, |
12 | } state; | 12 | } state; |
13 | atomic_t onoff; | 13 | atomic_t onoff; |
14 | struct mutex reg_mutex; | ||
14 | unsigned int count; /* number of attached slave devices */ | 15 | unsigned int count; /* number of attached slave devices */ |
15 | struct device dev; /* master device */ | 16 | struct device dev; /* master device */ |
16 | struct ccw_device *cdev[0]; /* variable number, allocate as needed */ | 17 | struct ccw_device *cdev[0]; /* variable number, allocate as needed */ |
diff --git a/include/asm-s390/chpid.h b/include/asm-s390/chpid.h new file mode 100644 index 000000000000..b203336fd892 --- /dev/null +++ b/include/asm-s390/chpid.h | |||
@@ -0,0 +1,53 @@ | |||
1 | /* | ||
2 | * drivers/s390/cio/chpid.h | ||
3 | * | ||
4 | * Copyright IBM Corp. 2007 | ||
5 | * Author(s): Peter Oberparleiter <peter.oberparleiter@de.ibm.com> | ||
6 | */ | ||
7 | |||
8 | #ifndef _ASM_S390_CHPID_H | ||
9 | #define _ASM_S390_CHPID_H _ASM_S390_CHPID_H | ||
10 | |||
11 | #include <linux/string.h> | ||
12 | #include <asm/types.h> | ||
13 | #include <asm/cio.h> | ||
14 | |||
15 | #define __MAX_CHPID 255 | ||
16 | |||
17 | struct chp_id { | ||
18 | u8 reserved1; | ||
19 | u8 cssid; | ||
20 | u8 reserved2; | ||
21 | u8 id; | ||
22 | } __attribute__((packed)); | ||
23 | |||
24 | static inline void chp_id_init(struct chp_id *chpid) | ||
25 | { | ||
26 | memset(chpid, 0, sizeof(struct chp_id)); | ||
27 | } | ||
28 | |||
29 | static inline int chp_id_is_equal(struct chp_id *a, struct chp_id *b) | ||
30 | { | ||
31 | return (a->id == b->id) && (a->cssid == b->cssid); | ||
32 | } | ||
33 | |||
34 | static inline void chp_id_next(struct chp_id *chpid) | ||
35 | { | ||
36 | if (chpid->id < __MAX_CHPID) | ||
37 | chpid->id++; | ||
38 | else { | ||
39 | chpid->id = 0; | ||
40 | chpid->cssid++; | ||
41 | } | ||
42 | } | ||
43 | |||
44 | static inline int chp_id_is_valid(struct chp_id *chpid) | ||
45 | { | ||
46 | return (chpid->cssid <= __MAX_CSSID); | ||
47 | } | ||
48 | |||
49 | |||
50 | #define chp_id_for_each(c) \ | ||
51 | for (chp_id_init(c); chp_id_is_valid(c); chp_id_next(c)) | ||
52 | |||
53 | #endif /* _ASM_S390_CHPID_H */ | ||
diff --git a/include/asm-s390/cio.h b/include/asm-s390/cio.h index d92785030980..f738d2827582 100644 --- a/include/asm-s390/cio.h +++ b/include/asm-s390/cio.h | |||
@@ -13,6 +13,7 @@ | |||
13 | #ifdef __KERNEL__ | 13 | #ifdef __KERNEL__ |
14 | 14 | ||
15 | #define LPM_ANYPATH 0xff | 15 | #define LPM_ANYPATH 0xff |
16 | #define __MAX_CSSID 0 | ||
16 | 17 | ||
17 | /* | 18 | /* |
18 | * subchannel status word | 19 | * subchannel status word |
@@ -292,6 +293,13 @@ extern void css_schedule_reprobe(void); | |||
292 | 293 | ||
293 | extern void reipl_ccw_dev(struct ccw_dev_id *id); | 294 | extern void reipl_ccw_dev(struct ccw_dev_id *id); |
294 | 295 | ||
296 | struct cio_iplinfo { | ||
297 | u16 devno; | ||
298 | int is_qdio; | ||
299 | }; | ||
300 | |||
301 | extern int cio_get_iplinfo(struct cio_iplinfo *iplinfo); | ||
302 | |||
295 | #endif | 303 | #endif |
296 | 304 | ||
297 | #endif | 305 | #endif |
diff --git a/include/asm-s390/ipl.h b/include/asm-s390/ipl.h index 0eb64083480a..bdcd448d43fb 100644 --- a/include/asm-s390/ipl.h +++ b/include/asm-s390/ipl.h | |||
@@ -8,6 +8,8 @@ | |||
8 | #define _ASM_S390_IPL_H | 8 | #define _ASM_S390_IPL_H |
9 | 9 | ||
10 | #include <asm/types.h> | 10 | #include <asm/types.h> |
11 | #include <asm/cio.h> | ||
12 | #include <asm/setup.h> | ||
11 | 13 | ||
12 | #define IPL_PARMBLOCK_ORIGIN 0x2000 | 14 | #define IPL_PARMBLOCK_ORIGIN 0x2000 |
13 | 15 | ||
@@ -74,12 +76,12 @@ struct ipl_parameter_block { | |||
74 | } __attribute__((packed)); | 76 | } __attribute__((packed)); |
75 | 77 | ||
76 | /* | 78 | /* |
77 | * IPL validity flags and parameters as detected in head.S | 79 | * IPL validity flags |
78 | */ | 80 | */ |
79 | extern u32 ipl_flags; | 81 | extern u32 ipl_flags; |
80 | extern u16 ipl_devno; | ||
81 | 82 | ||
82 | extern u32 dump_prefix_page; | 83 | extern u32 dump_prefix_page; |
84 | |||
83 | extern void do_reipl(void); | 85 | extern void do_reipl(void); |
84 | extern void ipl_save_parameters(void); | 86 | extern void ipl_save_parameters(void); |
85 | 87 | ||
@@ -89,6 +91,35 @@ enum { | |||
89 | IPL_NSS_VALID = 4, | 91 | IPL_NSS_VALID = 4, |
90 | }; | 92 | }; |
91 | 93 | ||
94 | enum ipl_type { | ||
95 | IPL_TYPE_UNKNOWN = 1, | ||
96 | IPL_TYPE_CCW = 2, | ||
97 | IPL_TYPE_FCP = 4, | ||
98 | IPL_TYPE_FCP_DUMP = 8, | ||
99 | IPL_TYPE_NSS = 16, | ||
100 | }; | ||
101 | |||
102 | struct ipl_info | ||
103 | { | ||
104 | enum ipl_type type; | ||
105 | union { | ||
106 | struct { | ||
107 | struct ccw_dev_id dev_id; | ||
108 | } ccw; | ||
109 | struct { | ||
110 | struct ccw_dev_id dev_id; | ||
111 | u64 wwpn; | ||
112 | u64 lun; | ||
113 | } fcp; | ||
114 | struct { | ||
115 | char name[NSS_NAME_SIZE + 1]; | ||
116 | } nss; | ||
117 | } data; | ||
118 | }; | ||
119 | |||
120 | extern struct ipl_info ipl_info; | ||
121 | extern void setup_ipl_info(void); | ||
122 | |||
92 | /* | 123 | /* |
93 | * DIAG 308 support | 124 | * DIAG 308 support |
94 | */ | 125 | */ |
diff --git a/include/asm-s390/lowcore.h b/include/asm-s390/lowcore.h index 4a31d0a7ee83..ffc9788a21a7 100644 --- a/include/asm-s390/lowcore.h +++ b/include/asm-s390/lowcore.h | |||
@@ -147,6 +147,52 @@ void pgm_check_handler(void); | |||
147 | void mcck_int_handler(void); | 147 | void mcck_int_handler(void); |
148 | void io_int_handler(void); | 148 | void io_int_handler(void); |
149 | 149 | ||
150 | struct save_area_s390 { | ||
151 | u32 ext_save; | ||
152 | u64 timer; | ||
153 | u64 clk_cmp; | ||
154 | u8 pad1[24]; | ||
155 | u8 psw[8]; | ||
156 | u32 pref_reg; | ||
157 | u8 pad2[20]; | ||
158 | u32 acc_regs[16]; | ||
159 | u64 fp_regs[4]; | ||
160 | u32 gp_regs[16]; | ||
161 | u32 ctrl_regs[16]; | ||
162 | } __attribute__((packed)); | ||
163 | |||
164 | struct save_area_s390x { | ||
165 | u64 fp_regs[16]; | ||
166 | u64 gp_regs[16]; | ||
167 | u8 psw[16]; | ||
168 | u8 pad1[8]; | ||
169 | u32 pref_reg; | ||
170 | u32 fp_ctrl_reg; | ||
171 | u8 pad2[4]; | ||
172 | u32 tod_reg; | ||
173 | u64 timer; | ||
174 | u64 clk_cmp; | ||
175 | u8 pad3[8]; | ||
176 | u32 acc_regs[16]; | ||
177 | u64 ctrl_regs[16]; | ||
178 | } __attribute__((packed)); | ||
179 | |||
180 | union save_area { | ||
181 | struct save_area_s390 s390; | ||
182 | struct save_area_s390x s390x; | ||
183 | }; | ||
184 | |||
185 | #define SAVE_AREA_BASE_S390 0xd4 | ||
186 | #define SAVE_AREA_BASE_S390X 0x1200 | ||
187 | |||
188 | #ifndef __s390x__ | ||
189 | #define SAVE_AREA_SIZE sizeof(struct save_area_s390) | ||
190 | #define SAVE_AREA_BASE SAVE_AREA_BASE_S390 | ||
191 | #else | ||
192 | #define SAVE_AREA_SIZE sizeof(struct save_area_s390x) | ||
193 | #define SAVE_AREA_BASE SAVE_AREA_BASE_S390X | ||
194 | #endif | ||
195 | |||
150 | struct _lowcore | 196 | struct _lowcore |
151 | { | 197 | { |
152 | #ifndef __s390x__ | 198 | #ifndef __s390x__ |
diff --git a/include/asm-s390/pgtable.h b/include/asm-s390/pgtable.h index 13c16546eff5..8fe8d42e64c3 100644 --- a/include/asm-s390/pgtable.h +++ b/include/asm-s390/pgtable.h | |||
@@ -753,14 +753,14 @@ ptep_establish(struct vm_area_struct *vma, | |||
753 | * should therefore only be called if it is not mapped in any | 753 | * should therefore only be called if it is not mapped in any |
754 | * address space. | 754 | * address space. |
755 | */ | 755 | */ |
756 | static inline int page_test_and_clear_dirty(struct page *page) | 756 | static inline int page_test_dirty(struct page *page) |
757 | { | 757 | { |
758 | unsigned long physpage = page_to_phys(page); | 758 | return (page_get_storage_key(page_to_phys(page)) & _PAGE_CHANGED) != 0; |
759 | int skey = page_get_storage_key(physpage); | 759 | } |
760 | 760 | ||
761 | if (skey & _PAGE_CHANGED) | 761 | static inline void page_clear_dirty(struct page *page) |
762 | page_set_storage_key(physpage, skey & ~_PAGE_CHANGED); | 762 | { |
763 | return skey & _PAGE_CHANGED; | 763 | page_set_storage_key(page_to_phys(page), PAGE_DEFAULT_KEY); |
764 | } | 764 | } |
765 | 765 | ||
766 | /* | 766 | /* |
@@ -953,7 +953,8 @@ extern void memmap_init(unsigned long, int, unsigned long, unsigned long); | |||
953 | #define __HAVE_ARCH_PTEP_CLEAR_FLUSH | 953 | #define __HAVE_ARCH_PTEP_CLEAR_FLUSH |
954 | #define __HAVE_ARCH_PTEP_SET_WRPROTECT | 954 | #define __HAVE_ARCH_PTEP_SET_WRPROTECT |
955 | #define __HAVE_ARCH_PTE_SAME | 955 | #define __HAVE_ARCH_PTE_SAME |
956 | #define __HAVE_ARCH_PAGE_TEST_AND_CLEAR_DIRTY | 956 | #define __HAVE_ARCH_PAGE_TEST_DIRTY |
957 | #define __HAVE_ARCH_PAGE_CLEAR_DIRTY | ||
957 | #define __HAVE_ARCH_PAGE_TEST_AND_CLEAR_YOUNG | 958 | #define __HAVE_ARCH_PAGE_TEST_AND_CLEAR_YOUNG |
958 | #include <asm-generic/pgtable.h> | 959 | #include <asm-generic/pgtable.h> |
959 | 960 | ||
diff --git a/include/asm-s390/processor.h b/include/asm-s390/processor.h index 33b80ced4bc1..e0fcea8c64c3 100644 --- a/include/asm-s390/processor.h +++ b/include/asm-s390/processor.h | |||
@@ -57,6 +57,7 @@ struct cpuinfo_S390 | |||
57 | 57 | ||
58 | extern void s390_adjust_jiffies(void); | 58 | extern void s390_adjust_jiffies(void); |
59 | extern void print_cpu_info(struct cpuinfo_S390 *); | 59 | extern void print_cpu_info(struct cpuinfo_S390 *); |
60 | extern int get_cpu_capability(unsigned int *); | ||
60 | 61 | ||
61 | /* Lazy FPU handling on uni-processor */ | 62 | /* Lazy FPU handling on uni-processor */ |
62 | extern struct task_struct *last_task_used_math; | 63 | extern struct task_struct *last_task_used_math; |
@@ -196,6 +197,7 @@ extern unsigned long thread_saved_pc(struct task_struct *t); | |||
196 | extern char *task_show_regs(struct task_struct *task, char *buffer); | 197 | extern char *task_show_regs(struct task_struct *task, char *buffer); |
197 | 198 | ||
198 | extern void show_registers(struct pt_regs *regs); | 199 | extern void show_registers(struct pt_regs *regs); |
200 | extern void show_code(struct pt_regs *regs); | ||
199 | extern void show_trace(struct task_struct *task, unsigned long *sp); | 201 | extern void show_trace(struct task_struct *task, unsigned long *sp); |
200 | 202 | ||
201 | unsigned long get_wchan(struct task_struct *p); | 203 | unsigned long get_wchan(struct task_struct *p); |
diff --git a/include/asm-s390/sclp.h b/include/asm-s390/sclp.h index 468b97018405..21ed64773210 100644 --- a/include/asm-s390/sclp.h +++ b/include/asm-s390/sclp.h | |||
@@ -9,6 +9,7 @@ | |||
9 | #define _ASM_S390_SCLP_H | 9 | #define _ASM_S390_SCLP_H |
10 | 10 | ||
11 | #include <linux/types.h> | 11 | #include <linux/types.h> |
12 | #include <asm/chpid.h> | ||
12 | 13 | ||
13 | struct sccb_header { | 14 | struct sccb_header { |
14 | u16 length; | 15 | u16 length; |
@@ -33,7 +34,20 @@ struct sclp_readinfo_sccb { | |||
33 | u8 _reserved3[4096 - 112]; /* 112-4095 */ | 34 | u8 _reserved3[4096 - 112]; /* 112-4095 */ |
34 | } __attribute__((packed, aligned(4096))); | 35 | } __attribute__((packed, aligned(4096))); |
35 | 36 | ||
37 | #define SCLP_CHP_INFO_MASK_SIZE 32 | ||
38 | |||
39 | struct sclp_chp_info { | ||
40 | u8 recognized[SCLP_CHP_INFO_MASK_SIZE]; | ||
41 | u8 standby[SCLP_CHP_INFO_MASK_SIZE]; | ||
42 | u8 configured[SCLP_CHP_INFO_MASK_SIZE]; | ||
43 | }; | ||
44 | |||
36 | extern struct sclp_readinfo_sccb s390_readinfo_sccb; | 45 | extern struct sclp_readinfo_sccb s390_readinfo_sccb; |
37 | extern void sclp_readinfo_early(void); | 46 | extern void sclp_readinfo_early(void); |
47 | extern int sclp_sdias_blk_count(void); | ||
48 | extern int sclp_sdias_copy(void *dest, int blk_num, int nr_blks); | ||
49 | extern int sclp_chp_configure(struct chp_id chpid); | ||
50 | extern int sclp_chp_deconfigure(struct chp_id chpid); | ||
51 | extern int sclp_chp_read_info(struct sclp_chp_info *info); | ||
38 | 52 | ||
39 | #endif /* _ASM_S390_SCLP_H */ | 53 | #endif /* _ASM_S390_SCLP_H */ |
diff --git a/include/asm-s390/setup.h b/include/asm-s390/setup.h index 44c7aee2bd34..a76a6b8fd887 100644 --- a/include/asm-s390/setup.h +++ b/include/asm-s390/setup.h | |||
@@ -40,6 +40,7 @@ struct mem_chunk { | |||
40 | }; | 40 | }; |
41 | 41 | ||
42 | extern struct mem_chunk memory_chunk[]; | 42 | extern struct mem_chunk memory_chunk[]; |
43 | extern unsigned long real_memory_size; | ||
43 | 44 | ||
44 | #ifdef CONFIG_S390_SWITCH_AMODE | 45 | #ifdef CONFIG_S390_SWITCH_AMODE |
45 | extern unsigned int switch_amode; | 46 | extern unsigned int switch_amode; |
@@ -77,6 +78,7 @@ extern unsigned long machine_flags; | |||
77 | #endif /* __s390x__ */ | 78 | #endif /* __s390x__ */ |
78 | 79 | ||
79 | #define MACHINE_HAS_SCLP (!MACHINE_IS_P390) | 80 | #define MACHINE_HAS_SCLP (!MACHINE_IS_P390) |
81 | #define ZFCPDUMP_HSA_SIZE (32UL<<20) | ||
80 | 82 | ||
81 | /* | 83 | /* |
82 | * Console mode. Override with conmode= | 84 | * Console mode. Override with conmode= |
diff --git a/include/asm-s390/smp.h b/include/asm-s390/smp.h index b957e4cda464..0a28e6d6ef40 100644 --- a/include/asm-s390/smp.h +++ b/include/asm-s390/smp.h | |||
@@ -54,9 +54,6 @@ extern int smp_call_function_on(void (*func) (void *info), void *info, | |||
54 | 54 | ||
55 | #define raw_smp_processor_id() (S390_lowcore.cpu_data.cpu_nr) | 55 | #define raw_smp_processor_id() (S390_lowcore.cpu_data.cpu_nr) |
56 | 56 | ||
57 | extern int smp_get_cpu(cpumask_t cpu_map); | ||
58 | extern void smp_put_cpu(int cpu); | ||
59 | |||
60 | static inline __u16 hard_smp_processor_id(void) | 57 | static inline __u16 hard_smp_processor_id(void) |
61 | { | 58 | { |
62 | __u16 cpu_address; | 59 | __u16 cpu_address; |
@@ -114,9 +111,8 @@ static inline void smp_send_stop(void) | |||
114 | } | 111 | } |
115 | 112 | ||
116 | #define smp_cpu_not_running(cpu) 1 | 113 | #define smp_cpu_not_running(cpu) 1 |
117 | #define smp_get_cpu(cpu) ({ 0; }) | ||
118 | #define smp_put_cpu(cpu) ({ 0; }) | ||
119 | #define smp_setup_cpu_possible_map() do { } while (0) | 114 | #define smp_setup_cpu_possible_map() do { } while (0) |
120 | #endif | 115 | #endif |
121 | 116 | ||
117 | extern union save_area *zfcpdump_save_areas[NR_CPUS + 1]; | ||
122 | #endif | 118 | #endif |
diff --git a/include/asm-s390/socket.h b/include/asm-s390/socket.h index 1778a49a74c5..1161ebe3dec9 100644 --- a/include/asm-s390/socket.h +++ b/include/asm-s390/socket.h | |||
@@ -57,5 +57,7 @@ | |||
57 | 57 | ||
58 | #define SO_PEERSEC 31 | 58 | #define SO_PEERSEC 31 |
59 | #define SO_PASSSEC 34 | 59 | #define SO_PASSSEC 34 |
60 | #define SO_TIMESTAMPNS 35 | ||
61 | #define SCM_TIMESTAMPNS SO_TIMESTAMPNS | ||
60 | 62 | ||
61 | #endif /* _ASM_SOCKET_H */ | 63 | #endif /* _ASM_SOCKET_H */ |
diff --git a/include/asm-s390/sockios.h b/include/asm-s390/sockios.h index 412aeb4dd6ce..f4fc16c7da59 100644 --- a/include/asm-s390/sockios.h +++ b/include/asm-s390/sockios.h | |||
@@ -15,6 +15,7 @@ | |||
15 | #define FIOGETOWN 0x8903 | 15 | #define FIOGETOWN 0x8903 |
16 | #define SIOCGPGRP 0x8904 | 16 | #define SIOCGPGRP 0x8904 |
17 | #define SIOCATMARK 0x8905 | 17 | #define SIOCATMARK 0x8905 |
18 | #define SIOCGSTAMP 0x8906 /* Get stamp */ | 18 | #define SIOCGSTAMP 0x8906 /* Get stamp (timeval) */ |
19 | #define SIOCGSTAMPNS 0x8907 /* Get stamp (timespec) */ | ||
19 | 20 | ||
20 | #endif | 21 | #endif |
diff --git a/include/asm-sh/socket.h b/include/asm-sh/socket.h index ca70362eb563..c48d6fc9da38 100644 --- a/include/asm-sh/socket.h +++ b/include/asm-sh/socket.h | |||
@@ -49,5 +49,7 @@ | |||
49 | 49 | ||
50 | #define SO_PEERSEC 31 | 50 | #define SO_PEERSEC 31 |
51 | #define SO_PASSSEC 34 | 51 | #define SO_PASSSEC 34 |
52 | #define SO_TIMESTAMPNS 35 | ||
53 | #define SCM_TIMESTAMPNS SO_TIMESTAMPNS | ||
52 | 54 | ||
53 | #endif /* __ASM_SH_SOCKET_H */ | 55 | #endif /* __ASM_SH_SOCKET_H */ |
diff --git a/include/asm-sh/sockios.h b/include/asm-sh/sockios.h index 08a71df8a8be..cf8b96b1f9ab 100644 --- a/include/asm-sh/sockios.h +++ b/include/asm-sh/sockios.h | |||
@@ -9,5 +9,6 @@ | |||
9 | #define SIOCSPGRP _IOW('s', 8, pid_t) | 9 | #define SIOCSPGRP _IOW('s', 8, pid_t) |
10 | #define SIOCGPGRP _IOR('s', 9, pid_t) | 10 | #define SIOCGPGRP _IOR('s', 9, pid_t) |
11 | 11 | ||
12 | #define SIOCGSTAMP _IOR('s', 100, struct timeval) /* Get stamp - linux-specific */ | 12 | #define SIOCGSTAMP _IOR('s', 100, struct timeval) /* Get stamp (timeval) */ |
13 | #define SIOCGSTAMPNS _IOR('s', 101, struct timespec) /* Get stamp (timespec) */ | ||
13 | #endif /* __ASM_SH_SOCKIOS_H */ | 14 | #endif /* __ASM_SH_SOCKIOS_H */ |
diff --git a/include/asm-sh/string.h b/include/asm-sh/string.h index 95bc7db006b0..55f8db6bc1d7 100644 --- a/include/asm-sh/string.h +++ b/include/asm-sh/string.h | |||
@@ -126,9 +126,6 @@ extern void *memchr(const void *__s, int __c, size_t __n); | |||
126 | #define __HAVE_ARCH_STRLEN | 126 | #define __HAVE_ARCH_STRLEN |
127 | extern size_t strlen(const char *); | 127 | extern size_t strlen(const char *); |
128 | 128 | ||
129 | /* arch/sh/lib/strcasecmp.c */ | ||
130 | extern int strcasecmp(const char *, const char *); | ||
131 | |||
132 | #endif /* __KERNEL__ */ | 129 | #endif /* __KERNEL__ */ |
133 | 130 | ||
134 | #endif /* __ASM_SH_STRING_H */ | 131 | #endif /* __ASM_SH_STRING_H */ |
diff --git a/include/asm-sh64/sockios.h b/include/asm-sh64/sockios.h index 1ae23ae82977..419e76f12f41 100644 --- a/include/asm-sh64/sockios.h +++ b/include/asm-sh64/sockios.h | |||
@@ -20,5 +20,6 @@ | |||
20 | #define SIOCSPGRP _IOW('s', 8, pid_t) | 20 | #define SIOCSPGRP _IOW('s', 8, pid_t) |
21 | #define SIOCGPGRP _IOR('s', 9, pid_t) | 21 | #define SIOCGPGRP _IOR('s', 9, pid_t) |
22 | 22 | ||
23 | #define SIOCGSTAMP _IOR('s', 100, struct timeval) /* Get stamp - linux-specific */ | 23 | #define SIOCGSTAMP _IOR('s', 100, struct timeval) /* Get stamp (timeval) */ |
24 | #define SIOCGSTAMPNS _IOR('s', 101, struct timespec) /* Get stamp (timespec) */ | ||
24 | #endif /* __ASM_SH64_SOCKIOS_H */ | 25 | #endif /* __ASM_SH64_SOCKIOS_H */ |
diff --git a/include/asm-sparc/prom.h b/include/asm-sparc/prom.h index 274868d8598d..9ea105ebe2ff 100644 --- a/include/asm-sparc/prom.h +++ b/include/asm-sparc/prom.h | |||
@@ -35,8 +35,8 @@ struct property { | |||
35 | }; | 35 | }; |
36 | 36 | ||
37 | struct device_node { | 37 | struct device_node { |
38 | char *name; | 38 | const char *name; |
39 | char *type; | 39 | const char *type; |
40 | phandle node; | 40 | phandle node; |
41 | char *path_component_name; | 41 | char *path_component_name; |
42 | char *full_name; | 42 | char *full_name; |
@@ -85,12 +85,14 @@ extern struct device_node *of_find_node_by_phandle(phandle handle); | |||
85 | extern struct device_node *of_get_parent(const struct device_node *node); | 85 | extern struct device_node *of_get_parent(const struct device_node *node); |
86 | extern struct device_node *of_get_next_child(const struct device_node *node, | 86 | extern struct device_node *of_get_next_child(const struct device_node *node, |
87 | struct device_node *prev); | 87 | struct device_node *prev); |
88 | extern struct property *of_find_property(struct device_node *np, | 88 | extern struct property *of_find_property(const struct device_node *np, |
89 | const char *name, | 89 | const char *name, |
90 | int *lenp); | 90 | int *lenp); |
91 | extern int of_device_is_compatible(struct device_node *device, const char *); | 91 | extern int of_device_is_compatible(const struct device_node *device, |
92 | extern void *of_get_property(struct device_node *node, const char *name, | 92 | const char *); |
93 | int *lenp); | 93 | extern const void *of_get_property(const struct device_node *node, |
94 | const char *name, | ||
95 | int *lenp); | ||
94 | #define get_property(node,name,lenp) of_get_property(node,name,lenp) | 96 | #define get_property(node,name,lenp) of_get_property(node,name,lenp) |
95 | extern int of_set_property(struct device_node *node, const char *name, void *val, int len); | 97 | extern int of_set_property(struct device_node *node, const char *name, void *val, int len); |
96 | extern int of_getintprop_default(struct device_node *np, | 98 | extern int of_getintprop_default(struct device_node *np, |
diff --git a/include/asm-sparc/socket.h b/include/asm-sparc/socket.h index f6c4e5baf3f7..7c1423997cf0 100644 --- a/include/asm-sparc/socket.h +++ b/include/asm-sparc/socket.h | |||
@@ -49,6 +49,8 @@ | |||
49 | 49 | ||
50 | #define SO_PEERSEC 0x001e | 50 | #define SO_PEERSEC 0x001e |
51 | #define SO_PASSSEC 0x001f | 51 | #define SO_PASSSEC 0x001f |
52 | #define SO_TIMESTAMPNS 0x0021 | ||
53 | #define SCM_TIMESTAMPNS SO_TIMESTAMPNS | ||
52 | 54 | ||
53 | /* Security levels - as per NRL IPv6 - don't actually do anything */ | 55 | /* Security levels - as per NRL IPv6 - don't actually do anything */ |
54 | #define SO_SECURITY_AUTHENTICATION 0x5001 | 56 | #define SO_SECURITY_AUTHENTICATION 0x5001 |
diff --git a/include/asm-sparc/sockios.h b/include/asm-sparc/sockios.h index 0c01b597b06f..990ea746486b 100644 --- a/include/asm-sparc/sockios.h +++ b/include/asm-sparc/sockios.h | |||
@@ -7,7 +7,8 @@ | |||
7 | #define FIOGETOWN 0x8903 | 7 | #define FIOGETOWN 0x8903 |
8 | #define SIOCGPGRP 0x8904 | 8 | #define SIOCGPGRP 0x8904 |
9 | #define SIOCATMARK 0x8905 | 9 | #define SIOCATMARK 0x8905 |
10 | #define SIOCGSTAMP 0x8906 /* Get stamp */ | 10 | #define SIOCGSTAMP 0x8906 /* Get stamp (timeval) */ |
11 | #define SIOCGSTAMPNS 0x8907 /* Get stamp (timespec) */ | ||
11 | 12 | ||
12 | #endif /* !(_ASM_SPARC_SOCKIOS_H) */ | 13 | #endif /* !(_ASM_SPARC_SOCKIOS_H) */ |
13 | 14 | ||
diff --git a/include/asm-sparc64/cpudata.h b/include/asm-sparc64/cpudata.h index f2cc9411b4c7..e89922d6718c 100644 --- a/include/asm-sparc64/cpudata.h +++ b/include/asm-sparc64/cpudata.h | |||
@@ -17,8 +17,8 @@ | |||
17 | typedef struct { | 17 | typedef struct { |
18 | /* Dcache line 1 */ | 18 | /* Dcache line 1 */ |
19 | unsigned int __softirq_pending; /* must be 1st, see rtrap.S */ | 19 | unsigned int __softirq_pending; /* must be 1st, see rtrap.S */ |
20 | unsigned int multiplier; | 20 | unsigned int __pad0_1; |
21 | unsigned int counter; | 21 | unsigned int __pad0_2; |
22 | unsigned int __pad1; | 22 | unsigned int __pad1; |
23 | unsigned long clock_tick; /* %tick's per second */ | 23 | unsigned long clock_tick; /* %tick's per second */ |
24 | unsigned long udelay_val; | 24 | unsigned long udelay_val; |
diff --git a/include/asm-sparc64/device.h b/include/asm-sparc64/device.h index d8f9872b0e2d..d5a4559b9555 100644 --- a/include/asm-sparc64/device.h +++ b/include/asm-sparc64/device.h | |||
@@ -3,5 +3,21 @@ | |||
3 | * | 3 | * |
4 | * This file is released under the GPLv2 | 4 | * This file is released under the GPLv2 |
5 | */ | 5 | */ |
6 | #include <asm-generic/device.h> | 6 | #ifndef _ASM_SPARC64_DEVICE_H |
7 | #define _ASM_SPARC64_DEVICE_H | ||
7 | 8 | ||
9 | struct device_node; | ||
10 | struct of_device; | ||
11 | |||
12 | struct dev_archdata { | ||
13 | void *iommu; | ||
14 | void *stc; | ||
15 | void *host_controller; | ||
16 | |||
17 | struct device_node *prom_node; | ||
18 | struct of_device *op; | ||
19 | |||
20 | unsigned int msi_num; | ||
21 | }; | ||
22 | |||
23 | #endif /* _ASM_SPARC64_DEVICE_H */ | ||
diff --git a/include/asm-sparc64/ebus.h b/include/asm-sparc64/ebus.h index a4afe9d5703a..9c1c6db2a790 100644 --- a/include/asm-sparc64/ebus.h +++ b/include/asm-sparc64/ebus.h | |||
@@ -8,7 +8,6 @@ | |||
8 | #ifndef __SPARC64_EBUS_H | 8 | #ifndef __SPARC64_EBUS_H |
9 | #define __SPARC64_EBUS_H | 9 | #define __SPARC64_EBUS_H |
10 | 10 | ||
11 | #include <asm/pbm.h> | ||
12 | #include <asm/oplib.h> | 11 | #include <asm/oplib.h> |
13 | #include <asm/prom.h> | 12 | #include <asm/prom.h> |
14 | #include <asm/of_device.h> | 13 | #include <asm/of_device.h> |
@@ -41,7 +40,6 @@ struct linux_ebus { | |||
41 | struct of_device ofdev; | 40 | struct of_device ofdev; |
42 | struct linux_ebus *next; | 41 | struct linux_ebus *next; |
43 | struct linux_ebus_device *devices; | 42 | struct linux_ebus_device *devices; |
44 | struct pci_pbm_info *parent; | ||
45 | struct pci_dev *self; | 43 | struct pci_dev *self; |
46 | int index; | 44 | int index; |
47 | int is_rio; | 45 | int is_rio; |
diff --git a/include/asm-sparc64/floppy.h b/include/asm-sparc64/floppy.h index 331013a0053e..4aa0925e1b1b 100644 --- a/include/asm-sparc64/floppy.h +++ b/include/asm-sparc64/floppy.h | |||
@@ -549,7 +549,7 @@ static int __init ebus_fdthree_p(struct linux_ebus_device *edev) | |||
549 | if (!strcmp(edev->prom_node->name, "fdthree")) | 549 | if (!strcmp(edev->prom_node->name, "fdthree")) |
550 | return 1; | 550 | return 1; |
551 | if (!strcmp(edev->prom_node->name, "floppy")) { | 551 | if (!strcmp(edev->prom_node->name, "floppy")) { |
552 | char *compat; | 552 | const char *compat; |
553 | 553 | ||
554 | compat = of_get_property(edev->prom_node, | 554 | compat = of_get_property(edev->prom_node, |
555 | "compatible", NULL); | 555 | "compatible", NULL); |
@@ -661,7 +661,7 @@ static unsigned long __init sun_floppy_init(void) | |||
661 | struct linux_ebus_device *edev = NULL; | 661 | struct linux_ebus_device *edev = NULL; |
662 | unsigned long config = 0; | 662 | unsigned long config = 0; |
663 | void __iomem *auxio_reg; | 663 | void __iomem *auxio_reg; |
664 | char *state_prop; | 664 | const char *state_prop; |
665 | 665 | ||
666 | for_each_ebus(ebus) { | 666 | for_each_ebus(ebus) { |
667 | for_each_ebusdev(edev, ebus) { | 667 | for_each_ebusdev(edev, ebus) { |
diff --git a/include/asm-sparc64/io.h b/include/asm-sparc64/io.h index 30b912d8e8bc..ad595b679842 100644 --- a/include/asm-sparc64/io.h +++ b/include/asm-sparc64/io.h | |||
@@ -24,14 +24,6 @@ extern unsigned long kern_base, kern_size; | |||
24 | #define page_to_phys(page) (page_to_pfn(page) << PAGE_SHIFT) | 24 | #define page_to_phys(page) (page_to_pfn(page) << PAGE_SHIFT) |
25 | #define BIO_VMERGE_BOUNDARY 8192 | 25 | #define BIO_VMERGE_BOUNDARY 8192 |
26 | 26 | ||
27 | /* Different PCI controllers we support have their PCI MEM space | ||
28 | * mapped to an either 2GB (Psycho) or 4GB (Sabre) aligned area, | ||
29 | * so need to chop off the top 33 or 32 bits. | ||
30 | */ | ||
31 | extern unsigned long pci_memspace_mask; | ||
32 | |||
33 | #define bus_dvma_to_mem(__vaddr) ((__vaddr) & pci_memspace_mask) | ||
34 | |||
35 | static __inline__ u8 _inb(unsigned long addr) | 27 | static __inline__ u8 _inb(unsigned long addr) |
36 | { | 28 | { |
37 | u8 ret; | 29 | u8 ret; |
diff --git a/include/asm-sparc64/iommu.h b/include/asm-sparc64/iommu.h index 0de7a3da79cd..e199594a1e9b 100644 --- a/include/asm-sparc64/iommu.h +++ b/include/asm-sparc64/iommu.h | |||
@@ -7,15 +7,50 @@ | |||
7 | #define _SPARC64_IOMMU_H | 7 | #define _SPARC64_IOMMU_H |
8 | 8 | ||
9 | /* The format of an iopte in the page tables. */ | 9 | /* The format of an iopte in the page tables. */ |
10 | #define IOPTE_VALID 0x8000000000000000UL /* IOPTE is valid */ | 10 | #define IOPTE_VALID 0x8000000000000000UL |
11 | #define IOPTE_64K 0x2000000000000000UL /* IOPTE is for 64k page */ | 11 | #define IOPTE_64K 0x2000000000000000UL |
12 | #define IOPTE_STBUF 0x1000000000000000UL /* DVMA can use streaming buffer */ | 12 | #define IOPTE_STBUF 0x1000000000000000UL |
13 | #define IOPTE_INTRA 0x0800000000000000UL /* SBUS slot-->slot direct transfer*/ | 13 | #define IOPTE_INTRA 0x0800000000000000UL |
14 | #define IOPTE_CONTEXT 0x07ff800000000000UL /* Context number */ | 14 | #define IOPTE_CONTEXT 0x07ff800000000000UL |
15 | #define IOPTE_PAGE 0x00007fffffffe000UL /* Physical page number (PA[42:13])*/ | 15 | #define IOPTE_PAGE 0x00007fffffffe000UL |
16 | #define IOPTE_CACHE 0x0000000000000010UL /* Cached (in UPA E-cache) */ | 16 | #define IOPTE_CACHE 0x0000000000000010UL |
17 | #define IOPTE_WRITE 0x0000000000000002UL /* Writeable */ | 17 | #define IOPTE_WRITE 0x0000000000000002UL |
18 | 18 | ||
19 | #define IOMMU_NUM_CTXS 4096 | 19 | #define IOMMU_NUM_CTXS 4096 |
20 | 20 | ||
21 | struct iommu_arena { | ||
22 | unsigned long *map; | ||
23 | unsigned int hint; | ||
24 | unsigned int limit; | ||
25 | }; | ||
26 | |||
27 | struct iommu { | ||
28 | spinlock_t lock; | ||
29 | struct iommu_arena arena; | ||
30 | iopte_t *page_table; | ||
31 | u32 page_table_map_base; | ||
32 | unsigned long iommu_control; | ||
33 | unsigned long iommu_tsbbase; | ||
34 | unsigned long iommu_flush; | ||
35 | unsigned long iommu_ctxflush; | ||
36 | unsigned long write_complete_reg; | ||
37 | unsigned long dummy_page; | ||
38 | unsigned long dummy_page_pa; | ||
39 | unsigned long ctx_lowest_free; | ||
40 | DECLARE_BITMAP(ctx_bitmap, IOMMU_NUM_CTXS); | ||
41 | u32 dma_addr_mask; | ||
42 | }; | ||
43 | |||
44 | struct strbuf { | ||
45 | int strbuf_enabled; | ||
46 | unsigned long strbuf_control; | ||
47 | unsigned long strbuf_pflush; | ||
48 | unsigned long strbuf_fsync; | ||
49 | unsigned long strbuf_ctxflush; | ||
50 | unsigned long strbuf_ctxmatch_base; | ||
51 | unsigned long strbuf_flushflag_pa; | ||
52 | volatile unsigned long *strbuf_flushflag; | ||
53 | volatile unsigned long __flushflag_buf[(64+(64-1)) / sizeof(long)]; | ||
54 | }; | ||
55 | |||
21 | #endif /* !(_SPARC_IOMMU_H) */ | 56 | #endif /* !(_SPARC_IOMMU_H) */ |
diff --git a/include/asm-sparc64/isa.h b/include/asm-sparc64/isa.h index d9728b9031fc..ecd9290f78d4 100644 --- a/include/asm-sparc64/isa.h +++ b/include/asm-sparc64/isa.h | |||
@@ -7,7 +7,6 @@ | |||
7 | #ifndef __SPARC64_ISA_H | 7 | #ifndef __SPARC64_ISA_H |
8 | #define __SPARC64_ISA_H | 8 | #define __SPARC64_ISA_H |
9 | 9 | ||
10 | #include <asm/pbm.h> | ||
11 | #include <asm/oplib.h> | 10 | #include <asm/oplib.h> |
12 | #include <asm/prom.h> | 11 | #include <asm/prom.h> |
13 | #include <asm/of_device.h> | 12 | #include <asm/of_device.h> |
@@ -29,7 +28,6 @@ struct sparc_isa_bridge { | |||
29 | struct of_device ofdev; | 28 | struct of_device ofdev; |
30 | struct sparc_isa_bridge *next; | 29 | struct sparc_isa_bridge *next; |
31 | struct sparc_isa_device *devices; | 30 | struct sparc_isa_device *devices; |
32 | struct pci_pbm_info *parent; | ||
33 | struct pci_dev *self; | 31 | struct pci_dev *self; |
34 | int index; | 32 | int index; |
35 | struct device_node *prom_node; | 33 | struct device_node *prom_node; |
diff --git a/include/asm-sparc64/parport.h b/include/asm-sparc64/parport.h index 284dfd01a33d..6340a5253a34 100644 --- a/include/asm-sparc64/parport.h +++ b/include/asm-sparc64/parport.h | |||
@@ -103,7 +103,7 @@ static int ebus_ecpp_p(struct linux_ebus_device *edev) | |||
103 | if (!strcmp(edev->prom_node->name, "ecpp")) | 103 | if (!strcmp(edev->prom_node->name, "ecpp")) |
104 | return 1; | 104 | return 1; |
105 | if (!strcmp(edev->prom_node->name, "parallel")) { | 105 | if (!strcmp(edev->prom_node->name, "parallel")) { |
106 | char *compat; | 106 | const char *compat; |
107 | 107 | ||
108 | compat = of_get_property(edev->prom_node, | 108 | compat = of_get_property(edev->prom_node, |
109 | "compatible", NULL); | 109 | "compatible", NULL); |
diff --git a/include/asm-sparc64/pbm.h b/include/asm-sparc64/pbm.h index 7a246d8a1828..c008cecca149 100644 --- a/include/asm-sparc64/pbm.h +++ b/include/asm-sparc64/pbm.h | |||
@@ -1,7 +1,6 @@ | |||
1 | /* $Id: pbm.h,v 1.27 2001/08/12 13:18:23 davem Exp $ | 1 | /* pbm.h: UltraSparc PCI controller software state. |
2 | * pbm.h: UltraSparc PCI controller software state. | ||
3 | * | 2 | * |
4 | * Copyright (C) 1997, 1998, 1999 David S. Miller (davem@redhat.com) | 3 | * Copyright (C) 1997, 1998, 1999, 2007 David S. Miller (davem@davemloft.net) |
5 | */ | 4 | */ |
6 | 5 | ||
7 | #ifndef __SPARC64_PBM_H | 6 | #ifndef __SPARC64_PBM_H |
@@ -30,90 +29,7 @@ | |||
30 | * PCI bus. | 29 | * PCI bus. |
31 | */ | 30 | */ |
32 | 31 | ||
33 | struct pci_controller_info; | 32 | extern void pci_iommu_table_init(struct iommu *iommu, int tsbsize, u32 dma_offset, u32 dma_addr_mask); |
34 | |||
35 | /* This contains the software state necessary to drive a PCI | ||
36 | * controller's IOMMU. | ||
37 | */ | ||
38 | struct pci_iommu_arena { | ||
39 | unsigned long *map; | ||
40 | unsigned int hint; | ||
41 | unsigned int limit; | ||
42 | }; | ||
43 | |||
44 | struct pci_iommu { | ||
45 | /* This protects the controller's IOMMU and all | ||
46 | * streaming buffers underneath. | ||
47 | */ | ||
48 | spinlock_t lock; | ||
49 | |||
50 | struct pci_iommu_arena arena; | ||
51 | |||
52 | /* IOMMU page table, a linear array of ioptes. */ | ||
53 | iopte_t *page_table; /* The page table itself. */ | ||
54 | |||
55 | /* Base PCI memory space address where IOMMU mappings | ||
56 | * begin. | ||
57 | */ | ||
58 | u32 page_table_map_base; | ||
59 | |||
60 | /* IOMMU Controller Registers */ | ||
61 | unsigned long iommu_control; /* IOMMU control register */ | ||
62 | unsigned long iommu_tsbbase; /* IOMMU page table base register */ | ||
63 | unsigned long iommu_flush; /* IOMMU page flush register */ | ||
64 | unsigned long iommu_ctxflush; /* IOMMU context flush register */ | ||
65 | |||
66 | /* This is a register in the PCI controller, which if | ||
67 | * read will have no side-effects but will guarantee | ||
68 | * completion of all previous writes into IOMMU/STC. | ||
69 | */ | ||
70 | unsigned long write_complete_reg; | ||
71 | |||
72 | /* In order to deal with some buggy third-party PCI bridges that | ||
73 | * do wrong prefetching, we never mark valid mappings as invalid. | ||
74 | * Instead we point them at this dummy page. | ||
75 | */ | ||
76 | unsigned long dummy_page; | ||
77 | unsigned long dummy_page_pa; | ||
78 | |||
79 | /* CTX allocation. */ | ||
80 | unsigned long ctx_lowest_free; | ||
81 | unsigned long ctx_bitmap[IOMMU_NUM_CTXS / (sizeof(unsigned long) * 8)]; | ||
82 | |||
83 | /* Here a PCI controller driver describes the areas of | ||
84 | * PCI memory space where DMA to/from physical memory | ||
85 | * are addressed. Drivers interrogate the PCI layer | ||
86 | * if their device has addressing limitations. They | ||
87 | * do so via pci_dma_supported, and pass in a mask of | ||
88 | * DMA address bits their device can actually drive. | ||
89 | * | ||
90 | * The test for being usable is: | ||
91 | * (device_mask & dma_addr_mask) == dma_addr_mask | ||
92 | */ | ||
93 | u32 dma_addr_mask; | ||
94 | }; | ||
95 | |||
96 | extern void pci_iommu_table_init(struct pci_iommu *iommu, int tsbsize, u32 dma_offset, u32 dma_addr_mask); | ||
97 | |||
98 | /* This describes a PCI bus module's streaming buffer. */ | ||
99 | struct pci_strbuf { | ||
100 | int strbuf_enabled; /* Present and using it? */ | ||
101 | |||
102 | /* Streaming Buffer Control Registers */ | ||
103 | unsigned long strbuf_control; /* STC control register */ | ||
104 | unsigned long strbuf_pflush; /* STC page flush register */ | ||
105 | unsigned long strbuf_fsync; /* STC flush synchronization reg */ | ||
106 | unsigned long strbuf_ctxflush; /* STC context flush register */ | ||
107 | unsigned long strbuf_ctxmatch_base; /* STC context flush match reg */ | ||
108 | unsigned long strbuf_flushflag_pa; /* Physical address of flush flag */ | ||
109 | volatile unsigned long *strbuf_flushflag; /* The flush flag itself */ | ||
110 | |||
111 | /* And this is the actual flush flag area. | ||
112 | * We allocate extra because the chips require | ||
113 | * a 64-byte aligned area. | ||
114 | */ | ||
115 | volatile unsigned long __flushflag_buf[(64 + (64 - 1)) / sizeof(long)]; | ||
116 | }; | ||
117 | 33 | ||
118 | #define PCI_STC_FLUSHFLAG_INIT(STC) \ | 34 | #define PCI_STC_FLUSHFLAG_INIT(STC) \ |
119 | (*((STC)->strbuf_flushflag) = 0UL) | 35 | (*((STC)->strbuf_flushflag) = 0UL) |
@@ -126,6 +42,8 @@ struct pci_strbuf { | |||
126 | #define PROM_PCIRNG_MAX 64 | 42 | #define PROM_PCIRNG_MAX 64 |
127 | #define PROM_PCIIMAP_MAX 64 | 43 | #define PROM_PCIIMAP_MAX 64 |
128 | 44 | ||
45 | struct pci_controller_info; | ||
46 | |||
129 | struct pci_pbm_info { | 47 | struct pci_pbm_info { |
130 | /* PCI controller we sit under. */ | 48 | /* PCI controller we sit under. */ |
131 | struct pci_controller_info *parent; | 49 | struct pci_controller_info *parent; |
@@ -160,11 +78,6 @@ struct pci_pbm_info { | |||
160 | 78 | ||
161 | /* OBP specific information. */ | 79 | /* OBP specific information. */ |
162 | struct device_node *prom_node; | 80 | struct device_node *prom_node; |
163 | struct linux_prom_pci_ranges *pbm_ranges; | ||
164 | int num_pbm_ranges; | ||
165 | struct linux_prom_pci_intmap *pbm_intmap; | ||
166 | int num_pbm_intmap; | ||
167 | struct linux_prom_pci_intmask *pbm_intmask; | ||
168 | u64 ino_bitmap; | 81 | u64 ino_bitmap; |
169 | 82 | ||
170 | /* PBM I/O and Memory space resources. */ | 83 | /* PBM I/O and Memory space resources. */ |
@@ -197,13 +110,10 @@ struct pci_pbm_info { | |||
197 | #endif /* !(CONFIG_PCI_MSI) */ | 110 | #endif /* !(CONFIG_PCI_MSI) */ |
198 | 111 | ||
199 | /* This PBM's streaming buffer. */ | 112 | /* This PBM's streaming buffer. */ |
200 | struct pci_strbuf stc; | 113 | struct strbuf stc; |
201 | 114 | ||
202 | /* IOMMU state, potentially shared by both PBM segments. */ | 115 | /* IOMMU state, potentially shared by both PBM segments. */ |
203 | struct pci_iommu *iommu; | 116 | struct iommu *iommu; |
204 | |||
205 | /* PCI slot mapping. */ | ||
206 | unsigned int pci_first_slot; | ||
207 | 117 | ||
208 | /* Now things for the actual PCI bus probes. */ | 118 | /* Now things for the actual PCI bus probes. */ |
209 | unsigned int pci_first_busno; | 119 | unsigned int pci_first_busno; |
@@ -220,17 +130,12 @@ struct pci_controller_info { | |||
220 | */ | 130 | */ |
221 | int index; | 131 | int index; |
222 | 132 | ||
223 | /* Do the PBMs both exist in the same PCI domain? */ | ||
224 | int pbms_same_domain; | ||
225 | |||
226 | /* The PCI bus modules controlled by us. */ | 133 | /* The PCI bus modules controlled by us. */ |
227 | struct pci_pbm_info pbm_A; | 134 | struct pci_pbm_info pbm_A; |
228 | struct pci_pbm_info pbm_B; | 135 | struct pci_pbm_info pbm_B; |
229 | 136 | ||
230 | /* Operations which are controller specific. */ | 137 | /* Operations which are controller specific. */ |
231 | void (*scan_bus)(struct pci_controller_info *); | 138 | void (*scan_bus)(struct pci_controller_info *); |
232 | void (*base_address_update)(struct pci_dev *, int); | ||
233 | void (*resource_adjust)(struct pci_dev *, struct resource *, struct resource *); | ||
234 | 139 | ||
235 | #ifdef CONFIG_PCI_MSI | 140 | #ifdef CONFIG_PCI_MSI |
236 | int (*setup_msi_irq)(unsigned int *virt_irq_p, struct pci_dev *pdev, | 141 | int (*setup_msi_irq)(unsigned int *virt_irq_p, struct pci_dev *pdev, |
@@ -244,27 +149,4 @@ struct pci_controller_info { | |||
244 | unsigned int pci_last_busno; | 149 | unsigned int pci_last_busno; |
245 | }; | 150 | }; |
246 | 151 | ||
247 | /* PCI devices which are not bridges have this placed in their pci_dev | ||
248 | * sysdata member. This makes OBP aware PCI device drivers easier to | ||
249 | * code. | ||
250 | */ | ||
251 | struct pcidev_cookie { | ||
252 | struct pci_pbm_info *pbm; | ||
253 | struct device_node *prom_node; | ||
254 | struct of_device *op; | ||
255 | struct linux_prom_pci_registers prom_regs[PROMREG_MAX]; | ||
256 | int num_prom_regs; | ||
257 | struct linux_prom_pci_registers prom_assignments[PROMREG_MAX]; | ||
258 | int num_prom_assignments; | ||
259 | #ifdef CONFIG_PCI_MSI | ||
260 | unsigned int msi_num; | ||
261 | #endif | ||
262 | }; | ||
263 | |||
264 | /* Currently these are the same across all PCI controllers | ||
265 | * we support. Someday they may not be... | ||
266 | */ | ||
267 | #define PCI_IRQ_IGN 0x000007c0 /* Interrupt Group Number */ | ||
268 | #define PCI_IRQ_INO 0x0000003f /* Interrupt Number */ | ||
269 | |||
270 | #endif /* !(__SPARC64_PBM_H) */ | 152 | #endif /* !(__SPARC64_PBM_H) */ |
diff --git a/include/asm-sparc64/pci.h b/include/asm-sparc64/pci.h index b14a725b430d..47cea16e1bad 100644 --- a/include/asm-sparc64/pci.h +++ b/include/asm-sparc64/pci.h | |||
@@ -54,7 +54,7 @@ struct pci_iommu_ops { | |||
54 | void (*dma_sync_sg_for_cpu)(struct pci_dev *, struct scatterlist *, int, int); | 54 | void (*dma_sync_sg_for_cpu)(struct pci_dev *, struct scatterlist *, int, int); |
55 | }; | 55 | }; |
56 | 56 | ||
57 | extern struct pci_iommu_ops *pci_iommu_ops; | 57 | extern const struct pci_iommu_ops *pci_iommu_ops; |
58 | 58 | ||
59 | /* Allocate and map kernel buffer using consistent mode DMA for a device. | 59 | /* Allocate and map kernel buffer using consistent mode DMA for a device. |
60 | * hwdev should be valid struct pci_dev pointer for PCI devices. | 60 | * hwdev should be valid struct pci_dev pointer for PCI devices. |
diff --git a/include/asm-sparc64/pgtable.h b/include/asm-sparc64/pgtable.h index b12be7a869f6..46705ef47d27 100644 --- a/include/asm-sparc64/pgtable.h +++ b/include/asm-sparc64/pgtable.h | |||
@@ -737,20 +737,6 @@ extern unsigned long pte_file(pte_t); | |||
737 | extern pte_t pgoff_to_pte(unsigned long); | 737 | extern pte_t pgoff_to_pte(unsigned long); |
738 | #define PTE_FILE_MAX_BITS (64UL - PAGE_SHIFT - 1UL) | 738 | #define PTE_FILE_MAX_BITS (64UL - PAGE_SHIFT - 1UL) |
739 | 739 | ||
740 | extern unsigned long prom_virt_to_phys(unsigned long, int *); | ||
741 | |||
742 | extern unsigned long sun4u_get_pte(unsigned long); | ||
743 | |||
744 | static inline unsigned long __get_phys(unsigned long addr) | ||
745 | { | ||
746 | return sun4u_get_pte(addr); | ||
747 | } | ||
748 | |||
749 | static inline int __get_iospace(unsigned long addr) | ||
750 | { | ||
751 | return ((sun4u_get_pte(addr) & 0xf0000000) >> 28); | ||
752 | } | ||
753 | |||
754 | extern unsigned long *sparc64_valid_addr_bitmap; | 740 | extern unsigned long *sparc64_valid_addr_bitmap; |
755 | 741 | ||
756 | /* Needs to be defined here and not in linux/mm.h, as it is arch dependent */ | 742 | /* Needs to be defined here and not in linux/mm.h, as it is arch dependent */ |
@@ -791,6 +777,8 @@ extern void pgtable_cache_init(void); | |||
791 | extern void sun4v_register_fault_status(void); | 777 | extern void sun4v_register_fault_status(void); |
792 | extern void sun4v_ktsb_register(void); | 778 | extern void sun4v_ktsb_register(void); |
793 | 779 | ||
780 | extern unsigned long cmdline_memory_size; | ||
781 | |||
794 | #endif /* !(__ASSEMBLY__) */ | 782 | #endif /* !(__ASSEMBLY__) */ |
795 | 783 | ||
796 | #endif /* !(_SPARC64_PGTABLE_H) */ | 784 | #endif /* !(_SPARC64_PGTABLE_H) */ |
diff --git a/include/asm-sparc64/prom.h b/include/asm-sparc64/prom.h index 0eca2d98627f..ddad5f99ac7f 100644 --- a/include/asm-sparc64/prom.h +++ b/include/asm-sparc64/prom.h | |||
@@ -36,8 +36,8 @@ struct property { | |||
36 | 36 | ||
37 | struct of_irq_controller; | 37 | struct of_irq_controller; |
38 | struct device_node { | 38 | struct device_node { |
39 | char *name; | 39 | const char *name; |
40 | char *type; | 40 | const char *type; |
41 | phandle node; | 41 | phandle node; |
42 | char *path_component_name; | 42 | char *path_component_name; |
43 | char *full_name; | 43 | char *full_name; |
@@ -93,11 +93,13 @@ extern struct device_node *of_find_node_by_phandle(phandle handle); | |||
93 | extern struct device_node *of_get_parent(const struct device_node *node); | 93 | extern struct device_node *of_get_parent(const struct device_node *node); |
94 | extern struct device_node *of_get_next_child(const struct device_node *node, | 94 | extern struct device_node *of_get_next_child(const struct device_node *node, |
95 | struct device_node *prev); | 95 | struct device_node *prev); |
96 | extern struct property *of_find_property(struct device_node *np, | 96 | extern struct property *of_find_property(const struct device_node *np, |
97 | const char *name, | 97 | const char *name, |
98 | int *lenp); | 98 | int *lenp); |
99 | extern int of_device_is_compatible(struct device_node *device, const char *); | 99 | extern int of_device_is_compatible(const struct device_node *device, |
100 | extern void *of_get_property(struct device_node *node, const char *name, | 100 | const char *); |
101 | extern const void *of_get_property(const struct device_node *node, | ||
102 | const char *name, | ||
101 | int *lenp); | 103 | int *lenp); |
102 | #define get_property(node,name,lenp) of_get_property(node,name,lenp) | 104 | #define get_property(node,name,lenp) of_get_property(node,name,lenp) |
103 | extern int of_set_property(struct device_node *node, const char *name, void *val, int len); | 105 | extern int of_set_property(struct device_node *node, const char *name, void *val, int len); |
diff --git a/include/asm-sparc64/smp.h b/include/asm-sparc64/smp.h index 388249b751c3..cca54804b722 100644 --- a/include/asm-sparc64/smp.h +++ b/include/asm-sparc64/smp.h | |||
@@ -42,15 +42,15 @@ extern int hard_smp_processor_id(void); | |||
42 | #define raw_smp_processor_id() (current_thread_info()->cpu) | 42 | #define raw_smp_processor_id() (current_thread_info()->cpu) |
43 | 43 | ||
44 | extern void smp_setup_cpu_possible_map(void); | 44 | extern void smp_setup_cpu_possible_map(void); |
45 | extern unsigned char boot_cpu_id; | ||
45 | 46 | ||
46 | #endif /* !(__ASSEMBLY__) */ | 47 | #endif /* !(__ASSEMBLY__) */ |
47 | 48 | ||
48 | #else | 49 | #else |
49 | 50 | ||
50 | #define smp_setup_cpu_possible_map() do { } while (0) | 51 | #define smp_setup_cpu_possible_map() do { } while (0) |
52 | #define boot_cpu_id (0) | ||
51 | 53 | ||
52 | #endif /* !(CONFIG_SMP) */ | 54 | #endif /* !(CONFIG_SMP) */ |
53 | 55 | ||
54 | #define NO_PROC_ID 0xFF | ||
55 | |||
56 | #endif /* !(_SPARC64_SMP_H) */ | 56 | #endif /* !(_SPARC64_SMP_H) */ |
diff --git a/include/asm-sparc64/socket.h b/include/asm-sparc64/socket.h index 754d46a50af3..986441dcb8f0 100644 --- a/include/asm-sparc64/socket.h +++ b/include/asm-sparc64/socket.h | |||
@@ -49,6 +49,8 @@ | |||
49 | 49 | ||
50 | #define SO_PEERSEC 0x001e | 50 | #define SO_PEERSEC 0x001e |
51 | #define SO_PASSSEC 0x001f | 51 | #define SO_PASSSEC 0x001f |
52 | #define SO_TIMESTAMPNS 0x0021 | ||
53 | #define SCM_TIMESTAMPNS SO_TIMESTAMPNS | ||
52 | 54 | ||
53 | /* Security levels - as per NRL IPv6 - don't actually do anything */ | 55 | /* Security levels - as per NRL IPv6 - don't actually do anything */ |
54 | #define SO_SECURITY_AUTHENTICATION 0x5001 | 56 | #define SO_SECURITY_AUTHENTICATION 0x5001 |
diff --git a/include/asm-sparc64/sockios.h b/include/asm-sparc64/sockios.h index 6735bab4f39d..c7d9900638d0 100644 --- a/include/asm-sparc64/sockios.h +++ b/include/asm-sparc64/sockios.h | |||
@@ -7,7 +7,8 @@ | |||
7 | #define FIOGETOWN 0x8903 | 7 | #define FIOGETOWN 0x8903 |
8 | #define SIOCGPGRP 0x8904 | 8 | #define SIOCGPGRP 0x8904 |
9 | #define SIOCATMARK 0x8905 | 9 | #define SIOCATMARK 0x8905 |
10 | #define SIOCGSTAMP 0x8906 /* Get stamp */ | 10 | #define SIOCGSTAMP 0x8906 /* Get stamp (timeval) */ |
11 | #define SIOCGSTAMPNS 0x8907 /* Get stamp (timespec) */ | ||
11 | 12 | ||
12 | #endif /* !(_ASM_SPARC64_SOCKIOS_H) */ | 13 | #endif /* !(_ASM_SPARC64_SOCKIOS_H) */ |
13 | 14 | ||
diff --git a/include/asm-sparc64/sparsemem.h b/include/asm-sparc64/sparsemem.h index ed5c9d8541e2..77bcd2bfa53c 100644 --- a/include/asm-sparc64/sparsemem.h +++ b/include/asm-sparc64/sparsemem.h | |||
@@ -3,7 +3,7 @@ | |||
3 | 3 | ||
4 | #ifdef __KERNEL__ | 4 | #ifdef __KERNEL__ |
5 | 5 | ||
6 | #define SECTION_SIZE_BITS 26 | 6 | #define SECTION_SIZE_BITS 31 |
7 | #define MAX_PHYSADDR_BITS 42 | 7 | #define MAX_PHYSADDR_BITS 42 |
8 | #define MAX_PHYSMEM_BITS 42 | 8 | #define MAX_PHYSMEM_BITS 42 |
9 | 9 | ||
diff --git a/include/asm-sparc64/timer.h b/include/asm-sparc64/timer.h index d435594df786..ccbd69448866 100644 --- a/include/asm-sparc64/timer.h +++ b/include/asm-sparc64/timer.h | |||
@@ -11,22 +11,19 @@ | |||
11 | 11 | ||
12 | 12 | ||
13 | struct sparc64_tick_ops { | 13 | struct sparc64_tick_ops { |
14 | void (*init_tick)(unsigned long); | ||
15 | unsigned long (*get_tick)(void); | 14 | unsigned long (*get_tick)(void); |
16 | unsigned long (*get_compare)(void); | 15 | int (*add_compare)(unsigned long); |
17 | unsigned long (*add_tick)(unsigned long, unsigned long); | ||
18 | unsigned long (*add_compare)(unsigned long); | ||
19 | unsigned long softint_mask; | 16 | unsigned long softint_mask; |
17 | void (*disable_irq)(void); | ||
18 | |||
19 | void (*init_tick)(void); | ||
20 | unsigned long (*add_tick)(unsigned long); | ||
21 | |||
22 | char *name; | ||
20 | }; | 23 | }; |
21 | 24 | ||
22 | extern struct sparc64_tick_ops *tick_ops; | 25 | extern struct sparc64_tick_ops *tick_ops; |
23 | 26 | ||
24 | #ifdef CONFIG_SMP | ||
25 | extern unsigned long timer_tick_offset; | ||
26 | struct pt_regs; | ||
27 | extern void timer_tick_interrupt(struct pt_regs *); | ||
28 | #endif | ||
29 | |||
30 | extern unsigned long sparc64_get_clock_tick(unsigned int cpu); | 27 | extern unsigned long sparc64_get_clock_tick(unsigned int cpu); |
31 | 28 | ||
32 | #endif /* _SPARC64_TIMER_H */ | 29 | #endif /* _SPARC64_TIMER_H */ |
diff --git a/include/asm-sparc64/ttable.h b/include/asm-sparc64/ttable.h index c2a16e188499..bbb9c8f13d61 100644 --- a/include/asm-sparc64/ttable.h +++ b/include/asm-sparc64/ttable.h | |||
@@ -157,23 +157,6 @@ | |||
157 | ba,a,pt %xcc, rtrap_irq; \ | 157 | ba,a,pt %xcc, rtrap_irq; \ |
158 | .previous; | 158 | .previous; |
159 | 159 | ||
160 | #define TICK_SMP_IRQ \ | ||
161 | rdpr %pil, %g2; \ | ||
162 | wrpr %g0, 15, %pil; \ | ||
163 | sethi %hi(1f-4), %g7; \ | ||
164 | ba,pt %xcc, etrap_irq; \ | ||
165 | or %g7, %lo(1f-4), %g7; \ | ||
166 | nop; \ | ||
167 | nop; \ | ||
168 | nop; \ | ||
169 | .subsection 2; \ | ||
170 | 1: call trace_hardirqs_off; \ | ||
171 | nop; \ | ||
172 | call smp_percpu_timer_interrupt; \ | ||
173 | add %sp, PTREGS_OFF, %o0; \ | ||
174 | ba,a,pt %xcc, rtrap_irq; \ | ||
175 | .previous; | ||
176 | |||
177 | #else | 160 | #else |
178 | 161 | ||
179 | #define TRAP_IRQ(routine, level) \ | 162 | #define TRAP_IRQ(routine, level) \ |
@@ -186,16 +169,6 @@ | |||
186 | add %sp, PTREGS_OFF, %o1; \ | 169 | add %sp, PTREGS_OFF, %o1; \ |
187 | ba,a,pt %xcc, rtrap_irq; | 170 | ba,a,pt %xcc, rtrap_irq; |
188 | 171 | ||
189 | #define TICK_SMP_IRQ \ | ||
190 | rdpr %pil, %g2; \ | ||
191 | wrpr %g0, 15, %pil; \ | ||
192 | sethi %hi(109f), %g7; \ | ||
193 | ba,pt %xcc, etrap_irq; \ | ||
194 | 109: or %g7, %lo(109b), %g7; \ | ||
195 | call smp_percpu_timer_interrupt; \ | ||
196 | add %sp, PTREGS_OFF, %o0; \ | ||
197 | ba,a,pt %xcc, rtrap_irq; | ||
198 | |||
199 | #endif | 172 | #endif |
200 | 173 | ||
201 | #define TRAP_IVEC TRAP_NOSAVE(do_ivec) | 174 | #define TRAP_IVEC TRAP_NOSAVE(do_ivec) |
diff --git a/include/asm-um/div64.h b/include/asm-um/div64.h index 1e17f7409cab..7b73b2cd5b34 100644 --- a/include/asm-um/div64.h +++ b/include/asm-um/div64.h | |||
@@ -3,4 +3,5 @@ | |||
3 | 3 | ||
4 | #include "asm/arch/div64.h" | 4 | #include "asm/arch/div64.h" |
5 | 5 | ||
6 | extern uint64_t div64_64(uint64_t dividend, uint64_t divisor); | ||
6 | #endif | 7 | #endif |
diff --git a/include/asm-v850/socket.h b/include/asm-v850/socket.h index 0dfe55ac2ef2..a4c2493b025f 100644 --- a/include/asm-v850/socket.h +++ b/include/asm-v850/socket.h | |||
@@ -49,5 +49,7 @@ | |||
49 | 49 | ||
50 | #define SO_PEERSEC 31 | 50 | #define SO_PEERSEC 31 |
51 | #define SO_PASSSEC 34 | 51 | #define SO_PASSSEC 34 |
52 | #define SO_TIMESTAMPNS 35 | ||
53 | #define SCM_TIMESTAMPNS SO_TIMESTAMPNS | ||
52 | 54 | ||
53 | #endif /* __V850_SOCKET_H__ */ | 55 | #endif /* __V850_SOCKET_H__ */ |
diff --git a/include/asm-v850/sockios.h b/include/asm-v850/sockios.h index cf4874c2fd8a..823e106e6cd0 100644 --- a/include/asm-v850/sockios.h +++ b/include/asm-v850/sockios.h | |||
@@ -7,6 +7,7 @@ | |||
7 | #define FIOGETOWN 0x8903 | 7 | #define FIOGETOWN 0x8903 |
8 | #define SIOCGPGRP 0x8904 | 8 | #define SIOCGPGRP 0x8904 |
9 | #define SIOCATMARK 0x8905 | 9 | #define SIOCATMARK 0x8905 |
10 | #define SIOCGSTAMP 0x8906 /* Get stamp */ | 10 | #define SIOCGSTAMP 0x8906 /* Get stamp (timeval) */ |
11 | #define SIOCGSTAMPNS 0x8907 /* Get stamp (timespec) */ | ||
11 | 12 | ||
12 | #endif /* __V850_SOCKIOS_H__ */ | 13 | #endif /* __V850_SOCKIOS_H__ */ |
diff --git a/include/asm-x86_64/socket.h b/include/asm-x86_64/socket.h index b46702607933..90af60cf3c0e 100644 --- a/include/asm-x86_64/socket.h +++ b/include/asm-x86_64/socket.h | |||
@@ -49,5 +49,7 @@ | |||
49 | 49 | ||
50 | #define SO_PEERSEC 31 | 50 | #define SO_PEERSEC 31 |
51 | #define SO_PASSSEC 34 | 51 | #define SO_PASSSEC 34 |
52 | #define SO_TIMESTAMPNS 35 | ||
53 | #define SCM_TIMESTAMPNS SO_TIMESTAMPNS | ||
52 | 54 | ||
53 | #endif /* _ASM_SOCKET_H */ | 55 | #endif /* _ASM_SOCKET_H */ |
diff --git a/include/asm-x86_64/sockios.h b/include/asm-x86_64/sockios.h index 2eefd10d4f48..d726ba2513e3 100644 --- a/include/asm-x86_64/sockios.h +++ b/include/asm-x86_64/sockios.h | |||
@@ -7,6 +7,7 @@ | |||
7 | #define FIOGETOWN 0x8903 | 7 | #define FIOGETOWN 0x8903 |
8 | #define SIOCGPGRP 0x8904 | 8 | #define SIOCGPGRP 0x8904 |
9 | #define SIOCATMARK 0x8905 | 9 | #define SIOCATMARK 0x8905 |
10 | #define SIOCGSTAMP 0x8906 /* Get stamp */ | 10 | #define SIOCGSTAMP 0x8906 /* Get stamp (timeval) */ |
11 | #define SIOCGSTAMPNS 0x8907 /* Get stamp (timespec) */ | ||
11 | 12 | ||
12 | #endif | 13 | #endif |
diff --git a/include/asm-xtensa/div64.h b/include/asm-xtensa/div64.h index c4a105776383..20965e3af1dd 100644 --- a/include/asm-xtensa/div64.h +++ b/include/asm-xtensa/div64.h | |||
@@ -11,9 +11,15 @@ | |||
11 | #ifndef _XTENSA_DIV64_H | 11 | #ifndef _XTENSA_DIV64_H |
12 | #define _XTENSA_DIV64_H | 12 | #define _XTENSA_DIV64_H |
13 | 13 | ||
14 | #include <linux/types.h> | ||
15 | |||
14 | #define do_div(n,base) ({ \ | 16 | #define do_div(n,base) ({ \ |
15 | int __res = n % ((unsigned int) base); \ | 17 | int __res = n % ((unsigned int) base); \ |
16 | n /= (unsigned int) base; \ | 18 | n /= (unsigned int) base; \ |
17 | __res; }) | 19 | __res; }) |
18 | 20 | ||
21 | static inline uint64_t div64_64(uint64_t dividend, uint64_t divisor) | ||
22 | { | ||
23 | return dividend / divisor; | ||
24 | } | ||
19 | #endif | 25 | #endif |
diff --git a/include/asm-xtensa/socket.h b/include/asm-xtensa/socket.h index 971d231be60e..1f5aeacb9da2 100644 --- a/include/asm-xtensa/socket.h +++ b/include/asm-xtensa/socket.h | |||
@@ -60,5 +60,7 @@ | |||
60 | #define SO_ACCEPTCONN 30 | 60 | #define SO_ACCEPTCONN 30 |
61 | #define SO_PEERSEC 31 | 61 | #define SO_PEERSEC 31 |
62 | #define SO_PASSSEC 34 | 62 | #define SO_PASSSEC 34 |
63 | #define SO_TIMESTAMPNS 35 | ||
64 | #define SCM_TIMESTAMPNS SO_TIMESTAMPNS | ||
63 | 65 | ||
64 | #endif /* _XTENSA_SOCKET_H */ | 66 | #endif /* _XTENSA_SOCKET_H */ |
diff --git a/include/asm-xtensa/sockios.h b/include/asm-xtensa/sockios.h index 20d2ba10ecd1..efe0af379f01 100644 --- a/include/asm-xtensa/sockios.h +++ b/include/asm-xtensa/sockios.h | |||
@@ -25,6 +25,7 @@ | |||
25 | #define SIOCSPGRP _IOW('s', 8, pid_t) | 25 | #define SIOCSPGRP _IOW('s', 8, pid_t) |
26 | #define SIOCGPGRP _IOR('s', 9, pid_t) | 26 | #define SIOCGPGRP _IOR('s', 9, pid_t) |
27 | 27 | ||
28 | #define SIOCGSTAMP 0x8906 /* Get stamp - linux-specific */ | 28 | #define SIOCGSTAMP 0x8906 /* Get stamp (timeval) */ |
29 | #define SIOCGSTAMPNS 0x8907 /* Get stamp (timespec) */ | ||
29 | 30 | ||
30 | #endif /* _XTENSA_SOCKIOS_H */ | 31 | #endif /* _XTENSA_SOCKIOS_H */ |
diff --git a/include/keys/rxrpc-type.h b/include/keys/rxrpc-type.h new file mode 100644 index 000000000000..e2ee73aef0ee --- /dev/null +++ b/include/keys/rxrpc-type.h | |||
@@ -0,0 +1,22 @@ | |||
1 | /* RxRPC key type | ||
2 | * | ||
3 | * Copyright (C) 2007 Red Hat, Inc. All Rights Reserved. | ||
4 | * Written by David Howells (dhowells@redhat.com) | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or | ||
7 | * modify it under the terms of the GNU General Public License | ||
8 | * as published by the Free Software Foundation; either version | ||
9 | * 2 of the License, or (at your option) any later version. | ||
10 | */ | ||
11 | |||
12 | #ifndef _KEYS_RXRPC_TYPE_H | ||
13 | #define _KEYS_RXRPC_TYPE_H | ||
14 | |||
15 | #include <linux/key.h> | ||
16 | |||
17 | /* | ||
18 | * key type for AF_RXRPC keys | ||
19 | */ | ||
20 | extern struct key_type key_type_rxrpc; | ||
21 | |||
22 | #endif /* _KEYS_USER_TYPE_H */ | ||
diff --git a/include/linux/Kbuild b/include/linux/Kbuild index e81e301a4d71..4ff0f57d0add 100644 --- a/include/linux/Kbuild +++ b/include/linux/Kbuild | |||
@@ -69,9 +69,7 @@ header-y += hdsmart.h | |||
69 | header-y += hysdn_if.h | 69 | header-y += hysdn_if.h |
70 | header-y += i2c-dev.h | 70 | header-y += i2c-dev.h |
71 | header-y += i8k.h | 71 | header-y += i8k.h |
72 | header-y += icmp.h | ||
73 | header-y += if_arcnet.h | 72 | header-y += if_arcnet.h |
74 | header-y += if_arp.h | ||
75 | header-y += if_bonding.h | 73 | header-y += if_bonding.h |
76 | header-y += if_cablemodem.h | 74 | header-y += if_cablemodem.h |
77 | header-y += if_fc.h | 75 | header-y += if_fc.h |
@@ -88,7 +86,6 @@ header-y += if_tunnel.h | |||
88 | header-y += in6.h | 86 | header-y += in6.h |
89 | header-y += in_route.h | 87 | header-y += in_route.h |
90 | header-y += ioctl.h | 88 | header-y += ioctl.h |
91 | header-y += ip.h | ||
92 | header-y += ipmi_msgdefs.h | 89 | header-y += ipmi_msgdefs.h |
93 | header-y += ip_mp_alg.h | 90 | header-y += ip_mp_alg.h |
94 | header-y += ipsec.h | 91 | header-y += ipsec.h |
@@ -116,6 +113,7 @@ header-y += netrom.h | |||
116 | header-y += nfs2.h | 113 | header-y += nfs2.h |
117 | header-y += nfs4_mount.h | 114 | header-y += nfs4_mount.h |
118 | header-y += nfs_mount.h | 115 | header-y += nfs_mount.h |
116 | header-y += nl80211.h | ||
119 | header-y += oom.h | 117 | header-y += oom.h |
120 | header-y += param.h | 118 | header-y += param.h |
121 | header-y += pci_regs.h | 119 | header-y += pci_regs.h |
@@ -210,8 +208,10 @@ unifdef-y += hiddev.h | |||
210 | unifdef-y += hpet.h | 208 | unifdef-y += hpet.h |
211 | unifdef-y += i2c.h | 209 | unifdef-y += i2c.h |
212 | unifdef-y += i2o-dev.h | 210 | unifdef-y += i2o-dev.h |
211 | unifdef-y += icmp.h | ||
213 | unifdef-y += icmpv6.h | 212 | unifdef-y += icmpv6.h |
214 | unifdef-y += if_addr.h | 213 | unifdef-y += if_addr.h |
214 | unifdef-y += if_arp.h | ||
215 | unifdef-y += if_bridge.h | 215 | unifdef-y += if_bridge.h |
216 | unifdef-y += if_ec.h | 216 | unifdef-y += if_ec.h |
217 | unifdef-y += if_eql.h | 217 | unifdef-y += if_eql.h |
@@ -231,6 +231,7 @@ unifdef-y += inet_diag.h | |||
231 | unifdef-y += in.h | 231 | unifdef-y += in.h |
232 | unifdef-y += inotify.h | 232 | unifdef-y += inotify.h |
233 | unifdef-y += input.h | 233 | unifdef-y += input.h |
234 | unifdef-y += ip.h | ||
234 | unifdef-y += ipc.h | 235 | unifdef-y += ipc.h |
235 | unifdef-y += ipmi.h | 236 | unifdef-y += ipmi.h |
236 | unifdef-y += ipv6.h | 237 | unifdef-y += ipv6.h |
diff --git a/include/linux/atalk.h b/include/linux/atalk.h index d12984ddaa9f..ced8a1ed080c 100644 --- a/include/linux/atalk.h +++ b/include/linux/atalk.h | |||
@@ -101,7 +101,7 @@ struct ddpehdr { | |||
101 | 101 | ||
102 | static __inline__ struct ddpehdr *ddp_hdr(struct sk_buff *skb) | 102 | static __inline__ struct ddpehdr *ddp_hdr(struct sk_buff *skb) |
103 | { | 103 | { |
104 | return (struct ddpehdr *)skb->h.raw; | 104 | return (struct ddpehdr *)skb_transport_header(skb); |
105 | } | 105 | } |
106 | 106 | ||
107 | /* AppleTalk AARP headers */ | 107 | /* AppleTalk AARP headers */ |
@@ -129,7 +129,7 @@ struct elapaarp { | |||
129 | 129 | ||
130 | static __inline__ struct elapaarp *aarp_hdr(struct sk_buff *skb) | 130 | static __inline__ struct elapaarp *aarp_hdr(struct sk_buff *skb) |
131 | { | 131 | { |
132 | return (struct elapaarp *)skb->h.raw; | 132 | return (struct elapaarp *)skb_transport_header(skb); |
133 | } | 133 | } |
134 | 134 | ||
135 | /* Not specified - how long till we drop a resolved entry */ | 135 | /* Not specified - how long till we drop a resolved entry */ |
diff --git a/include/linux/dccp.h b/include/linux/dccp.h index 1cb054bd93f2..fda2148d8c85 100644 --- a/include/linux/dccp.h +++ b/include/linux/dccp.h | |||
@@ -260,19 +260,20 @@ enum { | |||
260 | 260 | ||
261 | static inline struct dccp_hdr *dccp_hdr(const struct sk_buff *skb) | 261 | static inline struct dccp_hdr *dccp_hdr(const struct sk_buff *skb) |
262 | { | 262 | { |
263 | return (struct dccp_hdr *)skb->h.raw; | 263 | return (struct dccp_hdr *)skb_transport_header(skb); |
264 | } | 264 | } |
265 | 265 | ||
266 | static inline struct dccp_hdr *dccp_zeroed_hdr(struct sk_buff *skb, int headlen) | 266 | static inline struct dccp_hdr *dccp_zeroed_hdr(struct sk_buff *skb, int headlen) |
267 | { | 267 | { |
268 | skb->h.raw = skb_push(skb, headlen); | 268 | skb_push(skb, headlen); |
269 | memset(skb->h.raw, 0, headlen); | 269 | skb_reset_transport_header(skb); |
270 | return dccp_hdr(skb); | 270 | return memset(skb_transport_header(skb), 0, headlen); |
271 | } | 271 | } |
272 | 272 | ||
273 | static inline struct dccp_hdr_ext *dccp_hdrx(const struct sk_buff *skb) | 273 | static inline struct dccp_hdr_ext *dccp_hdrx(const struct sk_buff *skb) |
274 | { | 274 | { |
275 | return (struct dccp_hdr_ext *)(skb->h.raw + sizeof(struct dccp_hdr)); | 275 | return (struct dccp_hdr_ext *)(skb_transport_header(skb) + |
276 | sizeof(struct dccp_hdr)); | ||
276 | } | 277 | } |
277 | 278 | ||
278 | static inline unsigned int __dccp_basic_hdr_len(const struct dccp_hdr *dh) | 279 | static inline unsigned int __dccp_basic_hdr_len(const struct dccp_hdr *dh) |
@@ -301,12 +302,14 @@ static inline __u64 dccp_hdr_seq(const struct sk_buff *skb) | |||
301 | 302 | ||
302 | static inline struct dccp_hdr_request *dccp_hdr_request(struct sk_buff *skb) | 303 | static inline struct dccp_hdr_request *dccp_hdr_request(struct sk_buff *skb) |
303 | { | 304 | { |
304 | return (struct dccp_hdr_request *)(skb->h.raw + dccp_basic_hdr_len(skb)); | 305 | return (struct dccp_hdr_request *)(skb_transport_header(skb) + |
306 | dccp_basic_hdr_len(skb)); | ||
305 | } | 307 | } |
306 | 308 | ||
307 | static inline struct dccp_hdr_ack_bits *dccp_hdr_ack_bits(const struct sk_buff *skb) | 309 | static inline struct dccp_hdr_ack_bits *dccp_hdr_ack_bits(const struct sk_buff *skb) |
308 | { | 310 | { |
309 | return (struct dccp_hdr_ack_bits *)(skb->h.raw + dccp_basic_hdr_len(skb)); | 311 | return (struct dccp_hdr_ack_bits *)(skb_transport_header(skb) + |
312 | dccp_basic_hdr_len(skb)); | ||
310 | } | 313 | } |
311 | 314 | ||
312 | static inline u64 dccp_hdr_ack_seq(const struct sk_buff *skb) | 315 | static inline u64 dccp_hdr_ack_seq(const struct sk_buff *skb) |
@@ -317,12 +320,14 @@ static inline u64 dccp_hdr_ack_seq(const struct sk_buff *skb) | |||
317 | 320 | ||
318 | static inline struct dccp_hdr_response *dccp_hdr_response(struct sk_buff *skb) | 321 | static inline struct dccp_hdr_response *dccp_hdr_response(struct sk_buff *skb) |
319 | { | 322 | { |
320 | return (struct dccp_hdr_response *)(skb->h.raw + dccp_basic_hdr_len(skb)); | 323 | return (struct dccp_hdr_response *)(skb_transport_header(skb) + |
324 | dccp_basic_hdr_len(skb)); | ||
321 | } | 325 | } |
322 | 326 | ||
323 | static inline struct dccp_hdr_reset *dccp_hdr_reset(struct sk_buff *skb) | 327 | static inline struct dccp_hdr_reset *dccp_hdr_reset(struct sk_buff *skb) |
324 | { | 328 | { |
325 | return (struct dccp_hdr_reset *)(skb->h.raw + dccp_basic_hdr_len(skb)); | 329 | return (struct dccp_hdr_reset *)(skb_transport_header(skb) + |
330 | dccp_basic_hdr_len(skb)); | ||
326 | } | 331 | } |
327 | 332 | ||
328 | static inline unsigned int __dccp_hdr_len(const struct dccp_hdr *dh) | 333 | static inline unsigned int __dccp_hdr_len(const struct dccp_hdr *dh) |
@@ -460,26 +465,27 @@ struct dccp_ackvec; | |||
460 | * @dccps_service_list - second .. last service code on passive socket | 465 | * @dccps_service_list - second .. last service code on passive socket |
461 | * @dccps_timestamp_time - time of latest TIMESTAMP option | 466 | * @dccps_timestamp_time - time of latest TIMESTAMP option |
462 | * @dccps_timestamp_echo - latest timestamp received on a TIMESTAMP option | 467 | * @dccps_timestamp_echo - latest timestamp received on a TIMESTAMP option |
463 | * @dccps_l_ack_ratio - | 468 | * @dccps_l_ack_ratio - feature-local Ack Ratio |
464 | * @dccps_r_ack_ratio - | 469 | * @dccps_r_ack_ratio - feature-remote Ack Ratio |
465 | * @dccps_pcslen - sender partial checksum coverage (via sockopt) | 470 | * @dccps_pcslen - sender partial checksum coverage (via sockopt) |
466 | * @dccps_pcrlen - receiver partial checksum coverage (via sockopt) | 471 | * @dccps_pcrlen - receiver partial checksum coverage (via sockopt) |
467 | * @dccps_ndp_count - number of Non Data Packets since last data packet | 472 | * @dccps_ndp_count - number of Non Data Packets since last data packet |
468 | * @dccps_mss_cache - | 473 | * @dccps_mss_cache - current value of MSS (path MTU minus header sizes) |
469 | * @dccps_minisock - | 474 | * @dccps_minisock - associated minisock (accessed via dccp_msk) |
470 | * @dccps_hc_rx_ackvec - rx half connection ack vector | 475 | * @dccps_hc_rx_ackvec - rx half connection ack vector |
471 | * @dccps_hc_rx_ccid - | 476 | * @dccps_hc_rx_ccid - CCID used for the receiver (or receiving half-connection) |
472 | * @dccps_hc_tx_ccid - | 477 | * @dccps_hc_tx_ccid - CCID used for the sender (or sending half-connection) |
473 | * @dccps_options_received - | 478 | * @dccps_options_received - parsed set of retrieved options |
474 | * @dccps_epoch - | 479 | * @dccps_role - role of this sock, one of %dccp_role |
475 | * @dccps_role - Role of this sock, one of %dccp_role | 480 | * @dccps_hc_rx_insert_options - receiver wants to add options when acking |
476 | * @dccps_hc_rx_insert_options - | 481 | * @dccps_hc_tx_insert_options - sender wants to add options when sending |
477 | * @dccps_hc_tx_insert_options - | ||
478 | * @dccps_xmit_timer - timer for when CCID is not ready to send | 482 | * @dccps_xmit_timer - timer for when CCID is not ready to send |
483 | * @dccps_syn_rtt - RTT sample from Request/Response exchange (in usecs) | ||
479 | */ | 484 | */ |
480 | struct dccp_sock { | 485 | struct dccp_sock { |
481 | /* inet_connection_sock has to be the first member of dccp_sock */ | 486 | /* inet_connection_sock has to be the first member of dccp_sock */ |
482 | struct inet_connection_sock dccps_inet_connection; | 487 | struct inet_connection_sock dccps_inet_connection; |
488 | #define dccps_syn_rtt dccps_inet_connection.icsk_ack.lrcvtime | ||
483 | __u64 dccps_swl; | 489 | __u64 dccps_swl; |
484 | __u64 dccps_swh; | 490 | __u64 dccps_swh; |
485 | __u64 dccps_awl; | 491 | __u64 dccps_awl; |
diff --git a/include/linux/debugfs.h b/include/linux/debugfs.h index 9fa0983d1aa8..5a9c49534d08 100644 --- a/include/linux/debugfs.h +++ b/include/linux/debugfs.h | |||
@@ -44,6 +44,8 @@ struct dentry *debugfs_create_u16(const char *name, mode_t mode, | |||
44 | struct dentry *parent, u16 *value); | 44 | struct dentry *parent, u16 *value); |
45 | struct dentry *debugfs_create_u32(const char *name, mode_t mode, | 45 | struct dentry *debugfs_create_u32(const char *name, mode_t mode, |
46 | struct dentry *parent, u32 *value); | 46 | struct dentry *parent, u32 *value); |
47 | struct dentry *debugfs_create_u64(const char *name, mode_t mode, | ||
48 | struct dentry *parent, u64 *value); | ||
47 | struct dentry *debugfs_create_bool(const char *name, mode_t mode, | 49 | struct dentry *debugfs_create_bool(const char *name, mode_t mode, |
48 | struct dentry *parent, u32 *value); | 50 | struct dentry *parent, u32 *value); |
49 | 51 | ||
@@ -104,6 +106,13 @@ static inline struct dentry *debugfs_create_u32(const char *name, mode_t mode, | |||
104 | return ERR_PTR(-ENODEV); | 106 | return ERR_PTR(-ENODEV); |
105 | } | 107 | } |
106 | 108 | ||
109 | static inline struct dentry *debugfs_create_u64(const char *name, mode_t mode, | ||
110 | struct dentry *parent, | ||
111 | u64 *value) | ||
112 | { | ||
113 | return ERR_PTR(-ENODEV); | ||
114 | } | ||
115 | |||
107 | static inline struct dentry *debugfs_create_bool(const char *name, mode_t mode, | 116 | static inline struct dentry *debugfs_create_bool(const char *name, mode_t mode, |
108 | struct dentry *parent, | 117 | struct dentry *parent, |
109 | u32 *value) | 118 | u32 *value) |
diff --git a/include/linux/device.h b/include/linux/device.h index 5cf30e95c8b6..a0cd2ced31a9 100644 --- a/include/linux/device.h +++ b/include/linux/device.h | |||
@@ -34,9 +34,24 @@ struct device; | |||
34 | struct device_driver; | 34 | struct device_driver; |
35 | struct class; | 35 | struct class; |
36 | struct class_device; | 36 | struct class_device; |
37 | struct bus_type; | ||
38 | |||
39 | struct bus_attribute { | ||
40 | struct attribute attr; | ||
41 | ssize_t (*show)(struct bus_type *, char * buf); | ||
42 | ssize_t (*store)(struct bus_type *, const char * buf, size_t count); | ||
43 | }; | ||
44 | |||
45 | #define BUS_ATTR(_name,_mode,_show,_store) \ | ||
46 | struct bus_attribute bus_attr_##_name = __ATTR(_name,_mode,_show,_store) | ||
47 | |||
48 | extern int __must_check bus_create_file(struct bus_type *, | ||
49 | struct bus_attribute *); | ||
50 | extern void bus_remove_file(struct bus_type *, struct bus_attribute *); | ||
37 | 51 | ||
38 | struct bus_type { | 52 | struct bus_type { |
39 | const char * name; | 53 | const char * name; |
54 | struct module * owner; | ||
40 | 55 | ||
41 | struct subsystem subsys; | 56 | struct subsystem subsys; |
42 | struct kset drivers; | 57 | struct kset drivers; |
@@ -49,6 +64,8 @@ struct bus_type { | |||
49 | struct bus_attribute * bus_attrs; | 64 | struct bus_attribute * bus_attrs; |
50 | struct device_attribute * dev_attrs; | 65 | struct device_attribute * dev_attrs; |
51 | struct driver_attribute * drv_attrs; | 66 | struct driver_attribute * drv_attrs; |
67 | struct bus_attribute drivers_autoprobe_attr; | ||
68 | struct bus_attribute drivers_probe_attr; | ||
52 | 69 | ||
53 | int (*match)(struct device * dev, struct device_driver * drv); | 70 | int (*match)(struct device * dev, struct device_driver * drv); |
54 | int (*uevent)(struct device *dev, char **envp, | 71 | int (*uevent)(struct device *dev, char **envp, |
@@ -61,6 +78,9 @@ struct bus_type { | |||
61 | int (*suspend_late)(struct device * dev, pm_message_t state); | 78 | int (*suspend_late)(struct device * dev, pm_message_t state); |
62 | int (*resume_early)(struct device * dev); | 79 | int (*resume_early)(struct device * dev); |
63 | int (*resume)(struct device * dev); | 80 | int (*resume)(struct device * dev); |
81 | |||
82 | unsigned int drivers_autoprobe:1; | ||
83 | unsigned int multithread_probe:1; | ||
64 | }; | 84 | }; |
65 | 85 | ||
66 | extern int __must_check bus_register(struct bus_type * bus); | 86 | extern int __must_check bus_register(struct bus_type * bus); |
@@ -102,26 +122,10 @@ extern int bus_unregister_notifier(struct bus_type *bus, | |||
102 | #define BUS_NOTIFY_UNBIND_DRIVER 0x00000004 /* driver about to be | 122 | #define BUS_NOTIFY_UNBIND_DRIVER 0x00000004 /* driver about to be |
103 | unbound */ | 123 | unbound */ |
104 | 124 | ||
105 | /* sysfs interface for exporting bus attributes */ | ||
106 | |||
107 | struct bus_attribute { | ||
108 | struct attribute attr; | ||
109 | ssize_t (*show)(struct bus_type *, char * buf); | ||
110 | ssize_t (*store)(struct bus_type *, const char * buf, size_t count); | ||
111 | }; | ||
112 | |||
113 | #define BUS_ATTR(_name,_mode,_show,_store) \ | ||
114 | struct bus_attribute bus_attr_##_name = __ATTR(_name,_mode,_show,_store) | ||
115 | |||
116 | extern int __must_check bus_create_file(struct bus_type *, | ||
117 | struct bus_attribute *); | ||
118 | extern void bus_remove_file(struct bus_type *, struct bus_attribute *); | ||
119 | |||
120 | struct device_driver { | 125 | struct device_driver { |
121 | const char * name; | 126 | const char * name; |
122 | struct bus_type * bus; | 127 | struct bus_type * bus; |
123 | 128 | ||
124 | struct completion unloaded; | ||
125 | struct kobject kobj; | 129 | struct kobject kobj; |
126 | struct klist klist_devices; | 130 | struct klist klist_devices; |
127 | struct klist_node knode_bus; | 131 | struct klist_node knode_bus; |
@@ -135,8 +139,6 @@ struct device_driver { | |||
135 | void (*shutdown) (struct device * dev); | 139 | void (*shutdown) (struct device * dev); |
136 | int (*suspend) (struct device * dev, pm_message_t state); | 140 | int (*suspend) (struct device * dev, pm_message_t state); |
137 | int (*resume) (struct device * dev); | 141 | int (*resume) (struct device * dev); |
138 | |||
139 | unsigned int multithread_probe:1; | ||
140 | }; | 142 | }; |
141 | 143 | ||
142 | 144 | ||
@@ -181,10 +183,9 @@ struct class { | |||
181 | struct list_head children; | 183 | struct list_head children; |
182 | struct list_head devices; | 184 | struct list_head devices; |
183 | struct list_head interfaces; | 185 | struct list_head interfaces; |
186 | struct kset class_dirs; | ||
184 | struct semaphore sem; /* locks both the children and interfaces lists */ | 187 | struct semaphore sem; /* locks both the children and interfaces lists */ |
185 | 188 | ||
186 | struct kobject *virtual_dir; | ||
187 | |||
188 | struct class_attribute * class_attrs; | 189 | struct class_attribute * class_attrs; |
189 | struct class_device_attribute * class_dev_attrs; | 190 | struct class_device_attribute * class_dev_attrs; |
190 | struct device_attribute * dev_attrs; | 191 | struct device_attribute * dev_attrs; |
@@ -328,11 +329,23 @@ extern struct class_device *class_device_create(struct class *cls, | |||
328 | __attribute__((format(printf,5,6))); | 329 | __attribute__((format(printf,5,6))); |
329 | extern void class_device_destroy(struct class *cls, dev_t devt); | 330 | extern void class_device_destroy(struct class *cls, dev_t devt); |
330 | 331 | ||
332 | /* | ||
333 | * The type of device, "struct device" is embedded in. A class | ||
334 | * or bus can contain devices of different types | ||
335 | * like "partitions" and "disks", "mouse" and "event". | ||
336 | * This identifies the device type and carries type-specific | ||
337 | * information, equivalent to the kobj_type of a kobject. | ||
338 | * If "name" is specified, the uevent will contain it in | ||
339 | * the DEVTYPE variable. | ||
340 | */ | ||
331 | struct device_type { | 341 | struct device_type { |
332 | struct device_attribute *attrs; | 342 | const char *name; |
343 | struct attribute_group **groups; | ||
333 | int (*uevent)(struct device *dev, char **envp, int num_envp, | 344 | int (*uevent)(struct device *dev, char **envp, int num_envp, |
334 | char *buffer, int buffer_size); | 345 | char *buffer, int buffer_size); |
335 | void (*release)(struct device *dev); | 346 | void (*release)(struct device *dev); |
347 | int (*suspend)(struct device * dev, pm_message_t state); | ||
348 | int (*resume)(struct device * dev); | ||
336 | }; | 349 | }; |
337 | 350 | ||
338 | /* interface for exporting device attributes */ | 351 | /* interface for exporting device attributes */ |
@@ -354,8 +367,12 @@ extern int __must_check device_create_bin_file(struct device *dev, | |||
354 | struct bin_attribute *attr); | 367 | struct bin_attribute *attr); |
355 | extern void device_remove_bin_file(struct device *dev, | 368 | extern void device_remove_bin_file(struct device *dev, |
356 | struct bin_attribute *attr); | 369 | struct bin_attribute *attr); |
357 | extern int device_schedule_callback(struct device *dev, | 370 | extern int device_schedule_callback_owner(struct device *dev, |
358 | void (*func)(struct device *)); | 371 | void (*func)(struct device *), struct module *owner); |
372 | |||
373 | /* This is a macro to avoid include problems with THIS_MODULE */ | ||
374 | #define device_schedule_callback(dev, func) \ | ||
375 | device_schedule_callback_owner(dev, func, THIS_MODULE) | ||
359 | 376 | ||
360 | /* device resource management */ | 377 | /* device resource management */ |
361 | typedef void (*dr_release_t)(struct device *dev, void *res); | 378 | typedef void (*dr_release_t)(struct device *dev, void *res); |
@@ -554,7 +571,11 @@ extern const char *dev_driver_string(struct device *dev); | |||
554 | #define dev_dbg(dev, format, arg...) \ | 571 | #define dev_dbg(dev, format, arg...) \ |
555 | dev_printk(KERN_DEBUG , dev , format , ## arg) | 572 | dev_printk(KERN_DEBUG , dev , format , ## arg) |
556 | #else | 573 | #else |
557 | #define dev_dbg(dev, format, arg...) do { (void)(dev); } while (0) | 574 | static inline int __attribute__ ((format (printf, 2, 3))) |
575 | dev_dbg(struct device * dev, const char * fmt, ...) | ||
576 | { | ||
577 | return 0; | ||
578 | } | ||
558 | #endif | 579 | #endif |
559 | 580 | ||
560 | #define dev_err(dev, format, arg...) \ | 581 | #define dev_err(dev, format, arg...) \ |
diff --git a/include/linux/dvb/audio.h b/include/linux/dvb/audio.h index 0874a67c6b92..89412e18f571 100644 --- a/include/linux/dvb/audio.h +++ b/include/linux/dvb/audio.h | |||
@@ -47,7 +47,9 @@ typedef enum { | |||
47 | typedef enum { | 47 | typedef enum { |
48 | AUDIO_STEREO, | 48 | AUDIO_STEREO, |
49 | AUDIO_MONO_LEFT, | 49 | AUDIO_MONO_LEFT, |
50 | AUDIO_MONO_RIGHT | 50 | AUDIO_MONO_RIGHT, |
51 | AUDIO_MONO, | ||
52 | AUDIO_STEREO_SWAPPED | ||
51 | } audio_channel_select_t; | 53 | } audio_channel_select_t; |
52 | 54 | ||
53 | 55 | ||
@@ -133,5 +135,6 @@ typedef uint16_t audio_attributes_t; | |||
133 | * extracted by the PES parser. | 135 | * extracted by the PES parser. |
134 | */ | 136 | */ |
135 | #define AUDIO_GET_PTS _IOR('o', 19, __u64) | 137 | #define AUDIO_GET_PTS _IOR('o', 19, __u64) |
138 | #define AUDIO_BILINGUAL_CHANNEL_SELECT _IO('o', 20) | ||
136 | 139 | ||
137 | #endif /* _DVBAUDIO_H_ */ | 140 | #endif /* _DVBAUDIO_H_ */ |
diff --git a/include/linux/dvb/version.h b/include/linux/dvb/version.h index 6183c9c4849e..126e0c26cb09 100644 --- a/include/linux/dvb/version.h +++ b/include/linux/dvb/version.h | |||
@@ -24,6 +24,6 @@ | |||
24 | #define _DVBVERSION_H_ | 24 | #define _DVBVERSION_H_ |
25 | 25 | ||
26 | #define DVB_API_VERSION 3 | 26 | #define DVB_API_VERSION 3 |
27 | #define DVB_API_VERSION_MINOR 1 | 27 | #define DVB_API_VERSION_MINOR 2 |
28 | 28 | ||
29 | #endif /*_DVBVERSION_H_*/ | 29 | #endif /*_DVBVERSION_H_*/ |
diff --git a/include/linux/dvb/video.h b/include/linux/dvb/video.h index faebfda397ff..93e4c3a6d190 100644 --- a/include/linux/dvb/video.h +++ b/include/linux/dvb/video.h | |||
@@ -80,14 +80,70 @@ typedef enum { | |||
80 | } video_play_state_t; | 80 | } video_play_state_t; |
81 | 81 | ||
82 | 82 | ||
83 | /* Decoder commands */ | ||
84 | #define VIDEO_CMD_PLAY (0) | ||
85 | #define VIDEO_CMD_STOP (1) | ||
86 | #define VIDEO_CMD_FREEZE (2) | ||
87 | #define VIDEO_CMD_CONTINUE (3) | ||
88 | |||
89 | /* Flags for VIDEO_CMD_FREEZE */ | ||
90 | #define VIDEO_CMD_FREEZE_TO_BLACK (1 << 0) | ||
91 | |||
92 | /* Flags for VIDEO_CMD_STOP */ | ||
93 | #define VIDEO_CMD_STOP_TO_BLACK (1 << 0) | ||
94 | #define VIDEO_CMD_STOP_IMMEDIATELY (1 << 1) | ||
95 | |||
96 | /* Play input formats: */ | ||
97 | /* The decoder has no special format requirements */ | ||
98 | #define VIDEO_PLAY_FMT_NONE (0) | ||
99 | /* The decoder requires full GOPs */ | ||
100 | #define VIDEO_PLAY_FMT_GOP (1) | ||
101 | |||
102 | /* The structure must be zeroed before use by the application | ||
103 | This ensures it can be extended safely in the future. */ | ||
104 | struct video_command { | ||
105 | __u32 cmd; | ||
106 | __u32 flags; | ||
107 | union { | ||
108 | struct { | ||
109 | __u64 pts; | ||
110 | } stop; | ||
111 | |||
112 | struct { | ||
113 | /* 0 or 1000 specifies normal speed, | ||
114 | 1 specifies forward single stepping, | ||
115 | -1 specifies backward single stepping, | ||
116 | >1: playback at speed/1000 of the normal speed, | ||
117 | <-1: reverse playback at (-speed/1000) of the normal speed. */ | ||
118 | __s32 speed; | ||
119 | __u32 format; | ||
120 | } play; | ||
121 | |||
122 | struct { | ||
123 | __u32 data[16]; | ||
124 | } raw; | ||
125 | }; | ||
126 | }; | ||
127 | |||
128 | /* FIELD_UNKNOWN can be used if the hardware does not know whether | ||
129 | the Vsync is for an odd, even or progressive (i.e. non-interlaced) | ||
130 | field. */ | ||
131 | #define VIDEO_VSYNC_FIELD_UNKNOWN (0) | ||
132 | #define VIDEO_VSYNC_FIELD_ODD (1) | ||
133 | #define VIDEO_VSYNC_FIELD_EVEN (2) | ||
134 | #define VIDEO_VSYNC_FIELD_PROGRESSIVE (3) | ||
135 | |||
83 | struct video_event { | 136 | struct video_event { |
84 | int32_t type; | 137 | int32_t type; |
85 | #define VIDEO_EVENT_SIZE_CHANGED 1 | 138 | #define VIDEO_EVENT_SIZE_CHANGED 1 |
86 | #define VIDEO_EVENT_FRAME_RATE_CHANGED 2 | 139 | #define VIDEO_EVENT_FRAME_RATE_CHANGED 2 |
140 | #define VIDEO_EVENT_DECODER_STOPPED 3 | ||
141 | #define VIDEO_EVENT_VSYNC 4 | ||
87 | time_t timestamp; | 142 | time_t timestamp; |
88 | union { | 143 | union { |
89 | video_size_t size; | 144 | video_size_t size; |
90 | unsigned int frame_rate; /* in frames per 1000sec */ | 145 | unsigned int frame_rate; /* in frames per 1000sec */ |
146 | unsigned char vsync_field; /* unknown/odd/even/progressive */ | ||
91 | } u; | 147 | } u; |
92 | }; | 148 | }; |
93 | 149 | ||
@@ -213,4 +269,10 @@ typedef uint16_t video_attributes_t; | |||
213 | */ | 269 | */ |
214 | #define VIDEO_GET_PTS _IOR('o', 57, __u64) | 270 | #define VIDEO_GET_PTS _IOR('o', 57, __u64) |
215 | 271 | ||
272 | /* Read the number of displayed frames since the decoder was started */ | ||
273 | #define VIDEO_GET_FRAME_COUNT _IOR('o', 58, __u64) | ||
274 | |||
275 | #define VIDEO_COMMAND _IOWR('o', 59, struct video_command) | ||
276 | #define VIDEO_TRY_COMMAND _IOWR('o', 60, struct video_command) | ||
277 | |||
216 | #endif /*_DVBVIDEO_H_*/ | 278 | #endif /*_DVBVIDEO_H_*/ |
diff --git a/include/linux/fib_rules.h b/include/linux/fib_rules.h index 8270aac2aa5d..87b606b63f1e 100644 --- a/include/linux/fib_rules.h +++ b/include/linux/fib_rules.h | |||
@@ -5,8 +5,13 @@ | |||
5 | #include <linux/rtnetlink.h> | 5 | #include <linux/rtnetlink.h> |
6 | 6 | ||
7 | /* rule is permanent, and cannot be deleted */ | 7 | /* rule is permanent, and cannot be deleted */ |
8 | #define FIB_RULE_PERMANENT 1 | 8 | #define FIB_RULE_PERMANENT 0x00000001 |
9 | #define FIB_RULE_INVERT 2 | 9 | #define FIB_RULE_INVERT 0x00000002 |
10 | #define FIB_RULE_UNRESOLVED 0x00000004 | ||
11 | #define FIB_RULE_DEV_DETACHED 0x00000008 | ||
12 | |||
13 | /* try to find source address in routing lookups */ | ||
14 | #define FIB_RULE_FIND_SADDR 0x00010000 | ||
10 | 15 | ||
11 | struct fib_rule_hdr | 16 | struct fib_rule_hdr |
12 | { | 17 | { |
@@ -29,7 +34,7 @@ enum | |||
29 | FRA_DST, /* destination address */ | 34 | FRA_DST, /* destination address */ |
30 | FRA_SRC, /* source address */ | 35 | FRA_SRC, /* source address */ |
31 | FRA_IFNAME, /* interface name */ | 36 | FRA_IFNAME, /* interface name */ |
32 | FRA_UNUSED1, | 37 | FRA_GOTO, /* target to jump to (FR_ACT_GOTO) */ |
33 | FRA_UNUSED2, | 38 | FRA_UNUSED2, |
34 | FRA_PRIORITY, /* priority/preference */ | 39 | FRA_PRIORITY, /* priority/preference */ |
35 | FRA_UNUSED3, | 40 | FRA_UNUSED3, |
@@ -51,8 +56,8 @@ enum | |||
51 | { | 56 | { |
52 | FR_ACT_UNSPEC, | 57 | FR_ACT_UNSPEC, |
53 | FR_ACT_TO_TBL, /* Pass to fixed table */ | 58 | FR_ACT_TO_TBL, /* Pass to fixed table */ |
54 | FR_ACT_RES1, | 59 | FR_ACT_GOTO, /* Jump to another rule */ |
55 | FR_ACT_RES2, | 60 | FR_ACT_NOP, /* No operation */ |
56 | FR_ACT_RES3, | 61 | FR_ACT_RES3, |
57 | FR_ACT_RES4, | 62 | FR_ACT_RES4, |
58 | FR_ACT_BLACKHOLE, /* Drop without notification */ | 63 | FR_ACT_BLACKHOLE, /* Drop without notification */ |
diff --git a/include/linux/fs.h b/include/linux/fs.h index 86ec3f4a7da6..095a9c9a64fb 100644 --- a/include/linux/fs.h +++ b/include/linux/fs.h | |||
@@ -843,8 +843,13 @@ extern int fcntl_setlease(unsigned int fd, struct file *filp, long arg); | |||
843 | extern int fcntl_getlease(struct file *filp); | 843 | extern int fcntl_getlease(struct file *filp); |
844 | 844 | ||
845 | /* fs/sync.c */ | 845 | /* fs/sync.c */ |
846 | extern int do_sync_file_range(struct file *file, loff_t offset, loff_t endbyte, | 846 | extern int do_sync_mapping_range(struct address_space *mapping, loff_t offset, |
847 | unsigned int flags); | 847 | loff_t endbyte, unsigned int flags); |
848 | static inline int do_sync_file_range(struct file *file, loff_t offset, | ||
849 | loff_t endbyte, unsigned int flags) | ||
850 | { | ||
851 | return do_sync_mapping_range(file->f_mapping, offset, endbyte, flags); | ||
852 | } | ||
848 | 853 | ||
849 | /* fs/locks.c */ | 854 | /* fs/locks.c */ |
850 | extern void locks_init_lock(struct file_lock *); | 855 | extern void locks_init_lock(struct file_lock *); |
diff --git a/include/linux/hdlc.h b/include/linux/hdlc.h index d4b333938f73..0fe562af9c8c 100644 --- a/include/linux/hdlc.h +++ b/include/linux/hdlc.h | |||
@@ -132,8 +132,8 @@ static __inline__ __be16 hdlc_type_trans(struct sk_buff *skb, | |||
132 | { | 132 | { |
133 | hdlc_device *hdlc = dev_to_hdlc(dev); | 133 | hdlc_device *hdlc = dev_to_hdlc(dev); |
134 | 134 | ||
135 | skb->mac.raw = skb->data; | 135 | skb->dev = dev; |
136 | skb->dev = dev; | 136 | skb_reset_mac_header(skb); |
137 | 137 | ||
138 | if (hdlc->proto->type_trans) | 138 | if (hdlc->proto->type_trans) |
139 | return hdlc->proto->type_trans(skb, dev); | 139 | return hdlc->proto->type_trans(skb, dev); |
diff --git a/include/linux/icmp.h b/include/linux/icmp.h index 24da4fbc1a2f..474f2a51cf0a 100644 --- a/include/linux/icmp.h +++ b/include/linux/icmp.h | |||
@@ -82,6 +82,15 @@ struct icmphdr { | |||
82 | } un; | 82 | } un; |
83 | }; | 83 | }; |
84 | 84 | ||
85 | #ifdef __KERNEL__ | ||
86 | #include <linux/skbuff.h> | ||
87 | |||
88 | static inline struct icmphdr *icmp_hdr(const struct sk_buff *skb) | ||
89 | { | ||
90 | return (struct icmphdr *)skb_transport_header(skb); | ||
91 | } | ||
92 | #endif | ||
93 | |||
85 | /* | 94 | /* |
86 | * constants for (set|get)sockopt | 95 | * constants for (set|get)sockopt |
87 | */ | 96 | */ |
diff --git a/include/linux/icmpv6.h b/include/linux/icmpv6.h index 68d3526c3a05..7c5e9817e998 100644 --- a/include/linux/icmpv6.h +++ b/include/linux/icmpv6.h | |||
@@ -75,6 +75,15 @@ struct icmp6hdr { | |||
75 | #define icmp6_router_pref icmp6_dataun.u_nd_ra.router_pref | 75 | #define icmp6_router_pref icmp6_dataun.u_nd_ra.router_pref |
76 | }; | 76 | }; |
77 | 77 | ||
78 | #ifdef __KERNEL__ | ||
79 | #include <linux/skbuff.h> | ||
80 | |||
81 | static inline struct icmp6hdr *icmp6_hdr(const struct sk_buff *skb) | ||
82 | { | ||
83 | return (struct icmp6hdr *)skb_transport_header(skb); | ||
84 | } | ||
85 | #endif | ||
86 | |||
78 | #define ICMPV6_ROUTER_PREF_LOW 0x3 | 87 | #define ICMPV6_ROUTER_PREF_LOW 0x3 |
79 | #define ICMPV6_ROUTER_PREF_MEDIUM 0x0 | 88 | #define ICMPV6_ROUTER_PREF_MEDIUM 0x0 |
80 | #define ICMPV6_ROUTER_PREF_HIGH 0x1 | 89 | #define ICMPV6_ROUTER_PREF_HIGH 0x1 |
diff --git a/include/linux/if_addr.h b/include/linux/if_addr.h index d557e4ce9b6b..43f3bedaafd3 100644 --- a/include/linux/if_addr.h +++ b/include/linux/if_addr.h | |||
@@ -39,6 +39,7 @@ enum | |||
39 | #define IFA_F_TEMPORARY IFA_F_SECONDARY | 39 | #define IFA_F_TEMPORARY IFA_F_SECONDARY |
40 | 40 | ||
41 | #define IFA_F_NODAD 0x02 | 41 | #define IFA_F_NODAD 0x02 |
42 | #define IFA_F_OPTIMISTIC 0x04 | ||
42 | #define IFA_F_HOMEADDRESS 0x10 | 43 | #define IFA_F_HOMEADDRESS 0x10 |
43 | #define IFA_F_DEPRECATED 0x20 | 44 | #define IFA_F_DEPRECATED 0x20 |
44 | #define IFA_F_TENTATIVE 0x40 | 45 | #define IFA_F_TENTATIVE 0x40 |
diff --git a/include/linux/if_arp.h b/include/linux/if_arp.h index 7f5714214ee3..ed7b93c3083a 100644 --- a/include/linux/if_arp.h +++ b/include/linux/if_arp.h | |||
@@ -148,4 +148,13 @@ struct arphdr | |||
148 | 148 | ||
149 | }; | 149 | }; |
150 | 150 | ||
151 | #ifdef __KERNEL__ | ||
152 | #include <linux/skbuff.h> | ||
153 | |||
154 | static inline struct arphdr *arp_hdr(const struct sk_buff *skb) | ||
155 | { | ||
156 | return (struct arphdr *)skb_network_header(skb); | ||
157 | } | ||
158 | #endif | ||
159 | |||
151 | #endif /* _LINUX_IF_ARP_H */ | 160 | #endif /* _LINUX_IF_ARP_H */ |
diff --git a/include/linux/if_bridge.h b/include/linux/if_bridge.h index fd1b6eb94a5f..4ff211d98769 100644 --- a/include/linux/if_bridge.h +++ b/include/linux/if_bridge.h | |||
@@ -105,7 +105,8 @@ struct __fdb_entry | |||
105 | #include <linux/netdevice.h> | 105 | #include <linux/netdevice.h> |
106 | 106 | ||
107 | extern void brioctl_set(int (*ioctl_hook)(unsigned int, void __user *)); | 107 | extern void brioctl_set(int (*ioctl_hook)(unsigned int, void __user *)); |
108 | extern int (*br_handle_frame_hook)(struct net_bridge_port *p, struct sk_buff **pskb); | 108 | extern struct sk_buff *(*br_handle_frame_hook)(struct net_bridge_port *p, |
109 | struct sk_buff *skb); | ||
109 | extern int (*br_should_route_hook)(struct sk_buff **pskb); | 110 | extern int (*br_should_route_hook)(struct sk_buff **pskb); |
110 | 111 | ||
111 | #endif | 112 | #endif |
diff --git a/include/linux/if_ether.h b/include/linux/if_ether.h index ab08f35cbc35..1db774cf9dc2 100644 --- a/include/linux/if_ether.h +++ b/include/linux/if_ether.h | |||
@@ -61,6 +61,7 @@ | |||
61 | #define ETH_P_8021Q 0x8100 /* 802.1Q VLAN Extended Header */ | 61 | #define ETH_P_8021Q 0x8100 /* 802.1Q VLAN Extended Header */ |
62 | #define ETH_P_IPX 0x8137 /* IPX over DIX */ | 62 | #define ETH_P_IPX 0x8137 /* IPX over DIX */ |
63 | #define ETH_P_IPV6 0x86DD /* IPv6 over bluebook */ | 63 | #define ETH_P_IPV6 0x86DD /* IPv6 over bluebook */ |
64 | #define ETH_P_PAUSE 0x8808 /* IEEE Pause frames. See 802.3 31B */ | ||
64 | #define ETH_P_SLOW 0x8809 /* Slow Protocol. See 802.3ad 43B */ | 65 | #define ETH_P_SLOW 0x8809 /* Slow Protocol. See 802.3ad 43B */ |
65 | #define ETH_P_WCCP 0x883E /* Web-cache coordination protocol | 66 | #define ETH_P_WCCP 0x883E /* Web-cache coordination protocol |
66 | * defined in draft-wilson-wrec-wccp-v2-00.txt */ | 67 | * defined in draft-wilson-wrec-wccp-v2-00.txt */ |
@@ -112,7 +113,7 @@ struct ethhdr { | |||
112 | 113 | ||
113 | static inline struct ethhdr *eth_hdr(const struct sk_buff *skb) | 114 | static inline struct ethhdr *eth_hdr(const struct sk_buff *skb) |
114 | { | 115 | { |
115 | return (struct ethhdr *)skb->mac.raw; | 116 | return (struct ethhdr *)skb_mac_header(skb); |
116 | } | 117 | } |
117 | 118 | ||
118 | #ifdef CONFIG_SYSCTL | 119 | #ifdef CONFIG_SYSCTL |
diff --git a/include/linux/if_link.h b/include/linux/if_link.h index 35ed3b5467f3..604c2434f71c 100644 --- a/include/linux/if_link.h +++ b/include/linux/if_link.h | |||
@@ -126,6 +126,7 @@ enum | |||
126 | IFLA_INET6_STATS, /* statistics */ | 126 | IFLA_INET6_STATS, /* statistics */ |
127 | IFLA_INET6_MCAST, /* MC things. What of them? */ | 127 | IFLA_INET6_MCAST, /* MC things. What of them? */ |
128 | IFLA_INET6_CACHEINFO, /* time values and max reasm size */ | 128 | IFLA_INET6_CACHEINFO, /* time values and max reasm size */ |
129 | IFLA_INET6_ICMP6STATS, /* statistics (icmpv6) */ | ||
129 | __IFLA_INET6_MAX | 130 | __IFLA_INET6_MAX |
130 | }; | 131 | }; |
131 | 132 | ||
diff --git a/include/linux/if_packet.h b/include/linux/if_packet.h index f3de05c30678..ad09609227ff 100644 --- a/include/linux/if_packet.h +++ b/include/linux/if_packet.h | |||
@@ -42,6 +42,7 @@ struct sockaddr_ll | |||
42 | #define PACKET_STATISTICS 6 | 42 | #define PACKET_STATISTICS 6 |
43 | #define PACKET_COPY_THRESH 7 | 43 | #define PACKET_COPY_THRESH 7 |
44 | #define PACKET_AUXDATA 8 | 44 | #define PACKET_AUXDATA 8 |
45 | #define PACKET_ORIGDEV 9 | ||
45 | 46 | ||
46 | struct tpacket_stats | 47 | struct tpacket_stats |
47 | { | 48 | { |
diff --git a/include/linux/if_pppox.h b/include/linux/if_pppox.h index e33ee763c052..6f987be60fe2 100644 --- a/include/linux/if_pppox.h +++ b/include/linux/if_pppox.h | |||
@@ -111,7 +111,17 @@ struct pppoe_hdr { | |||
111 | struct pppoe_tag tag[0]; | 111 | struct pppoe_tag tag[0]; |
112 | } __attribute__ ((packed)); | 112 | } __attribute__ ((packed)); |
113 | 113 | ||
114 | /* Length of entire PPPoE + PPP header */ | ||
115 | #define PPPOE_SES_HLEN 8 | ||
116 | |||
114 | #ifdef __KERNEL__ | 117 | #ifdef __KERNEL__ |
118 | #include <linux/skbuff.h> | ||
119 | |||
120 | static inline struct pppoe_hdr *pppoe_hdr(const struct sk_buff *skb) | ||
121 | { | ||
122 | return (struct pppoe_hdr *)skb_network_header(skb); | ||
123 | } | ||
124 | |||
115 | struct pppoe_opt { | 125 | struct pppoe_opt { |
116 | struct net_device *dev; /* device associated with socket*/ | 126 | struct net_device *dev; /* device associated with socket*/ |
117 | int ifindex; /* ifindex of device associated with socket */ | 127 | int ifindex; /* ifindex of device associated with socket */ |
diff --git a/include/linux/if_tr.h b/include/linux/if_tr.h index 2f94cf2c7abb..046e9d95ba9a 100644 --- a/include/linux/if_tr.h +++ b/include/linux/if_tr.h | |||
@@ -47,7 +47,7 @@ struct trh_hdr { | |||
47 | 47 | ||
48 | static inline struct trh_hdr *tr_hdr(const struct sk_buff *skb) | 48 | static inline struct trh_hdr *tr_hdr(const struct sk_buff *skb) |
49 | { | 49 | { |
50 | return (struct trh_hdr *)skb->mac.raw; | 50 | return (struct trh_hdr *)skb_mac_header(skb); |
51 | } | 51 | } |
52 | #ifdef CONFIG_SYSCTL | 52 | #ifdef CONFIG_SYSCTL |
53 | extern struct ctl_table tr_table[]; | 53 | extern struct ctl_table tr_table[]; |
diff --git a/include/linux/if_vlan.h b/include/linux/if_vlan.h index d103580c72d2..81e9bc93569b 100644 --- a/include/linux/if_vlan.h +++ b/include/linux/if_vlan.h | |||
@@ -51,7 +51,7 @@ struct vlan_ethhdr { | |||
51 | 51 | ||
52 | static inline struct vlan_ethhdr *vlan_eth_hdr(const struct sk_buff *skb) | 52 | static inline struct vlan_ethhdr *vlan_eth_hdr(const struct sk_buff *skb) |
53 | { | 53 | { |
54 | return (struct vlan_ethhdr *)skb->mac.raw; | 54 | return (struct vlan_ethhdr *)skb_mac_header(skb); |
55 | } | 55 | } |
56 | 56 | ||
57 | struct vlan_hdr { | 57 | struct vlan_hdr { |
@@ -275,8 +275,8 @@ static inline struct sk_buff *__vlan_put_tag(struct sk_buff *skb, unsigned short | |||
275 | veth->h_vlan_TCI = htons(tag); | 275 | veth->h_vlan_TCI = htons(tag); |
276 | 276 | ||
277 | skb->protocol = __constant_htons(ETH_P_8021Q); | 277 | skb->protocol = __constant_htons(ETH_P_8021Q); |
278 | skb->mac.raw -= VLAN_HLEN; | 278 | skb->mac_header -= VLAN_HLEN; |
279 | skb->nh.raw -= VLAN_HLEN; | 279 | skb->network_header -= VLAN_HLEN; |
280 | 280 | ||
281 | return skb; | 281 | return skb; |
282 | } | 282 | } |
diff --git a/include/linux/if_wanpipe_common.h b/include/linux/if_wanpipe_common.h deleted file mode 100644 index 6e5461d69fdd..000000000000 --- a/include/linux/if_wanpipe_common.h +++ /dev/null | |||
@@ -1,58 +0,0 @@ | |||
1 | /***************************************************************************** | ||
2 | * if_wanipe_common.h Sangoma Driver/Socket common area definitions. | ||
3 | * | ||
4 | * Author: Nenad Corbic <ncorbic@sangoma.com> | ||
5 | * | ||
6 | * Copyright: (c) 2000 Sangoma Technologies Inc. | ||
7 | * | ||
8 | * This program is free software; you can redistribute it and/or | ||
9 | * modify it under the terms of the GNU General Public License | ||
10 | * as published by the Free Software Foundation; either version | ||
11 | * 2 of the License, or (at your option) any later version. | ||
12 | * ============================================================================ | ||
13 | * Jan 13, 2000 Nenad Corbic Initial version | ||
14 | *****************************************************************************/ | ||
15 | |||
16 | |||
17 | #ifndef _WANPIPE_SOCK_DRIVER_COMMON_H | ||
18 | #define _WANPIPE_SOCK_DRIVER_COMMON_H | ||
19 | |||
20 | typedef struct { | ||
21 | struct net_device *slave; | ||
22 | atomic_t packet_sent; | ||
23 | atomic_t receive_block; | ||
24 | atomic_t command; | ||
25 | atomic_t disconnect; | ||
26 | atomic_t driver_busy; | ||
27 | long common_critical; | ||
28 | struct timer_list *tx_timer; | ||
29 | struct sock *sk; /* Wanpipe Sock bind's here */ | ||
30 | int (*func)(struct sk_buff *skb, struct net_device *dev, | ||
31 | struct sock *sk); | ||
32 | |||
33 | struct work_struct wanpipe_work; /* deferred keventd work */ | ||
34 | unsigned char rw_bind; /* Sock bind state */ | ||
35 | unsigned char usedby; | ||
36 | unsigned char state; | ||
37 | unsigned char svc; | ||
38 | unsigned short lcn; | ||
39 | void *mbox; | ||
40 | } wanpipe_common_t; | ||
41 | |||
42 | |||
43 | enum { | ||
44 | WANSOCK_UNCONFIGURED, /* link/channel is not configured */ | ||
45 | WANSOCK_DISCONNECTED, /* link/channel is disconnected */ | ||
46 | WANSOCK_CONNECTING, /* connection is in progress */ | ||
47 | WANSOCK_CONNECTED, /* link/channel is operational */ | ||
48 | WANSOCK_LIMIT, /* for verification only */ | ||
49 | WANSOCK_DUALPORT, /* for Dual Port cards */ | ||
50 | WANSOCK_DISCONNECTING, | ||
51 | WANSOCK_BINDED, | ||
52 | WANSOCK_BIND_LISTEN, | ||
53 | WANSOCK_LISTEN | ||
54 | }; | ||
55 | |||
56 | #endif | ||
57 | |||
58 | |||
diff --git a/include/linux/igmp.h b/include/linux/igmp.h index a113fe68d8a1..f510e7e382a8 100644 --- a/include/linux/igmp.h +++ b/include/linux/igmp.h | |||
@@ -80,6 +80,27 @@ struct igmpv3_query { | |||
80 | __be32 srcs[0]; | 80 | __be32 srcs[0]; |
81 | }; | 81 | }; |
82 | 82 | ||
83 | #ifdef __KERNEL__ | ||
84 | #include <linux/skbuff.h> | ||
85 | |||
86 | static inline struct igmphdr *igmp_hdr(const struct sk_buff *skb) | ||
87 | { | ||
88 | return (struct igmphdr *)skb_transport_header(skb); | ||
89 | } | ||
90 | |||
91 | static inline struct igmpv3_report * | ||
92 | igmpv3_report_hdr(const struct sk_buff *skb) | ||
93 | { | ||
94 | return (struct igmpv3_report *)skb_transport_header(skb); | ||
95 | } | ||
96 | |||
97 | static inline struct igmpv3_query * | ||
98 | igmpv3_query_hdr(const struct sk_buff *skb) | ||
99 | { | ||
100 | return (struct igmpv3_query *)skb_transport_header(skb); | ||
101 | } | ||
102 | #endif | ||
103 | |||
83 | #define IGMP_HOST_MEMBERSHIP_QUERY 0x11 /* From RFC1112 */ | 104 | #define IGMP_HOST_MEMBERSHIP_QUERY 0x11 /* From RFC1112 */ |
84 | #define IGMP_HOST_MEMBERSHIP_REPORT 0x12 /* Ditto */ | 105 | #define IGMP_HOST_MEMBERSHIP_REPORT 0x12 /* Ditto */ |
85 | #define IGMP_DVMRP 0x13 /* DVMRP routing */ | 106 | #define IGMP_DVMRP 0x13 /* DVMRP routing */ |
diff --git a/include/linux/in.h b/include/linux/in.h index 1912e7c0bc26..3975cbf52f20 100644 --- a/include/linux/in.h +++ b/include/linux/in.h | |||
@@ -83,6 +83,7 @@ struct in_addr { | |||
83 | #define IP_PMTUDISC_DONT 0 /* Never send DF frames */ | 83 | #define IP_PMTUDISC_DONT 0 /* Never send DF frames */ |
84 | #define IP_PMTUDISC_WANT 1 /* Use per route hints */ | 84 | #define IP_PMTUDISC_WANT 1 /* Use per route hints */ |
85 | #define IP_PMTUDISC_DO 2 /* Always DF */ | 85 | #define IP_PMTUDISC_DO 2 /* Always DF */ |
86 | #define IP_PMTUDISC_PROBE 3 /* Ignore dst pmtu */ | ||
86 | 87 | ||
87 | #define IP_MULTICAST_IF 32 | 88 | #define IP_MULTICAST_IF 32 |
88 | #define IP_MULTICAST_TTL 33 | 89 | #define IP_MULTICAST_TTL 33 |
diff --git a/include/linux/in6.h b/include/linux/in6.h index 4e8350ae8869..2a61c82af115 100644 --- a/include/linux/in6.h +++ b/include/linux/in6.h | |||
@@ -44,10 +44,8 @@ struct in6_addr | |||
44 | * NOTE: Be aware the IN6ADDR_* constants and in6addr_* externals are defined | 44 | * NOTE: Be aware the IN6ADDR_* constants and in6addr_* externals are defined |
45 | * in network byte order, not in host byte order as are the IPv4 equivalents | 45 | * in network byte order, not in host byte order as are the IPv4 equivalents |
46 | */ | 46 | */ |
47 | #if 0 | ||
48 | extern const struct in6_addr in6addr_any; | 47 | extern const struct in6_addr in6addr_any; |
49 | #define IN6ADDR_ANY_INIT { { { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 } } } | 48 | #define IN6ADDR_ANY_INIT { { { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 } } } |
50 | #endif | ||
51 | extern const struct in6_addr in6addr_loopback; | 49 | extern const struct in6_addr in6addr_loopback; |
52 | #define IN6ADDR_LOOPBACK_INIT { { { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1 } } } | 50 | #define IN6ADDR_LOOPBACK_INIT { { { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1 } } } |
53 | 51 | ||
@@ -179,6 +177,7 @@ struct in6_flowlabel_req | |||
179 | #define IPV6_PMTUDISC_DONT 0 | 177 | #define IPV6_PMTUDISC_DONT 0 |
180 | #define IPV6_PMTUDISC_WANT 1 | 178 | #define IPV6_PMTUDISC_WANT 1 |
181 | #define IPV6_PMTUDISC_DO 2 | 179 | #define IPV6_PMTUDISC_DO 2 |
180 | #define IPV6_PMTUDISC_PROBE 3 | ||
182 | 181 | ||
183 | /* Flowlabel */ | 182 | /* Flowlabel */ |
184 | #define IPV6_FLOWLABEL_MGR 32 | 183 | #define IPV6_FLOWLABEL_MGR 32 |
diff --git a/include/linux/io.h b/include/linux/io.h index c244a0cc9319..09d351236379 100644 --- a/include/linux/io.h +++ b/include/linux/io.h | |||
@@ -33,9 +33,22 @@ int ioremap_page_range(unsigned long addr, unsigned long end, | |||
33 | /* | 33 | /* |
34 | * Managed iomap interface | 34 | * Managed iomap interface |
35 | */ | 35 | */ |
36 | #ifdef CONFIG_HAS_IOPORT | ||
36 | void __iomem * devm_ioport_map(struct device *dev, unsigned long port, | 37 | void __iomem * devm_ioport_map(struct device *dev, unsigned long port, |
37 | unsigned int nr); | 38 | unsigned int nr); |
38 | void devm_ioport_unmap(struct device *dev, void __iomem *addr); | 39 | void devm_ioport_unmap(struct device *dev, void __iomem *addr); |
40 | #else | ||
41 | static inline void __iomem *devm_ioport_map(struct device *dev, | ||
42 | unsigned long port, | ||
43 | unsigned int nr) | ||
44 | { | ||
45 | return NULL; | ||
46 | } | ||
47 | |||
48 | static inline void devm_ioport_unmap(struct device *dev, void __iomem *addr) | ||
49 | { | ||
50 | } | ||
51 | #endif | ||
39 | 52 | ||
40 | void __iomem * devm_ioremap(struct device *dev, unsigned long offset, | 53 | void __iomem * devm_ioremap(struct device *dev, unsigned long offset, |
41 | unsigned long size); | 54 | unsigned long size); |
diff --git a/include/linux/ip.h b/include/linux/ip.h index 1d36b971a8b5..bd0a2a8631c6 100644 --- a/include/linux/ip.h +++ b/include/linux/ip.h | |||
@@ -104,6 +104,20 @@ struct iphdr { | |||
104 | /*The options start here. */ | 104 | /*The options start here. */ |
105 | }; | 105 | }; |
106 | 106 | ||
107 | #ifdef __KERNEL__ | ||
108 | #include <linux/skbuff.h> | ||
109 | |||
110 | static inline struct iphdr *ip_hdr(const struct sk_buff *skb) | ||
111 | { | ||
112 | return (struct iphdr *)skb_network_header(skb); | ||
113 | } | ||
114 | |||
115 | static inline struct iphdr *ipip_hdr(const struct sk_buff *skb) | ||
116 | { | ||
117 | return (struct iphdr *)skb_transport_header(skb); | ||
118 | } | ||
119 | #endif | ||
120 | |||
107 | struct ip_auth_hdr { | 121 | struct ip_auth_hdr { |
108 | __u8 nexthdr; | 122 | __u8 nexthdr; |
109 | __u8 hdrlen; /* This one is measured in 32 bit units! */ | 123 | __u8 hdrlen; /* This one is measured in 32 bit units! */ |
diff --git a/include/linux/ipv6.h b/include/linux/ipv6.h index f8241130f5ea..09ea01a8a99c 100644 --- a/include/linux/ipv6.h +++ b/include/linux/ipv6.h | |||
@@ -177,6 +177,10 @@ struct ipv6_devconf { | |||
177 | #endif | 177 | #endif |
178 | #endif | 178 | #endif |
179 | __s32 proxy_ndp; | 179 | __s32 proxy_ndp; |
180 | __s32 accept_source_route; | ||
181 | #ifdef CONFIG_IPV6_OPTIMISTIC_DAD | ||
182 | __s32 optimistic_dad; | ||
183 | #endif | ||
180 | void *sysctl; | 184 | void *sysctl; |
181 | }; | 185 | }; |
182 | 186 | ||
@@ -205,6 +209,9 @@ enum { | |||
205 | DEVCONF_RTR_PROBE_INTERVAL, | 209 | DEVCONF_RTR_PROBE_INTERVAL, |
206 | DEVCONF_ACCEPT_RA_RT_INFO_MAX_PLEN, | 210 | DEVCONF_ACCEPT_RA_RT_INFO_MAX_PLEN, |
207 | DEVCONF_PROXY_NDP, | 211 | DEVCONF_PROXY_NDP, |
212 | __DEVCONF_OPTIMISTIC_DAD, | ||
213 | DEVCONF_ACCEPT_SOURCE_ROUTE, | ||
214 | DEVCONF_OPTIMISTIC_DAD, | ||
208 | DEVCONF_MAX | 215 | DEVCONF_MAX |
209 | }; | 216 | }; |
210 | 217 | ||
@@ -216,6 +223,16 @@ enum { | |||
216 | #include <net/if_inet6.h> /* struct ipv6_mc_socklist */ | 223 | #include <net/if_inet6.h> /* struct ipv6_mc_socklist */ |
217 | #include <net/inet_sock.h> | 224 | #include <net/inet_sock.h> |
218 | 225 | ||
226 | static inline struct ipv6hdr *ipv6_hdr(const struct sk_buff *skb) | ||
227 | { | ||
228 | return (struct ipv6hdr *)skb_network_header(skb); | ||
229 | } | ||
230 | |||
231 | static inline struct ipv6hdr *ipipv6_hdr(const struct sk_buff *skb) | ||
232 | { | ||
233 | return (struct ipv6hdr *)skb_transport_header(skb); | ||
234 | } | ||
235 | |||
219 | /* | 236 | /* |
220 | This structure contains results of exthdrs parsing | 237 | This structure contains results of exthdrs parsing |
221 | as offsets from skb->nh. | 238 | as offsets from skb->nh. |
diff --git a/include/linux/jhash.h b/include/linux/jhash.h index 82c7ae412eec..2a2f99fbcb16 100644 --- a/include/linux/jhash.h +++ b/include/linux/jhash.h | |||
@@ -84,7 +84,7 @@ static inline u32 jhash(const void *key, u32 length, u32 initval) | |||
84 | /* A special optimized version that handles 1 or more of u32s. | 84 | /* A special optimized version that handles 1 or more of u32s. |
85 | * The length parameter here is the number of u32s in the key. | 85 | * The length parameter here is the number of u32s in the key. |
86 | */ | 86 | */ |
87 | static inline u32 jhash2(u32 *k, u32 length, u32 initval) | 87 | static inline u32 jhash2(const u32 *k, u32 length, u32 initval) |
88 | { | 88 | { |
89 | u32 a, b, c, len; | 89 | u32 a, b, c, len; |
90 | 90 | ||
diff --git a/include/linux/key.h b/include/linux/key.h index 169f05e4863e..a9220e75782e 100644 --- a/include/linux/key.h +++ b/include/linux/key.h | |||
@@ -160,6 +160,8 @@ struct key { | |||
160 | */ | 160 | */ |
161 | union { | 161 | union { |
162 | struct list_head link; | 162 | struct list_head link; |
163 | unsigned long x[2]; | ||
164 | void *p[2]; | ||
163 | } type_data; | 165 | } type_data; |
164 | 166 | ||
165 | /* key data | 167 | /* key data |
diff --git a/include/linux/kobject.h b/include/linux/kobject.h index b850e0310538..eb0e63ef297f 100644 --- a/include/linux/kobject.h +++ b/include/linux/kobject.h | |||
@@ -22,7 +22,6 @@ | |||
22 | #include <linux/sysfs.h> | 22 | #include <linux/sysfs.h> |
23 | #include <linux/compiler.h> | 23 | #include <linux/compiler.h> |
24 | #include <linux/spinlock.h> | 24 | #include <linux/spinlock.h> |
25 | #include <linux/rwsem.h> | ||
26 | #include <linux/kref.h> | 25 | #include <linux/kref.h> |
27 | #include <linux/kernel.h> | 26 | #include <linux/kernel.h> |
28 | #include <linux/wait.h> | 27 | #include <linux/wait.h> |
@@ -43,11 +42,9 @@ enum kobject_action { | |||
43 | KOBJ_ADD = (__force kobject_action_t) 0x01, /* exclusive to core */ | 42 | KOBJ_ADD = (__force kobject_action_t) 0x01, /* exclusive to core */ |
44 | KOBJ_REMOVE = (__force kobject_action_t) 0x02, /* exclusive to core */ | 43 | KOBJ_REMOVE = (__force kobject_action_t) 0x02, /* exclusive to core */ |
45 | KOBJ_CHANGE = (__force kobject_action_t) 0x03, /* device state change */ | 44 | KOBJ_CHANGE = (__force kobject_action_t) 0x03, /* device state change */ |
46 | KOBJ_MOUNT = (__force kobject_action_t) 0x04, /* mount event for block devices (broken) */ | 45 | KOBJ_OFFLINE = (__force kobject_action_t) 0x04, /* device offline */ |
47 | KOBJ_UMOUNT = (__force kobject_action_t) 0x05, /* umount event for block devices (broken) */ | 46 | KOBJ_ONLINE = (__force kobject_action_t) 0x05, /* device online */ |
48 | KOBJ_OFFLINE = (__force kobject_action_t) 0x06, /* device offline */ | 47 | KOBJ_MOVE = (__force kobject_action_t) 0x06, /* device move */ |
49 | KOBJ_ONLINE = (__force kobject_action_t) 0x07, /* device online */ | ||
50 | KOBJ_MOVE = (__force kobject_action_t) 0x08, /* device move */ | ||
51 | }; | 48 | }; |
52 | 49 | ||
53 | struct kobject { | 50 | struct kobject { |
@@ -89,6 +86,8 @@ extern void kobject_unregister(struct kobject *); | |||
89 | extern struct kobject * kobject_get(struct kobject *); | 86 | extern struct kobject * kobject_get(struct kobject *); |
90 | extern void kobject_put(struct kobject *); | 87 | extern void kobject_put(struct kobject *); |
91 | 88 | ||
89 | extern struct kobject *kobject_kset_add_dir(struct kset *kset, | ||
90 | struct kobject *, const char *); | ||
92 | extern struct kobject *kobject_add_dir(struct kobject *, const char *); | 91 | extern struct kobject *kobject_add_dir(struct kobject *, const char *); |
93 | 92 | ||
94 | extern char * kobject_get_path(struct kobject *, gfp_t); | 93 | extern char * kobject_get_path(struct kobject *, gfp_t); |
@@ -175,7 +174,6 @@ extern struct kobject * kset_find_obj(struct kset *, const char *); | |||
175 | 174 | ||
176 | struct subsystem { | 175 | struct subsystem { |
177 | struct kset kset; | 176 | struct kset kset; |
178 | struct rw_semaphore rwsem; | ||
179 | }; | 177 | }; |
180 | 178 | ||
181 | #define decl_subsys(_name,_type,_uevent_ops) \ | 179 | #define decl_subsys(_name,_type,_uevent_ops) \ |
diff --git a/include/linux/ktime.h b/include/linux/ktime.h index 248305bb9a18..81bb9c7a4eb3 100644 --- a/include/linux/ktime.h +++ b/include/linux/ktime.h | |||
@@ -259,6 +259,12 @@ static inline s64 ktime_to_ns(const ktime_t kt) | |||
259 | 259 | ||
260 | #endif | 260 | #endif |
261 | 261 | ||
262 | static inline s64 ktime_to_us(const ktime_t kt) | ||
263 | { | ||
264 | struct timeval tv = ktime_to_timeval(kt); | ||
265 | return (s64) tv.tv_sec * USEC_PER_SEC + tv.tv_usec; | ||
266 | } | ||
267 | |||
262 | /* | 268 | /* |
263 | * The resolution of the clocks. The resolution value is returned in | 269 | * The resolution of the clocks. The resolution value is returned in |
264 | * the clock_getres() system call to give application programmers an | 270 | * the clock_getres() system call to give application programmers an |
diff --git a/include/linux/mtd/iflash.h b/include/linux/mtd/iflash.h deleted file mode 100644 index 9aa5b4f02666..000000000000 --- a/include/linux/mtd/iflash.h +++ /dev/null | |||
@@ -1,98 +0,0 @@ | |||
1 | /* $Id: iflash.h,v 1.2 2000/11/13 18:01:54 dwmw2 Exp $ */ | ||
2 | |||
3 | #ifndef __MTD_IFLASH_H__ | ||
4 | #define __MTD_IFLASH_H__ | ||
5 | |||
6 | /* Extended CIS registers for Series 2 and 2+ cards */ | ||
7 | /* The registers are all offsets from 0x4000 */ | ||
8 | #define CISREG_CSR 0x0100 | ||
9 | #define CISREG_WP 0x0104 | ||
10 | #define CISREG_RDYBSY 0x0140 | ||
11 | |||
12 | /* Extended CIS registers for Series 2 cards */ | ||
13 | #define CISREG_SLEEP 0x0118 | ||
14 | #define CISREG_RDY_MASK 0x0120 | ||
15 | #define CISREG_RDY_STATUS 0x0130 | ||
16 | |||
17 | /* Extended CIS registers for Series 2+ cards */ | ||
18 | #define CISREG_VCR 0x010c | ||
19 | |||
20 | /* Card Status Register */ | ||
21 | #define CSR_SRESET 0x20 /* Soft reset */ | ||
22 | #define CSR_CMWP 0x10 /* Common memory write protect */ | ||
23 | #define CSR_PWRDOWN 0x08 /* Power down status */ | ||
24 | #define CSR_CISWP 0x04 /* Common memory CIS WP */ | ||
25 | #define CSR_WP 0x02 /* Mechanical write protect */ | ||
26 | #define CSR_READY 0x01 /* Ready/busy status */ | ||
27 | |||
28 | /* Write Protection Register */ | ||
29 | #define WP_BLKEN 0x04 /* Enable block locking */ | ||
30 | #define WP_CMWP 0x02 /* Common memory write protect */ | ||
31 | #define WP_CISWP 0x01 /* Common memory CIS WP */ | ||
32 | |||
33 | /* Voltage Control Register */ | ||
34 | #define VCR_VCC_LEVEL 0x80 /* 0 = 5V, 1 = 3.3V */ | ||
35 | #define VCR_VPP_VALID 0x02 /* Vpp Valid */ | ||
36 | #define VCR_VPP_GEN 0x01 /* Integrated Vpp generator */ | ||
37 | |||
38 | /* Ready/Busy Mode Register */ | ||
39 | #define RDYBSY_RACK 0x02 /* Ready acknowledge */ | ||
40 | #define RDYBSY_MODE 0x01 /* 1 = high performance */ | ||
41 | |||
42 | #define LOW(x) ((x) & 0xff) | ||
43 | |||
44 | /* 28F008SA-Compatible Command Set */ | ||
45 | #define IF_READ_ARRAY 0xffff | ||
46 | #define IF_INTEL_ID 0x9090 | ||
47 | #define IF_READ_CSR 0x7070 | ||
48 | #define IF_CLEAR_CSR 0x5050 | ||
49 | #define IF_WRITE 0x4040 | ||
50 | #define IF_BLOCK_ERASE 0x2020 | ||
51 | #define IF_ERASE_SUSPEND 0xb0b0 | ||
52 | #define IF_CONFIRM 0xd0d0 | ||
53 | |||
54 | /* 28F016SA Performance Enhancement Commands */ | ||
55 | #define IF_READ_PAGE 0x7575 | ||
56 | #define IF_PAGE_SWAP 0x7272 | ||
57 | #define IF_SINGLE_LOAD 0x7474 | ||
58 | #define IF_SEQ_LOAD 0xe0e0 | ||
59 | #define IF_PAGE_WRITE 0x0c0c | ||
60 | #define IF_RDY_MODE 0x9696 | ||
61 | #define IF_RDY_LEVEL 0x0101 | ||
62 | #define IF_RDY_PULSE_WRITE 0x0202 | ||
63 | #define IF_RDY_PULSE_ERASE 0x0303 | ||
64 | #define IF_RDY_DISABLE 0x0404 | ||
65 | #define IF_LOCK_BLOCK 0x7777 | ||
66 | #define IF_UPLOAD_STATUS 0x9797 | ||
67 | #define IF_READ_ESR 0x7171 | ||
68 | #define IF_ERASE_UNLOCKED 0xa7a7 | ||
69 | #define IF_SLEEP 0xf0f0 | ||
70 | #define IF_ABORT 0x8080 | ||
71 | #define IF_UPLOAD_DEVINFO 0x9999 | ||
72 | |||
73 | /* Definitions for Compatible Status Register */ | ||
74 | #define CSR_WR_READY 0x8080 /* Write state machine status */ | ||
75 | #define CSR_ERA_SUSPEND 0x4040 /* Erase suspend status */ | ||
76 | #define CSR_ERA_ERR 0x2020 /* Erase status */ | ||
77 | #define CSR_WR_ERR 0x1010 /* Data write status */ | ||
78 | #define CSR_VPP_LOW 0x0808 /* Vpp status */ | ||
79 | |||
80 | /* Definitions for Global Status Register */ | ||
81 | #define GSR_WR_READY 0x8080 /* Write state machine status */ | ||
82 | #define GSR_OP_SUSPEND 0x4040 /* Operation suspend status */ | ||
83 | #define GSR_OP_ERR 0x2020 /* Device operation status */ | ||
84 | #define GSR_SLEEP 0x1010 /* Device sleep status */ | ||
85 | #define GSR_QUEUE_FULL 0x0808 /* Queue status */ | ||
86 | #define GSR_PAGE_AVAIL 0x0404 /* Page buffer available status */ | ||
87 | #define GSR_PAGE_READY 0x0202 /* Page buffer status */ | ||
88 | #define GSR_PAGE_SELECT 0x0101 /* Page buffer select status */ | ||
89 | |||
90 | /* Definitions for Block Status Register */ | ||
91 | #define BSR_READY 0x8080 /* Block status */ | ||
92 | #define BSR_UNLOCK 0x4040 /* Block lock status */ | ||
93 | #define BSR_FAILED 0x2020 /* Block operation status */ | ||
94 | #define BSR_ABORTED 0x1010 /* Operation abort status */ | ||
95 | #define BSR_QUEUE_FULL 0x0808 /* Queue status */ | ||
96 | #define BSR_VPP_LOW 0x0404 /* Vpp status */ | ||
97 | |||
98 | #endif /* __MTD_IFLASH_H__ */ | ||
diff --git a/include/linux/mtd/mtd.h b/include/linux/mtd/mtd.h index 3d956c3abb31..45d482ce8397 100644 --- a/include/linux/mtd/mtd.h +++ b/include/linux/mtd/mtd.h | |||
@@ -53,6 +53,7 @@ struct mtd_erase_region_info { | |||
53 | u_int32_t offset; /* At which this region starts, from the beginning of the MTD */ | 53 | u_int32_t offset; /* At which this region starts, from the beginning of the MTD */ |
54 | u_int32_t erasesize; /* For this region */ | 54 | u_int32_t erasesize; /* For this region */ |
55 | u_int32_t numblocks; /* Number of blocks of erasesize in this region */ | 55 | u_int32_t numblocks; /* Number of blocks of erasesize in this region */ |
56 | unsigned long *lockmap; /* If keeping bitmap of locks */ | ||
56 | }; | 57 | }; |
57 | 58 | ||
58 | /* | 59 | /* |
diff --git a/include/linux/mtd/nand.h b/include/linux/mtd/nand.h index 97523887fe5d..cf197ad62da6 100644 --- a/include/linux/mtd/nand.h +++ b/include/linux/mtd/nand.h | |||
@@ -431,6 +431,7 @@ struct nand_chip { | |||
431 | #define NAND_MFR_RENESAS 0x07 | 431 | #define NAND_MFR_RENESAS 0x07 |
432 | #define NAND_MFR_STMICRO 0x20 | 432 | #define NAND_MFR_STMICRO 0x20 |
433 | #define NAND_MFR_HYNIX 0xad | 433 | #define NAND_MFR_HYNIX 0xad |
434 | #define NAND_MFR_MICRON 0x2c | ||
434 | 435 | ||
435 | /** | 436 | /** |
436 | * struct nand_flash_dev - NAND Flash Device ID Structure | 437 | * struct nand_flash_dev - NAND Flash Device ID Structure |
diff --git a/include/linux/mtd/ubi.h b/include/linux/mtd/ubi.h new file mode 100644 index 000000000000..3d967b6b120a --- /dev/null +++ b/include/linux/mtd/ubi.h | |||
@@ -0,0 +1,202 @@ | |||
1 | /* | ||
2 | * Copyright (c) International Business Machines Corp., 2006 | ||
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 | ||
12 | * the 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 | * Author: Artem Bityutskiy (Битюцкий Артём) | ||
19 | */ | ||
20 | |||
21 | #ifndef __LINUX_UBI_H__ | ||
22 | #define __LINUX_UBI_H__ | ||
23 | |||
24 | #include <asm/ioctl.h> | ||
25 | #include <linux/types.h> | ||
26 | #include <mtd/ubi-user.h> | ||
27 | |||
28 | /* | ||
29 | * UBI data type hint constants. | ||
30 | * | ||
31 | * UBI_LONGTERM: long-term data | ||
32 | * UBI_SHORTTERM: short-term data | ||
33 | * UBI_UNKNOWN: data persistence is unknown | ||
34 | * | ||
35 | * These constants are used when data is written to UBI volumes in order to | ||
36 | * help the UBI wear-leveling unit to find more appropriate physical | ||
37 | * eraseblocks. | ||
38 | */ | ||
39 | enum { | ||
40 | UBI_LONGTERM = 1, | ||
41 | UBI_SHORTTERM, | ||
42 | UBI_UNKNOWN | ||
43 | }; | ||
44 | |||
45 | /* | ||
46 | * enum ubi_open_mode - UBI volume open mode constants. | ||
47 | * | ||
48 | * UBI_READONLY: read-only mode | ||
49 | * UBI_READWRITE: read-write mode | ||
50 | * UBI_EXCLUSIVE: exclusive mode | ||
51 | */ | ||
52 | enum { | ||
53 | UBI_READONLY = 1, | ||
54 | UBI_READWRITE, | ||
55 | UBI_EXCLUSIVE | ||
56 | }; | ||
57 | |||
58 | /** | ||
59 | * struct ubi_volume_info - UBI volume description data structure. | ||
60 | * @vol_id: volume ID | ||
61 | * @ubi_num: UBI device number this volume belongs to | ||
62 | * @size: how many physical eraseblocks are reserved for this volume | ||
63 | * @used_bytes: how many bytes of data this volume contains | ||
64 | * @used_ebs: how many physical eraseblocks of this volume actually contain any | ||
65 | * data | ||
66 | * @vol_type: volume type (%UBI_DYNAMIC_VOLUME or %UBI_STATIC_VOLUME) | ||
67 | * @corrupted: non-zero if the volume is corrupted (static volumes only) | ||
68 | * @upd_marker: non-zero if the volume has update marker set | ||
69 | * @alignment: volume alignment | ||
70 | * @usable_leb_size: how many bytes are available in logical eraseblocks of | ||
71 | * this volume | ||
72 | * @name_len: volume name length | ||
73 | * @name: volume name | ||
74 | * @cdev: UBI volume character device major and minor numbers | ||
75 | * | ||
76 | * The @corrupted flag is only relevant to static volumes and is always zero | ||
77 | * for dynamic ones. This is because UBI does not care about dynamic volume | ||
78 | * data protection and only cares about protecting static volume data. | ||
79 | * | ||
80 | * The @upd_marker flag is set if the volume update operation was interrupted. | ||
81 | * Before touching the volume data during the update operation, UBI first sets | ||
82 | * the update marker flag for this volume. If the volume update operation was | ||
83 | * further interrupted, the update marker indicates this. If the update marker | ||
84 | * is set, the contents of the volume is certainly damaged and a new volume | ||
85 | * update operation has to be started. | ||
86 | * | ||
87 | * To put it differently, @corrupted and @upd_marker fields have different | ||
88 | * semantics: | ||
89 | * o the @corrupted flag means that this static volume is corrupted for some | ||
90 | * reasons, but not because an interrupted volume update | ||
91 | * o the @upd_marker field means that the volume is damaged because of an | ||
92 | * interrupted update operation. | ||
93 | * | ||
94 | * I.e., the @corrupted flag is never set if the @upd_marker flag is set. | ||
95 | * | ||
96 | * The @used_bytes and @used_ebs fields are only really needed for static | ||
97 | * volumes and contain the number of bytes stored in this static volume and how | ||
98 | * many eraseblock this data occupies. In case of dynamic volumes, the | ||
99 | * @used_bytes field is equivalent to @size*@usable_leb_size, and the @used_ebs | ||
100 | * field is equivalent to @size. | ||
101 | * | ||
102 | * In general, logical eraseblock size is a property of the UBI device, not | ||
103 | * of the UBI volume. Indeed, the logical eraseblock size depends on the | ||
104 | * physical eraseblock size and on how much bytes UBI headers consume. But | ||
105 | * because of the volume alignment (@alignment), the usable size of logical | ||
106 | * eraseblocks if a volume may be less. The following equation is true: | ||
107 | * @usable_leb_size = LEB size - (LEB size mod @alignment), | ||
108 | * where LEB size is the logical eraseblock size defined by the UBI device. | ||
109 | * | ||
110 | * The alignment is multiple to the minimal flash input/output unit size or %1 | ||
111 | * if all the available space is used. | ||
112 | * | ||
113 | * To put this differently, alignment may be considered is a way to change | ||
114 | * volume logical eraseblock sizes. | ||
115 | */ | ||
116 | struct ubi_volume_info { | ||
117 | int ubi_num; | ||
118 | int vol_id; | ||
119 | int size; | ||
120 | long long used_bytes; | ||
121 | int used_ebs; | ||
122 | int vol_type; | ||
123 | int corrupted; | ||
124 | int upd_marker; | ||
125 | int alignment; | ||
126 | int usable_leb_size; | ||
127 | int name_len; | ||
128 | const char *name; | ||
129 | dev_t cdev; | ||
130 | }; | ||
131 | |||
132 | /** | ||
133 | * struct ubi_device_info - UBI device description data structure. | ||
134 | * @ubi_num: ubi device number | ||
135 | * @leb_size: logical eraseblock size on this UBI device | ||
136 | * @min_io_size: minimal I/O unit size | ||
137 | * @ro_mode: if this device is in read-only mode | ||
138 | * @cdev: UBI character device major and minor numbers | ||
139 | * | ||
140 | * Note, @leb_size is the logical eraseblock size offered by the UBI device. | ||
141 | * Volumes of this UBI device may have smaller logical eraseblock size if their | ||
142 | * alignment is not equivalent to %1. | ||
143 | */ | ||
144 | struct ubi_device_info { | ||
145 | int ubi_num; | ||
146 | int leb_size; | ||
147 | int min_io_size; | ||
148 | int ro_mode; | ||
149 | dev_t cdev; | ||
150 | }; | ||
151 | |||
152 | /* UBI descriptor given to users when they open UBI volumes */ | ||
153 | struct ubi_volume_desc; | ||
154 | |||
155 | int ubi_get_device_info(int ubi_num, struct ubi_device_info *di); | ||
156 | void ubi_get_volume_info(struct ubi_volume_desc *desc, | ||
157 | struct ubi_volume_info *vi); | ||
158 | struct ubi_volume_desc *ubi_open_volume(int ubi_num, int vol_id, int mode); | ||
159 | struct ubi_volume_desc *ubi_open_volume_nm(int ubi_num, const char *name, | ||
160 | int mode); | ||
161 | void ubi_close_volume(struct ubi_volume_desc *desc); | ||
162 | int ubi_leb_read(struct ubi_volume_desc *desc, int lnum, char *buf, int offset, | ||
163 | int len, int check); | ||
164 | int ubi_leb_write(struct ubi_volume_desc *desc, int lnum, const void *buf, | ||
165 | int offset, int len, int dtype); | ||
166 | int ubi_leb_change(struct ubi_volume_desc *desc, int lnum, const void *buf, | ||
167 | int len, int dtype); | ||
168 | int ubi_leb_erase(struct ubi_volume_desc *desc, int lnum); | ||
169 | int ubi_leb_unmap(struct ubi_volume_desc *desc, int lnum); | ||
170 | int ubi_is_mapped(struct ubi_volume_desc *desc, int lnum); | ||
171 | |||
172 | /* | ||
173 | * This function is the same as the 'ubi_leb_read()' function, but it does not | ||
174 | * provide the checking capability. | ||
175 | */ | ||
176 | static inline int ubi_read(struct ubi_volume_desc *desc, int lnum, char *buf, | ||
177 | int offset, int len) | ||
178 | { | ||
179 | return ubi_leb_read(desc, lnum, buf, offset, len, 0); | ||
180 | } | ||
181 | |||
182 | /* | ||
183 | * This function is the same as the 'ubi_leb_write()' functions, but it does | ||
184 | * not have the data type argument. | ||
185 | */ | ||
186 | static inline int ubi_write(struct ubi_volume_desc *desc, int lnum, | ||
187 | const void *buf, int offset, int len) | ||
188 | { | ||
189 | return ubi_leb_write(desc, lnum, buf, offset, len, UBI_UNKNOWN); | ||
190 | } | ||
191 | |||
192 | /* | ||
193 | * This function is the same as the 'ubi_leb_change()' functions, but it does | ||
194 | * not have the data type argument. | ||
195 | */ | ||
196 | static inline int ubi_change(struct ubi_volume_desc *desc, int lnum, | ||
197 | const void *buf, int len) | ||
198 | { | ||
199 | return ubi_leb_change(desc, lnum, buf, len, UBI_UNKNOWN); | ||
200 | } | ||
201 | |||
202 | #endif /* !__LINUX_UBI_H__ */ | ||
diff --git a/include/linux/namei.h b/include/linux/namei.h index d39a5a67e979..b7dd24917f0d 100644 --- a/include/linux/namei.h +++ b/include/linux/namei.h | |||
@@ -82,6 +82,7 @@ extern struct file *nameidata_to_filp(struct nameidata *nd, int flags); | |||
82 | extern void release_open_intent(struct nameidata *); | 82 | extern void release_open_intent(struct nameidata *); |
83 | 83 | ||
84 | extern struct dentry * lookup_one_len(const char *, struct dentry *, int); | 84 | extern struct dentry * lookup_one_len(const char *, struct dentry *, int); |
85 | extern struct dentry *lookup_one_len_kern(const char *, struct dentry *, int); | ||
85 | 86 | ||
86 | extern int follow_down(struct vfsmount **, struct dentry **); | 87 | extern int follow_down(struct vfsmount **, struct dentry **); |
87 | extern int follow_up(struct vfsmount **, struct dentry **); | 88 | extern int follow_up(struct vfsmount **, struct dentry **); |
diff --git a/include/linux/net.h b/include/linux/net.h index 4db21e63d8d2..efc45177b503 100644 --- a/include/linux/net.h +++ b/include/linux/net.h | |||
@@ -24,7 +24,7 @@ | |||
24 | struct poll_table_struct; | 24 | struct poll_table_struct; |
25 | struct inode; | 25 | struct inode; |
26 | 26 | ||
27 | #define NPROTO 33 /* should be enough for now.. */ | 27 | #define NPROTO 34 /* should be enough for now.. */ |
28 | 28 | ||
29 | #define SYS_SOCKET 1 /* sys_socket(2) */ | 29 | #define SYS_SOCKET 1 /* sys_socket(2) */ |
30 | #define SYS_BIND 2 /* sys_bind(2) */ | 30 | #define SYS_BIND 2 /* sys_bind(2) */ |
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h index 1a528548cd1d..e027a3750a77 100644 --- a/include/linux/netdevice.h +++ b/include/linux/netdevice.h | |||
@@ -42,6 +42,8 @@ | |||
42 | struct vlan_group; | 42 | struct vlan_group; |
43 | struct ethtool_ops; | 43 | struct ethtool_ops; |
44 | struct netpoll_info; | 44 | struct netpoll_info; |
45 | /* 802.11 specific */ | ||
46 | struct wireless_dev; | ||
45 | /* source back-compat hooks */ | 47 | /* source back-compat hooks */ |
46 | #define SET_ETHTOOL_OPS(netdev,ops) \ | 48 | #define SET_ETHTOOL_OPS(netdev,ops) \ |
47 | ( (netdev)->ethtool_ops = (ops) ) | 49 | ( (netdev)->ethtool_ops = (ops) ) |
@@ -323,6 +325,7 @@ struct net_device | |||
323 | #define NETIF_F_VLAN_CHALLENGED 1024 /* Device cannot handle VLAN packets */ | 325 | #define NETIF_F_VLAN_CHALLENGED 1024 /* Device cannot handle VLAN packets */ |
324 | #define NETIF_F_GSO 2048 /* Enable software GSO. */ | 326 | #define NETIF_F_GSO 2048 /* Enable software GSO. */ |
325 | #define NETIF_F_LLTX 4096 /* LockLess TX */ | 327 | #define NETIF_F_LLTX 4096 /* LockLess TX */ |
328 | #define NETIF_F_INTERNAL_STATS 8192 /* Use stats structure in net_device */ | ||
326 | 329 | ||
327 | /* Segmentation offload features */ | 330 | /* Segmentation offload features */ |
328 | #define NETIF_F_GSO_SHIFT 16 | 331 | #define NETIF_F_GSO_SHIFT 16 |
@@ -347,13 +350,15 @@ struct net_device | |||
347 | 350 | ||
348 | 351 | ||
349 | struct net_device_stats* (*get_stats)(struct net_device *dev); | 352 | struct net_device_stats* (*get_stats)(struct net_device *dev); |
353 | struct net_device_stats stats; | ||
350 | 354 | ||
355 | #ifdef CONFIG_WIRELESS_EXT | ||
351 | /* List of functions to handle Wireless Extensions (instead of ioctl). | 356 | /* List of functions to handle Wireless Extensions (instead of ioctl). |
352 | * See <net/iw_handler.h> for details. Jean II */ | 357 | * See <net/iw_handler.h> for details. Jean II */ |
353 | const struct iw_handler_def * wireless_handlers; | 358 | const struct iw_handler_def * wireless_handlers; |
354 | /* Instance data managed by the core of Wireless Extensions. */ | 359 | /* Instance data managed by the core of Wireless Extensions. */ |
355 | struct iw_public_data * wireless_data; | 360 | struct iw_public_data * wireless_data; |
356 | 361 | #endif | |
357 | const struct ethtool_ops *ethtool_ops; | 362 | const struct ethtool_ops *ethtool_ops; |
358 | 363 | ||
359 | /* | 364 | /* |
@@ -398,6 +403,8 @@ struct net_device | |||
398 | void *ip6_ptr; /* IPv6 specific data */ | 403 | void *ip6_ptr; /* IPv6 specific data */ |
399 | void *ec_ptr; /* Econet specific data */ | 404 | void *ec_ptr; /* Econet specific data */ |
400 | void *ax25_ptr; /* AX.25 specific data */ | 405 | void *ax25_ptr; /* AX.25 specific data */ |
406 | struct wireless_dev *ieee80211_ptr; /* IEEE 802.11 specific data, | ||
407 | assign before registering */ | ||
401 | 408 | ||
402 | /* | 409 | /* |
403 | * Cache line mostly used on receive path (including eth_type_trans()) | 410 | * Cache line mostly used on receive path (including eth_type_trans()) |
diff --git a/include/linux/netfilter.h b/include/linux/netfilter.h index 70d3b4f1e48d..10b5c6275706 100644 --- a/include/linux/netfilter.h +++ b/include/linux/netfilter.h | |||
@@ -281,9 +281,6 @@ extern void nf_reinject(struct sk_buff *skb, | |||
281 | struct nf_info *info, | 281 | struct nf_info *info, |
282 | unsigned int verdict); | 282 | unsigned int verdict); |
283 | 283 | ||
284 | extern void (*ip_ct_attach)(struct sk_buff *, struct sk_buff *); | ||
285 | extern void nf_ct_attach(struct sk_buff *, struct sk_buff *); | ||
286 | |||
287 | /* FIXME: Before cache is ever used, this must be implemented for real. */ | 284 | /* FIXME: Before cache is ever used, this must be implemented for real. */ |
288 | extern void nf_invalidate_cache(int pf); | 285 | extern void nf_invalidate_cache(int pf); |
289 | 286 | ||
@@ -388,11 +385,18 @@ static inline int nf_hook(int pf, unsigned int hook, struct sk_buff **pskb, | |||
388 | { | 385 | { |
389 | return 1; | 386 | return 1; |
390 | } | 387 | } |
391 | static inline void nf_ct_attach(struct sk_buff *new, struct sk_buff *skb) {} | ||
392 | struct flowi; | 388 | struct flowi; |
393 | static inline void | 389 | static inline void |
394 | nf_nat_decode_session(struct sk_buff *skb, struct flowi *fl, int family) {} | 390 | nf_nat_decode_session(struct sk_buff *skb, struct flowi *fl, int family) {} |
395 | #endif /*CONFIG_NETFILTER*/ | 391 | #endif /*CONFIG_NETFILTER*/ |
396 | 392 | ||
393 | #if defined(CONFIG_NF_CONNTRACK) || defined(CONFIG_NF_CONNTRACK_MODULE) | ||
394 | extern void (*ip_ct_attach)(struct sk_buff *, struct sk_buff *); | ||
395 | extern void nf_ct_attach(struct sk_buff *, struct sk_buff *); | ||
396 | extern void (*nf_ct_destroy)(struct nf_conntrack *); | ||
397 | #else | ||
398 | static inline void nf_ct_attach(struct sk_buff *new, struct sk_buff *skb) {} | ||
399 | #endif | ||
400 | |||
397 | #endif /*__KERNEL__*/ | 401 | #endif /*__KERNEL__*/ |
398 | #endif /*__LINUX_NETFILTER_H*/ | 402 | #endif /*__LINUX_NETFILTER_H*/ |
diff --git a/include/linux/netfilter/nf_conntrack_tcp.h b/include/linux/netfilter/nf_conntrack_tcp.h index 007af4c2770b..22ce29995f13 100644 --- a/include/linux/netfilter/nf_conntrack_tcp.h +++ b/include/linux/netfilter/nf_conntrack_tcp.h | |||
@@ -30,6 +30,11 @@ enum tcp_conntrack { | |||
30 | /* Be liberal in window checking */ | 30 | /* Be liberal in window checking */ |
31 | #define IP_CT_TCP_FLAG_BE_LIBERAL 0x08 | 31 | #define IP_CT_TCP_FLAG_BE_LIBERAL 0x08 |
32 | 32 | ||
33 | struct nf_ct_tcp_flags { | ||
34 | u_int8_t flags; | ||
35 | u_int8_t mask; | ||
36 | }; | ||
37 | |||
33 | #ifdef __KERNEL__ | 38 | #ifdef __KERNEL__ |
34 | 39 | ||
35 | struct ip_ct_tcp_state { | 40 | struct ip_ct_tcp_state { |
diff --git a/include/linux/netfilter/nfnetlink.h b/include/linux/netfilter/nfnetlink.h index 1e9c821f152d..0f9311df1559 100644 --- a/include/linux/netfilter/nfnetlink.h +++ b/include/linux/netfilter/nfnetlink.h | |||
@@ -62,11 +62,11 @@ struct nfattr | |||
62 | #define NFA_DATA(nfa) ((void *)(((char *)(nfa)) + NFA_LENGTH(0))) | 62 | #define NFA_DATA(nfa) ((void *)(((char *)(nfa)) + NFA_LENGTH(0))) |
63 | #define NFA_PAYLOAD(nfa) ((int)((nfa)->nfa_len) - NFA_LENGTH(0)) | 63 | #define NFA_PAYLOAD(nfa) ((int)((nfa)->nfa_len) - NFA_LENGTH(0)) |
64 | #define NFA_NEST(skb, type) \ | 64 | #define NFA_NEST(skb, type) \ |
65 | ({ struct nfattr *__start = (struct nfattr *) (skb)->tail; \ | 65 | ({ struct nfattr *__start = (struct nfattr *)skb_tail_pointer(skb); \ |
66 | NFA_PUT(skb, (NFNL_NFA_NEST | type), 0, NULL); \ | 66 | NFA_PUT(skb, (NFNL_NFA_NEST | type), 0, NULL); \ |
67 | __start; }) | 67 | __start; }) |
68 | #define NFA_NEST_END(skb, start) \ | 68 | #define NFA_NEST_END(skb, start) \ |
69 | ({ (start)->nfa_len = ((skb)->tail - (unsigned char *) (start)); \ | 69 | ({ (start)->nfa_len = skb_tail_pointer(skb) - (unsigned char *)(start); \ |
70 | (skb)->len; }) | 70 | (skb)->len; }) |
71 | #define NFA_NEST_CANCEL(skb, start) \ | 71 | #define NFA_NEST_CANCEL(skb, start) \ |
72 | ({ if (start) \ | 72 | ({ if (start) \ |
@@ -111,7 +111,7 @@ struct nfgenmsg { | |||
111 | struct nfnl_callback | 111 | struct nfnl_callback |
112 | { | 112 | { |
113 | int (*call)(struct sock *nl, struct sk_buff *skb, | 113 | int (*call)(struct sock *nl, struct sk_buff *skb, |
114 | struct nlmsghdr *nlh, struct nfattr *cda[], int *errp); | 114 | struct nlmsghdr *nlh, struct nfattr *cda[]); |
115 | u_int16_t attr_count; /* number of nfattr's */ | 115 | u_int16_t attr_count; /* number of nfattr's */ |
116 | }; | 116 | }; |
117 | 117 | ||
@@ -129,19 +129,6 @@ extern void __nfa_fill(struct sk_buff *skb, int attrtype, | |||
129 | ({ if (skb_tailroom(skb) < (int)NFA_SPACE(attrlen)) goto nfattr_failure; \ | 129 | ({ if (skb_tailroom(skb) < (int)NFA_SPACE(attrlen)) goto nfattr_failure; \ |
130 | __nfa_fill(skb, attrtype, attrlen, data); }) | 130 | __nfa_fill(skb, attrtype, attrlen, data); }) |
131 | 131 | ||
132 | extern struct semaphore nfnl_sem; | ||
133 | |||
134 | #define nfnl_shlock() down(&nfnl_sem) | ||
135 | #define nfnl_shlock_nowait() down_trylock(&nfnl_sem) | ||
136 | |||
137 | #define nfnl_shunlock() do { up(&nfnl_sem); \ | ||
138 | if(nfnl && nfnl->sk_receive_queue.qlen) \ | ||
139 | nfnl->sk_data_ready(nfnl, 0); \ | ||
140 | } while(0) | ||
141 | |||
142 | extern void nfnl_lock(void); | ||
143 | extern void nfnl_unlock(void); | ||
144 | |||
145 | extern int nfnetlink_subsys_register(struct nfnetlink_subsystem *n); | 132 | extern int nfnetlink_subsys_register(struct nfnetlink_subsystem *n); |
146 | extern int nfnetlink_subsys_unregister(struct nfnetlink_subsystem *n); | 133 | extern int nfnetlink_subsys_unregister(struct nfnetlink_subsystem *n); |
147 | 134 | ||
diff --git a/include/linux/netfilter/nfnetlink_conntrack.h b/include/linux/netfilter/nfnetlink_conntrack.h index b5883ccee295..d7c35039721e 100644 --- a/include/linux/netfilter/nfnetlink_conntrack.h +++ b/include/linux/netfilter/nfnetlink_conntrack.h | |||
@@ -83,6 +83,10 @@ enum ctattr_protoinfo { | |||
83 | enum ctattr_protoinfo_tcp { | 83 | enum ctattr_protoinfo_tcp { |
84 | CTA_PROTOINFO_TCP_UNSPEC, | 84 | CTA_PROTOINFO_TCP_UNSPEC, |
85 | CTA_PROTOINFO_TCP_STATE, | 85 | CTA_PROTOINFO_TCP_STATE, |
86 | CTA_PROTOINFO_TCP_WSCALE_ORIGINAL, | ||
87 | CTA_PROTOINFO_TCP_WSCALE_REPLY, | ||
88 | CTA_PROTOINFO_TCP_FLAGS_ORIGINAL, | ||
89 | CTA_PROTOINFO_TCP_FLAGS_REPLY, | ||
86 | __CTA_PROTOINFO_TCP_MAX | 90 | __CTA_PROTOINFO_TCP_MAX |
87 | }; | 91 | }; |
88 | #define CTA_PROTOINFO_TCP_MAX (__CTA_PROTOINFO_TCP_MAX - 1) | 92 | #define CTA_PROTOINFO_TCP_MAX (__CTA_PROTOINFO_TCP_MAX - 1) |
diff --git a/include/linux/netfilter_bridge.h b/include/linux/netfilter_bridge.h index 55689f39f77a..19060030bac9 100644 --- a/include/linux/netfilter_bridge.h +++ b/include/linux/netfilter_bridge.h | |||
@@ -7,6 +7,7 @@ | |||
7 | #include <linux/netfilter.h> | 7 | #include <linux/netfilter.h> |
8 | #include <linux/if_ether.h> | 8 | #include <linux/if_ether.h> |
9 | #include <linux/if_vlan.h> | 9 | #include <linux/if_vlan.h> |
10 | #include <linux/if_pppox.h> | ||
10 | 11 | ||
11 | /* Bridge Hooks */ | 12 | /* Bridge Hooks */ |
12 | /* After promisc drops, checksum checks. */ | 13 | /* After promisc drops, checksum checks. */ |
@@ -58,8 +59,14 @@ static inline int nf_bridge_maybe_copy_header(struct sk_buff *skb) | |||
58 | * enough room for the encapsulating header (if there is one). */ | 59 | * enough room for the encapsulating header (if there is one). */ |
59 | static inline int nf_bridge_pad(const struct sk_buff *skb) | 60 | static inline int nf_bridge_pad(const struct sk_buff *skb) |
60 | { | 61 | { |
61 | return (skb->nf_bridge && skb->protocol == htons(ETH_P_8021Q)) | 62 | int padding = 0; |
62 | ? VLAN_HLEN : 0; | 63 | |
64 | if (skb->nf_bridge && skb->protocol == htons(ETH_P_8021Q)) | ||
65 | padding = VLAN_HLEN; | ||
66 | else if (skb->nf_bridge && skb->protocol == htons(ETH_P_PPP_SES)) | ||
67 | padding = PPPOE_SES_HLEN; | ||
68 | |||
69 | return padding; | ||
63 | } | 70 | } |
64 | 71 | ||
65 | struct bridge_skb_cb { | 72 | struct bridge_skb_cb { |
diff --git a/include/linux/netfilter_bridge/ebt_802_3.h b/include/linux/netfilter_bridge/ebt_802_3.h index 07f044ff1a6b..a11b0c2017fd 100644 --- a/include/linux/netfilter_bridge/ebt_802_3.h +++ b/include/linux/netfilter_bridge/ebt_802_3.h | |||
@@ -54,7 +54,7 @@ struct ebt_802_3_hdr { | |||
54 | 54 | ||
55 | static inline struct ebt_802_3_hdr *ebt_802_3_hdr(const struct sk_buff *skb) | 55 | static inline struct ebt_802_3_hdr *ebt_802_3_hdr(const struct sk_buff *skb) |
56 | { | 56 | { |
57 | return (struct ebt_802_3_hdr *)skb->mac.raw; | 57 | return (struct ebt_802_3_hdr *)skb_mac_header(skb); |
58 | } | 58 | } |
59 | #endif | 59 | #endif |
60 | 60 | ||
diff --git a/include/linux/netfilter_bridge/ebt_arp.h b/include/linux/netfilter_bridge/ebt_arp.h index 97e4dbde1f89..cbf4843b6b0f 100644 --- a/include/linux/netfilter_bridge/ebt_arp.h +++ b/include/linux/netfilter_bridge/ebt_arp.h | |||
@@ -8,8 +8,10 @@ | |||
8 | #define EBT_ARP_DST_IP 0x10 | 8 | #define EBT_ARP_DST_IP 0x10 |
9 | #define EBT_ARP_SRC_MAC 0x20 | 9 | #define EBT_ARP_SRC_MAC 0x20 |
10 | #define EBT_ARP_DST_MAC 0x40 | 10 | #define EBT_ARP_DST_MAC 0x40 |
11 | #define EBT_ARP_GRAT 0x80 | ||
11 | #define EBT_ARP_MASK (EBT_ARP_OPCODE | EBT_ARP_HTYPE | EBT_ARP_PTYPE | \ | 12 | #define EBT_ARP_MASK (EBT_ARP_OPCODE | EBT_ARP_HTYPE | EBT_ARP_PTYPE | \ |
12 | EBT_ARP_SRC_IP | EBT_ARP_DST_IP | EBT_ARP_SRC_MAC | EBT_ARP_DST_MAC) | 13 | EBT_ARP_SRC_IP | EBT_ARP_DST_IP | EBT_ARP_SRC_MAC | EBT_ARP_DST_MAC | \ |
14 | EBT_ARP_GRAT) | ||
13 | #define EBT_ARP_MATCH "arp" | 15 | #define EBT_ARP_MATCH "arp" |
14 | 16 | ||
15 | struct ebt_arp_info | 17 | struct ebt_arp_info |
diff --git a/include/linux/netfilter_ipv4/Kbuild b/include/linux/netfilter_ipv4/Kbuild index 180337801a86..7185792b900f 100644 --- a/include/linux/netfilter_ipv4/Kbuild +++ b/include/linux/netfilter_ipv4/Kbuild | |||
@@ -1,9 +1,3 @@ | |||
1 | header-y += ip_conntrack_helper.h | ||
2 | header-y += ip_conntrack_protocol.h | ||
3 | header-y += ip_conntrack_sctp.h | ||
4 | header-y += ip_conntrack_tcp.h | ||
5 | header-y += ip_conntrack_tftp.h | ||
6 | header-y += ip_nat_pptp.h | ||
7 | header-y += ipt_addrtype.h | 1 | header-y += ipt_addrtype.h |
8 | header-y += ipt_ah.h | 2 | header-y += ipt_ah.h |
9 | header-y += ipt_CLASSIFY.h | 3 | header-y += ipt_CLASSIFY.h |
@@ -49,13 +43,5 @@ header-y += ipt_ttl.h | |||
49 | header-y += ipt_TTL.h | 43 | header-y += ipt_TTL.h |
50 | header-y += ipt_ULOG.h | 44 | header-y += ipt_ULOG.h |
51 | 45 | ||
52 | unifdef-y += ip_conntrack.h | ||
53 | unifdef-y += ip_conntrack_h323.h | ||
54 | unifdef-y += ip_conntrack_irc.h | ||
55 | unifdef-y += ip_conntrack_pptp.h | ||
56 | unifdef-y += ip_conntrack_proto_gre.h | ||
57 | unifdef-y += ip_conntrack_tuple.h | ||
58 | unifdef-y += ip_nat.h | ||
59 | unifdef-y += ip_nat_rule.h | ||
60 | unifdef-y += ip_queue.h | 46 | unifdef-y += ip_queue.h |
61 | unifdef-y += ip_tables.h | 47 | unifdef-y += ip_tables.h |
diff --git a/include/linux/netfilter_ipv4/ip_conntrack.h b/include/linux/netfilter_ipv4/ip_conntrack.h deleted file mode 100644 index da9274e6bf12..000000000000 --- a/include/linux/netfilter_ipv4/ip_conntrack.h +++ /dev/null | |||
@@ -1,402 +0,0 @@ | |||
1 | #ifndef _IP_CONNTRACK_H | ||
2 | #define _IP_CONNTRACK_H | ||
3 | |||
4 | #include <linux/netfilter/nf_conntrack_common.h> | ||
5 | |||
6 | #ifdef __KERNEL__ | ||
7 | #include <linux/netfilter_ipv4/ip_conntrack_tuple.h> | ||
8 | #include <linux/bitops.h> | ||
9 | #include <linux/compiler.h> | ||
10 | #include <asm/atomic.h> | ||
11 | |||
12 | #include <linux/timer.h> | ||
13 | #include <linux/netfilter_ipv4/ip_conntrack_tcp.h> | ||
14 | #include <linux/netfilter_ipv4/ip_conntrack_icmp.h> | ||
15 | #include <linux/netfilter_ipv4/ip_conntrack_proto_gre.h> | ||
16 | #include <linux/netfilter_ipv4/ip_conntrack_sctp.h> | ||
17 | |||
18 | /* per conntrack: protocol private data */ | ||
19 | union ip_conntrack_proto { | ||
20 | /* insert conntrack proto private data here */ | ||
21 | struct ip_ct_gre gre; | ||
22 | struct ip_ct_sctp sctp; | ||
23 | struct ip_ct_tcp tcp; | ||
24 | struct ip_ct_icmp icmp; | ||
25 | }; | ||
26 | |||
27 | union ip_conntrack_expect_proto { | ||
28 | /* insert expect proto private data here */ | ||
29 | }; | ||
30 | |||
31 | /* Add protocol helper include file here */ | ||
32 | #include <linux/netfilter_ipv4/ip_conntrack_h323.h> | ||
33 | #include <linux/netfilter_ipv4/ip_conntrack_pptp.h> | ||
34 | #include <linux/netfilter_ipv4/ip_conntrack_amanda.h> | ||
35 | #include <linux/netfilter_ipv4/ip_conntrack_ftp.h> | ||
36 | #include <linux/netfilter_ipv4/ip_conntrack_irc.h> | ||
37 | |||
38 | /* per conntrack: application helper private data */ | ||
39 | union ip_conntrack_help { | ||
40 | /* insert conntrack helper private data (master) here */ | ||
41 | struct ip_ct_h323_master ct_h323_info; | ||
42 | struct ip_ct_pptp_master ct_pptp_info; | ||
43 | struct ip_ct_ftp_master ct_ftp_info; | ||
44 | struct ip_ct_irc_master ct_irc_info; | ||
45 | }; | ||
46 | |||
47 | #ifdef CONFIG_IP_NF_NAT_NEEDED | ||
48 | #include <linux/netfilter_ipv4/ip_nat.h> | ||
49 | #include <linux/netfilter_ipv4/ip_nat_pptp.h> | ||
50 | |||
51 | /* per conntrack: nat application helper private data */ | ||
52 | union ip_conntrack_nat_help { | ||
53 | /* insert nat helper private data here */ | ||
54 | struct ip_nat_pptp nat_pptp_info; | ||
55 | }; | ||
56 | #endif | ||
57 | |||
58 | #include <linux/types.h> | ||
59 | #include <linux/skbuff.h> | ||
60 | |||
61 | #ifdef CONFIG_NETFILTER_DEBUG | ||
62 | #define IP_NF_ASSERT(x) \ | ||
63 | do { \ | ||
64 | if (!(x)) \ | ||
65 | /* Wooah! I'm tripping my conntrack in a frenzy of \ | ||
66 | netplay... */ \ | ||
67 | printk("NF_IP_ASSERT: %s:%i(%s)\n", \ | ||
68 | __FILE__, __LINE__, __FUNCTION__); \ | ||
69 | } while(0) | ||
70 | #else | ||
71 | #define IP_NF_ASSERT(x) | ||
72 | #endif | ||
73 | |||
74 | struct ip_conntrack_helper; | ||
75 | |||
76 | struct ip_conntrack | ||
77 | { | ||
78 | /* Usage count in here is 1 for hash table/destruct timer, 1 per skb, | ||
79 | plus 1 for any connection(s) we are `master' for */ | ||
80 | struct nf_conntrack ct_general; | ||
81 | |||
82 | /* Have we seen traffic both ways yet? (bitset) */ | ||
83 | unsigned long status; | ||
84 | |||
85 | /* Timer function; drops refcnt when it goes off. */ | ||
86 | struct timer_list timeout; | ||
87 | |||
88 | #ifdef CONFIG_IP_NF_CT_ACCT | ||
89 | /* Accounting Information (same cache line as other written members) */ | ||
90 | struct ip_conntrack_counter counters[IP_CT_DIR_MAX]; | ||
91 | #endif | ||
92 | /* If we were expected by an expectation, this will be it */ | ||
93 | struct ip_conntrack *master; | ||
94 | |||
95 | /* Current number of expected connections */ | ||
96 | unsigned int expecting; | ||
97 | |||
98 | /* Unique ID that identifies this conntrack*/ | ||
99 | unsigned int id; | ||
100 | |||
101 | /* Helper, if any. */ | ||
102 | struct ip_conntrack_helper *helper; | ||
103 | |||
104 | /* Storage reserved for other modules: */ | ||
105 | union ip_conntrack_proto proto; | ||
106 | |||
107 | union ip_conntrack_help help; | ||
108 | |||
109 | #ifdef CONFIG_IP_NF_NAT_NEEDED | ||
110 | struct { | ||
111 | struct ip_nat_info info; | ||
112 | union ip_conntrack_nat_help help; | ||
113 | #if defined(CONFIG_IP_NF_TARGET_MASQUERADE) || \ | ||
114 | defined(CONFIG_IP_NF_TARGET_MASQUERADE_MODULE) | ||
115 | int masq_index; | ||
116 | #endif | ||
117 | } nat; | ||
118 | #endif /* CONFIG_IP_NF_NAT_NEEDED */ | ||
119 | |||
120 | #if defined(CONFIG_IP_NF_CONNTRACK_MARK) | ||
121 | u_int32_t mark; | ||
122 | #endif | ||
123 | |||
124 | #ifdef CONFIG_IP_NF_CONNTRACK_SECMARK | ||
125 | u_int32_t secmark; | ||
126 | #endif | ||
127 | |||
128 | /* Traversed often, so hopefully in different cacheline to top */ | ||
129 | /* These are my tuples; original and reply */ | ||
130 | struct ip_conntrack_tuple_hash tuplehash[IP_CT_DIR_MAX]; | ||
131 | }; | ||
132 | |||
133 | struct ip_conntrack_expect | ||
134 | { | ||
135 | /* Internal linked list (global expectation list) */ | ||
136 | struct list_head list; | ||
137 | |||
138 | /* We expect this tuple, with the following mask */ | ||
139 | struct ip_conntrack_tuple tuple, mask; | ||
140 | |||
141 | /* Function to call after setup and insertion */ | ||
142 | void (*expectfn)(struct ip_conntrack *new, | ||
143 | struct ip_conntrack_expect *this); | ||
144 | |||
145 | /* The conntrack of the master connection */ | ||
146 | struct ip_conntrack *master; | ||
147 | |||
148 | /* Timer function; deletes the expectation. */ | ||
149 | struct timer_list timeout; | ||
150 | |||
151 | /* Usage count. */ | ||
152 | atomic_t use; | ||
153 | |||
154 | /* Unique ID */ | ||
155 | unsigned int id; | ||
156 | |||
157 | /* Flags */ | ||
158 | unsigned int flags; | ||
159 | |||
160 | #ifdef CONFIG_IP_NF_NAT_NEEDED | ||
161 | __be32 saved_ip; | ||
162 | /* This is the original per-proto part, used to map the | ||
163 | * expected connection the way the recipient expects. */ | ||
164 | union ip_conntrack_manip_proto saved_proto; | ||
165 | /* Direction relative to the master connection. */ | ||
166 | enum ip_conntrack_dir dir; | ||
167 | #endif | ||
168 | }; | ||
169 | |||
170 | #define IP_CT_EXPECT_PERMANENT 0x1 | ||
171 | |||
172 | static inline struct ip_conntrack * | ||
173 | tuplehash_to_ctrack(const struct ip_conntrack_tuple_hash *hash) | ||
174 | { | ||
175 | return container_of(hash, struct ip_conntrack, | ||
176 | tuplehash[hash->tuple.dst.dir]); | ||
177 | } | ||
178 | |||
179 | /* get master conntrack via master expectation */ | ||
180 | #define master_ct(conntr) (conntr->master) | ||
181 | |||
182 | /* Alter reply tuple (maybe alter helper). */ | ||
183 | extern void | ||
184 | ip_conntrack_alter_reply(struct ip_conntrack *conntrack, | ||
185 | const struct ip_conntrack_tuple *newreply); | ||
186 | |||
187 | /* Is this tuple taken? (ignoring any belonging to the given | ||
188 | conntrack). */ | ||
189 | extern int | ||
190 | ip_conntrack_tuple_taken(const struct ip_conntrack_tuple *tuple, | ||
191 | const struct ip_conntrack *ignored_conntrack); | ||
192 | |||
193 | /* Return conntrack_info and tuple hash for given skb. */ | ||
194 | static inline struct ip_conntrack * | ||
195 | ip_conntrack_get(const struct sk_buff *skb, enum ip_conntrack_info *ctinfo) | ||
196 | { | ||
197 | *ctinfo = skb->nfctinfo; | ||
198 | return (struct ip_conntrack *)skb->nfct; | ||
199 | } | ||
200 | |||
201 | /* decrement reference count on a conntrack */ | ||
202 | static inline void | ||
203 | ip_conntrack_put(struct ip_conntrack *ct) | ||
204 | { | ||
205 | IP_NF_ASSERT(ct); | ||
206 | nf_conntrack_put(&ct->ct_general); | ||
207 | } | ||
208 | |||
209 | extern int invert_tuplepr(struct ip_conntrack_tuple *inverse, | ||
210 | const struct ip_conntrack_tuple *orig); | ||
211 | |||
212 | extern void __ip_ct_refresh_acct(struct ip_conntrack *ct, | ||
213 | enum ip_conntrack_info ctinfo, | ||
214 | const struct sk_buff *skb, | ||
215 | unsigned long extra_jiffies, | ||
216 | int do_acct); | ||
217 | |||
218 | /* Refresh conntrack for this many jiffies and do accounting */ | ||
219 | static inline void ip_ct_refresh_acct(struct ip_conntrack *ct, | ||
220 | enum ip_conntrack_info ctinfo, | ||
221 | const struct sk_buff *skb, | ||
222 | unsigned long extra_jiffies) | ||
223 | { | ||
224 | __ip_ct_refresh_acct(ct, ctinfo, skb, extra_jiffies, 1); | ||
225 | } | ||
226 | |||
227 | /* Refresh conntrack for this many jiffies */ | ||
228 | static inline void ip_ct_refresh(struct ip_conntrack *ct, | ||
229 | const struct sk_buff *skb, | ||
230 | unsigned long extra_jiffies) | ||
231 | { | ||
232 | __ip_ct_refresh_acct(ct, 0, skb, extra_jiffies, 0); | ||
233 | } | ||
234 | |||
235 | /* These are for NAT. Icky. */ | ||
236 | /* Update TCP window tracking data when NAT mangles the packet */ | ||
237 | extern void ip_conntrack_tcp_update(struct sk_buff *skb, | ||
238 | struct ip_conntrack *conntrack, | ||
239 | enum ip_conntrack_dir dir); | ||
240 | |||
241 | /* Call me when a conntrack is destroyed. */ | ||
242 | extern void (*ip_conntrack_destroyed)(struct ip_conntrack *conntrack); | ||
243 | |||
244 | /* Fake conntrack entry for untracked connections */ | ||
245 | extern struct ip_conntrack ip_conntrack_untracked; | ||
246 | |||
247 | /* Returns new sk_buff, or NULL */ | ||
248 | struct sk_buff * | ||
249 | ip_ct_gather_frags(struct sk_buff *skb, u_int32_t user); | ||
250 | |||
251 | /* Iterate over all conntracks: if iter returns true, it's deleted. */ | ||
252 | extern void | ||
253 | ip_ct_iterate_cleanup(int (*iter)(struct ip_conntrack *i, void *data), | ||
254 | void *data); | ||
255 | |||
256 | extern struct ip_conntrack_helper * | ||
257 | __ip_conntrack_helper_find_byname(const char *); | ||
258 | extern struct ip_conntrack_helper * | ||
259 | ip_conntrack_helper_find_get(const struct ip_conntrack_tuple *tuple); | ||
260 | extern void ip_conntrack_helper_put(struct ip_conntrack_helper *helper); | ||
261 | |||
262 | extern struct ip_conntrack_protocol * | ||
263 | __ip_conntrack_proto_find(u_int8_t protocol); | ||
264 | extern struct ip_conntrack_protocol * | ||
265 | ip_conntrack_proto_find_get(u_int8_t protocol); | ||
266 | extern void ip_conntrack_proto_put(struct ip_conntrack_protocol *proto); | ||
267 | |||
268 | extern void ip_ct_remove_expectations(struct ip_conntrack *ct); | ||
269 | |||
270 | extern struct ip_conntrack *ip_conntrack_alloc(struct ip_conntrack_tuple *, | ||
271 | struct ip_conntrack_tuple *); | ||
272 | |||
273 | extern void ip_conntrack_free(struct ip_conntrack *ct); | ||
274 | |||
275 | extern void ip_conntrack_hash_insert(struct ip_conntrack *ct); | ||
276 | |||
277 | extern struct ip_conntrack_expect * | ||
278 | __ip_conntrack_expect_find(const struct ip_conntrack_tuple *tuple); | ||
279 | |||
280 | extern struct ip_conntrack_expect * | ||
281 | ip_conntrack_expect_find_get(const struct ip_conntrack_tuple *tuple); | ||
282 | |||
283 | extern struct ip_conntrack_tuple_hash * | ||
284 | __ip_conntrack_find(const struct ip_conntrack_tuple *tuple, | ||
285 | const struct ip_conntrack *ignored_conntrack); | ||
286 | |||
287 | extern void ip_conntrack_flush(void); | ||
288 | |||
289 | /* It's confirmed if it is, or has been in the hash table. */ | ||
290 | static inline int is_confirmed(struct ip_conntrack *ct) | ||
291 | { | ||
292 | return test_bit(IPS_CONFIRMED_BIT, &ct->status); | ||
293 | } | ||
294 | |||
295 | static inline int is_dying(struct ip_conntrack *ct) | ||
296 | { | ||
297 | return test_bit(IPS_DYING_BIT, &ct->status); | ||
298 | } | ||
299 | |||
300 | extern unsigned int ip_conntrack_htable_size; | ||
301 | extern int ip_conntrack_checksum; | ||
302 | |||
303 | #define CONNTRACK_STAT_INC(count) (__get_cpu_var(ip_conntrack_stat).count++) | ||
304 | #define CONNTRACK_STAT_INC_ATOMIC(count) \ | ||
305 | do { \ | ||
306 | local_bh_disable(); \ | ||
307 | __get_cpu_var(ip_conntrack_stat).count++; \ | ||
308 | local_bh_enable(); \ | ||
309 | } while (0) | ||
310 | |||
311 | #ifdef CONFIG_IP_NF_CONNTRACK_EVENTS | ||
312 | #include <linux/notifier.h> | ||
313 | #include <linux/interrupt.h> | ||
314 | |||
315 | struct ip_conntrack_ecache { | ||
316 | struct ip_conntrack *ct; | ||
317 | unsigned int events; | ||
318 | }; | ||
319 | DECLARE_PER_CPU(struct ip_conntrack_ecache, ip_conntrack_ecache); | ||
320 | |||
321 | #define CONNTRACK_ECACHE(x) (__get_cpu_var(ip_conntrack_ecache).x) | ||
322 | |||
323 | extern struct atomic_notifier_head ip_conntrack_chain; | ||
324 | extern struct atomic_notifier_head ip_conntrack_expect_chain; | ||
325 | |||
326 | static inline int ip_conntrack_register_notifier(struct notifier_block *nb) | ||
327 | { | ||
328 | return atomic_notifier_chain_register(&ip_conntrack_chain, nb); | ||
329 | } | ||
330 | |||
331 | static inline int ip_conntrack_unregister_notifier(struct notifier_block *nb) | ||
332 | { | ||
333 | return atomic_notifier_chain_unregister(&ip_conntrack_chain, nb); | ||
334 | } | ||
335 | |||
336 | static inline int | ||
337 | ip_conntrack_expect_register_notifier(struct notifier_block *nb) | ||
338 | { | ||
339 | return atomic_notifier_chain_register(&ip_conntrack_expect_chain, nb); | ||
340 | } | ||
341 | |||
342 | static inline int | ||
343 | ip_conntrack_expect_unregister_notifier(struct notifier_block *nb) | ||
344 | { | ||
345 | return atomic_notifier_chain_unregister(&ip_conntrack_expect_chain, | ||
346 | nb); | ||
347 | } | ||
348 | |||
349 | extern void ip_ct_deliver_cached_events(const struct ip_conntrack *ct); | ||
350 | extern void __ip_ct_event_cache_init(struct ip_conntrack *ct); | ||
351 | |||
352 | static inline void | ||
353 | ip_conntrack_event_cache(enum ip_conntrack_events event, | ||
354 | const struct sk_buff *skb) | ||
355 | { | ||
356 | struct ip_conntrack *ct = (struct ip_conntrack *)skb->nfct; | ||
357 | struct ip_conntrack_ecache *ecache; | ||
358 | |||
359 | local_bh_disable(); | ||
360 | ecache = &__get_cpu_var(ip_conntrack_ecache); | ||
361 | if (ct != ecache->ct) | ||
362 | __ip_ct_event_cache_init(ct); | ||
363 | ecache->events |= event; | ||
364 | local_bh_enable(); | ||
365 | } | ||
366 | |||
367 | static inline void ip_conntrack_event(enum ip_conntrack_events event, | ||
368 | struct ip_conntrack *ct) | ||
369 | { | ||
370 | if (is_confirmed(ct) && !is_dying(ct)) | ||
371 | atomic_notifier_call_chain(&ip_conntrack_chain, event, ct); | ||
372 | } | ||
373 | |||
374 | static inline void | ||
375 | ip_conntrack_expect_event(enum ip_conntrack_expect_events event, | ||
376 | struct ip_conntrack_expect *exp) | ||
377 | { | ||
378 | atomic_notifier_call_chain(&ip_conntrack_expect_chain, event, exp); | ||
379 | } | ||
380 | #else /* CONFIG_IP_NF_CONNTRACK_EVENTS */ | ||
381 | static inline void ip_conntrack_event_cache(enum ip_conntrack_events event, | ||
382 | const struct sk_buff *skb) {} | ||
383 | static inline void ip_conntrack_event(enum ip_conntrack_events event, | ||
384 | struct ip_conntrack *ct) {} | ||
385 | static inline void ip_ct_deliver_cached_events(const struct ip_conntrack *ct) {} | ||
386 | static inline void | ||
387 | ip_conntrack_expect_event(enum ip_conntrack_expect_events event, | ||
388 | struct ip_conntrack_expect *exp) {} | ||
389 | #endif /* CONFIG_IP_NF_CONNTRACK_EVENTS */ | ||
390 | |||
391 | #ifdef CONFIG_IP_NF_NAT_NEEDED | ||
392 | static inline int ip_nat_initialized(struct ip_conntrack *conntrack, | ||
393 | enum ip_nat_manip_type manip) | ||
394 | { | ||
395 | if (manip == IP_NAT_MANIP_SRC) | ||
396 | return test_bit(IPS_SRC_NAT_DONE_BIT, &conntrack->status); | ||
397 | return test_bit(IPS_DST_NAT_DONE_BIT, &conntrack->status); | ||
398 | } | ||
399 | #endif /* CONFIG_IP_NF_NAT_NEEDED */ | ||
400 | |||
401 | #endif /* __KERNEL__ */ | ||
402 | #endif /* _IP_CONNTRACK_H */ | ||
diff --git a/include/linux/netfilter_ipv4/ip_conntrack_amanda.h b/include/linux/netfilter_ipv4/ip_conntrack_amanda.h deleted file mode 100644 index de3e41f51aec..000000000000 --- a/include/linux/netfilter_ipv4/ip_conntrack_amanda.h +++ /dev/null | |||
@@ -1,11 +0,0 @@ | |||
1 | #ifndef _IP_CONNTRACK_AMANDA_H | ||
2 | #define _IP_CONNTRACK_AMANDA_H | ||
3 | /* AMANDA tracking. */ | ||
4 | |||
5 | struct ip_conntrack_expect; | ||
6 | extern unsigned int (*ip_nat_amanda_hook)(struct sk_buff **pskb, | ||
7 | enum ip_conntrack_info ctinfo, | ||
8 | unsigned int matchoff, | ||
9 | unsigned int matchlen, | ||
10 | struct ip_conntrack_expect *exp); | ||
11 | #endif /* _IP_CONNTRACK_AMANDA_H */ | ||
diff --git a/include/linux/netfilter_ipv4/ip_conntrack_core.h b/include/linux/netfilter_ipv4/ip_conntrack_core.h deleted file mode 100644 index e3a6df07aa4b..000000000000 --- a/include/linux/netfilter_ipv4/ip_conntrack_core.h +++ /dev/null | |||
@@ -1,61 +0,0 @@ | |||
1 | #ifndef _IP_CONNTRACK_CORE_H | ||
2 | #define _IP_CONNTRACK_CORE_H | ||
3 | #include <linux/netfilter.h> | ||
4 | |||
5 | #define MAX_IP_CT_PROTO 256 | ||
6 | extern struct ip_conntrack_protocol *ip_ct_protos[MAX_IP_CT_PROTO]; | ||
7 | |||
8 | /* This header is used to share core functionality between the | ||
9 | standalone connection tracking module, and the compatibility layer's use | ||
10 | of connection tracking. */ | ||
11 | extern unsigned int ip_conntrack_in(unsigned int hooknum, | ||
12 | struct sk_buff **pskb, | ||
13 | const struct net_device *in, | ||
14 | const struct net_device *out, | ||
15 | int (*okfn)(struct sk_buff *)); | ||
16 | |||
17 | extern int ip_conntrack_init(void); | ||
18 | extern void ip_conntrack_cleanup(void); | ||
19 | |||
20 | struct ip_conntrack_protocol; | ||
21 | |||
22 | extern int | ||
23 | ip_ct_get_tuple(const struct iphdr *iph, | ||
24 | const struct sk_buff *skb, | ||
25 | unsigned int dataoff, | ||
26 | struct ip_conntrack_tuple *tuple, | ||
27 | const struct ip_conntrack_protocol *protocol); | ||
28 | |||
29 | extern int | ||
30 | ip_ct_invert_tuple(struct ip_conntrack_tuple *inverse, | ||
31 | const struct ip_conntrack_tuple *orig, | ||
32 | const struct ip_conntrack_protocol *protocol); | ||
33 | |||
34 | /* Find a connection corresponding to a tuple. */ | ||
35 | struct ip_conntrack_tuple_hash * | ||
36 | ip_conntrack_find_get(const struct ip_conntrack_tuple *tuple, | ||
37 | const struct ip_conntrack *ignored_conntrack); | ||
38 | |||
39 | extern int __ip_conntrack_confirm(struct sk_buff **pskb); | ||
40 | |||
41 | /* Confirm a connection: returns NF_DROP if packet must be dropped. */ | ||
42 | static inline int ip_conntrack_confirm(struct sk_buff **pskb) | ||
43 | { | ||
44 | struct ip_conntrack *ct = (struct ip_conntrack *)(*pskb)->nfct; | ||
45 | int ret = NF_ACCEPT; | ||
46 | |||
47 | if (ct) { | ||
48 | if (!is_confirmed(ct) && !is_dying(ct)) | ||
49 | ret = __ip_conntrack_confirm(pskb); | ||
50 | ip_ct_deliver_cached_events(ct); | ||
51 | } | ||
52 | return ret; | ||
53 | } | ||
54 | |||
55 | extern void ip_ct_unlink_expect(struct ip_conntrack_expect *exp); | ||
56 | |||
57 | extern struct list_head *ip_conntrack_hash; | ||
58 | extern struct list_head ip_conntrack_expect_list; | ||
59 | extern rwlock_t ip_conntrack_lock; | ||
60 | #endif /* _IP_CONNTRACK_CORE_H */ | ||
61 | |||
diff --git a/include/linux/netfilter_ipv4/ip_conntrack_ftp.h b/include/linux/netfilter_ipv4/ip_conntrack_ftp.h deleted file mode 100644 index 2129fc3972ac..000000000000 --- a/include/linux/netfilter_ipv4/ip_conntrack_ftp.h +++ /dev/null | |||
@@ -1,44 +0,0 @@ | |||
1 | #ifndef _IP_CONNTRACK_FTP_H | ||
2 | #define _IP_CONNTRACK_FTP_H | ||
3 | /* FTP tracking. */ | ||
4 | |||
5 | /* This enum is exposed to userspace */ | ||
6 | enum ip_ct_ftp_type | ||
7 | { | ||
8 | /* PORT command from client */ | ||
9 | IP_CT_FTP_PORT, | ||
10 | /* PASV response from server */ | ||
11 | IP_CT_FTP_PASV, | ||
12 | /* EPRT command from client */ | ||
13 | IP_CT_FTP_EPRT, | ||
14 | /* EPSV response from server */ | ||
15 | IP_CT_FTP_EPSV, | ||
16 | }; | ||
17 | |||
18 | #ifdef __KERNEL__ | ||
19 | |||
20 | #define FTP_PORT 21 | ||
21 | |||
22 | #define NUM_SEQ_TO_REMEMBER 2 | ||
23 | /* This structure exists only once per master */ | ||
24 | struct ip_ct_ftp_master { | ||
25 | /* Valid seq positions for cmd matching after newline */ | ||
26 | u_int32_t seq_aft_nl[IP_CT_DIR_MAX][NUM_SEQ_TO_REMEMBER]; | ||
27 | /* 0 means seq_match_aft_nl not set */ | ||
28 | int seq_aft_nl_num[IP_CT_DIR_MAX]; | ||
29 | }; | ||
30 | |||
31 | struct ip_conntrack_expect; | ||
32 | |||
33 | /* For NAT to hook in when we find a packet which describes what other | ||
34 | * connection we should expect. */ | ||
35 | extern unsigned int (*ip_nat_ftp_hook)(struct sk_buff **pskb, | ||
36 | enum ip_conntrack_info ctinfo, | ||
37 | enum ip_ct_ftp_type type, | ||
38 | unsigned int matchoff, | ||
39 | unsigned int matchlen, | ||
40 | struct ip_conntrack_expect *exp, | ||
41 | u32 *seq); | ||
42 | #endif /* __KERNEL__ */ | ||
43 | |||
44 | #endif /* _IP_CONNTRACK_FTP_H */ | ||
diff --git a/include/linux/netfilter_ipv4/ip_conntrack_h323.h b/include/linux/netfilter_ipv4/ip_conntrack_h323.h deleted file mode 100644 index 18f769818f4e..000000000000 --- a/include/linux/netfilter_ipv4/ip_conntrack_h323.h +++ /dev/null | |||
@@ -1,89 +0,0 @@ | |||
1 | #ifndef _IP_CONNTRACK_H323_H | ||
2 | #define _IP_CONNTRACK_H323_H | ||
3 | |||
4 | #ifdef __KERNEL__ | ||
5 | |||
6 | #include <linux/netfilter/nf_conntrack_h323_asn1.h> | ||
7 | |||
8 | #define RAS_PORT 1719 | ||
9 | #define Q931_PORT 1720 | ||
10 | #define H323_RTP_CHANNEL_MAX 4 /* Audio, video, FAX and other */ | ||
11 | |||
12 | /* This structure exists only once per master */ | ||
13 | struct ip_ct_h323_master { | ||
14 | |||
15 | /* Original and NATed Q.931 or H.245 signal ports */ | ||
16 | u_int16_t sig_port[IP_CT_DIR_MAX]; | ||
17 | |||
18 | /* Original and NATed RTP ports */ | ||
19 | u_int16_t rtp_port[H323_RTP_CHANNEL_MAX][IP_CT_DIR_MAX]; | ||
20 | |||
21 | union { | ||
22 | /* RAS connection timeout */ | ||
23 | u_int32_t timeout; | ||
24 | |||
25 | /* Next TPKT length (for separate TPKT header and data) */ | ||
26 | u_int16_t tpkt_len[IP_CT_DIR_MAX]; | ||
27 | }; | ||
28 | }; | ||
29 | |||
30 | struct ip_conntrack_expect; | ||
31 | |||
32 | extern int get_h225_addr(unsigned char *data, TransportAddress * addr, | ||
33 | __be32 * ip, u_int16_t * port); | ||
34 | extern void ip_conntrack_h245_expect(struct ip_conntrack *new, | ||
35 | struct ip_conntrack_expect *this); | ||
36 | extern void ip_conntrack_q931_expect(struct ip_conntrack *new, | ||
37 | struct ip_conntrack_expect *this); | ||
38 | extern int (*set_h245_addr_hook) (struct sk_buff ** pskb, | ||
39 | unsigned char **data, int dataoff, | ||
40 | H245_TransportAddress * addr, | ||
41 | __be32 ip, u_int16_t port); | ||
42 | extern int (*set_h225_addr_hook) (struct sk_buff ** pskb, | ||
43 | unsigned char **data, int dataoff, | ||
44 | TransportAddress * addr, | ||
45 | __be32 ip, u_int16_t port); | ||
46 | extern int (*set_sig_addr_hook) (struct sk_buff ** pskb, | ||
47 | struct ip_conntrack * ct, | ||
48 | enum ip_conntrack_info ctinfo, | ||
49 | unsigned char **data, | ||
50 | TransportAddress * addr, int count); | ||
51 | extern int (*set_ras_addr_hook) (struct sk_buff ** pskb, | ||
52 | struct ip_conntrack * ct, | ||
53 | enum ip_conntrack_info ctinfo, | ||
54 | unsigned char **data, | ||
55 | TransportAddress * addr, int count); | ||
56 | extern int (*nat_rtp_rtcp_hook) (struct sk_buff ** pskb, | ||
57 | struct ip_conntrack * ct, | ||
58 | enum ip_conntrack_info ctinfo, | ||
59 | unsigned char **data, int dataoff, | ||
60 | H245_TransportAddress * addr, | ||
61 | u_int16_t port, u_int16_t rtp_port, | ||
62 | struct ip_conntrack_expect * rtp_exp, | ||
63 | struct ip_conntrack_expect * rtcp_exp); | ||
64 | extern int (*nat_t120_hook) (struct sk_buff ** pskb, struct ip_conntrack * ct, | ||
65 | enum ip_conntrack_info ctinfo, | ||
66 | unsigned char **data, int dataoff, | ||
67 | H245_TransportAddress * addr, u_int16_t port, | ||
68 | struct ip_conntrack_expect * exp); | ||
69 | extern int (*nat_h245_hook) (struct sk_buff ** pskb, struct ip_conntrack * ct, | ||
70 | enum ip_conntrack_info ctinfo, | ||
71 | unsigned char **data, int dataoff, | ||
72 | TransportAddress * addr, u_int16_t port, | ||
73 | struct ip_conntrack_expect * exp); | ||
74 | extern int (*nat_callforwarding_hook) (struct sk_buff ** pskb, | ||
75 | struct ip_conntrack * ct, | ||
76 | enum ip_conntrack_info ctinfo, | ||
77 | unsigned char **data, int dataoff, | ||
78 | TransportAddress * addr, | ||
79 | u_int16_t port, | ||
80 | struct ip_conntrack_expect * exp); | ||
81 | extern int (*nat_q931_hook) (struct sk_buff ** pskb, struct ip_conntrack * ct, | ||
82 | enum ip_conntrack_info ctinfo, | ||
83 | unsigned char **data, TransportAddress * addr, | ||
84 | int idx, u_int16_t port, | ||
85 | struct ip_conntrack_expect * exp); | ||
86 | |||
87 | #endif | ||
88 | |||
89 | #endif | ||
diff --git a/include/linux/netfilter_ipv4/ip_conntrack_helper.h b/include/linux/netfilter_ipv4/ip_conntrack_helper.h deleted file mode 100644 index 77fe868d36ff..000000000000 --- a/include/linux/netfilter_ipv4/ip_conntrack_helper.h +++ /dev/null | |||
@@ -1,46 +0,0 @@ | |||
1 | /* IP connection tracking helpers. */ | ||
2 | #ifndef _IP_CONNTRACK_HELPER_H | ||
3 | #define _IP_CONNTRACK_HELPER_H | ||
4 | #include <linux/netfilter_ipv4/ip_conntrack.h> | ||
5 | |||
6 | struct module; | ||
7 | |||
8 | struct ip_conntrack_helper | ||
9 | { | ||
10 | struct list_head list; /* Internal use. */ | ||
11 | |||
12 | const char *name; /* name of the module */ | ||
13 | struct module *me; /* pointer to self */ | ||
14 | unsigned int max_expected; /* Maximum number of concurrent | ||
15 | * expected connections */ | ||
16 | unsigned int timeout; /* timeout for expecteds */ | ||
17 | |||
18 | /* Mask of things we will help (compared against server response) */ | ||
19 | struct ip_conntrack_tuple tuple; | ||
20 | struct ip_conntrack_tuple mask; | ||
21 | |||
22 | /* Function to call when data passes; return verdict, or -1 to | ||
23 | invalidate. */ | ||
24 | int (*help)(struct sk_buff **pskb, | ||
25 | struct ip_conntrack *ct, | ||
26 | enum ip_conntrack_info conntrackinfo); | ||
27 | |||
28 | void (*destroy)(struct ip_conntrack *ct); | ||
29 | |||
30 | int (*to_nfattr)(struct sk_buff *skb, const struct ip_conntrack *ct); | ||
31 | }; | ||
32 | |||
33 | extern int ip_conntrack_helper_register(struct ip_conntrack_helper *); | ||
34 | extern void ip_conntrack_helper_unregister(struct ip_conntrack_helper *); | ||
35 | |||
36 | /* Allocate space for an expectation: this is mandatory before calling | ||
37 | ip_conntrack_expect_related. You will have to call put afterwards. */ | ||
38 | extern struct ip_conntrack_expect * | ||
39 | ip_conntrack_expect_alloc(struct ip_conntrack *master); | ||
40 | extern void ip_conntrack_expect_put(struct ip_conntrack_expect *exp); | ||
41 | |||
42 | /* Add an expected connection: can have more than one per connection */ | ||
43 | extern int ip_conntrack_expect_related(struct ip_conntrack_expect *exp); | ||
44 | extern void ip_conntrack_unexpect_related(struct ip_conntrack_expect *exp); | ||
45 | |||
46 | #endif /*_IP_CONNTRACK_HELPER_H*/ | ||
diff --git a/include/linux/netfilter_ipv4/ip_conntrack_icmp.h b/include/linux/netfilter_ipv4/ip_conntrack_icmp.h deleted file mode 100644 index eed5ee3e4744..000000000000 --- a/include/linux/netfilter_ipv4/ip_conntrack_icmp.h +++ /dev/null | |||
@@ -1,6 +0,0 @@ | |||
1 | #ifndef _IP_CONNTRACK_ICMP_H | ||
2 | #define _IP_CONNTRACK_ICMP_H | ||
3 | |||
4 | #include <net/netfilter/ipv4/nf_conntrack_icmp.h> | ||
5 | |||
6 | #endif /* _IP_CONNTRACK_ICMP_H */ | ||
diff --git a/include/linux/netfilter_ipv4/ip_conntrack_irc.h b/include/linux/netfilter_ipv4/ip_conntrack_irc.h deleted file mode 100644 index 16601e0d5626..000000000000 --- a/include/linux/netfilter_ipv4/ip_conntrack_irc.h +++ /dev/null | |||
@@ -1,32 +0,0 @@ | |||
1 | /* IRC extension for IP connection tracking. | ||
2 | * (C) 2000 by Harald Welte <laforge@gnumonks.org> | ||
3 | * based on RR's ip_conntrack_ftp.h | ||
4 | * | ||
5 | * ip_conntrack_irc.h,v 1.6 2000/11/07 18:26:42 laforge Exp | ||
6 | * | ||
7 | * This program is free software; you can redistribute it and/or | ||
8 | * modify it under the terms of the GNU General Public License | ||
9 | * as published by the Free Software Foundation; either version | ||
10 | * 2 of the License, or (at your option) any later version. | ||
11 | * | ||
12 | * | ||
13 | */ | ||
14 | #ifndef _IP_CONNTRACK_IRC_H | ||
15 | #define _IP_CONNTRACK_IRC_H | ||
16 | |||
17 | /* This structure exists only once per master */ | ||
18 | struct ip_ct_irc_master { | ||
19 | }; | ||
20 | |||
21 | #ifdef __KERNEL__ | ||
22 | extern unsigned int (*ip_nat_irc_hook)(struct sk_buff **pskb, | ||
23 | enum ip_conntrack_info ctinfo, | ||
24 | unsigned int matchoff, | ||
25 | unsigned int matchlen, | ||
26 | struct ip_conntrack_expect *exp); | ||
27 | |||
28 | #define IRC_PORT 6667 | ||
29 | |||
30 | #endif /* __KERNEL__ */ | ||
31 | |||
32 | #endif /* _IP_CONNTRACK_IRC_H */ | ||
diff --git a/include/linux/netfilter_ipv4/ip_conntrack_pptp.h b/include/linux/netfilter_ipv4/ip_conntrack_pptp.h deleted file mode 100644 index 2644b1faddd6..000000000000 --- a/include/linux/netfilter_ipv4/ip_conntrack_pptp.h +++ /dev/null | |||
@@ -1,326 +0,0 @@ | |||
1 | /* PPTP constants and structs */ | ||
2 | #ifndef _CONNTRACK_PPTP_H | ||
3 | #define _CONNTRACK_PPTP_H | ||
4 | |||
5 | /* state of the control session */ | ||
6 | enum pptp_ctrlsess_state { | ||
7 | PPTP_SESSION_NONE, /* no session present */ | ||
8 | PPTP_SESSION_ERROR, /* some session error */ | ||
9 | PPTP_SESSION_STOPREQ, /* stop_sess request seen */ | ||
10 | PPTP_SESSION_REQUESTED, /* start_sess request seen */ | ||
11 | PPTP_SESSION_CONFIRMED, /* session established */ | ||
12 | }; | ||
13 | |||
14 | /* state of the call inside the control session */ | ||
15 | enum pptp_ctrlcall_state { | ||
16 | PPTP_CALL_NONE, | ||
17 | PPTP_CALL_ERROR, | ||
18 | PPTP_CALL_OUT_REQ, | ||
19 | PPTP_CALL_OUT_CONF, | ||
20 | PPTP_CALL_IN_REQ, | ||
21 | PPTP_CALL_IN_REP, | ||
22 | PPTP_CALL_IN_CONF, | ||
23 | PPTP_CALL_CLEAR_REQ, | ||
24 | }; | ||
25 | |||
26 | |||
27 | /* conntrack private data */ | ||
28 | struct ip_ct_pptp_master { | ||
29 | enum pptp_ctrlsess_state sstate; /* session state */ | ||
30 | |||
31 | /* everything below is going to be per-expectation in newnat, | ||
32 | * since there could be more than one call within one session */ | ||
33 | enum pptp_ctrlcall_state cstate; /* call state */ | ||
34 | __be16 pac_call_id; /* call id of PAC, host byte order */ | ||
35 | __be16 pns_call_id; /* call id of PNS, host byte order */ | ||
36 | |||
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 */ | ||
39 | struct ip_ct_gre_keymap *keymap_orig, *keymap_reply; | ||
40 | }; | ||
41 | |||
42 | /* conntrack_expect private member */ | ||
43 | struct ip_ct_pptp_expect { | ||
44 | enum pptp_ctrlcall_state cstate; /* call state */ | ||
45 | __be16 pac_call_id; /* call id of PAC */ | ||
46 | __be16 pns_call_id; /* call id of PNS */ | ||
47 | }; | ||
48 | |||
49 | |||
50 | #ifdef __KERNEL__ | ||
51 | |||
52 | #define IP_CONNTR_PPTP PPTP_CONTROL_PORT | ||
53 | |||
54 | #define PPTP_CONTROL_PORT 1723 | ||
55 | |||
56 | #define PPTP_PACKET_CONTROL 1 | ||
57 | #define PPTP_PACKET_MGMT 2 | ||
58 | |||
59 | #define PPTP_MAGIC_COOKIE 0x1a2b3c4d | ||
60 | |||
61 | struct pptp_pkt_hdr { | ||
62 | __u16 packetLength; | ||
63 | __be16 packetType; | ||
64 | __be32 magicCookie; | ||
65 | }; | ||
66 | |||
67 | /* PptpControlMessageType values */ | ||
68 | #define PPTP_START_SESSION_REQUEST 1 | ||
69 | #define PPTP_START_SESSION_REPLY 2 | ||
70 | #define PPTP_STOP_SESSION_REQUEST 3 | ||
71 | #define PPTP_STOP_SESSION_REPLY 4 | ||
72 | #define PPTP_ECHO_REQUEST 5 | ||
73 | #define PPTP_ECHO_REPLY 6 | ||
74 | #define PPTP_OUT_CALL_REQUEST 7 | ||
75 | #define PPTP_OUT_CALL_REPLY 8 | ||
76 | #define PPTP_IN_CALL_REQUEST 9 | ||
77 | #define PPTP_IN_CALL_REPLY 10 | ||
78 | #define PPTP_IN_CALL_CONNECT 11 | ||
79 | #define PPTP_CALL_CLEAR_REQUEST 12 | ||
80 | #define PPTP_CALL_DISCONNECT_NOTIFY 13 | ||
81 | #define PPTP_WAN_ERROR_NOTIFY 14 | ||
82 | #define PPTP_SET_LINK_INFO 15 | ||
83 | |||
84 | #define PPTP_MSG_MAX 15 | ||
85 | |||
86 | /* PptpGeneralError values */ | ||
87 | #define PPTP_ERROR_CODE_NONE 0 | ||
88 | #define PPTP_NOT_CONNECTED 1 | ||
89 | #define PPTP_BAD_FORMAT 2 | ||
90 | #define PPTP_BAD_VALUE 3 | ||
91 | #define PPTP_NO_RESOURCE 4 | ||
92 | #define PPTP_BAD_CALLID 5 | ||
93 | #define PPTP_REMOVE_DEVICE_ERROR 6 | ||
94 | |||
95 | struct PptpControlHeader { | ||
96 | __be16 messageType; | ||
97 | __u16 reserved; | ||
98 | }; | ||
99 | |||
100 | /* FramingCapability Bitmap Values */ | ||
101 | #define PPTP_FRAME_CAP_ASYNC 0x1 | ||
102 | #define PPTP_FRAME_CAP_SYNC 0x2 | ||
103 | |||
104 | /* BearerCapability Bitmap Values */ | ||
105 | #define PPTP_BEARER_CAP_ANALOG 0x1 | ||
106 | #define PPTP_BEARER_CAP_DIGITAL 0x2 | ||
107 | |||
108 | struct PptpStartSessionRequest { | ||
109 | __be16 protocolVersion; | ||
110 | __u16 reserved1; | ||
111 | __be32 framingCapability; | ||
112 | __be32 bearerCapability; | ||
113 | __be16 maxChannels; | ||
114 | __be16 firmwareRevision; | ||
115 | __u8 hostName[64]; | ||
116 | __u8 vendorString[64]; | ||
117 | }; | ||
118 | |||
119 | /* PptpStartSessionResultCode Values */ | ||
120 | #define PPTP_START_OK 1 | ||
121 | #define PPTP_START_GENERAL_ERROR 2 | ||
122 | #define PPTP_START_ALREADY_CONNECTED 3 | ||
123 | #define PPTP_START_NOT_AUTHORIZED 4 | ||
124 | #define PPTP_START_UNKNOWN_PROTOCOL 5 | ||
125 | |||
126 | struct PptpStartSessionReply { | ||
127 | __be16 protocolVersion; | ||
128 | __u8 resultCode; | ||
129 | __u8 generalErrorCode; | ||
130 | __be32 framingCapability; | ||
131 | __be32 bearerCapability; | ||
132 | __be16 maxChannels; | ||
133 | __be16 firmwareRevision; | ||
134 | __u8 hostName[64]; | ||
135 | __u8 vendorString[64]; | ||
136 | }; | ||
137 | |||
138 | /* PptpStopReasons */ | ||
139 | #define PPTP_STOP_NONE 1 | ||
140 | #define PPTP_STOP_PROTOCOL 2 | ||
141 | #define PPTP_STOP_LOCAL_SHUTDOWN 3 | ||
142 | |||
143 | struct PptpStopSessionRequest { | ||
144 | __u8 reason; | ||
145 | __u8 reserved1; | ||
146 | __u16 reserved2; | ||
147 | }; | ||
148 | |||
149 | /* PptpStopSessionResultCode */ | ||
150 | #define PPTP_STOP_OK 1 | ||
151 | #define PPTP_STOP_GENERAL_ERROR 2 | ||
152 | |||
153 | struct PptpStopSessionReply { | ||
154 | __u8 resultCode; | ||
155 | __u8 generalErrorCode; | ||
156 | __u16 reserved1; | ||
157 | }; | ||
158 | |||
159 | struct PptpEchoRequest { | ||
160 | __be32 identNumber; | ||
161 | }; | ||
162 | |||
163 | /* PptpEchoReplyResultCode */ | ||
164 | #define PPTP_ECHO_OK 1 | ||
165 | #define PPTP_ECHO_GENERAL_ERROR 2 | ||
166 | |||
167 | struct PptpEchoReply { | ||
168 | __be32 identNumber; | ||
169 | __u8 resultCode; | ||
170 | __u8 generalErrorCode; | ||
171 | __u16 reserved; | ||
172 | }; | ||
173 | |||
174 | /* PptpFramingType */ | ||
175 | #define PPTP_ASYNC_FRAMING 1 | ||
176 | #define PPTP_SYNC_FRAMING 2 | ||
177 | #define PPTP_DONT_CARE_FRAMING 3 | ||
178 | |||
179 | /* PptpCallBearerType */ | ||
180 | #define PPTP_ANALOG_TYPE 1 | ||
181 | #define PPTP_DIGITAL_TYPE 2 | ||
182 | #define PPTP_DONT_CARE_BEARER_TYPE 3 | ||
183 | |||
184 | struct PptpOutCallRequest { | ||
185 | __be16 callID; | ||
186 | __be16 callSerialNumber; | ||
187 | __be32 minBPS; | ||
188 | __be32 maxBPS; | ||
189 | __be32 bearerType; | ||
190 | __be32 framingType; | ||
191 | __be16 packetWindow; | ||
192 | __be16 packetProcDelay; | ||
193 | __be16 phoneNumberLength; | ||
194 | __u16 reserved1; | ||
195 | __u8 phoneNumber[64]; | ||
196 | __u8 subAddress[64]; | ||
197 | }; | ||
198 | |||
199 | /* PptpCallResultCode */ | ||
200 | #define PPTP_OUTCALL_CONNECT 1 | ||
201 | #define PPTP_OUTCALL_GENERAL_ERROR 2 | ||
202 | #define PPTP_OUTCALL_NO_CARRIER 3 | ||
203 | #define PPTP_OUTCALL_BUSY 4 | ||
204 | #define PPTP_OUTCALL_NO_DIAL_TONE 5 | ||
205 | #define PPTP_OUTCALL_TIMEOUT 6 | ||
206 | #define PPTP_OUTCALL_DONT_ACCEPT 7 | ||
207 | |||
208 | struct PptpOutCallReply { | ||
209 | __be16 callID; | ||
210 | __be16 peersCallID; | ||
211 | __u8 resultCode; | ||
212 | __u8 generalErrorCode; | ||
213 | __be16 causeCode; | ||
214 | __be32 connectSpeed; | ||
215 | __be16 packetWindow; | ||
216 | __be16 packetProcDelay; | ||
217 | __be32 physChannelID; | ||
218 | }; | ||
219 | |||
220 | struct PptpInCallRequest { | ||
221 | __be16 callID; | ||
222 | __be16 callSerialNumber; | ||
223 | __be32 callBearerType; | ||
224 | __be32 physChannelID; | ||
225 | __be16 dialedNumberLength; | ||
226 | __be16 dialingNumberLength; | ||
227 | __u8 dialedNumber[64]; | ||
228 | __u8 dialingNumber[64]; | ||
229 | __u8 subAddress[64]; | ||
230 | }; | ||
231 | |||
232 | /* PptpInCallResultCode */ | ||
233 | #define PPTP_INCALL_ACCEPT 1 | ||
234 | #define PPTP_INCALL_GENERAL_ERROR 2 | ||
235 | #define PPTP_INCALL_DONT_ACCEPT 3 | ||
236 | |||
237 | struct PptpInCallReply { | ||
238 | __be16 callID; | ||
239 | __be16 peersCallID; | ||
240 | __u8 resultCode; | ||
241 | __u8 generalErrorCode; | ||
242 | __be16 packetWindow; | ||
243 | __be16 packetProcDelay; | ||
244 | __u16 reserved; | ||
245 | }; | ||
246 | |||
247 | struct PptpInCallConnected { | ||
248 | __be16 peersCallID; | ||
249 | __u16 reserved; | ||
250 | __be32 connectSpeed; | ||
251 | __be16 packetWindow; | ||
252 | __be16 packetProcDelay; | ||
253 | __be32 callFramingType; | ||
254 | }; | ||
255 | |||
256 | struct PptpClearCallRequest { | ||
257 | __be16 callID; | ||
258 | __u16 reserved; | ||
259 | }; | ||
260 | |||
261 | struct PptpCallDisconnectNotify { | ||
262 | __be16 callID; | ||
263 | __u8 resultCode; | ||
264 | __u8 generalErrorCode; | ||
265 | __be16 causeCode; | ||
266 | __u16 reserved; | ||
267 | __u8 callStatistics[128]; | ||
268 | }; | ||
269 | |||
270 | struct PptpWanErrorNotify { | ||
271 | __be16 peersCallID; | ||
272 | __u16 reserved; | ||
273 | __be32 crcErrors; | ||
274 | __be32 framingErrors; | ||
275 | __be32 hardwareOverRuns; | ||
276 | __be32 bufferOverRuns; | ||
277 | __be32 timeoutErrors; | ||
278 | __be32 alignmentErrors; | ||
279 | }; | ||
280 | |||
281 | struct PptpSetLinkInfo { | ||
282 | __be16 peersCallID; | ||
283 | __u16 reserved; | ||
284 | __be32 sendAccm; | ||
285 | __be32 recvAccm; | ||
286 | }; | ||
287 | |||
288 | union pptp_ctrl_union { | ||
289 | struct PptpStartSessionRequest sreq; | ||
290 | struct PptpStartSessionReply srep; | ||
291 | struct PptpStopSessionRequest streq; | ||
292 | struct PptpStopSessionReply strep; | ||
293 | struct PptpOutCallRequest ocreq; | ||
294 | struct PptpOutCallReply ocack; | ||
295 | struct PptpInCallRequest icreq; | ||
296 | struct PptpInCallReply icack; | ||
297 | struct PptpInCallConnected iccon; | ||
298 | struct PptpClearCallRequest clrreq; | ||
299 | struct PptpCallDisconnectNotify disc; | ||
300 | struct PptpWanErrorNotify wanerr; | ||
301 | struct PptpSetLinkInfo setlink; | ||
302 | }; | ||
303 | |||
304 | extern int | ||
305 | (*ip_nat_pptp_hook_outbound)(struct sk_buff **pskb, | ||
306 | struct ip_conntrack *ct, | ||
307 | enum ip_conntrack_info ctinfo, | ||
308 | struct PptpControlHeader *ctlh, | ||
309 | union pptp_ctrl_union *pptpReq); | ||
310 | |||
311 | extern int | ||
312 | (*ip_nat_pptp_hook_inbound)(struct sk_buff **pskb, | ||
313 | struct ip_conntrack *ct, | ||
314 | enum ip_conntrack_info ctinfo, | ||
315 | struct PptpControlHeader *ctlh, | ||
316 | union pptp_ctrl_union *pptpReq); | ||
317 | |||
318 | extern void | ||
319 | (*ip_nat_pptp_hook_exp_gre)(struct ip_conntrack_expect *exp_orig, | ||
320 | struct ip_conntrack_expect *exp_reply); | ||
321 | |||
322 | extern void | ||
323 | (*ip_nat_pptp_hook_expectfn)(struct ip_conntrack *ct, | ||
324 | struct ip_conntrack_expect *exp); | ||
325 | #endif /* __KERNEL__ */ | ||
326 | #endif /* _CONNTRACK_PPTP_H */ | ||
diff --git a/include/linux/netfilter_ipv4/ip_conntrack_proto_gre.h b/include/linux/netfilter_ipv4/ip_conntrack_proto_gre.h deleted file mode 100644 index e371e0fc1672..000000000000 --- a/include/linux/netfilter_ipv4/ip_conntrack_proto_gre.h +++ /dev/null | |||
@@ -1,114 +0,0 @@ | |||
1 | #ifndef _CONNTRACK_PROTO_GRE_H | ||
2 | #define _CONNTRACK_PROTO_GRE_H | ||
3 | #include <asm/byteorder.h> | ||
4 | |||
5 | /* GRE PROTOCOL HEADER */ | ||
6 | |||
7 | /* GRE Version field */ | ||
8 | #define GRE_VERSION_1701 0x0 | ||
9 | #define GRE_VERSION_PPTP 0x1 | ||
10 | |||
11 | /* GRE Protocol field */ | ||
12 | #define GRE_PROTOCOL_PPTP 0x880B | ||
13 | |||
14 | /* GRE Flags */ | ||
15 | #define GRE_FLAG_C 0x80 | ||
16 | #define GRE_FLAG_R 0x40 | ||
17 | #define GRE_FLAG_K 0x20 | ||
18 | #define GRE_FLAG_S 0x10 | ||
19 | #define GRE_FLAG_A 0x80 | ||
20 | |||
21 | #define GRE_IS_C(f) ((f)&GRE_FLAG_C) | ||
22 | #define GRE_IS_R(f) ((f)&GRE_FLAG_R) | ||
23 | #define GRE_IS_K(f) ((f)&GRE_FLAG_K) | ||
24 | #define GRE_IS_S(f) ((f)&GRE_FLAG_S) | ||
25 | #define GRE_IS_A(f) ((f)&GRE_FLAG_A) | ||
26 | |||
27 | /* GRE is a mess: Four different standards */ | ||
28 | struct gre_hdr { | ||
29 | #if defined(__LITTLE_ENDIAN_BITFIELD) | ||
30 | __u16 rec:3, | ||
31 | srr:1, | ||
32 | seq:1, | ||
33 | key:1, | ||
34 | routing:1, | ||
35 | csum:1, | ||
36 | version:3, | ||
37 | reserved:4, | ||
38 | ack:1; | ||
39 | #elif defined(__BIG_ENDIAN_BITFIELD) | ||
40 | __u16 csum:1, | ||
41 | routing:1, | ||
42 | key:1, | ||
43 | seq:1, | ||
44 | srr:1, | ||
45 | rec:3, | ||
46 | ack:1, | ||
47 | reserved:4, | ||
48 | version:3; | ||
49 | #else | ||
50 | #error "Adjust your <asm/byteorder.h> defines" | ||
51 | #endif | ||
52 | __be16 protocol; | ||
53 | }; | ||
54 | |||
55 | /* modified GRE header for PPTP */ | ||
56 | struct gre_hdr_pptp { | ||
57 | __u8 flags; /* bitfield */ | ||
58 | __u8 version; /* should be GRE_VERSION_PPTP */ | ||
59 | __be16 protocol; /* should be GRE_PROTOCOL_PPTP */ | ||
60 | __be16 payload_len; /* size of ppp payload, not inc. gre header */ | ||
61 | __be16 call_id; /* peer's call_id for this session */ | ||
62 | __be32 seq; /* sequence number. Present if S==1 */ | ||
63 | __be32 ack; /* seq number of highest packet recieved by */ | ||
64 | /* sender in this session */ | ||
65 | }; | ||
66 | |||
67 | |||
68 | /* this is part of ip_conntrack */ | ||
69 | struct ip_ct_gre { | ||
70 | unsigned int stream_timeout; | ||
71 | unsigned int timeout; | ||
72 | }; | ||
73 | |||
74 | #ifdef __KERNEL__ | ||
75 | struct ip_conntrack_expect; | ||
76 | struct ip_conntrack; | ||
77 | |||
78 | /* structure for original <-> reply keymap */ | ||
79 | struct ip_ct_gre_keymap { | ||
80 | struct list_head list; | ||
81 | |||
82 | struct ip_conntrack_tuple tuple; | ||
83 | }; | ||
84 | |||
85 | /* add new tuple->key_reply pair to keymap */ | ||
86 | int ip_ct_gre_keymap_add(struct ip_conntrack *ct, | ||
87 | struct ip_conntrack_tuple *t, | ||
88 | int reply); | ||
89 | |||
90 | /* delete keymap entries */ | ||
91 | void ip_ct_gre_keymap_destroy(struct ip_conntrack *ct); | ||
92 | |||
93 | |||
94 | /* get pointer to gre key, if present */ | ||
95 | static inline __be32 *gre_key(struct gre_hdr *greh) | ||
96 | { | ||
97 | if (!greh->key) | ||
98 | return NULL; | ||
99 | if (greh->csum || greh->routing) | ||
100 | return (__be32 *) (greh+sizeof(*greh)+4); | ||
101 | return (__be32 *) (greh+sizeof(*greh)); | ||
102 | } | ||
103 | |||
104 | /* get pointer ot gre csum, if present */ | ||
105 | static inline __sum16 *gre_csum(struct gre_hdr *greh) | ||
106 | { | ||
107 | if (!greh->csum) | ||
108 | return NULL; | ||
109 | return (__sum16 *) (greh+sizeof(*greh)); | ||
110 | } | ||
111 | |||
112 | #endif /* __KERNEL__ */ | ||
113 | |||
114 | #endif /* _CONNTRACK_PROTO_GRE_H */ | ||
diff --git a/include/linux/netfilter_ipv4/ip_conntrack_protocol.h b/include/linux/netfilter_ipv4/ip_conntrack_protocol.h deleted file mode 100644 index 2c76b879e3dc..000000000000 --- a/include/linux/netfilter_ipv4/ip_conntrack_protocol.h +++ /dev/null | |||
@@ -1,98 +0,0 @@ | |||
1 | /* Header for use in defining a given protocol for connection tracking. */ | ||
2 | #ifndef _IP_CONNTRACK_PROTOCOL_H | ||
3 | #define _IP_CONNTRACK_PROTOCOL_H | ||
4 | #include <linux/netfilter_ipv4/ip_conntrack.h> | ||
5 | #include <linux/netfilter/nfnetlink_conntrack.h> | ||
6 | |||
7 | struct seq_file; | ||
8 | |||
9 | struct ip_conntrack_protocol | ||
10 | { | ||
11 | /* Protocol number. */ | ||
12 | u_int8_t proto; | ||
13 | |||
14 | /* Protocol name */ | ||
15 | const char *name; | ||
16 | |||
17 | /* Try to fill in the third arg: dataoff is offset past IP | ||
18 | hdr. Return true if possible. */ | ||
19 | int (*pkt_to_tuple)(const struct sk_buff *skb, | ||
20 | unsigned int dataoff, | ||
21 | struct ip_conntrack_tuple *tuple); | ||
22 | |||
23 | /* Invert the per-proto part of the tuple: ie. turn xmit into reply. | ||
24 | * Some packets can't be inverted: return 0 in that case. | ||
25 | */ | ||
26 | int (*invert_tuple)(struct ip_conntrack_tuple *inverse, | ||
27 | const struct ip_conntrack_tuple *orig); | ||
28 | |||
29 | /* Print out the per-protocol part of the tuple. Return like seq_* */ | ||
30 | int (*print_tuple)(struct seq_file *, | ||
31 | const struct ip_conntrack_tuple *); | ||
32 | |||
33 | /* Print out the private part of the conntrack. */ | ||
34 | int (*print_conntrack)(struct seq_file *, const struct ip_conntrack *); | ||
35 | |||
36 | /* Returns verdict for packet, or -1 for invalid. */ | ||
37 | int (*packet)(struct ip_conntrack *conntrack, | ||
38 | const struct sk_buff *skb, | ||
39 | enum ip_conntrack_info ctinfo); | ||
40 | |||
41 | /* Called when a new connection for this protocol found; | ||
42 | * returns TRUE if it's OK. If so, packet() called next. */ | ||
43 | int (*new)(struct ip_conntrack *conntrack, const struct sk_buff *skb); | ||
44 | |||
45 | /* Called when a conntrack entry is destroyed */ | ||
46 | void (*destroy)(struct ip_conntrack *conntrack); | ||
47 | |||
48 | int (*error)(struct sk_buff *skb, enum ip_conntrack_info *ctinfo, | ||
49 | unsigned int hooknum); | ||
50 | |||
51 | /* convert protoinfo to nfnetink attributes */ | ||
52 | int (*to_nfattr)(struct sk_buff *skb, struct nfattr *nfa, | ||
53 | const struct ip_conntrack *ct); | ||
54 | |||
55 | /* convert nfnetlink attributes to protoinfo */ | ||
56 | int (*from_nfattr)(struct nfattr *tb[], struct ip_conntrack *ct); | ||
57 | |||
58 | int (*tuple_to_nfattr)(struct sk_buff *skb, | ||
59 | const struct ip_conntrack_tuple *t); | ||
60 | int (*nfattr_to_tuple)(struct nfattr *tb[], | ||
61 | struct ip_conntrack_tuple *t); | ||
62 | |||
63 | /* Module (if any) which this is connected to. */ | ||
64 | struct module *me; | ||
65 | }; | ||
66 | |||
67 | /* Protocol registration. */ | ||
68 | extern int ip_conntrack_protocol_register(struct ip_conntrack_protocol *proto); | ||
69 | extern void ip_conntrack_protocol_unregister(struct ip_conntrack_protocol *proto); | ||
70 | /* Existing built-in protocols */ | ||
71 | extern struct ip_conntrack_protocol ip_conntrack_protocol_tcp; | ||
72 | extern struct ip_conntrack_protocol ip_conntrack_protocol_udp; | ||
73 | extern struct ip_conntrack_protocol ip_conntrack_protocol_icmp; | ||
74 | extern struct ip_conntrack_protocol ip_conntrack_generic_protocol; | ||
75 | extern int ip_conntrack_protocol_tcp_init(void); | ||
76 | |||
77 | /* Log invalid packets */ | ||
78 | extern unsigned int ip_ct_log_invalid; | ||
79 | |||
80 | extern int ip_ct_port_tuple_to_nfattr(struct sk_buff *, | ||
81 | const struct ip_conntrack_tuple *); | ||
82 | extern int ip_ct_port_nfattr_to_tuple(struct nfattr *tb[], | ||
83 | struct ip_conntrack_tuple *); | ||
84 | |||
85 | #ifdef CONFIG_SYSCTL | ||
86 | #ifdef DEBUG_INVALID_PACKETS | ||
87 | #define LOG_INVALID(proto) \ | ||
88 | (ip_ct_log_invalid == (proto) || ip_ct_log_invalid == IPPROTO_RAW) | ||
89 | #else | ||
90 | #define LOG_INVALID(proto) \ | ||
91 | ((ip_ct_log_invalid == (proto) || ip_ct_log_invalid == IPPROTO_RAW) \ | ||
92 | && net_ratelimit()) | ||
93 | #endif | ||
94 | #else | ||
95 | #define LOG_INVALID(proto) 0 | ||
96 | #endif /* CONFIG_SYSCTL */ | ||
97 | |||
98 | #endif /*_IP_CONNTRACK_PROTOCOL_H*/ | ||
diff --git a/include/linux/netfilter_ipv4/ip_conntrack_sctp.h b/include/linux/netfilter_ipv4/ip_conntrack_sctp.h deleted file mode 100644 index 4099a041a32a..000000000000 --- a/include/linux/netfilter_ipv4/ip_conntrack_sctp.h +++ /dev/null | |||
@@ -1,6 +0,0 @@ | |||
1 | #ifndef _IP_CONNTRACK_SCTP_H | ||
2 | #define _IP_CONNTRACK_SCTP_H | ||
3 | |||
4 | #include <linux/netfilter/nf_conntrack_sctp.h> | ||
5 | |||
6 | #endif /* _IP_CONNTRACK_SCTP_H */ | ||
diff --git a/include/linux/netfilter_ipv4/ip_conntrack_sip.h b/include/linux/netfilter_ipv4/ip_conntrack_sip.h deleted file mode 100644 index bef6c646defa..000000000000 --- a/include/linux/netfilter_ipv4/ip_conntrack_sip.h +++ /dev/null | |||
@@ -1,40 +0,0 @@ | |||
1 | #ifndef __IP_CONNTRACK_SIP_H__ | ||
2 | #define __IP_CONNTRACK_SIP_H__ | ||
3 | #ifdef __KERNEL__ | ||
4 | |||
5 | #define SIP_PORT 5060 | ||
6 | #define SIP_TIMEOUT 3600 | ||
7 | |||
8 | enum sip_header_pos { | ||
9 | POS_REG_REQ_URI, | ||
10 | POS_REQ_URI, | ||
11 | POS_FROM, | ||
12 | POS_TO, | ||
13 | POS_VIA, | ||
14 | POS_CONTACT, | ||
15 | POS_CONTENT, | ||
16 | POS_MEDIA, | ||
17 | POS_OWNER, | ||
18 | POS_CONNECTION, | ||
19 | POS_SDP_HEADER, | ||
20 | }; | ||
21 | |||
22 | extern unsigned int (*ip_nat_sip_hook)(struct sk_buff **pskb, | ||
23 | enum ip_conntrack_info ctinfo, | ||
24 | struct ip_conntrack *ct, | ||
25 | const char **dptr); | ||
26 | extern unsigned int (*ip_nat_sdp_hook)(struct sk_buff **pskb, | ||
27 | enum ip_conntrack_info ctinfo, | ||
28 | struct ip_conntrack_expect *exp, | ||
29 | const char *dptr); | ||
30 | |||
31 | extern int ct_sip_get_info(const char *dptr, size_t dlen, | ||
32 | unsigned int *matchoff, | ||
33 | unsigned int *matchlen, | ||
34 | enum sip_header_pos pos); | ||
35 | extern int ct_sip_lnlen(const char *line, const char *limit); | ||
36 | extern const char *ct_sip_search(const char *needle, const char *haystack, | ||
37 | size_t needle_len, size_t haystack_len, | ||
38 | int case_sensitive); | ||
39 | #endif /* __KERNEL__ */ | ||
40 | #endif /* __IP_CONNTRACK_SIP_H__ */ | ||
diff --git a/include/linux/netfilter_ipv4/ip_conntrack_tcp.h b/include/linux/netfilter_ipv4/ip_conntrack_tcp.h deleted file mode 100644 index 876b8fb17e68..000000000000 --- a/include/linux/netfilter_ipv4/ip_conntrack_tcp.h +++ /dev/null | |||
@@ -1,6 +0,0 @@ | |||
1 | #ifndef _IP_CONNTRACK_TCP_H | ||
2 | #define _IP_CONNTRACK_TCP_H | ||
3 | |||
4 | #include <linux/netfilter/nf_conntrack_tcp.h> | ||
5 | |||
6 | #endif /* _IP_CONNTRACK_TCP_H */ | ||
diff --git a/include/linux/netfilter_ipv4/ip_conntrack_tftp.h b/include/linux/netfilter_ipv4/ip_conntrack_tftp.h deleted file mode 100644 index a404fc0abf0e..000000000000 --- a/include/linux/netfilter_ipv4/ip_conntrack_tftp.h +++ /dev/null | |||
@@ -1,20 +0,0 @@ | |||
1 | #ifndef _IP_CT_TFTP | ||
2 | #define _IP_CT_TFTP | ||
3 | |||
4 | #define TFTP_PORT 69 | ||
5 | |||
6 | struct tftphdr { | ||
7 | __be16 opcode; | ||
8 | }; | ||
9 | |||
10 | #define TFTP_OPCODE_READ 1 | ||
11 | #define TFTP_OPCODE_WRITE 2 | ||
12 | #define TFTP_OPCODE_DATA 3 | ||
13 | #define TFTP_OPCODE_ACK 4 | ||
14 | #define TFTP_OPCODE_ERROR 5 | ||
15 | |||
16 | extern unsigned int (*ip_nat_tftp_hook)(struct sk_buff **pskb, | ||
17 | enum ip_conntrack_info ctinfo, | ||
18 | struct ip_conntrack_expect *exp); | ||
19 | |||
20 | #endif /* _IP_CT_TFTP */ | ||
diff --git a/include/linux/netfilter_ipv4/ip_conntrack_tuple.h b/include/linux/netfilter_ipv4/ip_conntrack_tuple.h deleted file mode 100644 index c228bde74c33..000000000000 --- a/include/linux/netfilter_ipv4/ip_conntrack_tuple.h +++ /dev/null | |||
@@ -1,146 +0,0 @@ | |||
1 | #ifndef _IP_CONNTRACK_TUPLE_H | ||
2 | #define _IP_CONNTRACK_TUPLE_H | ||
3 | |||
4 | #include <linux/types.h> | ||
5 | #include <linux/netfilter/nf_conntrack_tuple_common.h> | ||
6 | |||
7 | /* A `tuple' is a structure containing the information to uniquely | ||
8 | identify a connection. ie. if two packets have the same tuple, they | ||
9 | are in the same connection; if not, they are not. | ||
10 | |||
11 | We divide the structure along "manipulatable" and | ||
12 | "non-manipulatable" lines, for the benefit of the NAT code. | ||
13 | */ | ||
14 | |||
15 | /* The protocol-specific manipulable parts of the tuple: always in | ||
16 | network order! */ | ||
17 | union ip_conntrack_manip_proto | ||
18 | { | ||
19 | /* Add other protocols here. */ | ||
20 | u_int16_t all; | ||
21 | |||
22 | struct { | ||
23 | __be16 port; | ||
24 | } tcp; | ||
25 | struct { | ||
26 | __be16 port; | ||
27 | } udp; | ||
28 | struct { | ||
29 | __be16 id; | ||
30 | } icmp; | ||
31 | struct { | ||
32 | __be16 port; | ||
33 | } sctp; | ||
34 | struct { | ||
35 | __be16 key; /* key is 32bit, pptp only uses 16 */ | ||
36 | } gre; | ||
37 | }; | ||
38 | |||
39 | /* The manipulable part of the tuple. */ | ||
40 | struct ip_conntrack_manip | ||
41 | { | ||
42 | __be32 ip; | ||
43 | union ip_conntrack_manip_proto u; | ||
44 | }; | ||
45 | |||
46 | /* This contains the information to distinguish a connection. */ | ||
47 | struct ip_conntrack_tuple | ||
48 | { | ||
49 | struct ip_conntrack_manip src; | ||
50 | |||
51 | /* These are the parts of the tuple which are fixed. */ | ||
52 | struct { | ||
53 | __be32 ip; | ||
54 | union { | ||
55 | /* Add other protocols here. */ | ||
56 | u_int16_t all; | ||
57 | |||
58 | struct { | ||
59 | __be16 port; | ||
60 | } tcp; | ||
61 | struct { | ||
62 | __be16 port; | ||
63 | } udp; | ||
64 | struct { | ||
65 | u_int8_t type, code; | ||
66 | } icmp; | ||
67 | struct { | ||
68 | __be16 port; | ||
69 | } sctp; | ||
70 | struct { | ||
71 | __be16 key; /* key is 32bit, | ||
72 | * pptp only uses 16 */ | ||
73 | } gre; | ||
74 | } u; | ||
75 | |||
76 | /* The protocol. */ | ||
77 | u_int8_t protonum; | ||
78 | |||
79 | /* The direction (for tuplehash) */ | ||
80 | u_int8_t dir; | ||
81 | } dst; | ||
82 | }; | ||
83 | |||
84 | /* This is optimized opposed to a memset of the whole structure. Everything we | ||
85 | * really care about is the source/destination unions */ | ||
86 | #define IP_CT_TUPLE_U_BLANK(tuple) \ | ||
87 | do { \ | ||
88 | (tuple)->src.u.all = 0; \ | ||
89 | (tuple)->dst.u.all = 0; \ | ||
90 | } while (0) | ||
91 | |||
92 | #ifdef __KERNEL__ | ||
93 | |||
94 | #define DUMP_TUPLE(tp) \ | ||
95 | DEBUGP("tuple %p: %u %u.%u.%u.%u:%hu -> %u.%u.%u.%u:%hu\n", \ | ||
96 | (tp), (tp)->dst.protonum, \ | ||
97 | NIPQUAD((tp)->src.ip), ntohs((tp)->src.u.all), \ | ||
98 | NIPQUAD((tp)->dst.ip), ntohs((tp)->dst.u.all)) | ||
99 | |||
100 | /* If we're the first tuple, it's the original dir. */ | ||
101 | #define DIRECTION(h) ((enum ip_conntrack_dir)(h)->tuple.dst.dir) | ||
102 | |||
103 | /* Connections have two entries in the hash table: one for each way */ | ||
104 | struct ip_conntrack_tuple_hash | ||
105 | { | ||
106 | struct list_head list; | ||
107 | |||
108 | struct ip_conntrack_tuple tuple; | ||
109 | }; | ||
110 | |||
111 | #endif /* __KERNEL__ */ | ||
112 | |||
113 | static inline int ip_ct_tuple_src_equal(const struct ip_conntrack_tuple *t1, | ||
114 | const struct ip_conntrack_tuple *t2) | ||
115 | { | ||
116 | return t1->src.ip == t2->src.ip | ||
117 | && t1->src.u.all == t2->src.u.all; | ||
118 | } | ||
119 | |||
120 | static inline int ip_ct_tuple_dst_equal(const struct ip_conntrack_tuple *t1, | ||
121 | const struct ip_conntrack_tuple *t2) | ||
122 | { | ||
123 | return t1->dst.ip == t2->dst.ip | ||
124 | && t1->dst.u.all == t2->dst.u.all | ||
125 | && t1->dst.protonum == t2->dst.protonum; | ||
126 | } | ||
127 | |||
128 | static inline int ip_ct_tuple_equal(const struct ip_conntrack_tuple *t1, | ||
129 | const struct ip_conntrack_tuple *t2) | ||
130 | { | ||
131 | return ip_ct_tuple_src_equal(t1, t2) && ip_ct_tuple_dst_equal(t1, t2); | ||
132 | } | ||
133 | |||
134 | static inline int ip_ct_tuple_mask_cmp(const struct ip_conntrack_tuple *t, | ||
135 | const struct ip_conntrack_tuple *tuple, | ||
136 | const struct ip_conntrack_tuple *mask) | ||
137 | { | ||
138 | return !(((t->src.ip ^ tuple->src.ip) & mask->src.ip) | ||
139 | || ((t->dst.ip ^ tuple->dst.ip) & mask->dst.ip) | ||
140 | || ((t->src.u.all ^ tuple->src.u.all) & mask->src.u.all) | ||
141 | || ((t->dst.u.all ^ tuple->dst.u.all) & mask->dst.u.all) | ||
142 | || ((t->dst.protonum ^ tuple->dst.protonum) | ||
143 | & mask->dst.protonum)); | ||
144 | } | ||
145 | |||
146 | #endif /* _IP_CONNTRACK_TUPLE_H */ | ||
diff --git a/include/linux/netfilter_ipv4/ip_nat.h b/include/linux/netfilter_ipv4/ip_nat.h deleted file mode 100644 index bbca89aab813..000000000000 --- a/include/linux/netfilter_ipv4/ip_nat.h +++ /dev/null | |||
@@ -1,79 +0,0 @@ | |||
1 | #ifndef _IP_NAT_H | ||
2 | #define _IP_NAT_H | ||
3 | #include <linux/netfilter_ipv4.h> | ||
4 | #include <linux/netfilter_ipv4/ip_conntrack_tuple.h> | ||
5 | |||
6 | #define IP_NAT_MAPPING_TYPE_MAX_NAMELEN 16 | ||
7 | |||
8 | enum ip_nat_manip_type | ||
9 | { | ||
10 | IP_NAT_MANIP_SRC, | ||
11 | IP_NAT_MANIP_DST | ||
12 | }; | ||
13 | |||
14 | /* SRC manip occurs POST_ROUTING or LOCAL_IN */ | ||
15 | #define HOOK2MANIP(hooknum) ((hooknum) != NF_IP_POST_ROUTING && (hooknum) != NF_IP_LOCAL_IN) | ||
16 | |||
17 | #define IP_NAT_RANGE_MAP_IPS 1 | ||
18 | #define IP_NAT_RANGE_PROTO_SPECIFIED 2 | ||
19 | #define IP_NAT_RANGE_PROTO_RANDOM 4 /* add randomness to "port" selection */ | ||
20 | |||
21 | /* NAT sequence number modifications */ | ||
22 | struct ip_nat_seq { | ||
23 | /* position of the last TCP sequence number | ||
24 | * modification (if any) */ | ||
25 | u_int32_t correction_pos; | ||
26 | /* sequence number offset before and after last modification */ | ||
27 | int16_t offset_before, offset_after; | ||
28 | }; | ||
29 | |||
30 | /* Single range specification. */ | ||
31 | struct ip_nat_range | ||
32 | { | ||
33 | /* Set to OR of flags above. */ | ||
34 | unsigned int flags; | ||
35 | |||
36 | /* Inclusive: network order. */ | ||
37 | __be32 min_ip, max_ip; | ||
38 | |||
39 | /* Inclusive: network order */ | ||
40 | union ip_conntrack_manip_proto min, max; | ||
41 | }; | ||
42 | |||
43 | /* For backwards compat: don't use in modern code. */ | ||
44 | struct ip_nat_multi_range_compat | ||
45 | { | ||
46 | unsigned int rangesize; /* Must be 1. */ | ||
47 | |||
48 | /* hangs off end. */ | ||
49 | struct ip_nat_range range[1]; | ||
50 | }; | ||
51 | |||
52 | #ifdef __KERNEL__ | ||
53 | #include <linux/list.h> | ||
54 | |||
55 | /* Protects NAT hash tables, and NAT-private part of conntracks. */ | ||
56 | extern rwlock_t ip_nat_lock; | ||
57 | |||
58 | /* The structure embedded in the conntrack structure. */ | ||
59 | struct ip_nat_info | ||
60 | { | ||
61 | struct list_head bysource; | ||
62 | struct ip_nat_seq seq[IP_CT_DIR_MAX]; | ||
63 | }; | ||
64 | |||
65 | struct ip_conntrack; | ||
66 | |||
67 | /* Set up the info structure to map into this range. */ | ||
68 | extern unsigned int ip_nat_setup_info(struct ip_conntrack *conntrack, | ||
69 | const struct ip_nat_range *range, | ||
70 | unsigned int hooknum); | ||
71 | |||
72 | /* Is this tuple already taken? (not by us)*/ | ||
73 | extern int ip_nat_used_tuple(const struct ip_conntrack_tuple *tuple, | ||
74 | const struct ip_conntrack *ignored_conntrack); | ||
75 | |||
76 | #else /* !__KERNEL__: iptables wants this to compile. */ | ||
77 | #define ip_nat_multi_range ip_nat_multi_range_compat | ||
78 | #endif /*__KERNEL__*/ | ||
79 | #endif | ||
diff --git a/include/linux/netfilter_ipv4/ip_nat_core.h b/include/linux/netfilter_ipv4/ip_nat_core.h deleted file mode 100644 index 60566f9fd7b3..000000000000 --- a/include/linux/netfilter_ipv4/ip_nat_core.h +++ /dev/null | |||
@@ -1,18 +0,0 @@ | |||
1 | #ifndef _IP_NAT_CORE_H | ||
2 | #define _IP_NAT_CORE_H | ||
3 | #include <linux/list.h> | ||
4 | #include <linux/netfilter_ipv4/ip_conntrack.h> | ||
5 | |||
6 | /* This header used to share core functionality between the standalone | ||
7 | NAT module, and the compatibility layer's use of NAT for masquerading. */ | ||
8 | |||
9 | extern unsigned int ip_nat_packet(struct ip_conntrack *ct, | ||
10 | enum ip_conntrack_info conntrackinfo, | ||
11 | unsigned int hooknum, | ||
12 | struct sk_buff **pskb); | ||
13 | |||
14 | extern int ip_nat_icmp_reply_translation(struct ip_conntrack *ct, | ||
15 | enum ip_conntrack_info ctinfo, | ||
16 | unsigned int hooknum, | ||
17 | struct sk_buff **pskb); | ||
18 | #endif /* _IP_NAT_CORE_H */ | ||
diff --git a/include/linux/netfilter_ipv4/ip_nat_helper.h b/include/linux/netfilter_ipv4/ip_nat_helper.h deleted file mode 100644 index bf9cb105c885..000000000000 --- a/include/linux/netfilter_ipv4/ip_nat_helper.h +++ /dev/null | |||
@@ -1,33 +0,0 @@ | |||
1 | #ifndef _IP_NAT_HELPER_H | ||
2 | #define _IP_NAT_HELPER_H | ||
3 | /* NAT protocol helper routines. */ | ||
4 | |||
5 | #include <linux/netfilter_ipv4/ip_conntrack.h> | ||
6 | #include <linux/module.h> | ||
7 | |||
8 | struct sk_buff; | ||
9 | |||
10 | /* These return true or false. */ | ||
11 | extern int ip_nat_mangle_tcp_packet(struct sk_buff **skb, | ||
12 | struct ip_conntrack *ct, | ||
13 | enum ip_conntrack_info ctinfo, | ||
14 | unsigned int match_offset, | ||
15 | unsigned int match_len, | ||
16 | const char *rep_buffer, | ||
17 | unsigned int rep_len); | ||
18 | extern int ip_nat_mangle_udp_packet(struct sk_buff **skb, | ||
19 | struct ip_conntrack *ct, | ||
20 | enum ip_conntrack_info ctinfo, | ||
21 | unsigned int match_offset, | ||
22 | unsigned int match_len, | ||
23 | const char *rep_buffer, | ||
24 | unsigned int rep_len); | ||
25 | extern int ip_nat_seq_adjust(struct sk_buff **pskb, | ||
26 | struct ip_conntrack *ct, | ||
27 | enum ip_conntrack_info ctinfo); | ||
28 | |||
29 | /* Setup NAT on this expected conntrack so it follows master, but goes | ||
30 | * to port ct->master->saved_proto. */ | ||
31 | extern void ip_nat_follow_master(struct ip_conntrack *ct, | ||
32 | struct ip_conntrack_expect *this); | ||
33 | #endif | ||
diff --git a/include/linux/netfilter_ipv4/ip_nat_pptp.h b/include/linux/netfilter_ipv4/ip_nat_pptp.h deleted file mode 100644 index 36668bf0f373..000000000000 --- a/include/linux/netfilter_ipv4/ip_nat_pptp.h +++ /dev/null | |||
@@ -1,11 +0,0 @@ | |||
1 | /* PPTP constants and structs */ | ||
2 | #ifndef _NAT_PPTP_H | ||
3 | #define _NAT_PPTP_H | ||
4 | |||
5 | /* conntrack private data */ | ||
6 | struct ip_nat_pptp { | ||
7 | __be16 pns_call_id; /* NAT'ed PNS call id */ | ||
8 | __be16 pac_call_id; /* NAT'ed PAC call id */ | ||
9 | }; | ||
10 | |||
11 | #endif /* _NAT_PPTP_H */ | ||
diff --git a/include/linux/netfilter_ipv4/ip_nat_protocol.h b/include/linux/netfilter_ipv4/ip_nat_protocol.h deleted file mode 100644 index 612a43614e7b..000000000000 --- a/include/linux/netfilter_ipv4/ip_nat_protocol.h +++ /dev/null | |||
@@ -1,74 +0,0 @@ | |||
1 | /* Header for use in defining a given protocol. */ | ||
2 | #ifndef _IP_NAT_PROTOCOL_H | ||
3 | #define _IP_NAT_PROTOCOL_H | ||
4 | #include <linux/init.h> | ||
5 | #include <linux/list.h> | ||
6 | |||
7 | #include <linux/netfilter_ipv4/ip_nat.h> | ||
8 | #include <linux/netfilter/nfnetlink_conntrack.h> | ||
9 | |||
10 | struct iphdr; | ||
11 | struct ip_nat_range; | ||
12 | |||
13 | struct ip_nat_protocol | ||
14 | { | ||
15 | /* Protocol name */ | ||
16 | const char *name; | ||
17 | |||
18 | /* Protocol number. */ | ||
19 | unsigned int protonum; | ||
20 | |||
21 | struct module *me; | ||
22 | |||
23 | /* Translate a packet to the target according to manip type. | ||
24 | Return true if succeeded. */ | ||
25 | int (*manip_pkt)(struct sk_buff **pskb, | ||
26 | unsigned int iphdroff, | ||
27 | const struct ip_conntrack_tuple *tuple, | ||
28 | enum ip_nat_manip_type maniptype); | ||
29 | |||
30 | /* Is the manipable part of the tuple between min and max incl? */ | ||
31 | int (*in_range)(const struct ip_conntrack_tuple *tuple, | ||
32 | enum ip_nat_manip_type maniptype, | ||
33 | const union ip_conntrack_manip_proto *min, | ||
34 | const union ip_conntrack_manip_proto *max); | ||
35 | |||
36 | /* Alter the per-proto part of the tuple (depending on | ||
37 | maniptype), to give a unique tuple in the given range if | ||
38 | possible; return false if not. Per-protocol part of tuple | ||
39 | is initialized to the incoming packet. */ | ||
40 | int (*unique_tuple)(struct ip_conntrack_tuple *tuple, | ||
41 | const struct ip_nat_range *range, | ||
42 | enum ip_nat_manip_type maniptype, | ||
43 | const struct ip_conntrack *conntrack); | ||
44 | |||
45 | int (*range_to_nfattr)(struct sk_buff *skb, | ||
46 | const struct ip_nat_range *range); | ||
47 | |||
48 | int (*nfattr_to_range)(struct nfattr *tb[], | ||
49 | struct ip_nat_range *range); | ||
50 | }; | ||
51 | |||
52 | /* Protocol registration. */ | ||
53 | extern int ip_nat_protocol_register(struct ip_nat_protocol *proto); | ||
54 | extern void ip_nat_protocol_unregister(struct ip_nat_protocol *proto); | ||
55 | |||
56 | extern struct ip_nat_protocol *ip_nat_proto_find_get(u_int8_t protocol); | ||
57 | extern void ip_nat_proto_put(struct ip_nat_protocol *proto); | ||
58 | |||
59 | /* Built-in protocols. */ | ||
60 | extern struct ip_nat_protocol ip_nat_protocol_tcp; | ||
61 | extern struct ip_nat_protocol ip_nat_protocol_udp; | ||
62 | extern struct ip_nat_protocol ip_nat_protocol_icmp; | ||
63 | extern struct ip_nat_protocol ip_nat_unknown_protocol; | ||
64 | |||
65 | extern int init_protocols(void) __init; | ||
66 | extern void cleanup_protocols(void); | ||
67 | extern struct ip_nat_protocol *find_nat_proto(u_int16_t protonum); | ||
68 | |||
69 | extern int ip_nat_port_range_to_nfattr(struct sk_buff *skb, | ||
70 | const struct ip_nat_range *range); | ||
71 | extern int ip_nat_port_nfattr_to_range(struct nfattr *tb[], | ||
72 | struct ip_nat_range *range); | ||
73 | |||
74 | #endif /*_IP_NAT_PROTO_H*/ | ||
diff --git a/include/linux/netfilter_ipv4/ip_nat_rule.h b/include/linux/netfilter_ipv4/ip_nat_rule.h deleted file mode 100644 index 73b9552e6a89..000000000000 --- a/include/linux/netfilter_ipv4/ip_nat_rule.h +++ /dev/null | |||
@@ -1,28 +0,0 @@ | |||
1 | #ifndef _IP_NAT_RULE_H | ||
2 | #define _IP_NAT_RULE_H | ||
3 | #include <linux/netfilter_ipv4/ip_conntrack.h> | ||
4 | #include <linux/netfilter_ipv4/ip_tables.h> | ||
5 | #include <linux/netfilter_ipv4/ip_nat.h> | ||
6 | |||
7 | #ifdef __KERNEL__ | ||
8 | |||
9 | extern int ip_nat_rule_init(void) __init; | ||
10 | extern void ip_nat_rule_cleanup(void); | ||
11 | extern int ip_nat_rule_find(struct sk_buff **pskb, | ||
12 | unsigned int hooknum, | ||
13 | const struct net_device *in, | ||
14 | const struct net_device *out, | ||
15 | struct ip_conntrack *ct, | ||
16 | struct ip_nat_info *info); | ||
17 | |||
18 | extern unsigned int | ||
19 | alloc_null_binding(struct ip_conntrack *conntrack, | ||
20 | struct ip_nat_info *info, | ||
21 | unsigned int hooknum); | ||
22 | |||
23 | extern unsigned int | ||
24 | alloc_null_binding_confirmed(struct ip_conntrack *conntrack, | ||
25 | struct ip_nat_info *info, | ||
26 | unsigned int hooknum); | ||
27 | #endif | ||
28 | #endif /* _IP_NAT_RULE_H */ | ||
diff --git a/include/linux/netfilter_ipv4/ipt_SAME.h b/include/linux/netfilter_ipv4/ipt_SAME.h index cc4c0b2269af..be6e682a85ec 100644 --- a/include/linux/netfilter_ipv4/ipt_SAME.h +++ b/include/linux/netfilter_ipv4/ipt_SAME.h | |||
@@ -13,7 +13,7 @@ struct ipt_same_info | |||
13 | u_int32_t *iparray; | 13 | u_int32_t *iparray; |
14 | 14 | ||
15 | /* hangs off end. */ | 15 | /* hangs off end. */ |
16 | struct ip_nat_range range[IPT_SAME_MAX_RANGE]; | 16 | struct nf_nat_range range[IPT_SAME_MAX_RANGE]; |
17 | }; | 17 | }; |
18 | 18 | ||
19 | #endif /*_IPT_SAME_H*/ | 19 | #endif /*_IPT_SAME_H*/ |
diff --git a/include/linux/netlink.h b/include/linux/netlink.h index 2a20f488ac1b..f41688f56632 100644 --- a/include/linux/netlink.h +++ b/include/linux/netlink.h | |||
@@ -138,6 +138,11 @@ struct nlattr | |||
138 | #include <linux/capability.h> | 138 | #include <linux/capability.h> |
139 | #include <linux/skbuff.h> | 139 | #include <linux/skbuff.h> |
140 | 140 | ||
141 | static inline struct nlmsghdr *nlmsg_hdr(const struct sk_buff *skb) | ||
142 | { | ||
143 | return (struct nlmsghdr *)skb->data; | ||
144 | } | ||
145 | |||
141 | struct netlink_skb_parms | 146 | struct netlink_skb_parms |
142 | { | 147 | { |
143 | struct ucred creds; /* Skb credentials */ | 148 | struct ucred creds; /* Skb credentials */ |
@@ -152,7 +157,10 @@ struct netlink_skb_parms | |||
152 | #define NETLINK_CREDS(skb) (&NETLINK_CB((skb)).creds) | 157 | #define NETLINK_CREDS(skb) (&NETLINK_CB((skb)).creds) |
153 | 158 | ||
154 | 159 | ||
155 | extern struct sock *netlink_kernel_create(int unit, unsigned int groups, void (*input)(struct sock *sk, int len), struct module *module); | 160 | extern struct sock *netlink_kernel_create(int unit, unsigned int groups, |
161 | void (*input)(struct sock *sk, int len), | ||
162 | struct mutex *cb_mutex, | ||
163 | struct module *module); | ||
156 | extern void netlink_ack(struct sk_buff *in_skb, struct nlmsghdr *nlh, int err); | 164 | extern void netlink_ack(struct sk_buff *in_skb, struct nlmsghdr *nlh, int err); |
157 | extern int netlink_has_listeners(struct sock *sk, unsigned int group); | 165 | extern int netlink_has_listeners(struct sock *sk, unsigned int group); |
158 | extern int netlink_unicast(struct sock *ssk, struct sk_buff *skb, __u32 pid, int nonblock); | 166 | extern int netlink_unicast(struct sock *ssk, struct sk_buff *skb, __u32 pid, int nonblock); |
@@ -171,9 +179,16 @@ int netlink_sendskb(struct sock *sk, struct sk_buff *skb, int protocol); | |||
171 | 179 | ||
172 | /* | 180 | /* |
173 | * skb should fit one page. This choice is good for headerless malloc. | 181 | * skb should fit one page. This choice is good for headerless malloc. |
182 | * But we should limit to 8K so that userspace does not have to | ||
183 | * use enormous buffer sizes on recvmsg() calls just to avoid | ||
184 | * MSG_TRUNC when PAGE_SIZE is very large. | ||
174 | */ | 185 | */ |
175 | #define NLMSG_GOODORDER 0 | 186 | #if PAGE_SIZE < 8192UL |
176 | #define NLMSG_GOODSIZE (SKB_MAX_ORDER(0, NLMSG_GOODORDER)) | 187 | #define NLMSG_GOODSIZE SKB_WITH_OVERHEAD(PAGE_SIZE) |
188 | #else | ||
189 | #define NLMSG_GOODSIZE SKB_WITH_OVERHEAD(8192UL) | ||
190 | #endif | ||
191 | |||
177 | #define NLMSG_DEFAULT_SIZE (NLMSG_GOODSIZE - NLMSG_HDRLEN) | 192 | #define NLMSG_DEFAULT_SIZE (NLMSG_GOODSIZE - NLMSG_HDRLEN) |
178 | 193 | ||
179 | 194 | ||
@@ -217,18 +232,6 @@ __nlmsg_put(struct sk_buff *skb, u32 pid, u32 seq, int type, int len, int flags) | |||
217 | #define NLMSG_PUT(skb, pid, seq, type, len) \ | 232 | #define NLMSG_PUT(skb, pid, seq, type, len) \ |
218 | NLMSG_NEW(skb, pid, seq, type, len, 0) | 233 | NLMSG_NEW(skb, pid, seq, type, len, 0) |
219 | 234 | ||
220 | #define NLMSG_NEW_ANSWER(skb, cb, type, len, flags) \ | ||
221 | NLMSG_NEW(skb, NETLINK_CB((cb)->skb).pid, \ | ||
222 | (cb)->nlh->nlmsg_seq, type, len, flags) | ||
223 | |||
224 | #define NLMSG_END(skb, nlh) \ | ||
225 | ({ (nlh)->nlmsg_len = (skb)->tail - (unsigned char *) (nlh); \ | ||
226 | (skb)->len; }) | ||
227 | |||
228 | #define NLMSG_CANCEL(skb, nlh) \ | ||
229 | ({ skb_trim(skb, (unsigned char *) (nlh) - (skb)->data); \ | ||
230 | -1; }) | ||
231 | |||
232 | extern int netlink_dump_start(struct sock *ssk, struct sk_buff *skb, | 235 | extern int netlink_dump_start(struct sock *ssk, struct sk_buff *skb, |
233 | struct nlmsghdr *nlh, | 236 | struct nlmsghdr *nlh, |
234 | int (*dump)(struct sk_buff *skb, struct netlink_callback*), | 237 | int (*dump)(struct sk_buff *skb, struct netlink_callback*), |
diff --git a/include/linux/nfs_page.h b/include/linux/nfs_page.h index 2e555d49c9b7..16b0266b14fd 100644 --- a/include/linux/nfs_page.h +++ b/include/linux/nfs_page.h | |||
@@ -31,7 +31,6 @@ | |||
31 | #define PG_NEED_COMMIT 1 | 31 | #define PG_NEED_COMMIT 1 |
32 | #define PG_NEED_RESCHED 2 | 32 | #define PG_NEED_RESCHED 2 |
33 | #define PG_NEED_FLUSH 3 | 33 | #define PG_NEED_FLUSH 3 |
34 | #define PG_FLUSHING 4 | ||
35 | 34 | ||
36 | struct nfs_inode; | 35 | struct nfs_inode; |
37 | struct nfs_page { | 36 | struct nfs_page { |
@@ -50,8 +49,6 @@ struct nfs_page { | |||
50 | }; | 49 | }; |
51 | 50 | ||
52 | #define NFS_WBACK_BUSY(req) (test_bit(PG_BUSY,&(req)->wb_flags)) | 51 | #define NFS_WBACK_BUSY(req) (test_bit(PG_BUSY,&(req)->wb_flags)) |
53 | #define NFS_NEED_COMMIT(req) (test_bit(PG_NEED_COMMIT,&(req)->wb_flags)) | ||
54 | #define NFS_NEED_RESCHED(req) (test_bit(PG_NEED_RESCHED,&(req)->wb_flags)) | ||
55 | 52 | ||
56 | extern struct nfs_page *nfs_create_request(struct nfs_open_context *ctx, | 53 | extern struct nfs_page *nfs_create_request(struct nfs_open_context *ctx, |
57 | struct inode *inode, | 54 | struct inode *inode, |
@@ -122,34 +119,6 @@ nfs_list_remove_request(struct nfs_page *req) | |||
122 | req->wb_list_head = NULL; | 119 | req->wb_list_head = NULL; |
123 | } | 120 | } |
124 | 121 | ||
125 | static inline int | ||
126 | nfs_defer_commit(struct nfs_page *req) | ||
127 | { | ||
128 | return !test_and_set_bit(PG_NEED_COMMIT, &req->wb_flags); | ||
129 | } | ||
130 | |||
131 | static inline void | ||
132 | nfs_clear_commit(struct nfs_page *req) | ||
133 | { | ||
134 | smp_mb__before_clear_bit(); | ||
135 | clear_bit(PG_NEED_COMMIT, &req->wb_flags); | ||
136 | smp_mb__after_clear_bit(); | ||
137 | } | ||
138 | |||
139 | static inline int | ||
140 | nfs_defer_reschedule(struct nfs_page *req) | ||
141 | { | ||
142 | return !test_and_set_bit(PG_NEED_RESCHED, &req->wb_flags); | ||
143 | } | ||
144 | |||
145 | static inline void | ||
146 | nfs_clear_reschedule(struct nfs_page *req) | ||
147 | { | ||
148 | smp_mb__before_clear_bit(); | ||
149 | clear_bit(PG_NEED_RESCHED, &req->wb_flags); | ||
150 | smp_mb__after_clear_bit(); | ||
151 | } | ||
152 | |||
153 | static inline struct nfs_page * | 122 | static inline struct nfs_page * |
154 | nfs_list_entry(struct list_head *head) | 123 | nfs_list_entry(struct list_head *head) |
155 | { | 124 | { |
diff --git a/include/linux/nl80211.h b/include/linux/nl80211.h new file mode 100644 index 000000000000..9a30ba2ca75e --- /dev/null +++ b/include/linux/nl80211.h | |||
@@ -0,0 +1,38 @@ | |||
1 | #ifndef __LINUX_NL80211_H | ||
2 | #define __LINUX_NL80211_H | ||
3 | /* | ||
4 | * 802.11 netlink interface public header | ||
5 | * | ||
6 | * Copyright 2006, 2007 Johannes Berg <johannes@sipsolutions.net> | ||
7 | */ | ||
8 | |||
9 | /** | ||
10 | * enum nl80211_iftype - (virtual) interface types | ||
11 | * @NL80211_IFTYPE_UNSPECIFIED: unspecified type, driver decides | ||
12 | * @NL80211_IFTYPE_ADHOC: independent BSS member | ||
13 | * @NL80211_IFTYPE_STATION: managed BSS member | ||
14 | * @NL80211_IFTYPE_AP: access point | ||
15 | * @NL80211_IFTYPE_AP_VLAN: VLAN interface for access points | ||
16 | * @NL80211_IFTYPE_WDS: wireless distribution interface | ||
17 | * @NL80211_IFTYPE_MONITOR: monitor interface receiving all frames | ||
18 | * @__NL80211_IFTYPE_AFTER_LAST: internal use | ||
19 | * | ||
20 | * These values are used with the NL80211_ATTR_IFTYPE | ||
21 | * to set the type of an interface. | ||
22 | * | ||
23 | */ | ||
24 | enum nl80211_iftype { | ||
25 | NL80211_IFTYPE_UNSPECIFIED, | ||
26 | NL80211_IFTYPE_ADHOC, | ||
27 | NL80211_IFTYPE_STATION, | ||
28 | NL80211_IFTYPE_AP, | ||
29 | NL80211_IFTYPE_AP_VLAN, | ||
30 | NL80211_IFTYPE_WDS, | ||
31 | NL80211_IFTYPE_MONITOR, | ||
32 | |||
33 | /* keep last */ | ||
34 | __NL80211_IFTYPE_AFTER_LAST | ||
35 | }; | ||
36 | #define NL80211_IFTYPE_MAX (__NL80211_IFTYPE_AFTER_LAST - 1) | ||
37 | |||
38 | #endif /* __LINUX_NL80211_H */ | ||
diff --git a/include/linux/page-flags.h b/include/linux/page-flags.h index 9cd0d0eaf523..96326594e55d 100644 --- a/include/linux/page-flags.h +++ b/include/linux/page-flags.h | |||
@@ -133,7 +133,7 @@ | |||
133 | static inline void SetPageUptodate(struct page *page) | 133 | static inline void SetPageUptodate(struct page *page) |
134 | { | 134 | { |
135 | if (!test_and_set_bit(PG_uptodate, &page->flags)) | 135 | if (!test_and_set_bit(PG_uptodate, &page->flags)) |
136 | page_test_and_clear_dirty(page); | 136 | page_clear_dirty(page); |
137 | } | 137 | } |
138 | #else | 138 | #else |
139 | #define SetPageUptodate(page) set_bit(PG_uptodate, &(page)->flags) | 139 | #define SetPageUptodate(page) set_bit(PG_uptodate, &(page)->flags) |
diff --git a/include/linux/pci.h b/include/linux/pci.h index 481ea0663f19..a3ad76221c6f 100644 --- a/include/linux/pci.h +++ b/include/linux/pci.h | |||
@@ -361,8 +361,6 @@ struct pci_driver { | |||
361 | struct pci_error_handlers *err_handler; | 361 | struct pci_error_handlers *err_handler; |
362 | struct device_driver driver; | 362 | struct device_driver driver; |
363 | struct pci_dynids dynids; | 363 | struct pci_dynids dynids; |
364 | |||
365 | int multithread_probe; | ||
366 | }; | 364 | }; |
367 | 365 | ||
368 | #define to_pci_driver(drv) container_of(drv,struct pci_driver, driver) | 366 | #define to_pci_driver(drv) container_of(drv,struct pci_driver, driver) |
diff --git a/include/linux/plist.h b/include/linux/plist.h index b95818a037ad..85de2f055874 100644 --- a/include/linux/plist.h +++ b/include/linux/plist.h | |||
@@ -97,9 +97,9 @@ struct plist_node { | |||
97 | #endif | 97 | #endif |
98 | 98 | ||
99 | /** | 99 | /** |
100 | * #PLIST_HEAD_INIT - static struct plist_head initializer | 100 | * PLIST_HEAD_INIT - static struct plist_head initializer |
101 | * | ||
102 | * @head: struct plist_head variable name | 101 | * @head: struct plist_head variable name |
102 | * @_lock: lock to initialize for this list | ||
103 | */ | 103 | */ |
104 | #define PLIST_HEAD_INIT(head, _lock) \ | 104 | #define PLIST_HEAD_INIT(head, _lock) \ |
105 | { \ | 105 | { \ |
@@ -109,8 +109,7 @@ struct plist_node { | |||
109 | } | 109 | } |
110 | 110 | ||
111 | /** | 111 | /** |
112 | * #PLIST_NODE_INIT - static struct plist_node initializer | 112 | * PLIST_NODE_INIT - static struct plist_node initializer |
113 | * | ||
114 | * @node: struct plist_node variable name | 113 | * @node: struct plist_node variable name |
115 | * @__prio: initial node priority | 114 | * @__prio: initial node priority |
116 | */ | 115 | */ |
@@ -122,8 +121,8 @@ struct plist_node { | |||
122 | 121 | ||
123 | /** | 122 | /** |
124 | * plist_head_init - dynamic struct plist_head initializer | 123 | * plist_head_init - dynamic struct plist_head initializer |
125 | * | ||
126 | * @head: &struct plist_head pointer | 124 | * @head: &struct plist_head pointer |
125 | * @lock: list spinlock, remembered for debugging | ||
127 | */ | 126 | */ |
128 | static inline void | 127 | static inline void |
129 | plist_head_init(struct plist_head *head, spinlock_t *lock) | 128 | plist_head_init(struct plist_head *head, spinlock_t *lock) |
@@ -137,7 +136,6 @@ plist_head_init(struct plist_head *head, spinlock_t *lock) | |||
137 | 136 | ||
138 | /** | 137 | /** |
139 | * plist_node_init - Dynamic struct plist_node initializer | 138 | * plist_node_init - Dynamic struct plist_node initializer |
140 | * | ||
141 | * @node: &struct plist_node pointer | 139 | * @node: &struct plist_node pointer |
142 | * @prio: initial node priority | 140 | * @prio: initial node priority |
143 | */ | 141 | */ |
@@ -152,49 +150,46 @@ extern void plist_del(struct plist_node *node, struct plist_head *head); | |||
152 | 150 | ||
153 | /** | 151 | /** |
154 | * plist_for_each - iterate over the plist | 152 | * plist_for_each - iterate over the plist |
155 | * | 153 | * @pos: the type * to use as a loop counter |
156 | * @pos1: the type * to use as a loop counter. | 154 | * @head: the head for your list |
157 | * @head: the head for your list. | ||
158 | */ | 155 | */ |
159 | #define plist_for_each(pos, head) \ | 156 | #define plist_for_each(pos, head) \ |
160 | list_for_each_entry(pos, &(head)->node_list, plist.node_list) | 157 | list_for_each_entry(pos, &(head)->node_list, plist.node_list) |
161 | 158 | ||
162 | /** | 159 | /** |
163 | * plist_for_each_entry_safe - iterate over a plist of given type safe | 160 | * plist_for_each_safe - iterate safely over a plist of given type |
164 | * against removal of list entry | 161 | * @pos: the type * to use as a loop counter |
162 | * @n: another type * to use as temporary storage | ||
163 | * @head: the head for your list | ||
165 | * | 164 | * |
166 | * @pos1: the type * to use as a loop counter. | 165 | * Iterate over a plist of given type, safe against removal of list entry. |
167 | * @n1: another type * to use as temporary storage | ||
168 | * @head: the head for your list. | ||
169 | */ | 166 | */ |
170 | #define plist_for_each_safe(pos, n, head) \ | 167 | #define plist_for_each_safe(pos, n, head) \ |
171 | list_for_each_entry_safe(pos, n, &(head)->node_list, plist.node_list) | 168 | list_for_each_entry_safe(pos, n, &(head)->node_list, plist.node_list) |
172 | 169 | ||
173 | /** | 170 | /** |
174 | * plist_for_each_entry - iterate over list of given type | 171 | * plist_for_each_entry - iterate over list of given type |
175 | * | 172 | * @pos: the type * to use as a loop counter |
176 | * @pos: the type * to use as a loop counter. | 173 | * @head: the head for your list |
177 | * @head: the head for your list. | 174 | * @mem: the name of the list_struct within the struct |
178 | * @member: the name of the list_struct within the struct. | ||
179 | */ | 175 | */ |
180 | #define plist_for_each_entry(pos, head, mem) \ | 176 | #define plist_for_each_entry(pos, head, mem) \ |
181 | list_for_each_entry(pos, &(head)->node_list, mem.plist.node_list) | 177 | list_for_each_entry(pos, &(head)->node_list, mem.plist.node_list) |
182 | 178 | ||
183 | /** | 179 | /** |
184 | * plist_for_each_entry_safe - iterate over list of given type safe against | 180 | * plist_for_each_entry_safe - iterate safely over list of given type |
185 | * removal of list entry | 181 | * @pos: the type * to use as a loop counter |
186 | * | ||
187 | * @pos: the type * to use as a loop counter. | ||
188 | * @n: another type * to use as temporary storage | 182 | * @n: another type * to use as temporary storage |
189 | * @head: the head for your list. | 183 | * @head: the head for your list |
190 | * @m: the name of the list_struct within the struct. | 184 | * @m: the name of the list_struct within the struct |
185 | * | ||
186 | * Iterate over list of given type, safe against removal of list entry. | ||
191 | */ | 187 | */ |
192 | #define plist_for_each_entry_safe(pos, n, head, m) \ | 188 | #define plist_for_each_entry_safe(pos, n, head, m) \ |
193 | list_for_each_entry_safe(pos, n, &(head)->node_list, m.plist.node_list) | 189 | list_for_each_entry_safe(pos, n, &(head)->node_list, m.plist.node_list) |
194 | 190 | ||
195 | /** | 191 | /** |
196 | * plist_head_empty - return !0 if a plist_head is empty | 192 | * plist_head_empty - return !0 if a plist_head is empty |
197 | * | ||
198 | * @head: &struct plist_head pointer | 193 | * @head: &struct plist_head pointer |
199 | */ | 194 | */ |
200 | static inline int plist_head_empty(const struct plist_head *head) | 195 | static inline int plist_head_empty(const struct plist_head *head) |
@@ -204,7 +199,6 @@ static inline int plist_head_empty(const struct plist_head *head) | |||
204 | 199 | ||
205 | /** | 200 | /** |
206 | * plist_node_empty - return !0 if plist_node is not on a list | 201 | * plist_node_empty - return !0 if plist_node is not on a list |
207 | * | ||
208 | * @node: &struct plist_node pointer | 202 | * @node: &struct plist_node pointer |
209 | */ | 203 | */ |
210 | static inline int plist_node_empty(const struct plist_node *node) | 204 | static inline int plist_node_empty(const struct plist_node *node) |
@@ -216,10 +210,9 @@ static inline int plist_node_empty(const struct plist_node *node) | |||
216 | 210 | ||
217 | /** | 211 | /** |
218 | * plist_first_entry - get the struct for the first entry | 212 | * plist_first_entry - get the struct for the first entry |
219 | * | 213 | * @head: the &struct plist_head pointer |
220 | * @ptr: the &struct plist_head pointer. | 214 | * @type: the type of the struct this is embedded in |
221 | * @type: the type of the struct this is embedded in. | 215 | * @member: the name of the list_struct within the struct |
222 | * @member: the name of the list_struct within the struct. | ||
223 | */ | 216 | */ |
224 | #ifdef CONFIG_DEBUG_PI_LIST | 217 | #ifdef CONFIG_DEBUG_PI_LIST |
225 | # define plist_first_entry(head, type, member) \ | 218 | # define plist_first_entry(head, type, member) \ |
@@ -234,7 +227,6 @@ static inline int plist_node_empty(const struct plist_node *node) | |||
234 | 227 | ||
235 | /** | 228 | /** |
236 | * plist_first - return the first node (and thus, highest priority) | 229 | * plist_first - return the first node (and thus, highest priority) |
237 | * | ||
238 | * @head: the &struct plist_head pointer | 230 | * @head: the &struct plist_head pointer |
239 | * | 231 | * |
240 | * Assumes the plist is _not_ empty. | 232 | * Assumes the plist is _not_ empty. |
diff --git a/include/linux/pm.h b/include/linux/pm.h index 21db05ac7c0b..9bd86db4d395 100644 --- a/include/linux/pm.h +++ b/include/linux/pm.h | |||
@@ -166,6 +166,24 @@ extern struct pm_ops *pm_ops; | |||
166 | extern int pm_suspend(suspend_state_t state); | 166 | extern int pm_suspend(suspend_state_t state); |
167 | 167 | ||
168 | 168 | ||
169 | /** | ||
170 | * arch_suspend_disable_irqs - disable IRQs for suspend | ||
171 | * | ||
172 | * Disables IRQs (in the default case). This is a weak symbol in the common | ||
173 | * code and thus allows architectures to override it if more needs to be | ||
174 | * done. Not called for suspend to disk. | ||
175 | */ | ||
176 | extern void arch_suspend_disable_irqs(void); | ||
177 | |||
178 | /** | ||
179 | * arch_suspend_enable_irqs - enable IRQs after suspend | ||
180 | * | ||
181 | * Enables IRQs (in the default case). This is a weak symbol in the common | ||
182 | * code and thus allows architectures to override it if more needs to be | ||
183 | * done. Not called for suspend to disk. | ||
184 | */ | ||
185 | extern void arch_suspend_enable_irqs(void); | ||
186 | |||
169 | /* | 187 | /* |
170 | * Device power management | 188 | * Device power management |
171 | */ | 189 | */ |
@@ -273,6 +291,20 @@ extern void __suspend_report_result(const char *function, void *fn, int ret); | |||
273 | __suspend_report_result(__FUNCTION__, fn, ret); \ | 291 | __suspend_report_result(__FUNCTION__, fn, ret); \ |
274 | } while (0) | 292 | } while (0) |
275 | 293 | ||
294 | /* | ||
295 | * Platform hook to activate device wakeup capability, if that's not already | ||
296 | * handled by enable_irq_wake() etc. | ||
297 | * Returns zero on success, else negative errno | ||
298 | */ | ||
299 | extern int (*platform_enable_wakeup)(struct device *dev, int is_on); | ||
300 | |||
301 | static inline int call_platform_enable_wakeup(struct device *dev, int is_on) | ||
302 | { | ||
303 | if (platform_enable_wakeup) | ||
304 | return (*platform_enable_wakeup)(dev, is_on); | ||
305 | return 0; | ||
306 | } | ||
307 | |||
276 | #else /* !CONFIG_PM */ | 308 | #else /* !CONFIG_PM */ |
277 | 309 | ||
278 | static inline int device_suspend(pm_message_t state) | 310 | static inline int device_suspend(pm_message_t state) |
@@ -294,6 +326,11 @@ static inline void dpm_runtime_resume(struct device * dev) | |||
294 | 326 | ||
295 | #define suspend_report_result(fn, ret) do { } while (0) | 327 | #define suspend_report_result(fn, ret) do { } while (0) |
296 | 328 | ||
329 | static inline int call_platform_enable_wakeup(struct device *dev, int is_on) | ||
330 | { | ||
331 | return -EIO; | ||
332 | } | ||
333 | |||
297 | #endif | 334 | #endif |
298 | 335 | ||
299 | /* changes to device_may_wakeup take effect on the next pm state change. | 336 | /* changes to device_may_wakeup take effect on the next pm state change. |
diff --git a/include/linux/rtnetlink.h b/include/linux/rtnetlink.h index 4a629ea70cc4..1fae30af91f3 100644 --- a/include/linux/rtnetlink.h +++ b/include/linux/rtnetlink.h | |||
@@ -574,13 +574,6 @@ extern int rtattr_parse(struct rtattr *tb[], int maxattr, struct rtattr *rta, in | |||
574 | #define rtattr_parse_nested(tb, max, rta) \ | 574 | #define rtattr_parse_nested(tb, max, rta) \ |
575 | rtattr_parse((tb), (max), RTA_DATA((rta)), RTA_PAYLOAD((rta))) | 575 | rtattr_parse((tb), (max), RTA_DATA((rta)), RTA_PAYLOAD((rta))) |
576 | 576 | ||
577 | struct rtnetlink_link | ||
578 | { | ||
579 | int (*doit)(struct sk_buff *, struct nlmsghdr*, void *attr); | ||
580 | int (*dumpit)(struct sk_buff *, struct netlink_callback *cb); | ||
581 | }; | ||
582 | |||
583 | extern struct rtnetlink_link * rtnetlink_links[NPROTO]; | ||
584 | extern int rtnetlink_send(struct sk_buff *skb, u32 pid, u32 group, int echo); | 577 | 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); | 578 | extern int rtnl_unicast(struct sk_buff *skb, u32 pid); |
586 | extern int rtnl_notify(struct sk_buff *skb, u32 pid, u32 group, | 579 | extern int rtnl_notify(struct sk_buff *skb, u32 pid, u32 group, |
@@ -605,7 +598,7 @@ extern void __rta_fill(struct sk_buff *skb, int attrtype, int attrlen, const voi | |||
605 | 598 | ||
606 | #define RTA_PUT_NOHDR(skb, attrlen, data) \ | 599 | #define RTA_PUT_NOHDR(skb, attrlen, data) \ |
607 | ({ RTA_APPEND(skb, RTA_ALIGN(attrlen), data); \ | 600 | ({ RTA_APPEND(skb, RTA_ALIGN(attrlen), data); \ |
608 | memset(skb->tail - (RTA_ALIGN(attrlen) - attrlen), 0, \ | 601 | memset(skb_tail_pointer(skb) - (RTA_ALIGN(attrlen) - attrlen), 0, \ |
609 | RTA_ALIGN(attrlen) - attrlen); }) | 602 | RTA_ALIGN(attrlen) - attrlen); }) |
610 | 603 | ||
611 | #define RTA_PUT_U8(skb, attrtype, value) \ | 604 | #define RTA_PUT_U8(skb, attrtype, value) \ |
@@ -637,12 +630,12 @@ extern void __rta_fill(struct sk_buff *skb, int attrtype, int attrlen, const voi | |||
637 | RTA_PUT(skb, attrtype, 0, NULL); | 630 | RTA_PUT(skb, attrtype, 0, NULL); |
638 | 631 | ||
639 | #define RTA_NEST(skb, type) \ | 632 | #define RTA_NEST(skb, type) \ |
640 | ({ struct rtattr *__start = (struct rtattr *) (skb)->tail; \ | 633 | ({ struct rtattr *__start = (struct rtattr *)skb_tail_pointer(skb); \ |
641 | RTA_PUT(skb, type, 0, NULL); \ | 634 | RTA_PUT(skb, type, 0, NULL); \ |
642 | __start; }) | 635 | __start; }) |
643 | 636 | ||
644 | #define RTA_NEST_END(skb, start) \ | 637 | #define RTA_NEST_END(skb, start) \ |
645 | ({ (start)->rta_len = ((skb)->tail - (unsigned char *) (start)); \ | 638 | ({ (start)->rta_len = skb_tail_pointer(skb) - (unsigned char *)(start); \ |
646 | (skb)->len; }) | 639 | (skb)->len; }) |
647 | 640 | ||
648 | #define RTA_NEST_CANCEL(skb, start) \ | 641 | #define RTA_NEST_CANCEL(skb, start) \ |
diff --git a/include/linux/rxrpc.h b/include/linux/rxrpc.h new file mode 100644 index 000000000000..f7b826b565c7 --- /dev/null +++ b/include/linux/rxrpc.h | |||
@@ -0,0 +1,62 @@ | |||
1 | /* AF_RXRPC parameters | ||
2 | * | ||
3 | * Copyright (C) 2007 Red Hat, Inc. All Rights Reserved. | ||
4 | * Written by David Howells (dhowells@redhat.com) | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or | ||
7 | * modify it under the terms of the GNU General Public License | ||
8 | * as published by the Free Software Foundation; either version | ||
9 | * 2 of the License, or (at your option) any later version. | ||
10 | */ | ||
11 | |||
12 | #ifndef _LINUX_RXRPC_H | ||
13 | #define _LINUX_RXRPC_H | ||
14 | |||
15 | #include <linux/in.h> | ||
16 | #include <linux/in6.h> | ||
17 | |||
18 | /* | ||
19 | * RxRPC socket address | ||
20 | */ | ||
21 | struct sockaddr_rxrpc { | ||
22 | sa_family_t srx_family; /* address family */ | ||
23 | u16 srx_service; /* service desired */ | ||
24 | u16 transport_type; /* type of transport socket (SOCK_DGRAM) */ | ||
25 | u16 transport_len; /* length of transport address */ | ||
26 | union { | ||
27 | sa_family_t family; /* transport address family */ | ||
28 | struct sockaddr_in sin; /* IPv4 transport address */ | ||
29 | struct sockaddr_in6 sin6; /* IPv6 transport address */ | ||
30 | } transport; | ||
31 | }; | ||
32 | |||
33 | /* | ||
34 | * RxRPC socket options | ||
35 | */ | ||
36 | #define RXRPC_SECURITY_KEY 1 /* [clnt] set client security key */ | ||
37 | #define RXRPC_SECURITY_KEYRING 2 /* [srvr] set ring of server security keys */ | ||
38 | #define RXRPC_EXCLUSIVE_CONNECTION 3 /* [clnt] use exclusive RxRPC connection */ | ||
39 | #define RXRPC_MIN_SECURITY_LEVEL 4 /* minimum security level */ | ||
40 | |||
41 | /* | ||
42 | * RxRPC control messages | ||
43 | * - terminal messages mean that a user call ID tag can be recycled | ||
44 | */ | ||
45 | #define RXRPC_USER_CALL_ID 1 /* user call ID specifier */ | ||
46 | #define RXRPC_ABORT 2 /* abort request / notification [terminal] */ | ||
47 | #define RXRPC_ACK 3 /* [Server] RPC op final ACK received [terminal] */ | ||
48 | #define RXRPC_NET_ERROR 5 /* network error received [terminal] */ | ||
49 | #define RXRPC_BUSY 6 /* server busy received [terminal] */ | ||
50 | #define RXRPC_LOCAL_ERROR 7 /* local error generated [terminal] */ | ||
51 | #define RXRPC_NEW_CALL 8 /* [Server] new incoming call notification */ | ||
52 | #define RXRPC_ACCEPT 9 /* [Server] accept request */ | ||
53 | |||
54 | /* | ||
55 | * RxRPC security levels | ||
56 | */ | ||
57 | #define RXRPC_SECURITY_PLAIN 0 /* plain secure-checksummed packets only */ | ||
58 | #define RXRPC_SECURITY_AUTH 1 /* authenticated packets */ | ||
59 | #define RXRPC_SECURITY_ENCRYPT 2 /* encrypted packets */ | ||
60 | |||
61 | |||
62 | #endif /* _LINUX_RXRPC_H */ | ||
diff --git a/include/linux/sched.h b/include/linux/sched.h index 49fe2997a016..a1707583de49 100644 --- a/include/linux/sched.h +++ b/include/linux/sched.h | |||
@@ -196,13 +196,13 @@ extern void init_idle(struct task_struct *idle, int cpu); | |||
196 | extern cpumask_t nohz_cpu_mask; | 196 | extern cpumask_t nohz_cpu_mask; |
197 | 197 | ||
198 | /* | 198 | /* |
199 | * Only dump TASK_* tasks. (-1 for all tasks) | 199 | * Only dump TASK_* tasks. (0 for all tasks) |
200 | */ | 200 | */ |
201 | extern void show_state_filter(unsigned long state_filter); | 201 | extern void show_state_filter(unsigned long state_filter); |
202 | 202 | ||
203 | static inline void show_state(void) | 203 | static inline void show_state(void) |
204 | { | 204 | { |
205 | show_state_filter(-1); | 205 | show_state_filter(0); |
206 | } | 206 | } |
207 | 207 | ||
208 | extern void show_regs(struct pt_regs *); | 208 | extern void show_regs(struct pt_regs *); |
diff --git a/include/linux/sctp.h b/include/linux/sctp.h index d4f86560bfff..d70df61a029f 100644 --- a/include/linux/sctp.h +++ b/include/linux/sctp.h | |||
@@ -63,6 +63,15 @@ typedef struct sctphdr { | |||
63 | __be32 checksum; | 63 | __be32 checksum; |
64 | } __attribute__((packed)) sctp_sctphdr_t; | 64 | } __attribute__((packed)) sctp_sctphdr_t; |
65 | 65 | ||
66 | #ifdef __KERNEL__ | ||
67 | #include <linux/skbuff.h> | ||
68 | |||
69 | static inline struct sctphdr *sctp_hdr(const struct sk_buff *skb) | ||
70 | { | ||
71 | return (struct sctphdr *)skb_transport_header(skb); | ||
72 | } | ||
73 | #endif | ||
74 | |||
66 | /* Section 3.2. Chunk Field Descriptions. */ | 75 | /* Section 3.2. Chunk Field Descriptions. */ |
67 | typedef struct sctp_chunkhdr { | 76 | typedef struct sctp_chunkhdr { |
68 | __u8 type; | 77 | __u8 type; |
diff --git a/include/linux/sdla_fr.h b/include/linux/sdla_fr.h deleted file mode 100644 index cdfa77fcb06b..000000000000 --- a/include/linux/sdla_fr.h +++ /dev/null | |||
@@ -1,638 +0,0 @@ | |||
1 | /***************************************************************************** | ||
2 | * sdla_fr.h Sangoma frame relay firmware API definitions. | ||
3 | * | ||
4 | * Author: Gideon Hack | ||
5 | * Nenad Corbic <ncorbic@sangoma.com> | ||
6 | * | ||
7 | * Copyright: (c) 1995-2000 Sangoma Technologies Inc. | ||
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 | ||
11 | * as published by the Free Software Foundation; either version | ||
12 | * 2 of the License, or (at your option) any later version. | ||
13 | * ============================================================================ | ||
14 | * Oct 04, 1999 Gideon Hack Updated API structures | ||
15 | * Jun 02, 1999 Gideon Hack Modifications for S514 support | ||
16 | * Oct 12, 1997 Jaspreet Singh Added FR_READ_DLCI_IB_MAPPING | ||
17 | * Jul 21, 1997 Jaspreet Singh Changed FRRES_TOO_LONG and FRRES_TOO_MANY to | ||
18 | * 0x05 and 0x06 respectively. | ||
19 | * Dec 23, 1996 Gene Kozin v2.0 | ||
20 | * Apr 29, 1996 Gene Kozin v1.0 (merged version S502 & S508 definitions). | ||
21 | * Sep 26, 1995 Gene Kozin Initial version. | ||
22 | *****************************************************************************/ | ||
23 | #ifndef _SDLA_FR_H | ||
24 | #define _SDLA_FR_H | ||
25 | |||
26 | /*---------------------------------------------------------------------------- | ||
27 | * Notes: | ||
28 | * ------ | ||
29 | * 1. All structures defined in this file are byte-alined. | ||
30 | * | ||
31 | * Compiler Platform | ||
32 | * -------- -------- | ||
33 | * GNU C Linux | ||
34 | */ | ||
35 | |||
36 | #ifndef PACKED | ||
37 | # define PACKED __attribute__((packed)) | ||
38 | #endif /* PACKED */ | ||
39 | |||
40 | /* Adapter memory layout */ | ||
41 | #define FR_MB_VECTOR 0xE000 /* mailbox window vector */ | ||
42 | #define FR502_RX_VECTOR 0xA000 /* S502 direct receive window vector */ | ||
43 | #define FR502_MBOX_OFFS 0xF60 /* S502 mailbox offset */ | ||
44 | #define FR508_MBOX_OFFS 0 /* S508 mailbox offset */ | ||
45 | #define FR502_FLAG_OFFS 0x1FF0 /* S502 status flags offset */ | ||
46 | #define FR508_FLAG_OFFS 0x1000 /* S508 status flags offset */ | ||
47 | #define FR502_RXMB_OFFS 0x900 /* S502 direct receive mailbox offset */ | ||
48 | #define FR508_TXBC_OFFS 0x1100 /* S508 Tx buffer info offset */ | ||
49 | #define FR508_RXBC_OFFS 0x1120 /* S508 Rx buffer info offset */ | ||
50 | |||
51 | /* Important constants */ | ||
52 | #define FR502_MAX_DATA 4096 /* maximum data buffer length */ | ||
53 | #define FR508_MAX_DATA 4080 /* maximum data buffer length */ | ||
54 | #define MIN_LGTH_FR_DATA_CFG 300 /* min Information frame length | ||
55 | (for configuration purposes) */ | ||
56 | #define FR_MAX_NO_DATA_BYTES_IN_FRAME 15354 /* max Information frame length */ | ||
57 | |||
58 | #define HIGHEST_VALID_DLCI 991 | ||
59 | |||
60 | /****** Data Structures *****************************************************/ | ||
61 | |||
62 | /*---------------------------------------------------------------------------- | ||
63 | * Frame relay command block. | ||
64 | */ | ||
65 | typedef struct fr_cmd | ||
66 | { | ||
67 | unsigned char command PACKED; /* command code */ | ||
68 | unsigned short length PACKED; /* length of data buffer */ | ||
69 | unsigned char result PACKED; /* return code */ | ||
70 | unsigned short dlci PACKED; /* DLCI number */ | ||
71 | unsigned char attr PACKED; /* FECN, BECN, DE and C/R bits */ | ||
72 | unsigned short rxlost1 PACKED; /* frames discarded at int. level */ | ||
73 | unsigned long rxlost2 PACKED; /* frames discarded at app. level */ | ||
74 | unsigned char rsrv[2] PACKED; /* reserved for future use */ | ||
75 | } fr_cmd_t; | ||
76 | |||
77 | /* 'command' field defines */ | ||
78 | #define FR_WRITE 0x01 | ||
79 | #define FR_READ 0x02 | ||
80 | #define FR_ISSUE_IS_FRAME 0x03 | ||
81 | #define FR_SET_CONFIG 0x10 | ||
82 | #define FR_READ_CONFIG 0x11 | ||
83 | #define FR_COMM_DISABLE 0x12 | ||
84 | #define FR_COMM_ENABLE 0x13 | ||
85 | #define FR_READ_STATUS 0x14 | ||
86 | #define FR_READ_STATISTICS 0x15 | ||
87 | #define FR_FLUSH_STATISTICS 0x16 | ||
88 | #define FR_LIST_ACTIVE_DLCI 0x17 | ||
89 | #define FR_FLUSH_DATA_BUFFERS 0x18 | ||
90 | #define FR_READ_ADD_DLC_STATS 0x19 | ||
91 | #define FR_ADD_DLCI 0x20 | ||
92 | #define FR_DELETE_DLCI 0x21 | ||
93 | #define FR_ACTIVATE_DLCI 0x22 | ||
94 | #define FR_DEACTIVATE_DLCI 0x22 | ||
95 | #define FR_READ_MODEM_STATUS 0x30 | ||
96 | #define FR_SET_MODEM_STATUS 0x31 | ||
97 | #define FR_READ_ERROR_STATS 0x32 | ||
98 | #define FR_FLUSH_ERROR_STATS 0x33 | ||
99 | #define FR_READ_DLCI_IB_MAPPING 0x34 | ||
100 | #define FR_READ_CODE_VERSION 0x40 | ||
101 | #define FR_SET_INTR_MODE 0x50 | ||
102 | #define FR_READ_INTR_MODE 0x51 | ||
103 | #define FR_SET_TRACE_CONFIG 0x60 | ||
104 | #define FR_FT1_STATUS_CTRL 0x80 | ||
105 | #define FR_SET_FT1_MODE 0x81 | ||
106 | |||
107 | /* Special UDP drivers management commands */ | ||
108 | #define FPIPE_ENABLE_TRACING 0x41 | ||
109 | #define FPIPE_DISABLE_TRACING 0x42 | ||
110 | #define FPIPE_GET_TRACE_INFO 0x43 | ||
111 | #define FPIPE_FT1_READ_STATUS 0x44 | ||
112 | #define FPIPE_DRIVER_STAT_IFSEND 0x45 | ||
113 | #define FPIPE_DRIVER_STAT_INTR 0x46 | ||
114 | #define FPIPE_DRIVER_STAT_GEN 0x47 | ||
115 | #define FPIPE_FLUSH_DRIVER_STATS 0x48 | ||
116 | #define FPIPE_ROUTER_UP_TIME 0x49 | ||
117 | |||
118 | /* 'result' field defines */ | ||
119 | #define FRRES_OK 0x00 /* command executed successfully */ | ||
120 | #define FRRES_DISABLED 0x01 /* communications not enabled */ | ||
121 | #define FRRES_INOPERATIVE 0x02 /* channel inoperative */ | ||
122 | #define FRRES_DLCI_INACTIVE 0x03 /* DLCI is inactive */ | ||
123 | #define FRRES_DLCI_INVALID 0x04 /* DLCI is not configured */ | ||
124 | #define FRRES_TOO_LONG 0x05 | ||
125 | #define FRRES_TOO_MANY 0x06 | ||
126 | #define FRRES_CIR_OVERFLOW 0x07 /* Tx throughput has exceeded CIR */ | ||
127 | #define FRRES_BUFFER_OVERFLOW 0x08 | ||
128 | #define FRRES_MODEM_FAILURE 0x10 /* DCD and/or CTS dropped */ | ||
129 | #define FRRES_CHANNEL_DOWN 0x11 /* channel became inoperative */ | ||
130 | #define FRRES_CHANNEL_UP 0x12 /* channel became operative */ | ||
131 | #define FRRES_DLCI_CHANGE 0x13 /* DLCI status (or number) changed */ | ||
132 | #define FRRES_DLCI_MISMATCH 0x14 | ||
133 | #define FRRES_INVALID_CMD 0x1F /* invalid command */ | ||
134 | |||
135 | /* 'attr' field defines */ | ||
136 | #define FRATTR_ | ||
137 | |||
138 | /*---------------------------------------------------------------------------- | ||
139 | * Frame relay mailbox. | ||
140 | * This structure is located at offset FR50?_MBOX_OFFS into FR_MB_VECTOR. | ||
141 | * For S502 it is also located at offset FR502_RXMB_OFFS into | ||
142 | * FR502_RX_VECTOR. | ||
143 | */ | ||
144 | typedef struct fr_mbox | ||
145 | { | ||
146 | unsigned char opflag PACKED; /* 00h: execution flag */ | ||
147 | fr_cmd_t cmd PACKED; /* 01h: command block */ | ||
148 | unsigned char data[1] PACKED; /* 10h: variable length data buffer */ | ||
149 | } fr_mbox_t; | ||
150 | |||
151 | /*---------------------------------------------------------------------------- | ||
152 | * S502 frame relay status flags. | ||
153 | * This structure is located at offset FR502_FLAG_OFFS into FR_MB_VECTOR. | ||
154 | */ | ||
155 | typedef struct fr502_flags | ||
156 | { | ||
157 | unsigned char rsrv1[1] PACKED; /* 00h: */ | ||
158 | unsigned char tx_ready PACKED; /* 01h: Tx buffer available */ | ||
159 | unsigned char rx_ready PACKED; /* 02h: Rx frame available */ | ||
160 | unsigned char event PACKED; /* 03h: asynchronous event */ | ||
161 | unsigned char mstatus PACKED; /* 04h: modem status */ | ||
162 | unsigned char rsrv2[8] PACKED; /* 05h: */ | ||
163 | unsigned char iflag PACKED; /* 0Dh: interrupt flag */ | ||
164 | unsigned char imask PACKED; /* 0Eh: interrupt mask */ | ||
165 | } fr502_flags_t; | ||
166 | |||
167 | /*---------------------------------------------------------------------------- | ||
168 | * S508 frame relay status flags. | ||
169 | * This structure is located at offset FR508_FLAG_OFFS into FR_MB_VECTOR. | ||
170 | */ | ||
171 | typedef struct fr508_flags | ||
172 | { | ||
173 | unsigned char rsrv1[3] PACKED; /* 00h: reserved */ | ||
174 | unsigned char event PACKED; /* 03h: asynchronous event */ | ||
175 | unsigned char mstatus PACKED; /* 04h: modem status */ | ||
176 | unsigned char rsrv2[11] PACKED; /* 05h: reserved */ | ||
177 | unsigned char iflag PACKED; /* 10h: interrupt flag */ | ||
178 | unsigned char imask PACKED; /* 11h: interrupt mask */ | ||
179 | unsigned long tse_offs PACKED; /* 12h: Tx status element */ | ||
180 | unsigned short dlci PACKED; /* 16h: DLCI NUMBER */ | ||
181 | } fr508_flags_t; | ||
182 | |||
183 | /* 'event' field defines */ | ||
184 | #define FR_EVENT_STATUS 0x01 /* channel status change */ | ||
185 | #define FR_EVENT_DLC_STATUS 0x02 /* DLC status change */ | ||
186 | #define FR_EVENT_BAD_DLCI 0x04 /* FSR included wrong DLCI */ | ||
187 | #define FR_EVENT_LINK_DOWN 0x40 /* DCD or CTS low */ | ||
188 | |||
189 | /* 'mstatus' field defines */ | ||
190 | #define FR_MDM_DCD 0x08 /* mdm_status: DCD */ | ||
191 | #define FR_MDM_CTS 0x20 /* mdm_status: CTS */ | ||
192 | |||
193 | /* 'iflag' & 'imask' fields defines */ | ||
194 | #define FR_INTR_RXRDY 0x01 /* Rx ready */ | ||
195 | #define FR_INTR_TXRDY 0x02 /* Tx ready */ | ||
196 | #define FR_INTR_MODEM 0x04 /* modem status change (DCD, CTS) */ | ||
197 | #define FR_INTR_READY 0x08 /* interface command completed */ | ||
198 | #define FR_INTR_DLC 0x10 /* DLC status change */ | ||
199 | #define FR_INTR_TIMER 0x20 /* millisecond timer */ | ||
200 | #define FR_INTR_TX_MULT_DLCIs 0x80 /* Tx interrupt on multiple DLCIs */ | ||
201 | |||
202 | |||
203 | /*---------------------------------------------------------------------------- | ||
204 | * Receive Buffer Configuration Info. S508 only! | ||
205 | * This structure is located at offset FR508_RXBC_OFFS into FR_MB_VECTOR. | ||
206 | */ | ||
207 | typedef struct fr_buf_info | ||
208 | { | ||
209 | unsigned short rse_num PACKED; /* 00h: number of status elements */ | ||
210 | unsigned long rse_base PACKED; /* 02h: receive status array base */ | ||
211 | unsigned long rse_next PACKED; /* 06h: next status element */ | ||
212 | unsigned long buf_base PACKED; /* 0Ah: rotational buffer base */ | ||
213 | unsigned short reserved PACKED; /* 0Eh: */ | ||
214 | unsigned long buf_top PACKED; /* 10h: rotational buffer top */ | ||
215 | } fr_buf_info_t; | ||
216 | |||
217 | /*---------------------------------------------------------------------------- | ||
218 | * Buffer Status Element. S508 only! | ||
219 | * Array of structures of this type is located at offset defined by the | ||
220 | * 'rse_base' field of the frBufInfo_t structure into absolute adapter | ||
221 | * memory address space. | ||
222 | */ | ||
223 | typedef struct fr_rx_buf_ctl | ||
224 | { | ||
225 | unsigned char flag PACKED; /* 00h: ready flag */ | ||
226 | unsigned short length PACKED; /* 01h: frame length */ | ||
227 | unsigned short dlci PACKED; /* 03h: DLCI */ | ||
228 | unsigned char attr PACKED; /* 05h: FECN/BECN/DE/CR */ | ||
229 | unsigned short tmstamp PACKED; /* 06h: time stamp */ | ||
230 | unsigned short rsrv[2] PACKED; /* 08h: */ | ||
231 | unsigned long offset PACKED; /* 0Ch: buffer absolute address */ | ||
232 | } fr_rx_buf_ctl_t; | ||
233 | |||
234 | typedef struct fr_tx_buf_ctl | ||
235 | { | ||
236 | unsigned char flag PACKED; /* 00h: ready flag */ | ||
237 | unsigned short rsrv0[2] PACKED; /* 01h: */ | ||
238 | unsigned short length PACKED; /* 05h: frame length */ | ||
239 | unsigned short dlci PACKED; /* 07h: DLCI */ | ||
240 | unsigned char attr PACKED; /* 09h: FECN/BECN/DE/CR */ | ||
241 | unsigned short rsrv1 PACKED; /* 0Ah: */ | ||
242 | unsigned long offset PACKED; /* 0Ch: buffer absolute address */ | ||
243 | } fr_tx_buf_ctl_t; | ||
244 | |||
245 | /*---------------------------------------------------------------------------- | ||
246 | * Global Configuration Block. Passed to FR_SET_CONFIG command when dlci == 0. | ||
247 | */ | ||
248 | typedef struct fr_conf | ||
249 | { | ||
250 | unsigned short station PACKED; /* 00h: CPE/Node */ | ||
251 | unsigned short options PACKED; /* 02h: configuration options */ | ||
252 | unsigned short kbps PACKED; /* 04h: baud rate in kbps */ | ||
253 | unsigned short port PACKED; /* 06h: RS-232/V.35 */ | ||
254 | unsigned short mtu PACKED; /* 08h: max. transmit length */ | ||
255 | unsigned short t391 PACKED; /* 0Ah: */ | ||
256 | unsigned short t392 PACKED; /* 0Ch: */ | ||
257 | unsigned short n391 PACKED; /* 0Eh: */ | ||
258 | unsigned short n392 PACKED; /* 10h: */ | ||
259 | unsigned short n393 PACKED; /* 12h: */ | ||
260 | unsigned short cir_fwd PACKED; /* 14h: */ | ||
261 | unsigned short bc_fwd PACKED; /* 16h: */ | ||
262 | unsigned short be_fwd PACKED; /* 18h: */ | ||
263 | unsigned short cir_bwd PACKED; /* 1Ah: */ | ||
264 | unsigned short bc_bwd PACKED; /* 1Ch: */ | ||
265 | unsigned short be_bwd PACKED; /* 1Eh: */ | ||
266 | unsigned short dlci[0] PACKED; /* 20h: */ | ||
267 | } fr_conf_t; | ||
268 | |||
269 | /* 'station_type' defines */ | ||
270 | #define FRCFG_STATION_CPE 0 | ||
271 | #define FRCFG_STATION_NODE 1 | ||
272 | |||
273 | /* 'conf_flags' defines */ | ||
274 | #define FRCFG_IGNORE_TX_CIR 0x0001 | ||
275 | #define FRCFG_IGNORE_RX_CIR 0x0002 | ||
276 | #define FRCFG_DONT_RETRANSMIT 0x0004 | ||
277 | #define FRCFG_IGNORE_CBS 0x0008 | ||
278 | #define FRCFG_THROUGHPUT 0x0010 /* enable throughput calculation */ | ||
279 | #define FRCFG_DIRECT_RX 0x0080 /* enable direct receive buffer */ | ||
280 | #define FRCFG_AUTO_CONFIG 0x8000 /* enable auto DLCI configuration */ | ||
281 | |||
282 | /* 'baud_rate' defines */ | ||
283 | #define FRCFG_BAUD_1200 12 | ||
284 | #define FRCFG_BAUD_2400 24 | ||
285 | #define FRCFG_BAUD_4800 48 | ||
286 | #define FRCFG_BAUD_9600 96 | ||
287 | #define FRCFG_BAUD_19200 19 | ||
288 | #define FRCFG_BAUD_38400 38 | ||
289 | #define FRCFG_BAUD_56000 56 | ||
290 | #define FRCFG_BAUD_64000 64 | ||
291 | #define FRCFG_BAUD_128000 128 | ||
292 | |||
293 | /* 'port_mode' defines */ | ||
294 | #define FRCFG_MODE_EXT_CLK 0x0000 | ||
295 | #define FRCFG_MODE_INT_CLK 0x0001 | ||
296 | #define FRCFG_MODE_V35 0x0000 /* S508 only */ | ||
297 | #define FRCFG_MODE_RS232 0x0002 /* S508 only */ | ||
298 | |||
299 | /* defines for line tracing */ | ||
300 | |||
301 | /* the line trace status element presented by the frame relay code */ | ||
302 | typedef struct { | ||
303 | unsigned char flag PACKED; /* ready flag */ | ||
304 | unsigned short length PACKED; /* trace length */ | ||
305 | unsigned char rsrv0[2] PACKED; /* reserved */ | ||
306 | unsigned char attr PACKED; /* trace attributes */ | ||
307 | unsigned short tmstamp PACKED; /* time stamp */ | ||
308 | unsigned char rsrv1[4] PACKED; /* reserved */ | ||
309 | unsigned long offset PACKED; /* buffer absolute address */ | ||
310 | } fr_trc_el_t; | ||
311 | |||
312 | typedef struct { | ||
313 | unsigned char status PACKED; /* status flag */ | ||
314 | unsigned char data_passed PACKED; /* 0 if no data passed, 1 if */ | ||
315 | /* data passed */ | ||
316 | unsigned short length PACKED; /* frame length */ | ||
317 | unsigned short tmstamp PACKED; /* time stamp */ | ||
318 | } fpipemon_trc_hdr_t; | ||
319 | |||
320 | typedef struct { | ||
321 | fpipemon_trc_hdr_t fpipemon_trc_hdr PACKED; | ||
322 | unsigned char data[FR_MAX_NO_DATA_BYTES_IN_FRAME] PACKED; | ||
323 | } fpipemon_trc_t; | ||
324 | |||
325 | /* bit settings for the 'status' byte - note that bits 1, 2 and 3 are used */ | ||
326 | /* for returning the number of frames being passed to fpipemon */ | ||
327 | #define TRC_OUTGOING_FRM 0x01 | ||
328 | #define TRC_ABORT_ERROR 0x10 | ||
329 | #define TRC_CRC_ERROR 0x20 | ||
330 | #define TRC_OVERRUN_ERROR 0x40 | ||
331 | #define MORE_TRC_DATA 0x80 | ||
332 | |||
333 | #define MAX_FRMS_TRACED 0x07 | ||
334 | |||
335 | #define NO_TRC_ELEMENTS_OFF 0x9000 | ||
336 | #define BASE_TRC_ELEMENTS_OFF 0x9002 | ||
337 | #define TRC_ACTIVE 0x01 | ||
338 | #define FLUSH_TRC_BUFFERS 0x02 | ||
339 | #define FLUSH_TRC_STATISTICS 0x04 | ||
340 | #define TRC_SIGNALLING_FRMS 0x10 | ||
341 | #define TRC_INFO_FRMS 0x20 | ||
342 | #define ACTIVATE_TRC (TRC_ACTIVE | TRC_SIGNALLING_FRMS | TRC_INFO_FRMS) | ||
343 | #define RESET_TRC (FLUSH_TRC_BUFFERS | FLUSH_TRC_STATISTICS) | ||
344 | |||
345 | /*---------------------------------------------------------------------------- | ||
346 | * Channel configuration. | ||
347 | * This structure is passed to the FR_SET_CONFIG command when dlci != 0. | ||
348 | */ | ||
349 | typedef struct fr_dlc_conf | ||
350 | { | ||
351 | unsigned short conf_flags PACKED; /* 00h: configuration bits */ | ||
352 | unsigned short cir_fwd PACKED; /* 02h: */ | ||
353 | unsigned short bc_fwd PACKED; /* 04h: */ | ||
354 | unsigned short be_fwd PACKED; /* 06h: */ | ||
355 | unsigned short cir_bwd PACKED; /* 08h: */ | ||
356 | unsigned short bc_bwd PACKED; /* 0Ah: */ | ||
357 | unsigned short be_bwd PACKED; /* 0Ch: */ | ||
358 | } fr_dlc_conf_t; | ||
359 | |||
360 | /*---------------------------------------------------------------------------- | ||
361 | * S502 interrupt mode control block. | ||
362 | * This structure is passed to the FR_SET_INTR_FLAGS and returned by the | ||
363 | * FR_READ_INTR_FLAGS commands. | ||
364 | */ | ||
365 | typedef struct fr502_intr_ctl | ||
366 | { | ||
367 | unsigned char mode PACKED; /* 00h: interrupt enable flags */ | ||
368 | unsigned short tx_len PACKED; /* 01h: required Tx buffer size */ | ||
369 | } fr502_intr_ctl_t; | ||
370 | |||
371 | /*---------------------------------------------------------------------------- | ||
372 | * S508 interrupt mode control block. | ||
373 | * This structure is passed to the FR_SET_INTR_FLAGS and returned by the | ||
374 | * FR_READ_INTR_FLAGS commands. | ||
375 | */ | ||
376 | typedef struct fr508_intr_ctl | ||
377 | { | ||
378 | unsigned char mode PACKED; /* 00h: interrupt enable flags */ | ||
379 | unsigned short tx_len PACKED; /* 01h: required Tx buffer size */ | ||
380 | unsigned char irq PACKED; /* 03h: IRQ level to activate */ | ||
381 | unsigned char flags PACKED; /* 04h: ?? */ | ||
382 | unsigned short timeout PACKED; /* 05h: ms, for timer interrupt */ | ||
383 | } fr508_intr_ctl_t; | ||
384 | |||
385 | /*---------------------------------------------------------------------------- | ||
386 | * Channel status. | ||
387 | * This structure is returned by the FR_READ_STATUS command. | ||
388 | */ | ||
389 | typedef struct fr_dlc_Status | ||
390 | { | ||
391 | unsigned char status PACKED; /* 00h: link/DLCI status */ | ||
392 | struct | ||
393 | { | ||
394 | unsigned short dlci PACKED; /* 01h: DLCI number */ | ||
395 | unsigned char status PACKED; /* 03h: DLCI status */ | ||
396 | } circuit[1] PACKED; | ||
397 | } fr_dlc_status_t; | ||
398 | |||
399 | /* 'status' defines */ | ||
400 | #define FR_LINK_INOPER 0x00 /* for global status (DLCI == 0) */ | ||
401 | #define FR_LINK_OPER 0x01 | ||
402 | #define FR_DLCI_DELETED 0x01 /* for circuit status (DLCI != 0) */ | ||
403 | #define FR_DLCI_ACTIVE 0x02 | ||
404 | #define FR_DLCI_WAITING 0x04 | ||
405 | #define FR_DLCI_NEW 0x08 | ||
406 | #define FR_DLCI_REPORT 0x40 | ||
407 | |||
408 | /*---------------------------------------------------------------------------- | ||
409 | * Global Statistics Block. | ||
410 | * This structure is returned by the FR_READ_STATISTICS command when | ||
411 | * dcli == 0. | ||
412 | */ | ||
413 | typedef struct fr_link_stat | ||
414 | { | ||
415 | unsigned short rx_too_long PACKED; /* 00h: */ | ||
416 | unsigned short rx_dropped PACKED; /* 02h: */ | ||
417 | unsigned short rx_dropped2 PACKED; /* 04h: */ | ||
418 | unsigned short rx_bad_dlci PACKED; /* 06h: */ | ||
419 | unsigned short rx_bad_format PACKED; /* 08h: */ | ||
420 | unsigned short retransmitted PACKED; /* 0Ah: */ | ||
421 | unsigned short cpe_tx_FSE PACKED; /* 0Ch: */ | ||
422 | unsigned short cpe_tx_LIV PACKED; /* 0Eh: */ | ||
423 | unsigned short cpe_rx_FSR PACKED; /* 10h: */ | ||
424 | unsigned short cpe_rx_LIV PACKED; /* 12h: */ | ||
425 | unsigned short node_rx_FSE PACKED; /* 14h: */ | ||
426 | unsigned short node_rx_LIV PACKED; /* 16h: */ | ||
427 | unsigned short node_tx_FSR PACKED; /* 18h: */ | ||
428 | unsigned short node_tx_LIV PACKED; /* 1Ah: */ | ||
429 | unsigned short rx_ISF_err PACKED; /* 1Ch: */ | ||
430 | unsigned short rx_unsolicited PACKED; /* 1Eh: */ | ||
431 | unsigned short rx_SSN_err PACKED; /* 20h: */ | ||
432 | unsigned short rx_RSN_err PACKED; /* 22h: */ | ||
433 | unsigned short T391_timeouts PACKED; /* 24h: */ | ||
434 | unsigned short T392_timeouts PACKED; /* 26h: */ | ||
435 | unsigned short N392_reached PACKED; /* 28h: */ | ||
436 | unsigned short cpe_SSN_RSN PACKED; /* 2Ah: */ | ||
437 | unsigned short current_SSN PACKED; /* 2Ch: */ | ||
438 | unsigned short current_RSN PACKED; /* 2Eh: */ | ||
439 | unsigned short curreny_T391 PACKED; /* 30h: */ | ||
440 | unsigned short current_T392 PACKED; /* 32h: */ | ||
441 | unsigned short current_N392 PACKED; /* 34h: */ | ||
442 | unsigned short current_N393 PACKED; /* 36h: */ | ||
443 | } fr_link_stat_t; | ||
444 | |||
445 | /*---------------------------------------------------------------------------- | ||
446 | * DLCI statistics. | ||
447 | * This structure is returned by the FR_READ_STATISTICS command when | ||
448 | * dlci != 0. | ||
449 | */ | ||
450 | typedef struct fr_dlci_stat | ||
451 | { | ||
452 | unsigned long tx_frames PACKED; /* 00h: */ | ||
453 | unsigned long tx_bytes PACKED; /* 04h: */ | ||
454 | unsigned long rx_frames PACKED; /* 08h: */ | ||
455 | unsigned long rx_bytes PACKED; /* 0Ch: */ | ||
456 | unsigned long rx_dropped PACKED; /* 10h: */ | ||
457 | unsigned long rx_inactive PACKED; /* 14h: */ | ||
458 | unsigned long rx_exceed_CIR PACKED; /* 18h: */ | ||
459 | unsigned long rx_DE_set PACKED; /* 1Ch: */ | ||
460 | unsigned long tx_throughput PACKED; /* 20h: */ | ||
461 | unsigned long tx_calc_timer PACKED; /* 24h: */ | ||
462 | unsigned long rx_throughput PACKED; /* 28h: */ | ||
463 | unsigned long rx_calc_timer PACKED; /* 2Ch: */ | ||
464 | } fr_dlci_stat_t; | ||
465 | |||
466 | /*---------------------------------------------------------------------------- | ||
467 | * Communications error statistics. | ||
468 | * This structure is returned by the FR_READ_ERROR_STATS command. | ||
469 | */ | ||
470 | typedef struct fr_comm_stat | ||
471 | { | ||
472 | unsigned char rx_overruns PACKED; /* 00h: */ | ||
473 | unsigned char rx_bad_crc PACKED; /* 01h: */ | ||
474 | unsigned char rx_aborts PACKED; /* 02h: */ | ||
475 | unsigned char rx_too_long PACKED; /* 03h: */ | ||
476 | unsigned char tx_aborts PACKED; /* 04h: */ | ||
477 | unsigned char tx_underruns PACKED; /* 05h: */ | ||
478 | unsigned char tx_missed_undr PACKED; /* 06h: */ | ||
479 | unsigned char dcd_dropped PACKED; /* 07h: */ | ||
480 | unsigned char cts_dropped PACKED; /* 08h: */ | ||
481 | } fr_comm_stat_t; | ||
482 | |||
483 | /*---------------------------------------------------------------------------- | ||
484 | * Defines for the FR_ISSUE_IS_FRAME command. | ||
485 | */ | ||
486 | #define FR_ISF_LVE 2 /* issue Link Verification Enquiry */ | ||
487 | #define FR_ISF_FSE 3 /* issue Full Status Enquiry */ | ||
488 | |||
489 | /*---------------------------------------------------------------------------- | ||
490 | * Frame Relay ARP Header -- Used for Dynamic route creation with InvARP | ||
491 | */ | ||
492 | |||
493 | typedef struct arphdr_fr | ||
494 | { | ||
495 | unsigned short ar_hrd PACKED; /* format of hardware addr */ | ||
496 | unsigned short ar_pro PACKED; /* format of protocol addr */ | ||
497 | unsigned char ar_hln PACKED; /* length of hardware addr */ | ||
498 | unsigned char ar_pln PACKED; /* length of protocol addr */ | ||
499 | unsigned short ar_op PACKED; /* ARP opcode */ | ||
500 | unsigned short ar_sha PACKED; /* Sender DLCI addr 2 bytes */ | ||
501 | unsigned long ar_sip PACKED; /* Sender IP addr 4 bytes */ | ||
502 | unsigned short ar_tha PACKED; /* Target DLCI addr 2 bytes */ | ||
503 | unsigned long ar_tip PACKED; /* Target IP addr 4 bytes */ | ||
504 | } arphdr_fr_t; | ||
505 | |||
506 | /*---------------------------------------------------------------------------- | ||
507 | * Frame Relay RFC 1490 SNAP Header -- Used to check for ARP packets | ||
508 | */ | ||
509 | typedef struct arphdr_1490 | ||
510 | { | ||
511 | unsigned char control PACKED; /* UI, etc... */ | ||
512 | unsigned char pad PACKED; /* Pad */ | ||
513 | unsigned char NLPID PACKED; /* SNAP */ | ||
514 | unsigned char OUI[3] PACKED; /* Ethertype, etc... */ | ||
515 | unsigned short PID PACKED; /* ARP, IP, etc... */ | ||
516 | } arphdr_1490_t; | ||
517 | |||
518 | /* UDP/IP packet (for UDP management) layout */ | ||
519 | |||
520 | /* The embedded control block for UDP mgmt | ||
521 | This is essentially a mailbox structure, without the large data field */ | ||
522 | |||
523 | typedef struct { | ||
524 | unsigned char opp_flag PACKED; /* the opp flag */ | ||
525 | unsigned char command PACKED; /* command code */ | ||
526 | unsigned short length PACKED; /* length of data buffer */ | ||
527 | unsigned char result PACKED; /* return code */ | ||
528 | unsigned short dlci PACKED; /* DLCI number */ | ||
529 | unsigned char attr PACKED; /* FECN, BECN, DE and C/R bits */ | ||
530 | unsigned short rxlost1 PACKED; /* frames discarded at int. level */ | ||
531 | unsigned long rxlost2 PACKED; /* frames discarded at app. level */ | ||
532 | unsigned char rsrv[2] PACKED; /* reserved for future use */ | ||
533 | } cblock_t; | ||
534 | |||
535 | |||
536 | /* UDP management packet layout (data area of ip packet) */ | ||
537 | |||
538 | typedef struct { | ||
539 | unsigned char control PACKED; | ||
540 | unsigned char NLPID PACKED; | ||
541 | } fr_encap_hdr_t; | ||
542 | |||
543 | typedef struct { | ||
544 | // fr_encap_hdr_t fr_encap_hdr PACKED; | ||
545 | ip_pkt_t ip_pkt PACKED; | ||
546 | udp_pkt_t udp_pkt PACKED; | ||
547 | wp_mgmt_t wp_mgmt PACKED; | ||
548 | cblock_t cblock PACKED; | ||
549 | unsigned char data[4080] PACKED; | ||
550 | } fr_udp_pkt_t; | ||
551 | |||
552 | |||
553 | /* valid ip_protocol for UDP management */ | ||
554 | #define UDPMGMT_UDP_PROTOCOL 0x11 | ||
555 | |||
556 | #define UDPMGMT_FPIPE_SIGNATURE "FPIPE8ND" | ||
557 | #define UDPMGMT_DRVRSTATS_SIGNATURE "DRVSTATS" | ||
558 | |||
559 | /* values for request/reply byte */ | ||
560 | #define UDPMGMT_REQUEST 0x01 | ||
561 | #define UDPMGMT_REPLY 0x02 | ||
562 | #define UDP_OFFSET 12 | ||
563 | |||
564 | typedef struct { | ||
565 | unsigned long if_send_entry; | ||
566 | unsigned long if_send_skb_null; | ||
567 | unsigned long if_send_broadcast; | ||
568 | unsigned long if_send_multicast; | ||
569 | unsigned long if_send_critical_ISR; | ||
570 | unsigned long if_send_critical_non_ISR; | ||
571 | unsigned long if_send_busy; | ||
572 | unsigned long if_send_busy_timeout; | ||
573 | unsigned long if_send_DRVSTATS_request; | ||
574 | unsigned long if_send_FPIPE_request; | ||
575 | unsigned long if_send_wan_disconnected; | ||
576 | unsigned long if_send_dlci_disconnected; | ||
577 | unsigned long if_send_no_bfrs; | ||
578 | unsigned long if_send_adptr_bfrs_full; | ||
579 | unsigned long if_send_bfrs_passed_to_adptr; | ||
580 | unsigned long if_send_consec_send_fail; | ||
581 | } drvstats_if_send_t; | ||
582 | |||
583 | typedef struct { | ||
584 | unsigned long rx_intr_no_socket; | ||
585 | unsigned long rx_intr_dev_not_started; | ||
586 | unsigned long rx_intr_DRVSTATS_request; | ||
587 | unsigned long rx_intr_FPIPE_request; | ||
588 | unsigned long rx_intr_bfr_not_passed_to_stack; | ||
589 | unsigned long rx_intr_bfr_passed_to_stack; | ||
590 | } drvstats_rx_intr_t; | ||
591 | |||
592 | typedef struct { | ||
593 | unsigned long UDP_FPIPE_mgmt_kmalloc_err; | ||
594 | unsigned long UDP_FPIPE_mgmt_direction_err; | ||
595 | unsigned long UDP_FPIPE_mgmt_adptr_type_err; | ||
596 | unsigned long UDP_FPIPE_mgmt_adptr_cmnd_OK; | ||
597 | unsigned long UDP_FPIPE_mgmt_adptr_cmnd_timeout; | ||
598 | unsigned long UDP_FPIPE_mgmt_adptr_send_passed; | ||
599 | unsigned long UDP_FPIPE_mgmt_adptr_send_failed; | ||
600 | unsigned long UDP_FPIPE_mgmt_not_passed_to_stack; | ||
601 | unsigned long UDP_FPIPE_mgmt_passed_to_stack; | ||
602 | unsigned long UDP_FPIPE_mgmt_no_socket; | ||
603 | unsigned long UDP_DRVSTATS_mgmt_kmalloc_err; | ||
604 | unsigned long UDP_DRVSTATS_mgmt_adptr_cmnd_OK; | ||
605 | unsigned long UDP_DRVSTATS_mgmt_adptr_cmnd_timeout; | ||
606 | unsigned long UDP_DRVSTATS_mgmt_adptr_send_passed; | ||
607 | unsigned long UDP_DRVSTATS_mgmt_adptr_send_failed; | ||
608 | unsigned long UDP_DRVSTATS_mgmt_not_passed_to_stack; | ||
609 | unsigned long UDP_DRVSTATS_mgmt_passed_to_stack; | ||
610 | unsigned long UDP_DRVSTATS_mgmt_no_socket; | ||
611 | } drvstats_gen_t; | ||
612 | |||
613 | typedef struct { | ||
614 | unsigned char attr PACKED; | ||
615 | unsigned short time_stamp PACKED; | ||
616 | unsigned char reserved[13] PACKED; | ||
617 | } api_rx_hdr_t; | ||
618 | |||
619 | typedef struct { | ||
620 | api_rx_hdr_t api_rx_hdr PACKED; | ||
621 | void * data PACKED; | ||
622 | } api_rx_element_t; | ||
623 | |||
624 | typedef struct { | ||
625 | unsigned char attr PACKED; | ||
626 | unsigned char reserved[15] PACKED; | ||
627 | } api_tx_hdr_t; | ||
628 | |||
629 | typedef struct { | ||
630 | api_tx_hdr_t api_tx_hdr PACKED; | ||
631 | void * data PACKED; | ||
632 | } api_tx_element_t; | ||
633 | |||
634 | #ifdef _MSC_ | ||
635 | # pragma pack() | ||
636 | #endif | ||
637 | #endif /* _SDLA_FR_H */ | ||
638 | |||
diff --git a/include/linux/seqlock.h b/include/linux/seqlock.h index 52c9eb9b6df2..26e4925bc35b 100644 --- a/include/linux/seqlock.h +++ b/include/linux/seqlock.h | |||
@@ -61,10 +61,10 @@ static inline void write_seqlock(seqlock_t *sl) | |||
61 | { | 61 | { |
62 | spin_lock(&sl->lock); | 62 | spin_lock(&sl->lock); |
63 | ++sl->sequence; | 63 | ++sl->sequence; |
64 | smp_wmb(); | 64 | smp_wmb(); |
65 | } | 65 | } |
66 | 66 | ||
67 | static inline void write_sequnlock(seqlock_t *sl) | 67 | static inline void write_sequnlock(seqlock_t *sl) |
68 | { | 68 | { |
69 | smp_wmb(); | 69 | smp_wmb(); |
70 | sl->sequence++; | 70 | sl->sequence++; |
@@ -77,7 +77,7 @@ static inline int write_tryseqlock(seqlock_t *sl) | |||
77 | 77 | ||
78 | if (ret) { | 78 | if (ret) { |
79 | ++sl->sequence; | 79 | ++sl->sequence; |
80 | smp_wmb(); | 80 | smp_wmb(); |
81 | } | 81 | } |
82 | return ret; | 82 | return ret; |
83 | } | 83 | } |
diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h index 82f43ad478c7..2694cb3ca763 100644 --- a/include/linux/skbuff.h +++ b/include/linux/skbuff.h | |||
@@ -27,20 +27,24 @@ | |||
27 | #include <net/checksum.h> | 27 | #include <net/checksum.h> |
28 | #include <linux/rcupdate.h> | 28 | #include <linux/rcupdate.h> |
29 | #include <linux/dmaengine.h> | 29 | #include <linux/dmaengine.h> |
30 | #include <linux/hrtimer.h> | ||
30 | 31 | ||
31 | #define HAVE_ALLOC_SKB /* For the drivers to know */ | 32 | #define HAVE_ALLOC_SKB /* For the drivers to know */ |
32 | #define HAVE_ALIGNABLE_SKB /* Ditto 8) */ | 33 | #define HAVE_ALIGNABLE_SKB /* Ditto 8) */ |
33 | 34 | ||
35 | /* Don't change this without changing skb_csum_unnecessary! */ | ||
34 | #define CHECKSUM_NONE 0 | 36 | #define CHECKSUM_NONE 0 |
35 | #define CHECKSUM_PARTIAL 1 | 37 | #define CHECKSUM_UNNECESSARY 1 |
36 | #define CHECKSUM_UNNECESSARY 2 | 38 | #define CHECKSUM_COMPLETE 2 |
37 | #define CHECKSUM_COMPLETE 3 | 39 | #define CHECKSUM_PARTIAL 3 |
38 | 40 | ||
39 | #define SKB_DATA_ALIGN(X) (((X) + (SMP_CACHE_BYTES - 1)) & \ | 41 | #define SKB_DATA_ALIGN(X) (((X) + (SMP_CACHE_BYTES - 1)) & \ |
40 | ~(SMP_CACHE_BYTES - 1)) | 42 | ~(SMP_CACHE_BYTES - 1)) |
41 | #define SKB_MAX_ORDER(X, ORDER) (((PAGE_SIZE << (ORDER)) - (X) - \ | 43 | #define SKB_WITH_OVERHEAD(X) \ |
42 | sizeof(struct skb_shared_info)) & \ | 44 | (((X) - sizeof(struct skb_shared_info)) & \ |
43 | ~(SMP_CACHE_BYTES - 1)) | 45 | ~(SMP_CACHE_BYTES - 1)) |
46 | #define SKB_MAX_ORDER(X, ORDER) \ | ||
47 | SKB_WITH_OVERHEAD((PAGE_SIZE << (ORDER)) - (X)) | ||
44 | #define SKB_MAX_HEAD(X) (SKB_MAX_ORDER((X), 0)) | 48 | #define SKB_MAX_HEAD(X) (SKB_MAX_ORDER((X), 0)) |
45 | #define SKB_MAX_ALLOC (SKB_MAX_ORDER(0, 2)) | 49 | #define SKB_MAX_ALLOC (SKB_MAX_ORDER(0, 2)) |
46 | 50 | ||
@@ -66,8 +70,8 @@ | |||
66 | * NONE: skb is checksummed by protocol or csum is not required. | 70 | * NONE: skb is checksummed by protocol or csum is not required. |
67 | * | 71 | * |
68 | * PARTIAL: device is required to csum packet as seen by hard_start_xmit | 72 | * PARTIAL: device is required to csum packet as seen by hard_start_xmit |
69 | * from skb->h.raw to the end and to record the checksum | 73 | * from skb->transport_header to the end and to record the checksum |
70 | * at skb->h.raw+skb->csum. | 74 | * at skb->transport_header + skb->csum. |
71 | * | 75 | * |
72 | * Device must show its capabilities in dev->features, set | 76 | * Device must show its capabilities in dev->features, set |
73 | * at device setup time. | 77 | * at device setup time. |
@@ -83,12 +87,13 @@ | |||
83 | */ | 87 | */ |
84 | 88 | ||
85 | struct net_device; | 89 | struct net_device; |
90 | struct scatterlist; | ||
86 | 91 | ||
87 | #ifdef CONFIG_NETFILTER | 92 | #if defined(CONFIG_NF_CONNTRACK) || defined(CONFIG_NF_CONNTRACK_MODULE) |
88 | struct nf_conntrack { | 93 | struct nf_conntrack { |
89 | atomic_t use; | 94 | atomic_t use; |
90 | void (*destroy)(struct nf_conntrack *); | ||
91 | }; | 95 | }; |
96 | #endif | ||
92 | 97 | ||
93 | #ifdef CONFIG_BRIDGE_NETFILTER | 98 | #ifdef CONFIG_BRIDGE_NETFILTER |
94 | struct nf_bridge_info { | 99 | struct nf_bridge_info { |
@@ -103,8 +108,6 @@ struct nf_bridge_info { | |||
103 | }; | 108 | }; |
104 | #endif | 109 | #endif |
105 | 110 | ||
106 | #endif | ||
107 | |||
108 | struct sk_buff_head { | 111 | struct sk_buff_head { |
109 | /* These two members must be first. */ | 112 | /* These two members must be first. */ |
110 | struct sk_buff *next; | 113 | struct sk_buff *next; |
@@ -156,11 +159,6 @@ struct skb_shared_info { | |||
156 | #define SKB_DATAREF_SHIFT 16 | 159 | #define SKB_DATAREF_SHIFT 16 |
157 | #define SKB_DATAREF_MASK ((1 << SKB_DATAREF_SHIFT) - 1) | 160 | #define SKB_DATAREF_MASK ((1 << SKB_DATAREF_SHIFT) - 1) |
158 | 161 | ||
159 | struct skb_timeval { | ||
160 | u32 off_sec; | ||
161 | u32 off_usec; | ||
162 | }; | ||
163 | |||
164 | 162 | ||
165 | enum { | 163 | enum { |
166 | SKB_FCLONE_UNAVAILABLE, | 164 | SKB_FCLONE_UNAVAILABLE, |
@@ -181,6 +179,16 @@ enum { | |||
181 | SKB_GSO_TCPV6 = 1 << 4, | 179 | SKB_GSO_TCPV6 = 1 << 4, |
182 | }; | 180 | }; |
183 | 181 | ||
182 | #if BITS_PER_LONG > 32 | ||
183 | #define NET_SKBUFF_DATA_USES_OFFSET 1 | ||
184 | #endif | ||
185 | |||
186 | #ifdef NET_SKBUFF_DATA_USES_OFFSET | ||
187 | typedef unsigned int sk_buff_data_t; | ||
188 | #else | ||
189 | typedef unsigned char *sk_buff_data_t; | ||
190 | #endif | ||
191 | |||
184 | /** | 192 | /** |
185 | * struct sk_buff - socket buffer | 193 | * struct sk_buff - socket buffer |
186 | * @next: Next buffer in list | 194 | * @next: Next buffer in list |
@@ -190,15 +198,17 @@ enum { | |||
190 | * @dev: Device we arrived on/are leaving by | 198 | * @dev: Device we arrived on/are leaving by |
191 | * @iif: ifindex of device we arrived on | 199 | * @iif: ifindex of device we arrived on |
192 | * @h: Transport layer header | 200 | * @h: Transport layer header |
193 | * @nh: Network layer header | 201 | * @network_header: Network layer header |
194 | * @mac: Link layer header | 202 | * @mac_header: Link layer header |
195 | * @dst: destination entry | 203 | * @dst: destination entry |
196 | * @sp: the security path, used for xfrm | 204 | * @sp: the security path, used for xfrm |
197 | * @cb: Control buffer. Free for use by every layer. Put private vars here | 205 | * @cb: Control buffer. Free for use by every layer. Put private vars here |
198 | * @len: Length of actual data | 206 | * @len: Length of actual data |
199 | * @data_len: Data length | 207 | * @data_len: Data length |
200 | * @mac_len: Length of link layer header | 208 | * @mac_len: Length of link layer header |
201 | * @csum: Checksum | 209 | * @csum: Checksum (must include start/offset pair) |
210 | * @csum_start: Offset from skb->head where checksumming should start | ||
211 | * @csum_offset: Offset from csum_start where checksum should be stored | ||
202 | * @local_df: allow local fragmentation | 212 | * @local_df: allow local fragmentation |
203 | * @cloned: Head may be cloned (check refcnt to be sure) | 213 | * @cloned: Head may be cloned (check refcnt to be sure) |
204 | * @nohdr: Payload reference only, must not modify header | 214 | * @nohdr: Payload reference only, must not modify header |
@@ -233,32 +243,11 @@ struct sk_buff { | |||
233 | struct sk_buff *prev; | 243 | struct sk_buff *prev; |
234 | 244 | ||
235 | struct sock *sk; | 245 | struct sock *sk; |
236 | struct skb_timeval tstamp; | 246 | ktime_t tstamp; |
237 | struct net_device *dev; | 247 | struct net_device *dev; |
238 | int iif; | 248 | int iif; |
239 | /* 4 byte hole on 64 bit*/ | 249 | /* 4 byte hole on 64 bit*/ |
240 | 250 | ||
241 | union { | ||
242 | struct tcphdr *th; | ||
243 | struct udphdr *uh; | ||
244 | struct icmphdr *icmph; | ||
245 | struct igmphdr *igmph; | ||
246 | struct iphdr *ipiph; | ||
247 | struct ipv6hdr *ipv6h; | ||
248 | unsigned char *raw; | ||
249 | } h; | ||
250 | |||
251 | union { | ||
252 | struct iphdr *iph; | ||
253 | struct ipv6hdr *ipv6h; | ||
254 | struct arphdr *arph; | ||
255 | unsigned char *raw; | ||
256 | } nh; | ||
257 | |||
258 | union { | ||
259 | unsigned char *raw; | ||
260 | } mac; | ||
261 | |||
262 | struct dst_entry *dst; | 251 | struct dst_entry *dst; |
263 | struct sec_path *sp; | 252 | struct sec_path *sp; |
264 | 253 | ||
@@ -275,7 +264,10 @@ struct sk_buff { | |||
275 | mac_len; | 264 | mac_len; |
276 | union { | 265 | union { |
277 | __wsum csum; | 266 | __wsum csum; |
278 | __u32 csum_offset; | 267 | struct { |
268 | __u16 csum_start; | ||
269 | __u16 csum_offset; | ||
270 | }; | ||
279 | }; | 271 | }; |
280 | __u32 priority; | 272 | __u32 priority; |
281 | __u8 local_df:1, | 273 | __u8 local_df:1, |
@@ -289,15 +281,13 @@ struct sk_buff { | |||
289 | __be16 protocol; | 281 | __be16 protocol; |
290 | 282 | ||
291 | void (*destructor)(struct sk_buff *skb); | 283 | void (*destructor)(struct sk_buff *skb); |
292 | #ifdef CONFIG_NETFILTER | ||
293 | struct nf_conntrack *nfct; | ||
294 | #if defined(CONFIG_NF_CONNTRACK) || defined(CONFIG_NF_CONNTRACK_MODULE) | 284 | #if defined(CONFIG_NF_CONNTRACK) || defined(CONFIG_NF_CONNTRACK_MODULE) |
285 | struct nf_conntrack *nfct; | ||
295 | struct sk_buff *nfct_reasm; | 286 | struct sk_buff *nfct_reasm; |
296 | #endif | 287 | #endif |
297 | #ifdef CONFIG_BRIDGE_NETFILTER | 288 | #ifdef CONFIG_BRIDGE_NETFILTER |
298 | struct nf_bridge_info *nf_bridge; | 289 | struct nf_bridge_info *nf_bridge; |
299 | #endif | 290 | #endif |
300 | #endif /* CONFIG_NETFILTER */ | ||
301 | #ifdef CONFIG_NET_SCHED | 291 | #ifdef CONFIG_NET_SCHED |
302 | __u16 tc_index; /* traffic control index */ | 292 | __u16 tc_index; /* traffic control index */ |
303 | #ifdef CONFIG_NET_CLS_ACT | 293 | #ifdef CONFIG_NET_CLS_ACT |
@@ -313,13 +303,16 @@ struct sk_buff { | |||
313 | 303 | ||
314 | __u32 mark; | 304 | __u32 mark; |
315 | 305 | ||
306 | sk_buff_data_t transport_header; | ||
307 | sk_buff_data_t network_header; | ||
308 | sk_buff_data_t mac_header; | ||
316 | /* These elements must be at the end, see alloc_skb() for details. */ | 309 | /* These elements must be at the end, see alloc_skb() for details. */ |
310 | sk_buff_data_t tail; | ||
311 | sk_buff_data_t end; | ||
312 | unsigned char *head, | ||
313 | *data; | ||
317 | unsigned int truesize; | 314 | unsigned int truesize; |
318 | atomic_t users; | 315 | atomic_t users; |
319 | unsigned char *head, | ||
320 | *data, | ||
321 | *tail, | ||
322 | *end; | ||
323 | }; | 316 | }; |
324 | 317 | ||
325 | #ifdef __KERNEL__ | 318 | #ifdef __KERNEL__ |
@@ -346,9 +339,6 @@ static inline struct sk_buff *alloc_skb_fclone(unsigned int size, | |||
346 | return __alloc_skb(size, priority, 1, -1); | 339 | return __alloc_skb(size, priority, 1, -1); |
347 | } | 340 | } |
348 | 341 | ||
349 | extern struct sk_buff *alloc_skb_from_cache(struct kmem_cache *cp, | ||
350 | unsigned int size, | ||
351 | gfp_t priority); | ||
352 | extern void kfree_skbmem(struct sk_buff *skb); | 342 | extern void kfree_skbmem(struct sk_buff *skb); |
353 | extern struct sk_buff *skb_clone(struct sk_buff *skb, | 343 | extern struct sk_buff *skb_clone(struct sk_buff *skb, |
354 | gfp_t priority); | 344 | gfp_t priority); |
@@ -364,6 +354,11 @@ extern struct sk_buff *skb_realloc_headroom(struct sk_buff *skb, | |||
364 | extern struct sk_buff *skb_copy_expand(const struct sk_buff *skb, | 354 | extern struct sk_buff *skb_copy_expand(const struct sk_buff *skb, |
365 | int newheadroom, int newtailroom, | 355 | int newheadroom, int newtailroom, |
366 | gfp_t priority); | 356 | gfp_t priority); |
357 | extern int skb_to_sgvec(struct sk_buff *skb, | ||
358 | struct scatterlist *sg, int offset, | ||
359 | int len); | ||
360 | extern int skb_cow_data(struct sk_buff *skb, int tailbits, | ||
361 | struct sk_buff **trailer); | ||
367 | extern int skb_pad(struct sk_buff *skb, int pad); | 362 | extern int skb_pad(struct sk_buff *skb, int pad); |
368 | #define dev_kfree_skb(a) kfree_skb(a) | 363 | #define dev_kfree_skb(a) kfree_skb(a) |
369 | extern void skb_over_panic(struct sk_buff *skb, int len, | 364 | extern void skb_over_panic(struct sk_buff *skb, int len, |
@@ -405,8 +400,20 @@ extern unsigned int skb_find_text(struct sk_buff *skb, unsigned int from, | |||
405 | unsigned int to, struct ts_config *config, | 400 | unsigned int to, struct ts_config *config, |
406 | struct ts_state *state); | 401 | struct ts_state *state); |
407 | 402 | ||
403 | #ifdef NET_SKBUFF_DATA_USES_OFFSET | ||
404 | static inline unsigned char *skb_end_pointer(const struct sk_buff *skb) | ||
405 | { | ||
406 | return skb->head + skb->end; | ||
407 | } | ||
408 | #else | ||
409 | static inline unsigned char *skb_end_pointer(const struct sk_buff *skb) | ||
410 | { | ||
411 | return skb->end; | ||
412 | } | ||
413 | #endif | ||
414 | |||
408 | /* Internal */ | 415 | /* Internal */ |
409 | #define skb_shinfo(SKB) ((struct skb_shared_info *)((SKB)->end)) | 416 | #define skb_shinfo(SKB) ((struct skb_shared_info *)(skb_end_pointer(SKB))) |
410 | 417 | ||
411 | /** | 418 | /** |
412 | * skb_queue_empty - check if a queue is empty | 419 | * skb_queue_empty - check if a queue is empty |
@@ -622,6 +629,13 @@ static inline void skb_queue_head_init(struct sk_buff_head *list) | |||
622 | list->qlen = 0; | 629 | list->qlen = 0; |
623 | } | 630 | } |
624 | 631 | ||
632 | static inline void skb_queue_head_init_class(struct sk_buff_head *list, | ||
633 | struct lock_class_key *class) | ||
634 | { | ||
635 | skb_queue_head_init(list); | ||
636 | lockdep_set_class(&list->lock, class); | ||
637 | } | ||
638 | |||
625 | /* | 639 | /* |
626 | * Insert an sk_buff at the start of a list. | 640 | * Insert an sk_buff at the start of a list. |
627 | * | 641 | * |
@@ -818,12 +832,46 @@ static inline void skb_fill_page_desc(struct sk_buff *skb, int i, | |||
818 | #define SKB_FRAG_ASSERT(skb) BUG_ON(skb_shinfo(skb)->frag_list) | 832 | #define SKB_FRAG_ASSERT(skb) BUG_ON(skb_shinfo(skb)->frag_list) |
819 | #define SKB_LINEAR_ASSERT(skb) BUG_ON(skb_is_nonlinear(skb)) | 833 | #define SKB_LINEAR_ASSERT(skb) BUG_ON(skb_is_nonlinear(skb)) |
820 | 834 | ||
835 | #ifdef NET_SKBUFF_DATA_USES_OFFSET | ||
836 | static inline unsigned char *skb_tail_pointer(const struct sk_buff *skb) | ||
837 | { | ||
838 | return skb->head + skb->tail; | ||
839 | } | ||
840 | |||
841 | static inline void skb_reset_tail_pointer(struct sk_buff *skb) | ||
842 | { | ||
843 | skb->tail = skb->data - skb->head; | ||
844 | } | ||
845 | |||
846 | static inline void skb_set_tail_pointer(struct sk_buff *skb, const int offset) | ||
847 | { | ||
848 | skb_reset_tail_pointer(skb); | ||
849 | skb->tail += offset; | ||
850 | } | ||
851 | #else /* NET_SKBUFF_DATA_USES_OFFSET */ | ||
852 | static inline unsigned char *skb_tail_pointer(const struct sk_buff *skb) | ||
853 | { | ||
854 | return skb->tail; | ||
855 | } | ||
856 | |||
857 | static inline void skb_reset_tail_pointer(struct sk_buff *skb) | ||
858 | { | ||
859 | skb->tail = skb->data; | ||
860 | } | ||
861 | |||
862 | static inline void skb_set_tail_pointer(struct sk_buff *skb, const int offset) | ||
863 | { | ||
864 | skb->tail = skb->data + offset; | ||
865 | } | ||
866 | |||
867 | #endif /* NET_SKBUFF_DATA_USES_OFFSET */ | ||
868 | |||
821 | /* | 869 | /* |
822 | * Add data to an sk_buff | 870 | * Add data to an sk_buff |
823 | */ | 871 | */ |
824 | static inline unsigned char *__skb_put(struct sk_buff *skb, unsigned int len) | 872 | static inline unsigned char *__skb_put(struct sk_buff *skb, unsigned int len) |
825 | { | 873 | { |
826 | unsigned char *tmp = skb->tail; | 874 | unsigned char *tmp = skb_tail_pointer(skb); |
827 | SKB_LINEAR_ASSERT(skb); | 875 | SKB_LINEAR_ASSERT(skb); |
828 | skb->tail += len; | 876 | skb->tail += len; |
829 | skb->len += len; | 877 | skb->len += len; |
@@ -841,11 +889,11 @@ static inline unsigned char *__skb_put(struct sk_buff *skb, unsigned int len) | |||
841 | */ | 889 | */ |
842 | static inline unsigned char *skb_put(struct sk_buff *skb, unsigned int len) | 890 | static inline unsigned char *skb_put(struct sk_buff *skb, unsigned int len) |
843 | { | 891 | { |
844 | unsigned char *tmp = skb->tail; | 892 | unsigned char *tmp = skb_tail_pointer(skb); |
845 | SKB_LINEAR_ASSERT(skb); | 893 | SKB_LINEAR_ASSERT(skb); |
846 | skb->tail += len; | 894 | skb->tail += len; |
847 | skb->len += len; | 895 | skb->len += len; |
848 | if (unlikely(skb->tail>skb->end)) | 896 | if (unlikely(skb->tail > skb->end)) |
849 | skb_over_panic(skb, len, current_text_addr()); | 897 | skb_over_panic(skb, len, current_text_addr()); |
850 | return tmp; | 898 | return tmp; |
851 | } | 899 | } |
@@ -958,6 +1006,130 @@ static inline void skb_reserve(struct sk_buff *skb, int len) | |||
958 | skb->tail += len; | 1006 | skb->tail += len; |
959 | } | 1007 | } |
960 | 1008 | ||
1009 | #ifdef NET_SKBUFF_DATA_USES_OFFSET | ||
1010 | static inline unsigned char *skb_transport_header(const struct sk_buff *skb) | ||
1011 | { | ||
1012 | return skb->head + skb->transport_header; | ||
1013 | } | ||
1014 | |||
1015 | static inline void skb_reset_transport_header(struct sk_buff *skb) | ||
1016 | { | ||
1017 | skb->transport_header = skb->data - skb->head; | ||
1018 | } | ||
1019 | |||
1020 | static inline void skb_set_transport_header(struct sk_buff *skb, | ||
1021 | const int offset) | ||
1022 | { | ||
1023 | skb_reset_transport_header(skb); | ||
1024 | skb->transport_header += offset; | ||
1025 | } | ||
1026 | |||
1027 | static inline unsigned char *skb_network_header(const struct sk_buff *skb) | ||
1028 | { | ||
1029 | return skb->head + skb->network_header; | ||
1030 | } | ||
1031 | |||
1032 | static inline void skb_reset_network_header(struct sk_buff *skb) | ||
1033 | { | ||
1034 | skb->network_header = skb->data - skb->head; | ||
1035 | } | ||
1036 | |||
1037 | static inline void skb_set_network_header(struct sk_buff *skb, const int offset) | ||
1038 | { | ||
1039 | skb_reset_network_header(skb); | ||
1040 | skb->network_header += offset; | ||
1041 | } | ||
1042 | |||
1043 | static inline unsigned char *skb_mac_header(const struct sk_buff *skb) | ||
1044 | { | ||
1045 | return skb->head + skb->mac_header; | ||
1046 | } | ||
1047 | |||
1048 | static inline int skb_mac_header_was_set(const struct sk_buff *skb) | ||
1049 | { | ||
1050 | return skb->mac_header != ~0U; | ||
1051 | } | ||
1052 | |||
1053 | static inline void skb_reset_mac_header(struct sk_buff *skb) | ||
1054 | { | ||
1055 | skb->mac_header = skb->data - skb->head; | ||
1056 | } | ||
1057 | |||
1058 | static inline void skb_set_mac_header(struct sk_buff *skb, const int offset) | ||
1059 | { | ||
1060 | skb_reset_mac_header(skb); | ||
1061 | skb->mac_header += offset; | ||
1062 | } | ||
1063 | |||
1064 | #else /* NET_SKBUFF_DATA_USES_OFFSET */ | ||
1065 | |||
1066 | static inline unsigned char *skb_transport_header(const struct sk_buff *skb) | ||
1067 | { | ||
1068 | return skb->transport_header; | ||
1069 | } | ||
1070 | |||
1071 | static inline void skb_reset_transport_header(struct sk_buff *skb) | ||
1072 | { | ||
1073 | skb->transport_header = skb->data; | ||
1074 | } | ||
1075 | |||
1076 | static inline void skb_set_transport_header(struct sk_buff *skb, | ||
1077 | const int offset) | ||
1078 | { | ||
1079 | skb->transport_header = skb->data + offset; | ||
1080 | } | ||
1081 | |||
1082 | static inline unsigned char *skb_network_header(const struct sk_buff *skb) | ||
1083 | { | ||
1084 | return skb->network_header; | ||
1085 | } | ||
1086 | |||
1087 | static inline void skb_reset_network_header(struct sk_buff *skb) | ||
1088 | { | ||
1089 | skb->network_header = skb->data; | ||
1090 | } | ||
1091 | |||
1092 | static inline void skb_set_network_header(struct sk_buff *skb, const int offset) | ||
1093 | { | ||
1094 | skb->network_header = skb->data + offset; | ||
1095 | } | ||
1096 | |||
1097 | static inline unsigned char *skb_mac_header(const struct sk_buff *skb) | ||
1098 | { | ||
1099 | return skb->mac_header; | ||
1100 | } | ||
1101 | |||
1102 | static inline int skb_mac_header_was_set(const struct sk_buff *skb) | ||
1103 | { | ||
1104 | return skb->mac_header != NULL; | ||
1105 | } | ||
1106 | |||
1107 | static inline void skb_reset_mac_header(struct sk_buff *skb) | ||
1108 | { | ||
1109 | skb->mac_header = skb->data; | ||
1110 | } | ||
1111 | |||
1112 | static inline void skb_set_mac_header(struct sk_buff *skb, const int offset) | ||
1113 | { | ||
1114 | skb->mac_header = skb->data + offset; | ||
1115 | } | ||
1116 | #endif /* NET_SKBUFF_DATA_USES_OFFSET */ | ||
1117 | |||
1118 | static inline int skb_transport_offset(const struct sk_buff *skb) | ||
1119 | { | ||
1120 | return skb_transport_header(skb) - skb->data; | ||
1121 | } | ||
1122 | |||
1123 | static inline u32 skb_network_header_len(const struct sk_buff *skb) | ||
1124 | { | ||
1125 | return skb->transport_header - skb->network_header; | ||
1126 | } | ||
1127 | |||
1128 | static inline int skb_network_offset(const struct sk_buff *skb) | ||
1129 | { | ||
1130 | return skb_network_header(skb) - skb->data; | ||
1131 | } | ||
1132 | |||
961 | /* | 1133 | /* |
962 | * CPUs often take a performance hit when accessing unaligned memory | 1134 | * CPUs often take a performance hit when accessing unaligned memory |
963 | * locations. The actual performance hit varies, it can be small if the | 1135 | * locations. The actual performance hit varies, it can be small if the |
@@ -1009,8 +1181,8 @@ static inline void __skb_trim(struct sk_buff *skb, unsigned int len) | |||
1009 | WARN_ON(1); | 1181 | WARN_ON(1); |
1010 | return; | 1182 | return; |
1011 | } | 1183 | } |
1012 | skb->len = len; | 1184 | skb->len = len; |
1013 | skb->tail = skb->data + len; | 1185 | skb_set_tail_pointer(skb, len); |
1014 | } | 1186 | } |
1015 | 1187 | ||
1016 | /** | 1188 | /** |
@@ -1322,8 +1494,8 @@ extern __wsum skb_checksum(const struct sk_buff *skb, int offset, | |||
1322 | int len, __wsum csum); | 1494 | int len, __wsum csum); |
1323 | extern int skb_copy_bits(const struct sk_buff *skb, int offset, | 1495 | extern int skb_copy_bits(const struct sk_buff *skb, int offset, |
1324 | void *to, int len); | 1496 | void *to, int len); |
1325 | extern int skb_store_bits(const struct sk_buff *skb, int offset, | 1497 | extern int skb_store_bits(struct sk_buff *skb, int offset, |
1326 | void *from, int len); | 1498 | const void *from, int len); |
1327 | extern __wsum skb_copy_and_csum_bits(const struct sk_buff *skb, | 1499 | extern __wsum skb_copy_and_csum_bits(const struct sk_buff *skb, |
1328 | int offset, u8 *to, int len, | 1500 | int offset, u8 *to, int len, |
1329 | __wsum csum); | 1501 | __wsum csum); |
@@ -1347,8 +1519,36 @@ static inline void *skb_header_pointer(const struct sk_buff *skb, int offset, | |||
1347 | return buffer; | 1519 | return buffer; |
1348 | } | 1520 | } |
1349 | 1521 | ||
1522 | static inline void skb_copy_from_linear_data(const struct sk_buff *skb, | ||
1523 | void *to, | ||
1524 | const unsigned int len) | ||
1525 | { | ||
1526 | memcpy(to, skb->data, len); | ||
1527 | } | ||
1528 | |||
1529 | static inline void skb_copy_from_linear_data_offset(const struct sk_buff *skb, | ||
1530 | const int offset, void *to, | ||
1531 | const unsigned int len) | ||
1532 | { | ||
1533 | memcpy(to, skb->data + offset, len); | ||
1534 | } | ||
1535 | |||
1536 | static inline void skb_copy_to_linear_data(struct sk_buff *skb, | ||
1537 | const void *from, | ||
1538 | const unsigned int len) | ||
1539 | { | ||
1540 | memcpy(skb->data, from, len); | ||
1541 | } | ||
1542 | |||
1543 | static inline void skb_copy_to_linear_data_offset(struct sk_buff *skb, | ||
1544 | const int offset, | ||
1545 | const void *from, | ||
1546 | const unsigned int len) | ||
1547 | { | ||
1548 | memcpy(skb->data + offset, from, len); | ||
1549 | } | ||
1550 | |||
1350 | extern void skb_init(void); | 1551 | extern void skb_init(void); |
1351 | extern void skb_add_mtu(int mtu); | ||
1352 | 1552 | ||
1353 | /** | 1553 | /** |
1354 | * skb_get_timestamp - get timestamp from a skb | 1554 | * skb_get_timestamp - get timestamp from a skb |
@@ -1361,29 +1561,28 @@ extern void skb_add_mtu(int mtu); | |||
1361 | */ | 1561 | */ |
1362 | static inline void skb_get_timestamp(const struct sk_buff *skb, struct timeval *stamp) | 1562 | static inline void skb_get_timestamp(const struct sk_buff *skb, struct timeval *stamp) |
1363 | { | 1563 | { |
1364 | stamp->tv_sec = skb->tstamp.off_sec; | 1564 | *stamp = ktime_to_timeval(skb->tstamp); |
1365 | stamp->tv_usec = skb->tstamp.off_usec; | ||
1366 | } | 1565 | } |
1367 | 1566 | ||
1368 | /** | 1567 | static inline void __net_timestamp(struct sk_buff *skb) |
1369 | * skb_set_timestamp - set timestamp of a skb | 1568 | { |
1370 | * @skb: skb to set stamp of | 1569 | skb->tstamp = ktime_get_real(); |
1371 | * @stamp: pointer to struct timeval to get stamp from | 1570 | } |
1372 | * | 1571 | |
1373 | * Timestamps are stored in the skb as offsets to a base timestamp. | 1572 | static inline ktime_t net_timedelta(ktime_t t) |
1374 | * This function converts a struct timeval to an offset and stores | ||
1375 | * it in the skb. | ||
1376 | */ | ||
1377 | static inline void skb_set_timestamp(struct sk_buff *skb, const struct timeval *stamp) | ||
1378 | { | 1573 | { |
1379 | skb->tstamp.off_sec = stamp->tv_sec; | 1574 | return ktime_sub(ktime_get_real(), t); |
1380 | skb->tstamp.off_usec = stamp->tv_usec; | ||
1381 | } | 1575 | } |
1382 | 1576 | ||
1383 | extern void __net_timestamp(struct sk_buff *skb); | ||
1384 | 1577 | ||
1578 | extern __sum16 __skb_checksum_complete_head(struct sk_buff *skb, int len); | ||
1385 | extern __sum16 __skb_checksum_complete(struct sk_buff *skb); | 1579 | extern __sum16 __skb_checksum_complete(struct sk_buff *skb); |
1386 | 1580 | ||
1581 | static inline int skb_csum_unnecessary(const struct sk_buff *skb) | ||
1582 | { | ||
1583 | return skb->ip_summed & CHECKSUM_UNNECESSARY; | ||
1584 | } | ||
1585 | |||
1387 | /** | 1586 | /** |
1388 | * skb_checksum_complete - Calculate checksum of an entire packet | 1587 | * skb_checksum_complete - Calculate checksum of an entire packet |
1389 | * @skb: packet to process | 1588 | * @skb: packet to process |
@@ -1402,22 +1601,22 @@ extern __sum16 __skb_checksum_complete(struct sk_buff *skb); | |||
1402 | */ | 1601 | */ |
1403 | static inline unsigned int skb_checksum_complete(struct sk_buff *skb) | 1602 | static inline unsigned int skb_checksum_complete(struct sk_buff *skb) |
1404 | { | 1603 | { |
1405 | return skb->ip_summed != CHECKSUM_UNNECESSARY && | 1604 | return skb_csum_unnecessary(skb) ? |
1406 | __skb_checksum_complete(skb); | 1605 | 0 : __skb_checksum_complete(skb); |
1407 | } | 1606 | } |
1408 | 1607 | ||
1409 | #ifdef CONFIG_NETFILTER | 1608 | #if defined(CONFIG_NF_CONNTRACK) || defined(CONFIG_NF_CONNTRACK_MODULE) |
1609 | extern void nf_conntrack_destroy(struct nf_conntrack *nfct); | ||
1410 | static inline void nf_conntrack_put(struct nf_conntrack *nfct) | 1610 | static inline void nf_conntrack_put(struct nf_conntrack *nfct) |
1411 | { | 1611 | { |
1412 | if (nfct && atomic_dec_and_test(&nfct->use)) | 1612 | if (nfct && atomic_dec_and_test(&nfct->use)) |
1413 | nfct->destroy(nfct); | 1613 | nf_conntrack_destroy(nfct); |
1414 | } | 1614 | } |
1415 | static inline void nf_conntrack_get(struct nf_conntrack *nfct) | 1615 | static inline void nf_conntrack_get(struct nf_conntrack *nfct) |
1416 | { | 1616 | { |
1417 | if (nfct) | 1617 | if (nfct) |
1418 | atomic_inc(&nfct->use); | 1618 | atomic_inc(&nfct->use); |
1419 | } | 1619 | } |
1420 | #if defined(CONFIG_NF_CONNTRACK) || defined(CONFIG_NF_CONNTRACK_MODULE) | ||
1421 | static inline void nf_conntrack_get_reasm(struct sk_buff *skb) | 1620 | static inline void nf_conntrack_get_reasm(struct sk_buff *skb) |
1422 | { | 1621 | { |
1423 | if (skb) | 1622 | if (skb) |
@@ -1443,9 +1642,9 @@ static inline void nf_bridge_get(struct nf_bridge_info *nf_bridge) | |||
1443 | #endif /* CONFIG_BRIDGE_NETFILTER */ | 1642 | #endif /* CONFIG_BRIDGE_NETFILTER */ |
1444 | static inline void nf_reset(struct sk_buff *skb) | 1643 | static inline void nf_reset(struct sk_buff *skb) |
1445 | { | 1644 | { |
1645 | #if defined(CONFIG_NF_CONNTRACK) || defined(CONFIG_NF_CONNTRACK_MODULE) | ||
1446 | nf_conntrack_put(skb->nfct); | 1646 | nf_conntrack_put(skb->nfct); |
1447 | skb->nfct = NULL; | 1647 | skb->nfct = NULL; |
1448 | #if defined(CONFIG_NF_CONNTRACK) || defined(CONFIG_NF_CONNTRACK_MODULE) | ||
1449 | nf_conntrack_put_reasm(skb->nfct_reasm); | 1648 | nf_conntrack_put_reasm(skb->nfct_reasm); |
1450 | skb->nfct_reasm = NULL; | 1649 | skb->nfct_reasm = NULL; |
1451 | #endif | 1650 | #endif |
@@ -1455,9 +1654,33 @@ static inline void nf_reset(struct sk_buff *skb) | |||
1455 | #endif | 1654 | #endif |
1456 | } | 1655 | } |
1457 | 1656 | ||
1458 | #else /* CONFIG_NETFILTER */ | 1657 | /* Note: This doesn't put any conntrack and bridge info in dst. */ |
1459 | static inline void nf_reset(struct sk_buff *skb) {} | 1658 | static inline void __nf_copy(struct sk_buff *dst, const struct sk_buff *src) |
1460 | #endif /* CONFIG_NETFILTER */ | 1659 | { |
1660 | #if defined(CONFIG_NF_CONNTRACK) || defined(CONFIG_NF_CONNTRACK_MODULE) | ||
1661 | dst->nfct = src->nfct; | ||
1662 | nf_conntrack_get(src->nfct); | ||
1663 | dst->nfctinfo = src->nfctinfo; | ||
1664 | dst->nfct_reasm = src->nfct_reasm; | ||
1665 | nf_conntrack_get_reasm(src->nfct_reasm); | ||
1666 | #endif | ||
1667 | #ifdef CONFIG_BRIDGE_NETFILTER | ||
1668 | dst->nf_bridge = src->nf_bridge; | ||
1669 | nf_bridge_get(src->nf_bridge); | ||
1670 | #endif | ||
1671 | } | ||
1672 | |||
1673 | static inline void nf_copy(struct sk_buff *dst, const struct sk_buff *src) | ||
1674 | { | ||
1675 | #if defined(CONFIG_NF_CONNTRACK) || defined(CONFIG_NF_CONNTRACK_MODULE) | ||
1676 | nf_conntrack_put(dst->nfct); | ||
1677 | nf_conntrack_put_reasm(dst->nfct_reasm); | ||
1678 | #endif | ||
1679 | #ifdef CONFIG_BRIDGE_NETFILTER | ||
1680 | nf_bridge_put(dst->nf_bridge); | ||
1681 | #endif | ||
1682 | __nf_copy(dst, src); | ||
1683 | } | ||
1461 | 1684 | ||
1462 | #ifdef CONFIG_NETWORK_SECMARK | 1685 | #ifdef CONFIG_NETWORK_SECMARK |
1463 | static inline void skb_copy_secmark(struct sk_buff *to, const struct sk_buff *from) | 1686 | static inline void skb_copy_secmark(struct sk_buff *to, const struct sk_buff *from) |
@@ -1482,5 +1705,12 @@ static inline int skb_is_gso(const struct sk_buff *skb) | |||
1482 | return skb_shinfo(skb)->gso_size; | 1705 | return skb_shinfo(skb)->gso_size; |
1483 | } | 1706 | } |
1484 | 1707 | ||
1708 | static inline void skb_forward_csum(struct sk_buff *skb) | ||
1709 | { | ||
1710 | /* Unfortunately we don't support this one. Any brave souls? */ | ||
1711 | if (skb->ip_summed == CHECKSUM_COMPLETE) | ||
1712 | skb->ip_summed = CHECKSUM_NONE; | ||
1713 | } | ||
1714 | |||
1485 | #endif /* __KERNEL__ */ | 1715 | #endif /* __KERNEL__ */ |
1486 | #endif /* _LINUX_SKBUFF_H */ | 1716 | #endif /* _LINUX_SKBUFF_H */ |
diff --git a/include/linux/socket.h b/include/linux/socket.h index fcd35a210e7f..6e7c9483a6a6 100644 --- a/include/linux/socket.h +++ b/include/linux/socket.h | |||
@@ -188,7 +188,8 @@ struct ucred { | |||
188 | #define AF_TIPC 30 /* TIPC sockets */ | 188 | #define AF_TIPC 30 /* TIPC sockets */ |
189 | #define AF_BLUETOOTH 31 /* Bluetooth sockets */ | 189 | #define AF_BLUETOOTH 31 /* Bluetooth sockets */ |
190 | #define AF_IUCV 32 /* IUCV sockets */ | 190 | #define AF_IUCV 32 /* IUCV sockets */ |
191 | #define AF_MAX 33 /* For now.. */ | 191 | #define AF_RXRPC 33 /* RxRPC sockets */ |
192 | #define AF_MAX 34 /* For now.. */ | ||
192 | 193 | ||
193 | /* Protocol families, same as address families. */ | 194 | /* Protocol families, same as address families. */ |
194 | #define PF_UNSPEC AF_UNSPEC | 195 | #define PF_UNSPEC AF_UNSPEC |
@@ -222,6 +223,7 @@ struct ucred { | |||
222 | #define PF_TIPC AF_TIPC | 223 | #define PF_TIPC AF_TIPC |
223 | #define PF_BLUETOOTH AF_BLUETOOTH | 224 | #define PF_BLUETOOTH AF_BLUETOOTH |
224 | #define PF_IUCV AF_IUCV | 225 | #define PF_IUCV AF_IUCV |
226 | #define PF_RXRPC AF_RXRPC | ||
225 | #define PF_MAX AF_MAX | 227 | #define PF_MAX AF_MAX |
226 | 228 | ||
227 | /* Maximum queue length specifiable by listen. */ | 229 | /* Maximum queue length specifiable by listen. */ |
@@ -284,6 +286,7 @@ struct ucred { | |||
284 | #define SOL_DCCP 269 | 286 | #define SOL_DCCP 269 |
285 | #define SOL_NETLINK 270 | 287 | #define SOL_NETLINK 270 |
286 | #define SOL_TIPC 271 | 288 | #define SOL_TIPC 271 |
289 | #define SOL_RXRPC 272 | ||
287 | 290 | ||
288 | /* IPX options */ | 291 | /* IPX options */ |
289 | #define IPX_TYPE 1 | 292 | #define IPX_TYPE 1 |
diff --git a/include/linux/string.h b/include/linux/string.h index 4f69ef9e6eb5..7f2eb6a477f9 100644 --- a/include/linux/string.h +++ b/include/linux/string.h | |||
@@ -47,6 +47,12 @@ extern int strncmp(const char *,const char *,__kernel_size_t); | |||
47 | #ifndef __HAVE_ARCH_STRNICMP | 47 | #ifndef __HAVE_ARCH_STRNICMP |
48 | extern int strnicmp(const char *, const char *, __kernel_size_t); | 48 | extern int strnicmp(const char *, const char *, __kernel_size_t); |
49 | #endif | 49 | #endif |
50 | #ifndef __HAVE_ARCH_STRCASECMP | ||
51 | extern int strcasecmp(const char *s1, const char *s2); | ||
52 | #endif | ||
53 | #ifndef __HAVE_ARCH_STRNCASECMP | ||
54 | extern int strncasecmp(const char *s1, const char *s2, size_t n); | ||
55 | #endif | ||
50 | #ifndef __HAVE_ARCH_STRCHR | 56 | #ifndef __HAVE_ARCH_STRCHR |
51 | extern char * strchr(const char *,int); | 57 | extern char * strchr(const char *,int); |
52 | #endif | 58 | #endif |
diff --git a/include/linux/sysctl.h b/include/linux/sysctl.h index 2c5fb38d9392..47f1c53332ce 100644 --- a/include/linux/sysctl.h +++ b/include/linux/sysctl.h | |||
@@ -290,6 +290,7 @@ enum | |||
290 | NET_CORE_BUDGET=19, | 290 | NET_CORE_BUDGET=19, |
291 | NET_CORE_AEVENT_ETIME=20, | 291 | NET_CORE_AEVENT_ETIME=20, |
292 | NET_CORE_AEVENT_RSEQTH=21, | 292 | NET_CORE_AEVENT_RSEQTH=21, |
293 | NET_CORE_WARNINGS=22, | ||
293 | }; | 294 | }; |
294 | 295 | ||
295 | /* /proc/sys/net/ethernet */ | 296 | /* /proc/sys/net/ethernet */ |
@@ -438,6 +439,8 @@ enum | |||
438 | NET_CIPSOV4_RBM_STRICTVALID=121, | 439 | NET_CIPSOV4_RBM_STRICTVALID=121, |
439 | NET_TCP_AVAIL_CONG_CONTROL=122, | 440 | NET_TCP_AVAIL_CONG_CONTROL=122, |
440 | NET_TCP_ALLOWED_CONG_CONTROL=123, | 441 | NET_TCP_ALLOWED_CONG_CONTROL=123, |
442 | NET_TCP_MAX_SSTHRESH=124, | ||
443 | NET_TCP_FRTO_RESPONSE=125, | ||
441 | }; | 444 | }; |
442 | 445 | ||
443 | enum { | 446 | enum { |
@@ -580,6 +583,7 @@ enum { | |||
580 | NET_IPV6_RTR_PROBE_INTERVAL=21, | 583 | NET_IPV6_RTR_PROBE_INTERVAL=21, |
581 | NET_IPV6_ACCEPT_RA_RT_INFO_MAX_PLEN=22, | 584 | NET_IPV6_ACCEPT_RA_RT_INFO_MAX_PLEN=22, |
582 | NET_IPV6_PROXY_NDP=23, | 585 | NET_IPV6_PROXY_NDP=23, |
586 | NET_IPV6_ACCEPT_SOURCE_ROUTE=25, | ||
583 | __NET_IPV6_MAX | 587 | __NET_IPV6_MAX |
584 | }; | 588 | }; |
585 | 589 | ||
@@ -788,6 +792,7 @@ enum { | |||
788 | NET_BRIDGE_NF_CALL_IPTABLES = 2, | 792 | NET_BRIDGE_NF_CALL_IPTABLES = 2, |
789 | NET_BRIDGE_NF_CALL_IP6TABLES = 3, | 793 | NET_BRIDGE_NF_CALL_IP6TABLES = 3, |
790 | NET_BRIDGE_NF_FILTER_VLAN_TAGGED = 4, | 794 | NET_BRIDGE_NF_FILTER_VLAN_TAGGED = 4, |
795 | NET_BRIDGE_NF_FILTER_PPPOE_TAGGED = 5, | ||
791 | }; | 796 | }; |
792 | 797 | ||
793 | /* CTL_FS names: */ | 798 | /* CTL_FS names: */ |
diff --git a/include/linux/sysfs.h b/include/linux/sysfs.h index fea9a6b3fb7b..7d5d1ec95c2e 100644 --- a/include/linux/sysfs.h +++ b/include/linux/sysfs.h | |||
@@ -80,7 +80,7 @@ struct sysfs_ops { | |||
80 | #ifdef CONFIG_SYSFS | 80 | #ifdef CONFIG_SYSFS |
81 | 81 | ||
82 | extern int sysfs_schedule_callback(struct kobject *kobj, | 82 | extern int sysfs_schedule_callback(struct kobject *kobj, |
83 | void (*func)(void *), void *data); | 83 | void (*func)(void *), void *data, struct module *owner); |
84 | 84 | ||
85 | extern int __must_check | 85 | extern int __must_check |
86 | sysfs_create_dir(struct kobject *, struct dentry *); | 86 | sysfs_create_dir(struct kobject *, struct dentry *); |
@@ -137,7 +137,7 @@ extern int __must_check sysfs_init(void); | |||
137 | #else /* CONFIG_SYSFS */ | 137 | #else /* CONFIG_SYSFS */ |
138 | 138 | ||
139 | static inline int sysfs_schedule_callback(struct kobject *kobj, | 139 | static inline int sysfs_schedule_callback(struct kobject *kobj, |
140 | void (*func)(void *), void *data) | 140 | void (*func)(void *), void *data, struct module *owner) |
141 | { | 141 | { |
142 | return -ENOSYS; | 142 | return -ENOSYS; |
143 | } | 143 | } |
diff --git a/include/linux/taskstats.h b/include/linux/taskstats.h index 3fced4798255..a46104a28f66 100644 --- a/include/linux/taskstats.h +++ b/include/linux/taskstats.h | |||
@@ -31,7 +31,7 @@ | |||
31 | */ | 31 | */ |
32 | 32 | ||
33 | 33 | ||
34 | #define TASKSTATS_VERSION 3 | 34 | #define TASKSTATS_VERSION 4 |
35 | #define TS_COMM_LEN 32 /* should be >= TASK_COMM_LEN | 35 | #define TS_COMM_LEN 32 /* should be >= TASK_COMM_LEN |
36 | * in linux/sched.h */ | 36 | * in linux/sched.h */ |
37 | 37 | ||
@@ -66,7 +66,7 @@ struct taskstats { | |||
66 | /* Delay waiting for cpu, while runnable | 66 | /* Delay waiting for cpu, while runnable |
67 | * count, delay_total NOT updated atomically | 67 | * count, delay_total NOT updated atomically |
68 | */ | 68 | */ |
69 | __u64 cpu_count; | 69 | __u64 cpu_count __attribute__((aligned(8))); |
70 | __u64 cpu_delay_total; | 70 | __u64 cpu_delay_total; |
71 | 71 | ||
72 | /* Following four fields atomically updated using task->delays->lock */ | 72 | /* Following four fields atomically updated using task->delays->lock */ |
@@ -101,14 +101,17 @@ struct taskstats { | |||
101 | 101 | ||
102 | /* Basic Accounting Fields start */ | 102 | /* Basic Accounting Fields start */ |
103 | char ac_comm[TS_COMM_LEN]; /* Command name */ | 103 | char ac_comm[TS_COMM_LEN]; /* Command name */ |
104 | __u8 ac_sched; /* Scheduling discipline */ | 104 | __u8 ac_sched __attribute__((aligned(8))); |
105 | /* Scheduling discipline */ | ||
105 | __u8 ac_pad[3]; | 106 | __u8 ac_pad[3]; |
106 | __u32 ac_uid; /* User ID */ | 107 | __u32 ac_uid __attribute__((aligned(8))); |
108 | /* User ID */ | ||
107 | __u32 ac_gid; /* Group ID */ | 109 | __u32 ac_gid; /* Group ID */ |
108 | __u32 ac_pid; /* Process ID */ | 110 | __u32 ac_pid; /* Process ID */ |
109 | __u32 ac_ppid; /* Parent process ID */ | 111 | __u32 ac_ppid; /* Parent process ID */ |
110 | __u32 ac_btime; /* Begin time [sec since 1970] */ | 112 | __u32 ac_btime; /* Begin time [sec since 1970] */ |
111 | __u64 ac_etime; /* Elapsed time [usec] */ | 113 | __u64 ac_etime __attribute__((aligned(8))); |
114 | /* Elapsed time [usec] */ | ||
112 | __u64 ac_utime; /* User CPU time [usec] */ | 115 | __u64 ac_utime; /* User CPU time [usec] */ |
113 | __u64 ac_stime; /* SYstem CPU time [usec] */ | 116 | __u64 ac_stime; /* SYstem CPU time [usec] */ |
114 | __u64 ac_minflt; /* Minor Page Fault Count */ | 117 | __u64 ac_minflt; /* Minor Page Fault Count */ |
diff --git a/include/linux/tcp.h b/include/linux/tcp.h index 29d3089038ab..c6b9f92e8289 100644 --- a/include/linux/tcp.h +++ b/include/linux/tcp.h | |||
@@ -178,6 +178,21 @@ struct tcp_md5sig { | |||
178 | #include <net/inet_connection_sock.h> | 178 | #include <net/inet_connection_sock.h> |
179 | #include <net/inet_timewait_sock.h> | 179 | #include <net/inet_timewait_sock.h> |
180 | 180 | ||
181 | static inline struct tcphdr *tcp_hdr(const struct sk_buff *skb) | ||
182 | { | ||
183 | return (struct tcphdr *)skb_transport_header(skb); | ||
184 | } | ||
185 | |||
186 | static inline unsigned int tcp_hdrlen(const struct sk_buff *skb) | ||
187 | { | ||
188 | return tcp_hdr(skb)->doff * 4; | ||
189 | } | ||
190 | |||
191 | static inline unsigned int tcp_optlen(const struct sk_buff *skb) | ||
192 | { | ||
193 | return (tcp_hdr(skb)->doff - 5) * 4; | ||
194 | } | ||
195 | |||
181 | /* This defines a selective acknowledgement block. */ | 196 | /* This defines a selective acknowledgement block. */ |
182 | struct tcp_sack_block_wire { | 197 | struct tcp_sack_block_wire { |
183 | __be32 start_seq; | 198 | __be32 start_seq; |
@@ -242,6 +257,8 @@ struct tcp_sock { | |||
242 | * See RFC793 and RFC1122. The RFC writes these in capitals. | 257 | * See RFC793 and RFC1122. The RFC writes these in capitals. |
243 | */ | 258 | */ |
244 | u32 rcv_nxt; /* What we want to receive next */ | 259 | u32 rcv_nxt; /* What we want to receive next */ |
260 | u32 copied_seq; /* Head of yet unread data */ | ||
261 | u32 rcv_wup; /* rcv_nxt on last window update sent */ | ||
245 | u32 snd_nxt; /* Next sequence we send */ | 262 | u32 snd_nxt; /* Next sequence we send */ |
246 | 263 | ||
247 | u32 snd_una; /* First byte we want an ack for */ | 264 | u32 snd_una; /* First byte we want an ack for */ |
@@ -300,17 +317,15 @@ struct tcp_sock { | |||
300 | u32 snd_ssthresh; /* Slow start size threshold */ | 317 | u32 snd_ssthresh; /* Slow start size threshold */ |
301 | u32 snd_cwnd; /* Sending congestion window */ | 318 | u32 snd_cwnd; /* Sending congestion window */ |
302 | u16 snd_cwnd_cnt; /* Linear increase counter */ | 319 | u16 snd_cwnd_cnt; /* Linear increase counter */ |
303 | u16 snd_cwnd_clamp; /* Do not allow snd_cwnd to grow above this */ | 320 | u32 snd_cwnd_clamp; /* Do not allow snd_cwnd to grow above this */ |
304 | u32 snd_cwnd_used; | 321 | u32 snd_cwnd_used; |
305 | u32 snd_cwnd_stamp; | 322 | u32 snd_cwnd_stamp; |
306 | 323 | ||
307 | struct sk_buff_head out_of_order_queue; /* Out of order segments go here */ | 324 | struct sk_buff_head out_of_order_queue; /* Out of order segments go here */ |
308 | 325 | ||
309 | u32 rcv_wnd; /* Current receiver window */ | 326 | u32 rcv_wnd; /* Current receiver window */ |
310 | u32 rcv_wup; /* rcv_nxt on last window update sent */ | ||
311 | u32 write_seq; /* Tail(+1) of data held in tcp send buffer */ | 327 | u32 write_seq; /* Tail(+1) of data held in tcp send buffer */ |
312 | u32 pushed_seq; /* Last pushed seq, required to talk to windows */ | 328 | u32 pushed_seq; /* Last pushed seq, required to talk to windows */ |
313 | u32 copied_seq; /* Head of yet unread data */ | ||
314 | 329 | ||
315 | /* SACKs data */ | 330 | /* SACKs data */ |
316 | struct tcp_sack_block duplicate_sack[1]; /* D-SACK block */ | 331 | struct tcp_sack_block duplicate_sack[1]; /* D-SACK block */ |
diff --git a/include/linux/udp.h b/include/linux/udp.h index 7e08c07efe0f..6de445c31a64 100644 --- a/include/linux/udp.h +++ b/include/linux/udp.h | |||
@@ -26,6 +26,15 @@ struct udphdr { | |||
26 | __sum16 check; | 26 | __sum16 check; |
27 | }; | 27 | }; |
28 | 28 | ||
29 | #ifdef __KERNEL__ | ||
30 | #include <linux/skbuff.h> | ||
31 | |||
32 | static inline struct udphdr *udp_hdr(const struct sk_buff *skb) | ||
33 | { | ||
34 | return (struct udphdr *)skb_transport_header(skb); | ||
35 | } | ||
36 | #endif | ||
37 | |||
29 | /* UDP socket options */ | 38 | /* UDP socket options */ |
30 | #define UDP_CORK 1 /* Never send partially complete segments */ | 39 | #define UDP_CORK 1 /* Never send partially complete segments */ |
31 | #define UDP_ENCAP 100 /* Set the socket to accept encapsulated packets */ | 40 | #define UDP_ENCAP 100 /* Set the socket to accept encapsulated packets */ |
diff --git a/include/linux/usb.h b/include/linux/usb.h index 87dc75a6cee1..cfbd2bb8fa2c 100644 --- a/include/linux/usb.h +++ b/include/linux/usb.h | |||
@@ -299,8 +299,9 @@ struct usb_bus { | |||
299 | int bandwidth_int_reqs; /* number of Interrupt requests */ | 299 | int bandwidth_int_reqs; /* number of Interrupt requests */ |
300 | int bandwidth_isoc_reqs; /* number of Isoc. requests */ | 300 | int bandwidth_isoc_reqs; /* number of Isoc. requests */ |
301 | 301 | ||
302 | #ifdef CONFIG_USB_DEVICEFS | ||
302 | struct dentry *usbfs_dentry; /* usbfs dentry entry for the bus */ | 303 | struct dentry *usbfs_dentry; /* usbfs dentry entry for the bus */ |
303 | 304 | #endif | |
304 | struct class_device *class_dev; /* class device for this bus */ | 305 | struct class_device *class_dev; /* class device for this bus */ |
305 | 306 | ||
306 | #if defined(CONFIG_USB_MON) | 307 | #if defined(CONFIG_USB_MON) |
@@ -373,9 +374,12 @@ struct usb_device { | |||
373 | char *serial; /* iSerialNumber string, if present */ | 374 | char *serial; /* iSerialNumber string, if present */ |
374 | 375 | ||
375 | struct list_head filelist; | 376 | struct list_head filelist; |
376 | struct device *usbfs_dev; | 377 | #ifdef CONFIG_USB_DEVICE_CLASS |
378 | struct device *usb_classdev; | ||
379 | #endif | ||
380 | #ifdef CONFIG_USB_DEVICEFS | ||
377 | struct dentry *usbfs_dentry; /* usbfs dentry entry for the device */ | 381 | struct dentry *usbfs_dentry; /* usbfs dentry entry for the device */ |
378 | 382 | #endif | |
379 | /* | 383 | /* |
380 | * Child devices - these can be either new devices | 384 | * Child devices - these can be either new devices |
381 | * (if this is a hub device), or different instances | 385 | * (if this is a hub device), or different instances |
@@ -394,10 +398,13 @@ struct usb_device { | |||
394 | struct delayed_work autosuspend; /* for delayed autosuspends */ | 398 | struct delayed_work autosuspend; /* for delayed autosuspends */ |
395 | struct mutex pm_mutex; /* protects PM operations */ | 399 | struct mutex pm_mutex; /* protects PM operations */ |
396 | 400 | ||
397 | unsigned autosuspend_delay; /* in jiffies */ | 401 | unsigned long last_busy; /* time of last use */ |
402 | int autosuspend_delay; /* in jiffies */ | ||
398 | 403 | ||
399 | unsigned auto_pm:1; /* autosuspend/resume in progress */ | 404 | unsigned auto_pm:1; /* autosuspend/resume in progress */ |
400 | unsigned do_remote_wakeup:1; /* remote wakeup should be enabled */ | 405 | unsigned do_remote_wakeup:1; /* remote wakeup should be enabled */ |
406 | unsigned autosuspend_disabled:1; /* autosuspend and autoresume */ | ||
407 | unsigned autoresume_disabled:1; /* disabled by the user */ | ||
401 | #endif | 408 | #endif |
402 | }; | 409 | }; |
403 | #define to_usb_device(d) container_of(d, struct usb_device, dev) | 410 | #define to_usb_device(d) container_of(d, struct usb_device, dev) |
@@ -437,6 +444,11 @@ static inline void usb_autopm_disable(struct usb_interface *intf) | |||
437 | usb_autopm_set_interface(intf); | 444 | usb_autopm_set_interface(intf); |
438 | } | 445 | } |
439 | 446 | ||
447 | static inline void usb_mark_last_busy(struct usb_device *udev) | ||
448 | { | ||
449 | udev->last_busy = jiffies; | ||
450 | } | ||
451 | |||
440 | #else | 452 | #else |
441 | 453 | ||
442 | static inline int usb_autopm_set_interface(struct usb_interface *intf) | 454 | static inline int usb_autopm_set_interface(struct usb_interface *intf) |
@@ -451,6 +463,8 @@ static inline void usb_autopm_enable(struct usb_interface *intf) | |||
451 | { } | 463 | { } |
452 | static inline void usb_autopm_disable(struct usb_interface *intf) | 464 | static inline void usb_autopm_disable(struct usb_interface *intf) |
453 | { } | 465 | { } |
466 | static inline void usb_mark_last_busy(struct usb_device *udev) | ||
467 | { } | ||
454 | #endif | 468 | #endif |
455 | 469 | ||
456 | /*-------------------------------------------------------------------------*/ | 470 | /*-------------------------------------------------------------------------*/ |
diff --git a/include/linux/usb/cdc.h b/include/linux/usb/cdc.h index 956edf3bbecb..2204ae22c381 100644 --- a/include/linux/usb/cdc.h +++ b/include/linux/usb/cdc.h | |||
@@ -91,6 +91,17 @@ struct usb_cdc_union_desc { | |||
91 | /* ... and there could be other slave interfaces */ | 91 | /* ... and there could be other slave interfaces */ |
92 | } __attribute__ ((packed)); | 92 | } __attribute__ ((packed)); |
93 | 93 | ||
94 | /* "Country Selection Functional Descriptor" from CDC spec 5.2.3.9 */ | ||
95 | struct usb_cdc_country_functional_desc { | ||
96 | __u8 bLength; | ||
97 | __u8 bDescriptorType; | ||
98 | __u8 bDescriptorSubType; | ||
99 | |||
100 | __u8 iCountryCodeRelDate; | ||
101 | __le16 wCountyCode0; | ||
102 | /* ... and there can be a lot of country codes */ | ||
103 | } __attribute__ ((packed)); | ||
104 | |||
94 | /* "Network Channel Terminal Functional Descriptor" from CDC spec 5.2.3.11 */ | 105 | /* "Network Channel Terminal Functional Descriptor" from CDC spec 5.2.3.11 */ |
95 | struct usb_cdc_network_terminal_desc { | 106 | struct usb_cdc_network_terminal_desc { |
96 | __u8 bLength; | 107 | __u8 bLength; |
diff --git a/include/linux/usb/ch9.h b/include/linux/usb/ch9.h index 1122a6c2c1a3..6169438ec5a2 100644 --- a/include/linux/usb/ch9.h +++ b/include/linux/usb/ch9.h | |||
@@ -181,12 +181,15 @@ struct usb_ctrlrequest { | |||
181 | #define USB_DT_WIRE_ADAPTER 0x21 | 181 | #define USB_DT_WIRE_ADAPTER 0x21 |
182 | #define USB_DT_RPIPE 0x22 | 182 | #define USB_DT_RPIPE 0x22 |
183 | 183 | ||
184 | /* conventional codes for class-specific descriptors */ | 184 | /* Conventional codes for class-specific descriptors. The convention is |
185 | #define USB_DT_CS_DEVICE 0x21 | 185 | * defined in the USB "Common Class" Spec (3.11). Individual class specs |
186 | #define USB_DT_CS_CONFIG 0x22 | 186 | * are authoritative for their usage, not the "common class" writeup. |
187 | #define USB_DT_CS_STRING 0x23 | 187 | */ |
188 | #define USB_DT_CS_INTERFACE 0x24 | 188 | #define USB_DT_CS_DEVICE (USB_TYPE_CLASS | USB_DT_DEVICE) |
189 | #define USB_DT_CS_ENDPOINT 0x25 | 189 | #define USB_DT_CS_CONFIG (USB_TYPE_CLASS | USB_DT_CONFIG) |
190 | #define USB_DT_CS_STRING (USB_TYPE_CLASS | USB_DT_STRING) | ||
191 | #define USB_DT_CS_INTERFACE (USB_TYPE_CLASS | USB_DT_INTERFACE) | ||
192 | #define USB_DT_CS_ENDPOINT (USB_TYPE_CLASS | USB_DT_ENDPOINT) | ||
190 | 193 | ||
191 | /* All standard descriptors have these 2 fields at the beginning */ | 194 | /* All standard descriptors have these 2 fields at the beginning */ |
192 | struct usb_descriptor_header { | 195 | struct usb_descriptor_header { |
diff --git a/include/linux/videodev2.h b/include/linux/videodev2.h index 441b877bf150..a25c2afa67e1 100644 --- a/include/linux/videodev2.h +++ b/include/linux/videodev2.h | |||
@@ -96,44 +96,60 @@ | |||
96 | * E N U M S | 96 | * E N U M S |
97 | */ | 97 | */ |
98 | enum v4l2_field { | 98 | enum v4l2_field { |
99 | V4L2_FIELD_ANY = 0, /* driver can choose from none, | 99 | V4L2_FIELD_ANY = 0, /* driver can choose from none, |
100 | top, bottom, interlaced | 100 | top, bottom, interlaced |
101 | depending on whatever it thinks | 101 | depending on whatever it thinks |
102 | is approximate ... */ | 102 | is approximate ... */ |
103 | V4L2_FIELD_NONE = 1, /* this device has no fields ... */ | 103 | V4L2_FIELD_NONE = 1, /* this device has no fields ... */ |
104 | V4L2_FIELD_TOP = 2, /* top field only */ | 104 | V4L2_FIELD_TOP = 2, /* top field only */ |
105 | V4L2_FIELD_BOTTOM = 3, /* bottom field only */ | 105 | V4L2_FIELD_BOTTOM = 3, /* bottom field only */ |
106 | V4L2_FIELD_INTERLACED = 4, /* both fields interlaced */ | 106 | V4L2_FIELD_INTERLACED = 4, /* both fields interlaced */ |
107 | V4L2_FIELD_SEQ_TB = 5, /* both fields sequential into one | 107 | V4L2_FIELD_SEQ_TB = 5, /* both fields sequential into one |
108 | buffer, top-bottom order */ | 108 | buffer, top-bottom order */ |
109 | V4L2_FIELD_SEQ_BT = 6, /* same as above + bottom-top order */ | 109 | V4L2_FIELD_SEQ_BT = 6, /* same as above + bottom-top order */ |
110 | V4L2_FIELD_ALTERNATE = 7, /* both fields alternating into | 110 | V4L2_FIELD_ALTERNATE = 7, /* both fields alternating into |
111 | separate buffers */ | 111 | separate buffers */ |
112 | V4L2_FIELD_INTERLACED_TB = 8, /* both fields interlaced, top field | ||
113 | first and the top field is | ||
114 | transmitted first */ | ||
115 | V4L2_FIELD_INTERLACED_BT = 9, /* both fields interlaced, top field | ||
116 | first and the bottom field is | ||
117 | transmitted first */ | ||
112 | }; | 118 | }; |
113 | #define V4L2_FIELD_HAS_TOP(field) \ | 119 | #define V4L2_FIELD_HAS_TOP(field) \ |
114 | ((field) == V4L2_FIELD_TOP ||\ | 120 | ((field) == V4L2_FIELD_TOP ||\ |
115 | (field) == V4L2_FIELD_INTERLACED ||\ | 121 | (field) == V4L2_FIELD_INTERLACED ||\ |
122 | (field) == V4L2_FIELD_INTERLACED_TB ||\ | ||
123 | (field) == V4L2_FIELD_INTERLACED_BT ||\ | ||
116 | (field) == V4L2_FIELD_SEQ_TB ||\ | 124 | (field) == V4L2_FIELD_SEQ_TB ||\ |
117 | (field) == V4L2_FIELD_SEQ_BT) | 125 | (field) == V4L2_FIELD_SEQ_BT) |
118 | #define V4L2_FIELD_HAS_BOTTOM(field) \ | 126 | #define V4L2_FIELD_HAS_BOTTOM(field) \ |
119 | ((field) == V4L2_FIELD_BOTTOM ||\ | 127 | ((field) == V4L2_FIELD_BOTTOM ||\ |
120 | (field) == V4L2_FIELD_INTERLACED ||\ | 128 | (field) == V4L2_FIELD_INTERLACED ||\ |
129 | (field) == V4L2_FIELD_INTERLACED_TB ||\ | ||
130 | (field) == V4L2_FIELD_INTERLACED_BT ||\ | ||
121 | (field) == V4L2_FIELD_SEQ_TB ||\ | 131 | (field) == V4L2_FIELD_SEQ_TB ||\ |
122 | (field) == V4L2_FIELD_SEQ_BT) | 132 | (field) == V4L2_FIELD_SEQ_BT) |
123 | #define V4L2_FIELD_HAS_BOTH(field) \ | 133 | #define V4L2_FIELD_HAS_BOTH(field) \ |
124 | ((field) == V4L2_FIELD_INTERLACED ||\ | 134 | ((field) == V4L2_FIELD_INTERLACED ||\ |
125 | (field) == V4L2_FIELD_SEQ_TB ||\ | 135 | (field) == V4L2_FIELD_INTERLACED_TB ||\ |
136 | (field) == V4L2_FIELD_INTERLACED_BT ||\ | ||
137 | (field) == V4L2_FIELD_SEQ_TB ||\ | ||
126 | (field) == V4L2_FIELD_SEQ_BT) | 138 | (field) == V4L2_FIELD_SEQ_BT) |
127 | 139 | ||
128 | enum v4l2_buf_type { | 140 | enum v4l2_buf_type { |
129 | V4L2_BUF_TYPE_VIDEO_CAPTURE = 1, | 141 | V4L2_BUF_TYPE_VIDEO_CAPTURE = 1, |
130 | V4L2_BUF_TYPE_VIDEO_OUTPUT = 2, | 142 | V4L2_BUF_TYPE_VIDEO_OUTPUT = 2, |
131 | V4L2_BUF_TYPE_VIDEO_OVERLAY = 3, | 143 | V4L2_BUF_TYPE_VIDEO_OVERLAY = 3, |
132 | V4L2_BUF_TYPE_VBI_CAPTURE = 4, | 144 | V4L2_BUF_TYPE_VBI_CAPTURE = 4, |
133 | V4L2_BUF_TYPE_VBI_OUTPUT = 5, | 145 | V4L2_BUF_TYPE_VBI_OUTPUT = 5, |
134 | V4L2_BUF_TYPE_SLICED_VBI_CAPTURE = 6, | 146 | V4L2_BUF_TYPE_SLICED_VBI_CAPTURE = 6, |
135 | V4L2_BUF_TYPE_SLICED_VBI_OUTPUT = 7, | 147 | V4L2_BUF_TYPE_SLICED_VBI_OUTPUT = 7, |
136 | V4L2_BUF_TYPE_PRIVATE = 0x80, | 148 | #if 1 |
149 | /* Experimental */ | ||
150 | V4L2_BUF_TYPE_VIDEO_OUTPUT_OVERLAY = 8, | ||
151 | #endif | ||
152 | V4L2_BUF_TYPE_PRIVATE = 0x80, | ||
137 | }; | 153 | }; |
138 | 154 | ||
139 | enum v4l2_ctrl_type { | 155 | enum v4l2_ctrl_type { |
@@ -227,6 +243,8 @@ struct v4l2_capability | |||
227 | #define V4L2_CAP_SLICED_VBI_CAPTURE 0x00000040 /* Is a sliced VBI capture device */ | 243 | #define V4L2_CAP_SLICED_VBI_CAPTURE 0x00000040 /* Is a sliced VBI capture device */ |
228 | #define V4L2_CAP_SLICED_VBI_OUTPUT 0x00000080 /* Is a sliced VBI output device */ | 244 | #define V4L2_CAP_SLICED_VBI_OUTPUT 0x00000080 /* Is a sliced VBI output device */ |
229 | #define V4L2_CAP_RDS_CAPTURE 0x00000100 /* RDS data capture */ | 245 | #define V4L2_CAP_RDS_CAPTURE 0x00000100 /* RDS data capture */ |
246 | #define V4L2_CAP_VIDEO_OUTPUT_POS 0x00000200 /* Video output can have x,y coords */ | ||
247 | #define V4L2_CAP_VIDEO_OUTPUT_OVERLAY 0x00000400 /* Can do video output overlay */ | ||
230 | 248 | ||
231 | #define V4L2_CAP_TUNER 0x00010000 /* has a tuner */ | 249 | #define V4L2_CAP_TUNER 0x00010000 /* has a tuner */ |
232 | #define V4L2_CAP_AUDIO 0x00020000 /* has audio support */ | 250 | #define V4L2_CAP_AUDIO 0x00020000 /* has audio support */ |
@@ -249,6 +267,8 @@ struct v4l2_pix_format | |||
249 | __u32 sizeimage; | 267 | __u32 sizeimage; |
250 | enum v4l2_colorspace colorspace; | 268 | enum v4l2_colorspace colorspace; |
251 | __u32 priv; /* private data, depends on pixelformat */ | 269 | __u32 priv; /* private data, depends on pixelformat */ |
270 | __u32 left; /* only valid if V4L2_CAP_VIDEO_OUTPUT_POS is set */ | ||
271 | __u32 top; /* only valid if V4L2_CAP_VIDEO_OUTPUT_POS is set */ | ||
252 | }; | 272 | }; |
253 | 273 | ||
254 | /* Pixel format FOURCC depth Description */ | 274 | /* Pixel format FOURCC depth Description */ |
@@ -596,10 +616,14 @@ struct v4l2_framebuffer | |||
596 | #define V4L2_FBUF_CAP_CHROMAKEY 0x0002 | 616 | #define V4L2_FBUF_CAP_CHROMAKEY 0x0002 |
597 | #define V4L2_FBUF_CAP_LIST_CLIPPING 0x0004 | 617 | #define V4L2_FBUF_CAP_LIST_CLIPPING 0x0004 |
598 | #define V4L2_FBUF_CAP_BITMAP_CLIPPING 0x0008 | 618 | #define V4L2_FBUF_CAP_BITMAP_CLIPPING 0x0008 |
619 | #define V4L2_FBUF_CAP_LOCAL_ALPHA 0x0010 | ||
620 | #define V4L2_FBUF_CAP_GLOBAL_ALPHA 0x0020 | ||
599 | /* Flags for the 'flags' field. */ | 621 | /* Flags for the 'flags' field. */ |
600 | #define V4L2_FBUF_FLAG_PRIMARY 0x0001 | 622 | #define V4L2_FBUF_FLAG_PRIMARY 0x0001 |
601 | #define V4L2_FBUF_FLAG_OVERLAY 0x0002 | 623 | #define V4L2_FBUF_FLAG_OVERLAY 0x0002 |
602 | #define V4L2_FBUF_FLAG_CHROMAKEY 0x0004 | 624 | #define V4L2_FBUF_FLAG_CHROMAKEY 0x0004 |
625 | #define V4L2_FBUF_FLAG_LOCAL_ALPHA 0x0008 | ||
626 | #define V4L2_FBUF_FLAG_GLOBAL_ALPHA 0x0010 | ||
603 | 627 | ||
604 | struct v4l2_clip | 628 | struct v4l2_clip |
605 | { | 629 | { |
@@ -615,6 +639,7 @@ struct v4l2_window | |||
615 | struct v4l2_clip __user *clips; | 639 | struct v4l2_clip __user *clips; |
616 | __u32 clipcount; | 640 | __u32 clipcount; |
617 | void __user *bitmap; | 641 | void __user *bitmap; |
642 | __u8 global_alpha; | ||
618 | }; | 643 | }; |
619 | 644 | ||
620 | /* | 645 | /* |
@@ -1037,6 +1062,7 @@ enum v4l2_mpeg_audio_crc { | |||
1037 | V4L2_MPEG_AUDIO_CRC_NONE = 0, | 1062 | V4L2_MPEG_AUDIO_CRC_NONE = 0, |
1038 | V4L2_MPEG_AUDIO_CRC_CRC16 = 1, | 1063 | V4L2_MPEG_AUDIO_CRC_CRC16 = 1, |
1039 | }; | 1064 | }; |
1065 | #define V4L2_CID_MPEG_AUDIO_MUTE (V4L2_CID_MPEG_BASE+109) | ||
1040 | 1066 | ||
1041 | /* MPEG video */ | 1067 | /* MPEG video */ |
1042 | #define V4L2_CID_MPEG_VIDEO_ENCODING (V4L2_CID_MPEG_BASE+200) | 1068 | #define V4L2_CID_MPEG_VIDEO_ENCODING (V4L2_CID_MPEG_BASE+200) |
@@ -1063,6 +1089,8 @@ enum v4l2_mpeg_video_bitrate_mode { | |||
1063 | #define V4L2_CID_MPEG_VIDEO_BITRATE (V4L2_CID_MPEG_BASE+207) | 1089 | #define V4L2_CID_MPEG_VIDEO_BITRATE (V4L2_CID_MPEG_BASE+207) |
1064 | #define V4L2_CID_MPEG_VIDEO_BITRATE_PEAK (V4L2_CID_MPEG_BASE+208) | 1090 | #define V4L2_CID_MPEG_VIDEO_BITRATE_PEAK (V4L2_CID_MPEG_BASE+208) |
1065 | #define V4L2_CID_MPEG_VIDEO_TEMPORAL_DECIMATION (V4L2_CID_MPEG_BASE+209) | 1091 | #define V4L2_CID_MPEG_VIDEO_TEMPORAL_DECIMATION (V4L2_CID_MPEG_BASE+209) |
1092 | #define V4L2_CID_MPEG_VIDEO_MUTE (V4L2_CID_MPEG_BASE+210) | ||
1093 | #define V4L2_CID_MPEG_VIDEO_MUTE_YUV (V4L2_CID_MPEG_BASE+211) | ||
1066 | 1094 | ||
1067 | /* MPEG-class control IDs specific to the CX2584x driver as defined by V4L2 */ | 1095 | /* MPEG-class control IDs specific to the CX2584x driver as defined by V4L2 */ |
1068 | #define V4L2_CID_MPEG_CX2341X_BASE (V4L2_CTRL_CLASS_MPEG | 0x1000) | 1096 | #define V4L2_CID_MPEG_CX2341X_BASE (V4L2_CTRL_CLASS_MPEG | 0x1000) |
@@ -1103,6 +1131,7 @@ enum v4l2_mpeg_cx2341x_video_median_filter_type { | |||
1103 | #define V4L2_CID_MPEG_CX2341X_VIDEO_LUMA_MEDIAN_FILTER_TOP (V4L2_CID_MPEG_CX2341X_BASE+8) | 1131 | #define V4L2_CID_MPEG_CX2341X_VIDEO_LUMA_MEDIAN_FILTER_TOP (V4L2_CID_MPEG_CX2341X_BASE+8) |
1104 | #define V4L2_CID_MPEG_CX2341X_VIDEO_CHROMA_MEDIAN_FILTER_BOTTOM (V4L2_CID_MPEG_CX2341X_BASE+9) | 1132 | #define V4L2_CID_MPEG_CX2341X_VIDEO_CHROMA_MEDIAN_FILTER_BOTTOM (V4L2_CID_MPEG_CX2341X_BASE+9) |
1105 | #define V4L2_CID_MPEG_CX2341X_VIDEO_CHROMA_MEDIAN_FILTER_TOP (V4L2_CID_MPEG_CX2341X_BASE+10) | 1133 | #define V4L2_CID_MPEG_CX2341X_VIDEO_CHROMA_MEDIAN_FILTER_TOP (V4L2_CID_MPEG_CX2341X_BASE+10) |
1134 | #define V4L2_CID_MPEG_CX2341X_STREAM_INSERT_NAV_PACKETS (V4L2_CID_MPEG_CX2341X_BASE+11) | ||
1106 | 1135 | ||
1107 | /* | 1136 | /* |
1108 | * T U N I N G | 1137 | * T U N I N G |
@@ -1369,6 +1398,14 @@ struct v4l2_register { | |||
1369 | __u64 val; | 1398 | __u64 val; |
1370 | }; | 1399 | }; |
1371 | 1400 | ||
1401 | /* VIDIOC_G_CHIP_IDENT */ | ||
1402 | struct v4l2_chip_ident { | ||
1403 | __u32 match_type; /* Match type */ | ||
1404 | __u32 match_chip; /* Match this chip, meaning determined by match_type */ | ||
1405 | __u32 ident; /* chip identifier as specified in <media/v4l2-chip-ident.h> */ | ||
1406 | __u32 revision; /* chip revision, chip specific */ | ||
1407 | }; | ||
1408 | |||
1372 | /* | 1409 | /* |
1373 | * I O C T L C O D E S F O R V I D E O D E V I C E S | 1410 | * I O C T L C O D E S F O R V I D E O D E V I C E S |
1374 | * | 1411 | * |
@@ -1442,6 +1479,8 @@ struct v4l2_register { | |||
1442 | /* Experimental, only implemented if CONFIG_VIDEO_ADV_DEBUG is defined */ | 1479 | /* Experimental, only implemented if CONFIG_VIDEO_ADV_DEBUG is defined */ |
1443 | #define VIDIOC_DBG_S_REGISTER _IOW ('V', 79, struct v4l2_register) | 1480 | #define VIDIOC_DBG_S_REGISTER _IOW ('V', 79, struct v4l2_register) |
1444 | #define VIDIOC_DBG_G_REGISTER _IOWR ('V', 80, struct v4l2_register) | 1481 | #define VIDIOC_DBG_G_REGISTER _IOWR ('V', 80, struct v4l2_register) |
1482 | |||
1483 | #define VIDIOC_G_CHIP_IDENT _IOWR ('V', 81, struct v4l2_chip_ident) | ||
1445 | #endif | 1484 | #endif |
1446 | 1485 | ||
1447 | #ifdef __OLD_VIDIOC_ | 1486 | #ifdef __OLD_VIDIOC_ |
diff --git a/include/linux/workqueue.h b/include/linux/workqueue.h index 2a7b38d87018..b8abfc74d038 100644 --- a/include/linux/workqueue.h +++ b/include/linux/workqueue.h | |||
@@ -191,14 +191,15 @@ int execute_in_process_context(work_func_t fn, struct execute_work *); | |||
191 | 191 | ||
192 | /* | 192 | /* |
193 | * Kill off a pending schedule_delayed_work(). Note that the work callback | 193 | * Kill off a pending schedule_delayed_work(). Note that the work callback |
194 | * function may still be running on return from cancel_delayed_work(). Run | 194 | * function may still be running on return from cancel_delayed_work(), unless |
195 | * flush_scheduled_work() to wait on it. | 195 | * it returns 1 and the work doesn't re-arm itself. Run flush_workqueue() or |
196 | * cancel_work_sync() to wait on it. | ||
196 | */ | 197 | */ |
197 | static inline int cancel_delayed_work(struct delayed_work *work) | 198 | static inline int cancel_delayed_work(struct delayed_work *work) |
198 | { | 199 | { |
199 | int ret; | 200 | int ret; |
200 | 201 | ||
201 | ret = del_timer_sync(&work->timer); | 202 | ret = del_timer(&work->timer); |
202 | if (ret) | 203 | if (ret) |
203 | work_release(&work->work); | 204 | work_release(&work->work); |
204 | return ret; | 205 | return ret; |
diff --git a/include/linux/xfrm.h b/include/linux/xfrm.h index 15ca89e9961b..9c656a5cf842 100644 --- a/include/linux/xfrm.h +++ b/include/linux/xfrm.h | |||
@@ -181,6 +181,10 @@ enum { | |||
181 | XFRM_MSG_MIGRATE, | 181 | XFRM_MSG_MIGRATE, |
182 | #define XFRM_MSG_MIGRATE XFRM_MSG_MIGRATE | 182 | #define XFRM_MSG_MIGRATE XFRM_MSG_MIGRATE |
183 | 183 | ||
184 | XFRM_MSG_NEWSADINFO, | ||
185 | #define XFRM_MSG_NEWSADINFO XFRM_MSG_NEWSADINFO | ||
186 | XFRM_MSG_GETSADINFO, | ||
187 | #define XFRM_MSG_GETSADINFO XFRM_MSG_GETSADINFO | ||
184 | __XFRM_MSG_MAX | 188 | __XFRM_MSG_MAX |
185 | }; | 189 | }; |
186 | #define XFRM_MSG_MAX (__XFRM_MSG_MAX - 1) | 190 | #define XFRM_MSG_MAX (__XFRM_MSG_MAX - 1) |
@@ -234,6 +238,17 @@ enum xfrm_ae_ftype_t { | |||
234 | #define XFRM_AE_MAX (__XFRM_AE_MAX - 1) | 238 | #define XFRM_AE_MAX (__XFRM_AE_MAX - 1) |
235 | }; | 239 | }; |
236 | 240 | ||
241 | /* SAD Table filter flags */ | ||
242 | enum xfrm_sad_ftype_t { | ||
243 | XFRM_SAD_UNSPEC, | ||
244 | XFRM_SAD_HMASK=1, | ||
245 | XFRM_SAD_HMAX=2, | ||
246 | XFRM_SAD_CNT=4, | ||
247 | __XFRM_SAD_MAX | ||
248 | |||
249 | #define XFRM_SAD_MAX (__XFRM_SAD_MAX - 1) | ||
250 | }; | ||
251 | |||
237 | struct xfrm_userpolicy_type { | 252 | struct xfrm_userpolicy_type { |
238 | __u8 type; | 253 | __u8 type; |
239 | __u16 reserved1; | 254 | __u16 reserved1; |
@@ -265,6 +280,16 @@ enum xfrm_attr_type_t { | |||
265 | #define XFRMA_MAX (__XFRMA_MAX - 1) | 280 | #define XFRMA_MAX (__XFRMA_MAX - 1) |
266 | }; | 281 | }; |
267 | 282 | ||
283 | enum xfrm_sadattr_type_t { | ||
284 | XFRMA_SAD_UNSPEC, | ||
285 | XFRMA_SADHMASK, | ||
286 | XFRMA_SADHMAX, | ||
287 | XFRMA_SADCNT, | ||
288 | __XFRMA_SAD_MAX | ||
289 | |||
290 | #define XFRMA_SAD_MAX (__XFRMA_SAD_MAX - 1) | ||
291 | }; | ||
292 | |||
268 | struct xfrm_usersa_info { | 293 | struct xfrm_usersa_info { |
269 | struct xfrm_selector sel; | 294 | struct xfrm_selector sel; |
270 | struct xfrm_id id; | 295 | struct xfrm_id id; |
diff --git a/include/media/cx2341x.h b/include/media/cx2341x.h index d758a52cf556..38c12fed7535 100644 --- a/include/media/cx2341x.h +++ b/include/media/cx2341x.h | |||
@@ -40,6 +40,7 @@ struct cx2341x_mpeg_params { | |||
40 | /* stream */ | 40 | /* stream */ |
41 | enum v4l2_mpeg_stream_type stream_type; | 41 | enum v4l2_mpeg_stream_type stream_type; |
42 | enum v4l2_mpeg_stream_vbi_fmt stream_vbi_fmt; | 42 | enum v4l2_mpeg_stream_vbi_fmt stream_vbi_fmt; |
43 | u16 stream_insert_nav_packets; | ||
43 | 44 | ||
44 | /* audio */ | 45 | /* audio */ |
45 | enum v4l2_mpeg_audio_sampling_freq audio_sampling_freq; | 46 | enum v4l2_mpeg_audio_sampling_freq audio_sampling_freq; |
@@ -50,6 +51,7 @@ struct cx2341x_mpeg_params { | |||
50 | enum v4l2_mpeg_audio_emphasis audio_emphasis; | 51 | enum v4l2_mpeg_audio_emphasis audio_emphasis; |
51 | enum v4l2_mpeg_audio_crc audio_crc; | 52 | enum v4l2_mpeg_audio_crc audio_crc; |
52 | u16 audio_properties; | 53 | u16 audio_properties; |
54 | u16 audio_mute; | ||
53 | 55 | ||
54 | /* video */ | 56 | /* video */ |
55 | enum v4l2_mpeg_video_encoding video_encoding; | 57 | enum v4l2_mpeg_video_encoding video_encoding; |
@@ -61,6 +63,8 @@ struct cx2341x_mpeg_params { | |||
61 | u32 video_bitrate; | 63 | u32 video_bitrate; |
62 | u32 video_bitrate_peak; | 64 | u32 video_bitrate_peak; |
63 | u16 video_temporal_decimation; | 65 | u16 video_temporal_decimation; |
66 | u16 video_mute; | ||
67 | u32 video_mute_yuv; | ||
64 | 68 | ||
65 | /* encoding filters */ | 69 | /* encoding filters */ |
66 | enum v4l2_mpeg_cx2341x_video_spatial_filter_mode video_spatial_filter_mode; | 70 | enum v4l2_mpeg_cx2341x_video_spatial_filter_mode video_spatial_filter_mode; |
@@ -162,7 +166,7 @@ void cx2341x_log_status(struct cx2341x_mpeg_params *p, const char *prefix); | |||
162 | #define CX2341X_ENC_SET_PLACEHOLDER 0xd7 | 166 | #define CX2341X_ENC_SET_PLACEHOLDER 0xd7 |
163 | #define CX2341X_ENC_MUTE_VIDEO 0xd9 | 167 | #define CX2341X_ENC_MUTE_VIDEO 0xd9 |
164 | #define CX2341X_ENC_MUTE_AUDIO 0xda | 168 | #define CX2341X_ENC_MUTE_AUDIO 0xda |
165 | #define CX2341X_ENC_UNKNOWN 0xdb | 169 | #define CX2341X_ENC_SET_VERT_CROP_LINE 0xdb |
166 | #define CX2341X_ENC_MISC 0xdc | 170 | #define CX2341X_ENC_MISC 0xdc |
167 | 171 | ||
168 | /* OSD API, specific to the cx23415 */ | 172 | /* OSD API, specific to the cx23415 */ |
diff --git a/include/media/ivtv.h b/include/media/ivtv.h new file mode 100644 index 000000000000..412b48ea8eda --- /dev/null +++ b/include/media/ivtv.h | |||
@@ -0,0 +1,65 @@ | |||
1 | /* | ||
2 | Public ivtv API header | ||
3 | Copyright (C) 2003-2004 Kevin Thayer <nufan_wfk at yahoo.com> | ||
4 | Copyright (C) 2004-2007 Hans Verkuil <hverkuil@xs4all.nl> | ||
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 _LINUX_IVTV_H | ||
22 | #define _LINUX_IVTV_H | ||
23 | |||
24 | /* ivtv knows several distinct output modes: MPEG streaming, | ||
25 | YUV streaming, YUV updates through user DMA and the passthrough | ||
26 | mode. | ||
27 | |||
28 | In order to clearly tell the driver that we are in user DMA | ||
29 | YUV mode you need to call IVTV_IOC_DMA_FRAME with y_source == NULL | ||
30 | first (althrough if you don't then the first time | ||
31 | DMA_FRAME is called the mode switch is done automatically). | ||
32 | |||
33 | When you close the file handle the user DMA mode is exited again. | ||
34 | |||
35 | While in one mode, you cannot use another mode (EBUSY is returned). | ||
36 | |||
37 | All this means that if you want to change the YUV interlacing | ||
38 | for the user DMA YUV mode you first need to do call IVTV_IOC_DMA_FRAME | ||
39 | with y_source == NULL before you can set the correct format using | ||
40 | VIDIOC_S_FMT. | ||
41 | |||
42 | Eventually all this should be replaced with a proper V4L2 API, | ||
43 | but for now we have to do it this way. */ | ||
44 | |||
45 | struct ivtv_dma_frame { | ||
46 | enum v4l2_buf_type type; /* V4L2_BUF_TYPE_VIDEO_OUTPUT */ | ||
47 | __u32 pixelformat; /* 0 == same as destination */ | ||
48 | void __user *y_source; /* if NULL and type == V4L2_BUF_TYPE_VIDEO_OUTPUT, | ||
49 | then just switch to user DMA YUV output mode */ | ||
50 | void __user *uv_source; /* Unused for RGB pixelformats */ | ||
51 | struct v4l2_rect src; | ||
52 | struct v4l2_rect dst; | ||
53 | __u32 src_width; | ||
54 | __u32 src_height; | ||
55 | }; | ||
56 | |||
57 | #define IVTV_IOC_DMA_FRAME _IOW ('V', BASE_VIDIOC_PRIVATE+0, struct ivtv_dma_frame) | ||
58 | |||
59 | /* These are the VBI types as they appear in the embedded VBI private packets. */ | ||
60 | #define IVTV_SLICED_TYPE_TELETEXT_B (1) | ||
61 | #define IVTV_SLICED_TYPE_CAPTION_525 (4) | ||
62 | #define IVTV_SLICED_TYPE_WSS_625 (5) | ||
63 | #define IVTV_SLICED_TYPE_VPS (7) | ||
64 | |||
65 | #endif /* _LINUX_IVTV_H */ | ||
diff --git a/include/media/tuner.h b/include/media/tuner.h index 99acf847365c..a41ac41113ac 100644 --- a/include/media/tuner.h +++ b/include/media/tuner.h | |||
@@ -177,6 +177,8 @@ struct tuner_setup { | |||
177 | unsigned short addr; /* I2C address */ | 177 | unsigned short addr; /* I2C address */ |
178 | unsigned int type; /* Tuner type */ | 178 | unsigned int type; /* Tuner type */ |
179 | unsigned int mode_mask; /* Allowed tuner modes */ | 179 | unsigned int mode_mask; /* Allowed tuner modes */ |
180 | unsigned int config; /* configuraion for more complex tuners */ | ||
181 | int (*tuner_callback) (void *dev, int command,int arg); | ||
180 | }; | 182 | }; |
181 | 183 | ||
182 | struct tuner { | 184 | struct tuner { |
@@ -211,6 +213,9 @@ struct tuner { | |||
211 | unsigned char tda827x_ver; | 213 | unsigned char tda827x_ver; |
212 | unsigned int sgIF; | 214 | unsigned int sgIF; |
213 | 215 | ||
216 | unsigned int config; | ||
217 | int (*tuner_callback) (void *dev, int command,int arg); | ||
218 | |||
214 | /* function ptrs */ | 219 | /* function ptrs */ |
215 | void (*set_tv_freq)(struct i2c_client *c, unsigned int freq); | 220 | void (*set_tv_freq)(struct i2c_client *c, unsigned int freq); |
216 | void (*set_radio_freq)(struct i2c_client *c, unsigned int freq); | 221 | void (*set_radio_freq)(struct i2c_client *c, unsigned int freq); |
diff --git a/include/media/v4l2-chip-ident.h b/include/media/v4l2-chip-ident.h new file mode 100644 index 000000000000..09d16c4f00f7 --- /dev/null +++ b/include/media/v4l2-chip-ident.h | |||
@@ -0,0 +1,149 @@ | |||
1 | /* | ||
2 | v4l2 chip identifiers header | ||
3 | |||
4 | This header provides a list of chip identifiers that can be returned | ||
5 | through the VIDIOC_G_CHIP_IDENT ioctl. | ||
6 | |||
7 | Copyright (C) 2007 Hans Verkuil <hverkuil@xs4all.nl> | ||
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 | #ifndef V4L2_CHIP_IDENT_H_ | ||
25 | #define V4L2_CHIP_IDENT_H_ | ||
26 | |||
27 | /* VIDIOC_G_CHIP_IDENT: identifies the actual chip installed on the board */ | ||
28 | enum { | ||
29 | /* general idents: reserved range 0-49 */ | ||
30 | V4L2_IDENT_NONE = 0, /* No chip matched */ | ||
31 | V4L2_IDENT_AMBIGUOUS = 1, /* Match too general, multiple chips matched */ | ||
32 | V4L2_IDENT_UNKNOWN = 2, /* Chip found, but cannot identify */ | ||
33 | |||
34 | /* module tvaudio: reserved range 50-99 */ | ||
35 | V4L2_IDENT_TVAUDIO = 50, /* A tvaudio chip, unknown which it is exactly */ | ||
36 | |||
37 | /* module saa7110: just ident 100 */ | ||
38 | V4L2_IDENT_SAA7110 = 100, | ||
39 | |||
40 | /* module saa7111: just ident 101 */ | ||
41 | V4L2_IDENT_SAA7111 = 101, | ||
42 | |||
43 | /* module saa7115: reserved range 102-149 */ | ||
44 | V4L2_IDENT_SAA7113 = 103, | ||
45 | V4L2_IDENT_SAA7114 = 104, | ||
46 | V4L2_IDENT_SAA7115 = 105, | ||
47 | V4L2_IDENT_SAA7118 = 108, | ||
48 | |||
49 | /* module saa7127: reserved range 150-199 */ | ||
50 | V4L2_IDENT_SAA7127 = 157, | ||
51 | V4L2_IDENT_SAA7129 = 159, | ||
52 | |||
53 | /* module cx25840: reserved range 200-249 */ | ||
54 | V4L2_IDENT_CX25836 = 236, | ||
55 | V4L2_IDENT_CX25837 = 237, | ||
56 | V4L2_IDENT_CX25840 = 240, | ||
57 | V4L2_IDENT_CX25841 = 241, | ||
58 | V4L2_IDENT_CX25842 = 242, | ||
59 | V4L2_IDENT_CX25843 = 243, | ||
60 | |||
61 | /* OmniVision sensors: reserved range 250-299 */ | ||
62 | V4L2_IDENT_OV7670 = 250, | ||
63 | |||
64 | /* Conexant MPEG encoder/decoders: reserved range 410-420 */ | ||
65 | V4L2_IDENT_CX23415 = 415, | ||
66 | V4L2_IDENT_CX23416 = 416, | ||
67 | |||
68 | /* module wm8739: just ident 8739 */ | ||
69 | V4L2_IDENT_WM8739 = 8739, | ||
70 | |||
71 | /* module wm8775: just ident 8775 */ | ||
72 | V4L2_IDENT_WM8775 = 8775, | ||
73 | |||
74 | /* module cs53132a: just ident 53132 */ | ||
75 | V4L2_IDENT_CS53l32A = 53132, | ||
76 | |||
77 | /* module upd64031a: just ident 64031 */ | ||
78 | V4L2_IDENT_UPD64031A = 64031, | ||
79 | |||
80 | /* module upd64083: just ident 64083 */ | ||
81 | V4L2_IDENT_UPD64083 = 64083, | ||
82 | |||
83 | /* module msp34xx: reserved range 34000-34999 */ | ||
84 | V4L2_IDENT_MSP3400B = 34002, | ||
85 | V4L2_IDENT_MSP3410B = 34102, | ||
86 | |||
87 | V4L2_IDENT_MSP3400C = 34003, | ||
88 | V4L2_IDENT_MSP3410C = 34103, | ||
89 | |||
90 | V4L2_IDENT_MSP3400D = 34004, | ||
91 | V4L2_IDENT_MSP3410D = 34104, | ||
92 | V4L2_IDENT_MSP3405D = 34054, | ||
93 | V4L2_IDENT_MSP3415D = 34154, | ||
94 | V4L2_IDENT_MSP3407D = 34074, | ||
95 | V4L2_IDENT_MSP3417D = 34174, | ||
96 | |||
97 | V4L2_IDENT_MSP3400G = 34007, | ||
98 | V4L2_IDENT_MSP3410G = 34107, | ||
99 | V4L2_IDENT_MSP3420G = 34207, | ||
100 | V4L2_IDENT_MSP3430G = 34307, | ||
101 | V4L2_IDENT_MSP3440G = 34407, | ||
102 | V4L2_IDENT_MSP3450G = 34507, | ||
103 | V4L2_IDENT_MSP3460G = 34607, | ||
104 | |||
105 | V4L2_IDENT_MSP3401G = 34017, | ||
106 | V4L2_IDENT_MSP3411G = 34117, | ||
107 | V4L2_IDENT_MSP3421G = 34217, | ||
108 | V4L2_IDENT_MSP3431G = 34317, | ||
109 | V4L2_IDENT_MSP3441G = 34417, | ||
110 | V4L2_IDENT_MSP3451G = 34517, | ||
111 | V4L2_IDENT_MSP3461G = 34617, | ||
112 | |||
113 | V4L2_IDENT_MSP3402G = 34027, | ||
114 | V4L2_IDENT_MSP3412G = 34127, | ||
115 | V4L2_IDENT_MSP3422G = 34227, | ||
116 | V4L2_IDENT_MSP3442G = 34427, | ||
117 | V4L2_IDENT_MSP3452G = 34527, | ||
118 | |||
119 | V4L2_IDENT_MSP3405G = 34057, | ||
120 | V4L2_IDENT_MSP3415G = 34157, | ||
121 | V4L2_IDENT_MSP3425G = 34257, | ||
122 | V4L2_IDENT_MSP3435G = 34357, | ||
123 | V4L2_IDENT_MSP3445G = 34457, | ||
124 | V4L2_IDENT_MSP3455G = 34557, | ||
125 | V4L2_IDENT_MSP3465G = 34657, | ||
126 | |||
127 | V4L2_IDENT_MSP3407G = 34077, | ||
128 | V4L2_IDENT_MSP3417G = 34177, | ||
129 | V4L2_IDENT_MSP3427G = 34277, | ||
130 | V4L2_IDENT_MSP3437G = 34377, | ||
131 | V4L2_IDENT_MSP3447G = 34477, | ||
132 | V4L2_IDENT_MSP3457G = 34577, | ||
133 | V4L2_IDENT_MSP3467G = 34677, | ||
134 | |||
135 | /* module msp44xx: reserved range 44000-44999 */ | ||
136 | V4L2_IDENT_MSP4400G = 44007, | ||
137 | V4L2_IDENT_MSP4410G = 44107, | ||
138 | V4L2_IDENT_MSP4420G = 44207, | ||
139 | V4L2_IDENT_MSP4440G = 44407, | ||
140 | V4L2_IDENT_MSP4450G = 44507, | ||
141 | |||
142 | V4L2_IDENT_MSP4408G = 44087, | ||
143 | V4L2_IDENT_MSP4418G = 44187, | ||
144 | V4L2_IDENT_MSP4428G = 44287, | ||
145 | V4L2_IDENT_MSP4448G = 44487, | ||
146 | V4L2_IDENT_MSP4458G = 44587, | ||
147 | }; | ||
148 | |||
149 | #endif | ||
diff --git a/include/media/v4l2-common.h b/include/media/v4l2-common.h index 6eaeec98ed89..181a40c46a52 100644 --- a/include/media/v4l2-common.h +++ b/include/media/v4l2-common.h | |||
@@ -98,6 +98,8 @@ u32 v4l2_ctrl_next(const u32 * const *ctrl_classes, u32 id); | |||
98 | 98 | ||
99 | struct i2c_client; /* forward reference */ | 99 | struct i2c_client; /* forward reference */ |
100 | int v4l2_chip_match_i2c_client(struct i2c_client *c, u32 id_type, u32 chip_id); | 100 | int v4l2_chip_match_i2c_client(struct i2c_client *c, u32 id_type, u32 chip_id); |
101 | int v4l2_chip_ident_i2c_client(struct i2c_client *c, struct v4l2_chip_ident *chip, | ||
102 | u32 ident, u32 revision); | ||
101 | int v4l2_chip_match_host(u32 id_type, u32 chip_id); | 103 | int v4l2_chip_match_host(u32 id_type, u32 chip_id); |
102 | 104 | ||
103 | /* ------------------------------------------------------------------------- */ | 105 | /* ------------------------------------------------------------------------- */ |
@@ -114,39 +116,6 @@ struct v4l2_decode_vbi_line { | |||
114 | u32 type; /* VBI service type (V4L2_SLICED_*). 0 if no service found */ | 116 | u32 type; /* VBI service type (V4L2_SLICED_*). 0 if no service found */ |
115 | }; | 117 | }; |
116 | 118 | ||
117 | /* VIDIOC_INT_G_CHIP_IDENT: identifies the actual chip installed on the board */ | ||
118 | enum v4l2_chip_ident { | ||
119 | /* general idents: reserved range 0-49 */ | ||
120 | V4L2_IDENT_UNKNOWN = 0, | ||
121 | |||
122 | /* module saa7110: just ident= 100 */ | ||
123 | V4L2_IDENT_SAA7110 = 100, | ||
124 | |||
125 | /* module saa7111: just ident= 101 */ | ||
126 | V4L2_IDENT_SAA7111 = 101, | ||
127 | |||
128 | /* module saa7115: reserved range 102-149 */ | ||
129 | V4L2_IDENT_SAA7113 = 103, | ||
130 | V4L2_IDENT_SAA7114 = 104, | ||
131 | V4L2_IDENT_SAA7115 = 105, | ||
132 | V4L2_IDENT_SAA7118 = 108, | ||
133 | |||
134 | /* module saa7127: reserved range 150-199 */ | ||
135 | V4L2_IDENT_SAA7127 = 157, | ||
136 | V4L2_IDENT_SAA7129 = 159, | ||
137 | |||
138 | /* module cx25840: reserved range 200-249 */ | ||
139 | V4L2_IDENT_CX25836 = 236, | ||
140 | V4L2_IDENT_CX25837 = 237, | ||
141 | V4L2_IDENT_CX25840 = 240, | ||
142 | V4L2_IDENT_CX25841 = 241, | ||
143 | V4L2_IDENT_CX25842 = 242, | ||
144 | V4L2_IDENT_CX25843 = 243, | ||
145 | |||
146 | /* OmniVision sensors - range 250-299 */ | ||
147 | V4L2_IDENT_OV7670 = 250, | ||
148 | }; | ||
149 | |||
150 | /* audio ioctls */ | 119 | /* audio ioctls */ |
151 | 120 | ||
152 | /* v4l device was opened in Radio mode, to be replaced by VIDIOC_INT_S_TUNER_MODE */ | 121 | /* v4l device was opened in Radio mode, to be replaced by VIDIOC_INT_S_TUNER_MODE */ |
@@ -208,10 +177,6 @@ enum v4l2_chip_ident { | |||
208 | whether CC data from the first or second field should be obtained). */ | 177 | whether CC data from the first or second field should be obtained). */ |
209 | #define VIDIOC_INT_G_VBI_DATA _IOWR('d', 106, struct v4l2_sliced_vbi_data) | 178 | #define VIDIOC_INT_G_VBI_DATA _IOWR('d', 106, struct v4l2_sliced_vbi_data) |
210 | 179 | ||
211 | /* Returns the chip identifier or V4L2_IDENT_UNKNOWN if no identification can | ||
212 | be made. */ | ||
213 | #define VIDIOC_INT_G_CHIP_IDENT _IOR ('d', 107, enum v4l2_chip_ident) | ||
214 | |||
215 | /* Sets I2S speed in bps. This is used to provide a standard way to select I2S | 180 | /* Sets I2S speed in bps. This is used to provide a standard way to select I2S |
216 | clock used by driving digital audio streams at some board designs. | 181 | clock used by driving digital audio streams at some board designs. |
217 | Usual values for the frequency are 1024000 and 2048000. | 182 | Usual values for the frequency are 1024000 and 2048000. |
@@ -254,4 +219,12 @@ struct v4l2_crystal_freq { | |||
254 | default values. */ | 219 | default values. */ |
255 | #define VIDIOC_INT_INIT _IOW ('d', 114, u32) | 220 | #define VIDIOC_INT_INIT _IOW ('d', 114, u32) |
256 | 221 | ||
222 | /* Set v4l2_std_id for video OUTPUT devices. This is ignored by | ||
223 | video input devices. */ | ||
224 | #define VIDIOC_INT_S_STD_OUTPUT _IOW ('d', 115, v4l2_std_id) | ||
225 | |||
226 | /* Get v4l2_std_id for video OUTPUT devices. This is ignored by | ||
227 | video input devices. */ | ||
228 | #define VIDIOC_INT_G_STD_OUTPUT _IOW ('d', 116, v4l2_std_id) | ||
229 | |||
257 | #endif /* V4L2_COMMON_H_ */ | 230 | #endif /* V4L2_COMMON_H_ */ |
diff --git a/include/media/v4l2-dev.h b/include/media/v4l2-dev.h index 1dd3d3239ecf..d62847f846c2 100644 --- a/include/media/v4l2-dev.h +++ b/include/media/v4l2-dev.h | |||
@@ -127,6 +127,8 @@ struct video_device | |||
127 | struct v4l2_fmtdesc *f); | 127 | struct v4l2_fmtdesc *f); |
128 | int (*vidioc_enum_fmt_video_output)(struct file *file, void *fh, | 128 | int (*vidioc_enum_fmt_video_output)(struct file *file, void *fh, |
129 | struct v4l2_fmtdesc *f); | 129 | struct v4l2_fmtdesc *f); |
130 | int (*vidioc_enum_fmt_output_overlay) (struct file *file, void *fh, | ||
131 | struct v4l2_fmtdesc *f); | ||
130 | int (*vidioc_enum_fmt_vbi_output) (struct file *file, void *fh, | 132 | int (*vidioc_enum_fmt_vbi_output) (struct file *file, void *fh, |
131 | struct v4l2_fmtdesc *f); | 133 | struct v4l2_fmtdesc *f); |
132 | int (*vidioc_enum_fmt_type_private)(struct file *file, void *fh, | 134 | int (*vidioc_enum_fmt_type_private)(struct file *file, void *fh, |
@@ -145,6 +147,8 @@ struct video_device | |||
145 | struct v4l2_format *f); | 147 | struct v4l2_format *f); |
146 | int (*vidioc_g_fmt_video_output)(struct file *file, void *fh, | 148 | int (*vidioc_g_fmt_video_output)(struct file *file, void *fh, |
147 | struct v4l2_format *f); | 149 | struct v4l2_format *f); |
150 | int (*vidioc_g_fmt_output_overlay) (struct file *file, void *fh, | ||
151 | struct v4l2_format *f); | ||
148 | int (*vidioc_g_fmt_type_private)(struct file *file, void *fh, | 152 | int (*vidioc_g_fmt_type_private)(struct file *file, void *fh, |
149 | struct v4l2_format *f); | 153 | struct v4l2_format *f); |
150 | 154 | ||
@@ -162,6 +166,8 @@ struct video_device | |||
162 | struct v4l2_format *f); | 166 | struct v4l2_format *f); |
163 | int (*vidioc_s_fmt_video_output)(struct file *file, void *fh, | 167 | int (*vidioc_s_fmt_video_output)(struct file *file, void *fh, |
164 | struct v4l2_format *f); | 168 | struct v4l2_format *f); |
169 | int (*vidioc_s_fmt_output_overlay) (struct file *file, void *fh, | ||
170 | struct v4l2_format *f); | ||
165 | int (*vidioc_s_fmt_type_private)(struct file *file, void *fh, | 171 | int (*vidioc_s_fmt_type_private)(struct file *file, void *fh, |
166 | struct v4l2_format *f); | 172 | struct v4l2_format *f); |
167 | 173 | ||
@@ -178,6 +184,8 @@ struct video_device | |||
178 | struct v4l2_format *f); | 184 | struct v4l2_format *f); |
179 | int (*vidioc_try_fmt_video_output)(struct file *file, void *fh, | 185 | int (*vidioc_try_fmt_video_output)(struct file *file, void *fh, |
180 | struct v4l2_format *f); | 186 | struct v4l2_format *f); |
187 | int (*vidioc_try_fmt_output_overlay)(struct file *file, void *fh, | ||
188 | struct v4l2_format *f); | ||
181 | int (*vidioc_try_fmt_type_private)(struct file *file, void *fh, | 189 | int (*vidioc_try_fmt_type_private)(struct file *file, void *fh, |
182 | struct v4l2_format *f); | 190 | struct v4l2_format *f); |
183 | 191 | ||
@@ -309,6 +317,8 @@ struct video_device | |||
309 | int (*vidioc_s_register) (struct file *file, void *fh, | 317 | int (*vidioc_s_register) (struct file *file, void *fh, |
310 | struct v4l2_register *reg); | 318 | struct v4l2_register *reg); |
311 | #endif | 319 | #endif |
320 | int (*vidioc_g_chip_ident) (struct file *file, void *fh, | ||
321 | struct v4l2_chip_ident *chip); | ||
312 | 322 | ||
313 | 323 | ||
314 | #ifdef OBSOLETE_OWNER /* to be removed soon */ | 324 | #ifdef OBSOLETE_OWNER /* to be removed soon */ |
diff --git a/include/mtd/Kbuild b/include/mtd/Kbuild index e0fe92b03a4e..4d46b3bdebd8 100644 --- a/include/mtd/Kbuild +++ b/include/mtd/Kbuild | |||
@@ -3,3 +3,5 @@ header-y += jffs2-user.h | |||
3 | header-y += mtd-abi.h | 3 | header-y += mtd-abi.h |
4 | header-y += mtd-user.h | 4 | header-y += mtd-user.h |
5 | header-y += nftl-user.h | 5 | header-y += nftl-user.h |
6 | header-y += ubi-header.h | ||
7 | header-y += ubi-user.h | ||
diff --git a/include/mtd/mtd-abi.h b/include/mtd/mtd-abi.h index 8e501a75a764..f71dac420394 100644 --- a/include/mtd/mtd-abi.h +++ b/include/mtd/mtd-abi.h | |||
@@ -24,6 +24,7 @@ struct mtd_oob_buf { | |||
24 | #define MTD_NORFLASH 3 | 24 | #define MTD_NORFLASH 3 |
25 | #define MTD_NANDFLASH 4 | 25 | #define MTD_NANDFLASH 4 |
26 | #define MTD_DATAFLASH 6 | 26 | #define MTD_DATAFLASH 6 |
27 | #define MTD_UBIVOLUME 7 | ||
27 | 28 | ||
28 | #define MTD_WRITEABLE 0x400 /* Device is writeable */ | 29 | #define MTD_WRITEABLE 0x400 /* Device is writeable */ |
29 | #define MTD_BIT_WRITEABLE 0x800 /* Single bits can be flipped */ | 30 | #define MTD_BIT_WRITEABLE 0x800 /* Single bits can be flipped */ |
diff --git a/include/mtd/ubi-header.h b/include/mtd/ubi-header.h new file mode 100644 index 000000000000..fa479c71aa34 --- /dev/null +++ b/include/mtd/ubi-header.h | |||
@@ -0,0 +1,360 @@ | |||
1 | /* | ||
2 | * Copyright (c) International Business Machines Corp., 2006 | ||
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 | ||
12 | * the 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 | * Authors: Artem Bityutskiy (Битюцкий Артём) | ||
19 | * Thomas Gleixner | ||
20 | * Frank Haverkamp | ||
21 | * Oliver Lohmann | ||
22 | * Andreas Arnez | ||
23 | */ | ||
24 | |||
25 | /* | ||
26 | * This file defines the layout of UBI headers and all the other UBI on-flash | ||
27 | * data structures. May be included by user-space. | ||
28 | */ | ||
29 | |||
30 | #ifndef __UBI_HEADER_H__ | ||
31 | #define __UBI_HEADER_H__ | ||
32 | |||
33 | #include <asm/byteorder.h> | ||
34 | |||
35 | /* The version of UBI images supported by this implementation */ | ||
36 | #define UBI_VERSION 1 | ||
37 | |||
38 | /* The highest erase counter value supported by this implementation */ | ||
39 | #define UBI_MAX_ERASECOUNTER 0x7FFFFFFF | ||
40 | |||
41 | /* The initial CRC32 value used when calculating CRC checksums */ | ||
42 | #define UBI_CRC32_INIT 0xFFFFFFFFU | ||
43 | |||
44 | /* Erase counter header magic number (ASCII "UBI#") */ | ||
45 | #define UBI_EC_HDR_MAGIC 0x55424923 | ||
46 | /* Volume identifier header magic number (ASCII "UBI!") */ | ||
47 | #define UBI_VID_HDR_MAGIC 0x55424921 | ||
48 | |||
49 | /* | ||
50 | * Volume type constants used in the volume identifier header. | ||
51 | * | ||
52 | * @UBI_VID_DYNAMIC: dynamic volume | ||
53 | * @UBI_VID_STATIC: static volume | ||
54 | */ | ||
55 | enum { | ||
56 | UBI_VID_DYNAMIC = 1, | ||
57 | UBI_VID_STATIC = 2 | ||
58 | }; | ||
59 | |||
60 | /* | ||
61 | * Compatibility constants used by internal volumes. | ||
62 | * | ||
63 | * @UBI_COMPAT_DELETE: delete this internal volume before anything is written | ||
64 | * to the flash | ||
65 | * @UBI_COMPAT_RO: attach this device in read-only mode | ||
66 | * @UBI_COMPAT_PRESERVE: preserve this internal volume - do not touch its | ||
67 | * physical eraseblocks, don't allow the wear-leveling unit to move them | ||
68 | * @UBI_COMPAT_REJECT: reject this UBI image | ||
69 | */ | ||
70 | enum { | ||
71 | UBI_COMPAT_DELETE = 1, | ||
72 | UBI_COMPAT_RO = 2, | ||
73 | UBI_COMPAT_PRESERVE = 4, | ||
74 | UBI_COMPAT_REJECT = 5 | ||
75 | }; | ||
76 | |||
77 | /* | ||
78 | * ubi16_t/ubi32_t/ubi64_t - 16, 32, and 64-bit integers used in UBI on-flash | ||
79 | * data structures. | ||
80 | */ | ||
81 | typedef struct { | ||
82 | uint16_t int16; | ||
83 | } __attribute__ ((packed)) ubi16_t; | ||
84 | |||
85 | typedef struct { | ||
86 | uint32_t int32; | ||
87 | } __attribute__ ((packed)) ubi32_t; | ||
88 | |||
89 | typedef struct { | ||
90 | uint64_t int64; | ||
91 | } __attribute__ ((packed)) ubi64_t; | ||
92 | |||
93 | /* | ||
94 | * In this implementation of UBI uses the big-endian format for on-flash | ||
95 | * integers. The below are the corresponding conversion macros. | ||
96 | */ | ||
97 | #define cpu_to_ubi16(x) ((ubi16_t){__cpu_to_be16(x)}) | ||
98 | #define ubi16_to_cpu(x) ((uint16_t)__be16_to_cpu((x).int16)) | ||
99 | |||
100 | #define cpu_to_ubi32(x) ((ubi32_t){__cpu_to_be32(x)}) | ||
101 | #define ubi32_to_cpu(x) ((uint32_t)__be32_to_cpu((x).int32)) | ||
102 | |||
103 | #define cpu_to_ubi64(x) ((ubi64_t){__cpu_to_be64(x)}) | ||
104 | #define ubi64_to_cpu(x) ((uint64_t)__be64_to_cpu((x).int64)) | ||
105 | |||
106 | /* Sizes of UBI headers */ | ||
107 | #define UBI_EC_HDR_SIZE sizeof(struct ubi_ec_hdr) | ||
108 | #define UBI_VID_HDR_SIZE sizeof(struct ubi_vid_hdr) | ||
109 | |||
110 | /* Sizes of UBI headers without the ending CRC */ | ||
111 | #define UBI_EC_HDR_SIZE_CRC (UBI_EC_HDR_SIZE - sizeof(ubi32_t)) | ||
112 | #define UBI_VID_HDR_SIZE_CRC (UBI_VID_HDR_SIZE - sizeof(ubi32_t)) | ||
113 | |||
114 | /** | ||
115 | * struct ubi_ec_hdr - UBI erase counter header. | ||
116 | * @magic: erase counter header magic number (%UBI_EC_HDR_MAGIC) | ||
117 | * @version: version of UBI implementation which is supposed to accept this | ||
118 | * UBI image | ||
119 | * @padding1: reserved for future, zeroes | ||
120 | * @ec: the erase counter | ||
121 | * @vid_hdr_offset: where the VID header starts | ||
122 | * @data_offset: where the user data start | ||
123 | * @padding2: reserved for future, zeroes | ||
124 | * @hdr_crc: erase counter header CRC checksum | ||
125 | * | ||
126 | * The erase counter header takes 64 bytes and has a plenty of unused space for | ||
127 | * future usage. The unused fields are zeroed. The @version field is used to | ||
128 | * indicate the version of UBI implementation which is supposed to be able to | ||
129 | * work with this UBI image. If @version is greater then the current UBI | ||
130 | * version, the image is rejected. This may be useful in future if something | ||
131 | * is changed radically. This field is duplicated in the volume identifier | ||
132 | * header. | ||
133 | * | ||
134 | * The @vid_hdr_offset and @data_offset fields contain the offset of the the | ||
135 | * volume identifier header and user data, relative to the beginning of the | ||
136 | * physical eraseblock. These values have to be the same for all physical | ||
137 | * eraseblocks. | ||
138 | */ | ||
139 | struct ubi_ec_hdr { | ||
140 | ubi32_t magic; | ||
141 | uint8_t version; | ||
142 | uint8_t padding1[3]; | ||
143 | ubi64_t ec; /* Warning: the current limit is 31-bit anyway! */ | ||
144 | ubi32_t vid_hdr_offset; | ||
145 | ubi32_t data_offset; | ||
146 | uint8_t padding2[36]; | ||
147 | ubi32_t hdr_crc; | ||
148 | } __attribute__ ((packed)); | ||
149 | |||
150 | /** | ||
151 | * struct ubi_vid_hdr - on-flash UBI volume identifier header. | ||
152 | * @magic: volume identifier header magic number (%UBI_VID_HDR_MAGIC) | ||
153 | * @version: UBI implementation version which is supposed to accept this UBI | ||
154 | * image (%UBI_VERSION) | ||
155 | * @vol_type: volume type (%UBI_VID_DYNAMIC or %UBI_VID_STATIC) | ||
156 | * @copy_flag: if this logical eraseblock was copied from another physical | ||
157 | * eraseblock (for wear-leveling reasons) | ||
158 | * @compat: compatibility of this volume (%0, %UBI_COMPAT_DELETE, | ||
159 | * %UBI_COMPAT_IGNORE, %UBI_COMPAT_PRESERVE, or %UBI_COMPAT_REJECT) | ||
160 | * @vol_id: ID of this volume | ||
161 | * @lnum: logical eraseblock number | ||
162 | * @leb_ver: version of this logical eraseblock (IMPORTANT: obsolete, to be | ||
163 | * removed, kept only for not breaking older UBI users) | ||
164 | * @data_size: how many bytes of data this logical eraseblock contains | ||
165 | * @used_ebs: total number of used logical eraseblocks in this volume | ||
166 | * @data_pad: how many bytes at the end of this physical eraseblock are not | ||
167 | * used | ||
168 | * @data_crc: CRC checksum of the data stored in this logical eraseblock | ||
169 | * @padding1: reserved for future, zeroes | ||
170 | * @sqnum: sequence number | ||
171 | * @padding2: reserved for future, zeroes | ||
172 | * @hdr_crc: volume identifier header CRC checksum | ||
173 | * | ||
174 | * The @sqnum is the value of the global sequence counter at the time when this | ||
175 | * VID header was created. The global sequence counter is incremented each time | ||
176 | * UBI writes a new VID header to the flash, i.e. when it maps a logical | ||
177 | * eraseblock to a new physical eraseblock. The global sequence counter is an | ||
178 | * unsigned 64-bit integer and we assume it never overflows. The @sqnum | ||
179 | * (sequence number) is used to distinguish between older and newer versions of | ||
180 | * logical eraseblocks. | ||
181 | * | ||
182 | * There are 2 situations when there may be more then one physical eraseblock | ||
183 | * corresponding to the same logical eraseblock, i.e., having the same @vol_id | ||
184 | * and @lnum values in the volume identifier header. Suppose we have a logical | ||
185 | * eraseblock L and it is mapped to the physical eraseblock P. | ||
186 | * | ||
187 | * 1. Because UBI may erase physical eraseblocks asynchronously, the following | ||
188 | * situation is possible: L is asynchronously erased, so P is scheduled for | ||
189 | * erasure, then L is written to,i.e. mapped to another physical eraseblock P1, | ||
190 | * so P1 is written to, then an unclean reboot happens. Result - there are 2 | ||
191 | * physical eraseblocks P and P1 corresponding to the same logical eraseblock | ||
192 | * L. But P1 has greater sequence number, so UBI picks P1 when it attaches the | ||
193 | * flash. | ||
194 | * | ||
195 | * 2. From time to time UBI moves logical eraseblocks to other physical | ||
196 | * eraseblocks for wear-leveling reasons. If, for example, UBI moves L from P | ||
197 | * to P1, and an unclean reboot happens before P is physically erased, there | ||
198 | * are two physical eraseblocks P and P1 corresponding to L and UBI has to | ||
199 | * select one of them when the flash is attached. The @sqnum field says which | ||
200 | * PEB is the original (obviously P will have lower @sqnum) and the copy. But | ||
201 | * it is not enough to select the physical eraseblock with the higher sequence | ||
202 | * number, because the unclean reboot could have happen in the middle of the | ||
203 | * copying process, so the data in P is corrupted. It is also not enough to | ||
204 | * just select the physical eraseblock with lower sequence number, because the | ||
205 | * data there may be old (consider a case if more data was added to P1 after | ||
206 | * the copying). Moreover, the unclean reboot may happen when the erasure of P | ||
207 | * was just started, so it result in unstable P, which is "mostly" OK, but | ||
208 | * still has unstable bits. | ||
209 | * | ||
210 | * UBI uses the @copy_flag field to indicate that this logical eraseblock is a | ||
211 | * copy. UBI also calculates data CRC when the data is moved and stores it at | ||
212 | * the @data_crc field of the copy (P1). So when UBI needs to pick one physical | ||
213 | * eraseblock of two (P or P1), the @copy_flag of the newer one (P1) is | ||
214 | * examined. If it is cleared, the situation* is simple and the newer one is | ||
215 | * picked. If it is set, the data CRC of the copy (P1) is examined. If the CRC | ||
216 | * checksum is correct, this physical eraseblock is selected (P1). Otherwise | ||
217 | * the older one (P) is selected. | ||
218 | * | ||
219 | * Note, there is an obsolete @leb_ver field which was used instead of @sqnum | ||
220 | * in the past. But it is not used anymore and we keep it in order to be able | ||
221 | * to deal with old UBI images. It will be removed at some point. | ||
222 | * | ||
223 | * There are 2 sorts of volumes in UBI: user volumes and internal volumes. | ||
224 | * Internal volumes are not seen from outside and are used for various internal | ||
225 | * UBI purposes. In this implementation there is only one internal volume - the | ||
226 | * layout volume. Internal volumes are the main mechanism of UBI extensions. | ||
227 | * For example, in future one may introduce a journal internal volume. Internal | ||
228 | * volumes have their own reserved range of IDs. | ||
229 | * | ||
230 | * The @compat field is only used for internal volumes and contains the "degree | ||
231 | * of their compatibility". It is always zero for user volumes. This field | ||
232 | * provides a mechanism to introduce UBI extensions and to be still compatible | ||
233 | * with older UBI binaries. For example, if someone introduced a journal in | ||
234 | * future, he would probably use %UBI_COMPAT_DELETE compatibility for the | ||
235 | * journal volume. And in this case, older UBI binaries, which know nothing | ||
236 | * about the journal volume, would just delete this volume and work perfectly | ||
237 | * fine. This is similar to what Ext2fs does when it is fed by an Ext3fs image | ||
238 | * - it just ignores the Ext3fs journal. | ||
239 | * | ||
240 | * The @data_crc field contains the CRC checksum of the contents of the logical | ||
241 | * eraseblock if this is a static volume. In case of dynamic volumes, it does | ||
242 | * not contain the CRC checksum as a rule. The only exception is when the | ||
243 | * data of the physical eraseblock was moved by the wear-leveling unit, then | ||
244 | * the wear-leveling unit calculates the data CRC and stores it in the | ||
245 | * @data_crc field. And of course, the @copy_flag is %in this case. | ||
246 | * | ||
247 | * The @data_size field is used only for static volumes because UBI has to know | ||
248 | * how many bytes of data are stored in this eraseblock. For dynamic volumes, | ||
249 | * this field usually contains zero. The only exception is when the data of the | ||
250 | * physical eraseblock was moved to another physical eraseblock for | ||
251 | * wear-leveling reasons. In this case, UBI calculates CRC checksum of the | ||
252 | * contents and uses both @data_crc and @data_size fields. In this case, the | ||
253 | * @data_size field contains data size. | ||
254 | * | ||
255 | * The @used_ebs field is used only for static volumes and indicates how many | ||
256 | * eraseblocks the data of the volume takes. For dynamic volumes this field is | ||
257 | * not used and always contains zero. | ||
258 | * | ||
259 | * The @data_pad is calculated when volumes are created using the alignment | ||
260 | * parameter. So, effectively, the @data_pad field reduces the size of logical | ||
261 | * eraseblocks of this volume. This is very handy when one uses block-oriented | ||
262 | * software (say, cramfs) on top of the UBI volume. | ||
263 | */ | ||
264 | struct ubi_vid_hdr { | ||
265 | ubi32_t magic; | ||
266 | uint8_t version; | ||
267 | uint8_t vol_type; | ||
268 | uint8_t copy_flag; | ||
269 | uint8_t compat; | ||
270 | ubi32_t vol_id; | ||
271 | ubi32_t lnum; | ||
272 | ubi32_t leb_ver; /* obsolete, to be removed, don't use */ | ||
273 | ubi32_t data_size; | ||
274 | ubi32_t used_ebs; | ||
275 | ubi32_t data_pad; | ||
276 | ubi32_t data_crc; | ||
277 | uint8_t padding1[4]; | ||
278 | ubi64_t sqnum; | ||
279 | uint8_t padding2[12]; | ||
280 | ubi32_t hdr_crc; | ||
281 | } __attribute__ ((packed)); | ||
282 | |||
283 | /* Internal UBI volumes count */ | ||
284 | #define UBI_INT_VOL_COUNT 1 | ||
285 | |||
286 | /* | ||
287 | * Starting ID of internal volumes. There is reserved room for 4096 internal | ||
288 | * volumes. | ||
289 | */ | ||
290 | #define UBI_INTERNAL_VOL_START (0x7FFFFFFF - 4096) | ||
291 | |||
292 | /* The layout volume contains the volume table */ | ||
293 | |||
294 | #define UBI_LAYOUT_VOL_ID UBI_INTERNAL_VOL_START | ||
295 | #define UBI_LAYOUT_VOLUME_EBS 2 | ||
296 | #define UBI_LAYOUT_VOLUME_NAME "layout volume" | ||
297 | #define UBI_LAYOUT_VOLUME_COMPAT UBI_COMPAT_REJECT | ||
298 | |||
299 | /* The maximum number of volumes per one UBI device */ | ||
300 | #define UBI_MAX_VOLUMES 128 | ||
301 | |||
302 | /* The maximum volume name length */ | ||
303 | #define UBI_VOL_NAME_MAX 127 | ||
304 | |||
305 | /* Size of the volume table record */ | ||
306 | #define UBI_VTBL_RECORD_SIZE sizeof(struct ubi_vtbl_record) | ||
307 | |||
308 | /* Size of the volume table record without the ending CRC */ | ||
309 | #define UBI_VTBL_RECORD_SIZE_CRC (UBI_VTBL_RECORD_SIZE - sizeof(ubi32_t)) | ||
310 | |||
311 | /** | ||
312 | * struct ubi_vtbl_record - a record in the volume table. | ||
313 | * @reserved_pebs: how many physical eraseblocks are reserved for this volume | ||
314 | * @alignment: volume alignment | ||
315 | * @data_pad: how many bytes are unused at the end of the each physical | ||
316 | * eraseblock to satisfy the requested alignment | ||
317 | * @vol_type: volume type (%UBI_DYNAMIC_VOLUME or %UBI_STATIC_VOLUME) | ||
318 | * @upd_marker: if volume update was started but not finished | ||
319 | * @name_len: volume name length | ||
320 | * @name: the volume name | ||
321 | * @padding2: reserved, zeroes | ||
322 | * @crc: a CRC32 checksum of the record | ||
323 | * | ||
324 | * The volume table records are stored in the volume table, which is stored in | ||
325 | * the layout volume. The layout volume consists of 2 logical eraseblock, each | ||
326 | * of which contains a copy of the volume table (i.e., the volume table is | ||
327 | * duplicated). The volume table is an array of &struct ubi_vtbl_record | ||
328 | * objects indexed by the volume ID. | ||
329 | * | ||
330 | * If the size of the logical eraseblock is large enough to fit | ||
331 | * %UBI_MAX_VOLUMES records, the volume table contains %UBI_MAX_VOLUMES | ||
332 | * records. Otherwise, it contains as many records as it can fit (i.e., size of | ||
333 | * logical eraseblock divided by sizeof(struct ubi_vtbl_record)). | ||
334 | * | ||
335 | * The @upd_marker flag is used to implement volume update. It is set to %1 | ||
336 | * before update and set to %0 after the update. So if the update operation was | ||
337 | * interrupted, UBI knows that the volume is corrupted. | ||
338 | * | ||
339 | * The @alignment field is specified when the volume is created and cannot be | ||
340 | * later changed. It may be useful, for example, when a block-oriented file | ||
341 | * system works on top of UBI. The @data_pad field is calculated using the | ||
342 | * logical eraseblock size and @alignment. The alignment must be multiple to the | ||
343 | * minimal flash I/O unit. If @alignment is 1, all the available space of | ||
344 | * the physical eraseblocks is used. | ||
345 | * | ||
346 | * Empty records contain all zeroes and the CRC checksum of those zeroes. | ||
347 | */ | ||
348 | struct ubi_vtbl_record { | ||
349 | ubi32_t reserved_pebs; | ||
350 | ubi32_t alignment; | ||
351 | ubi32_t data_pad; | ||
352 | uint8_t vol_type; | ||
353 | uint8_t upd_marker; | ||
354 | ubi16_t name_len; | ||
355 | uint8_t name[UBI_VOL_NAME_MAX+1]; | ||
356 | uint8_t padding2[24]; | ||
357 | ubi32_t crc; | ||
358 | } __attribute__ ((packed)); | ||
359 | |||
360 | #endif /* !__UBI_HEADER_H__ */ | ||
diff --git a/include/mtd/ubi-user.h b/include/mtd/ubi-user.h new file mode 100644 index 000000000000..fe06ded0e6b8 --- /dev/null +++ b/include/mtd/ubi-user.h | |||
@@ -0,0 +1,161 @@ | |||
1 | /* | ||
2 | * Copyright (c) International Business Machines Corp., 2006 | ||
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 | ||
12 | * the 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 | * Author: Artem Bityutskiy (Битюцкий Артём) | ||
19 | */ | ||
20 | |||
21 | #ifndef __UBI_USER_H__ | ||
22 | #define __UBI_USER_H__ | ||
23 | |||
24 | /* | ||
25 | * UBI volume creation | ||
26 | * ~~~~~~~~~~~~~~~~~~~ | ||
27 | * | ||
28 | * UBI volumes are created via the %UBI_IOCMKVOL IOCTL command of UBI character | ||
29 | * device. A &struct ubi_mkvol_req object has to be properly filled and a | ||
30 | * pointer to it has to be passed to the IOCTL. | ||
31 | * | ||
32 | * UBI volume deletion | ||
33 | * ~~~~~~~~~~~~~~~~~~~ | ||
34 | * | ||
35 | * To delete a volume, the %UBI_IOCRMVOL IOCTL command of the UBI character | ||
36 | * device should be used. A pointer to the 32-bit volume ID hast to be passed | ||
37 | * to the IOCTL. | ||
38 | * | ||
39 | * UBI volume re-size | ||
40 | * ~~~~~~~~~~~~~~~~~~ | ||
41 | * | ||
42 | * To re-size a volume, the %UBI_IOCRSVOL IOCTL command of the UBI character | ||
43 | * device should be used. A &struct ubi_rsvol_req object has to be properly | ||
44 | * filled and a pointer to it has to be passed to the IOCTL. | ||
45 | * | ||
46 | * UBI volume update | ||
47 | * ~~~~~~~~~~~~~~~~~ | ||
48 | * | ||
49 | * Volume update should be done via the %UBI_IOCVOLUP IOCTL command of the | ||
50 | * corresponding UBI volume character device. A pointer to a 64-bit update | ||
51 | * size should be passed to the IOCTL. After then, UBI expects user to write | ||
52 | * this number of bytes to the volume character device. The update is finished | ||
53 | * when the claimed number of bytes is passed. So, the volume update sequence | ||
54 | * is something like: | ||
55 | * | ||
56 | * fd = open("/dev/my_volume"); | ||
57 | * ioctl(fd, UBI_IOCVOLUP, &image_size); | ||
58 | * write(fd, buf, image_size); | ||
59 | * close(fd); | ||
60 | */ | ||
61 | |||
62 | /* | ||
63 | * When a new volume is created, users may either specify the volume number they | ||
64 | * want to create or to let UBI automatically assign a volume number using this | ||
65 | * constant. | ||
66 | */ | ||
67 | #define UBI_VOL_NUM_AUTO (-1) | ||
68 | |||
69 | /* Maximum volume name length */ | ||
70 | #define UBI_MAX_VOLUME_NAME 127 | ||
71 | |||
72 | /* IOCTL commands of UBI character devices */ | ||
73 | |||
74 | #define UBI_IOC_MAGIC 'o' | ||
75 | |||
76 | /* Create an UBI volume */ | ||
77 | #define UBI_IOCMKVOL _IOW(UBI_IOC_MAGIC, 0, struct ubi_mkvol_req) | ||
78 | /* Remove an UBI volume */ | ||
79 | #define UBI_IOCRMVOL _IOW(UBI_IOC_MAGIC, 1, int32_t) | ||
80 | /* Re-size an UBI volume */ | ||
81 | #define UBI_IOCRSVOL _IOW(UBI_IOC_MAGIC, 2, struct ubi_rsvol_req) | ||
82 | |||
83 | /* IOCTL commands of UBI volume character devices */ | ||
84 | |||
85 | #define UBI_VOL_IOC_MAGIC 'O' | ||
86 | |||
87 | /* Start UBI volume update */ | ||
88 | #define UBI_IOCVOLUP _IOW(UBI_VOL_IOC_MAGIC, 0, int64_t) | ||
89 | /* An eraseblock erasure command, used for debugging, disabled by default */ | ||
90 | #define UBI_IOCEBER _IOW(UBI_VOL_IOC_MAGIC, 1, int32_t) | ||
91 | |||
92 | /* | ||
93 | * UBI volume type constants. | ||
94 | * | ||
95 | * @UBI_DYNAMIC_VOLUME: dynamic volume | ||
96 | * @UBI_STATIC_VOLUME: static volume | ||
97 | */ | ||
98 | enum { | ||
99 | UBI_DYNAMIC_VOLUME = 3, | ||
100 | UBI_STATIC_VOLUME = 4 | ||
101 | }; | ||
102 | |||
103 | /** | ||
104 | * struct ubi_mkvol_req - volume description data structure used in | ||
105 | * volume creation requests. | ||
106 | * @vol_id: volume number | ||
107 | * @alignment: volume alignment | ||
108 | * @bytes: volume size in bytes | ||
109 | * @vol_type: volume type (%UBI_DYNAMIC_VOLUME or %UBI_STATIC_VOLUME) | ||
110 | * @padding1: reserved for future, not used | ||
111 | * @name_len: volume name length | ||
112 | * @padding2: reserved for future, not used | ||
113 | * @name: volume name | ||
114 | * | ||
115 | * This structure is used by userspace programs when creating new volumes. The | ||
116 | * @used_bytes field is only necessary when creating static volumes. | ||
117 | * | ||
118 | * The @alignment field specifies the required alignment of the volume logical | ||
119 | * eraseblock. This means, that the size of logical eraseblocks will be aligned | ||
120 | * to this number, i.e., | ||
121 | * (UBI device logical eraseblock size) mod (@alignment) = 0. | ||
122 | * | ||
123 | * To put it differently, the logical eraseblock of this volume may be slightly | ||
124 | * shortened in order to make it properly aligned. The alignment has to be | ||
125 | * multiple of the flash minimal input/output unit, or %1 to utilize the entire | ||
126 | * available space of logical eraseblocks. | ||
127 | * | ||
128 | * The @alignment field may be useful, for example, when one wants to maintain | ||
129 | * a block device on top of an UBI volume. In this case, it is desirable to fit | ||
130 | * an integer number of blocks in logical eraseblocks of this UBI volume. With | ||
131 | * alignment it is possible to update this volume using plane UBI volume image | ||
132 | * BLOBs, without caring about how to properly align them. | ||
133 | */ | ||
134 | struct ubi_mkvol_req { | ||
135 | int32_t vol_id; | ||
136 | int32_t alignment; | ||
137 | int64_t bytes; | ||
138 | int8_t vol_type; | ||
139 | int8_t padding1; | ||
140 | int16_t name_len; | ||
141 | int8_t padding2[4]; | ||
142 | char name[UBI_MAX_VOLUME_NAME+1]; | ||
143 | } __attribute__ ((packed)); | ||
144 | |||
145 | /** | ||
146 | * struct ubi_rsvol_req - a data structure used in volume re-size requests. | ||
147 | * @vol_id: ID of the volume to re-size | ||
148 | * @bytes: new size of the volume in bytes | ||
149 | * | ||
150 | * Re-sizing is possible for both dynamic and static volumes. But while dynamic | ||
151 | * volumes may be re-sized arbitrarily, static volumes cannot be made to be | ||
152 | * smaller then the number of bytes they bear. To arbitrarily shrink a static | ||
153 | * volume, it must be wiped out first (by means of volume update operation with | ||
154 | * zero number of bytes). | ||
155 | */ | ||
156 | struct ubi_rsvol_req { | ||
157 | int64_t bytes; | ||
158 | int32_t vol_id; | ||
159 | } __attribute__ ((packed)); | ||
160 | |||
161 | #endif /* __UBI_USER_H__ */ | ||
diff --git a/include/net/addrconf.h b/include/net/addrconf.h index 88df8fc814e4..f3531d0bcd05 100644 --- a/include/net/addrconf.h +++ b/include/net/addrconf.h | |||
@@ -73,7 +73,9 @@ extern int ipv6_get_saddr(struct dst_entry *dst, | |||
73 | extern int ipv6_dev_get_saddr(struct net_device *dev, | 73 | extern int ipv6_dev_get_saddr(struct net_device *dev, |
74 | struct in6_addr *daddr, | 74 | struct in6_addr *daddr, |
75 | struct in6_addr *saddr); | 75 | struct in6_addr *saddr); |
76 | extern int ipv6_get_lladdr(struct net_device *dev, struct in6_addr *); | 76 | extern int ipv6_get_lladdr(struct net_device *dev, |
77 | struct in6_addr *addr, | ||
78 | unsigned char banned_flags); | ||
77 | extern int ipv6_rcv_saddr_equal(const struct sock *sk, | 79 | extern int ipv6_rcv_saddr_equal(const struct sock *sk, |
78 | const struct sock *sk2); | 80 | const struct sock *sk2); |
79 | extern void addrconf_join_solict(struct net_device *dev, | 81 | extern void addrconf_join_solict(struct net_device *dev, |
diff --git a/include/net/af_rxrpc.h b/include/net/af_rxrpc.h new file mode 100644 index 000000000000..00c2eaa07c25 --- /dev/null +++ b/include/net/af_rxrpc.h | |||
@@ -0,0 +1,57 @@ | |||
1 | /* RxRPC kernel service interface definitions | ||
2 | * | ||
3 | * Copyright (C) 2007 Red Hat, Inc. All Rights Reserved. | ||
4 | * Written by David Howells (dhowells@redhat.com) | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or | ||
7 | * modify it under the terms of the GNU General Public License | ||
8 | * as published by the Free Software Foundation; either version | ||
9 | * 2 of the License, or (at your option) any later version. | ||
10 | */ | ||
11 | |||
12 | #ifndef _NET_RXRPC_H | ||
13 | #define _NET_RXRPC_H | ||
14 | |||
15 | #ifdef __KERNEL__ | ||
16 | |||
17 | #include <linux/rxrpc.h> | ||
18 | |||
19 | struct rxrpc_call; | ||
20 | |||
21 | /* | ||
22 | * the mark applied to socket buffers that may be intercepted | ||
23 | */ | ||
24 | enum { | ||
25 | RXRPC_SKB_MARK_DATA, /* data message */ | ||
26 | RXRPC_SKB_MARK_FINAL_ACK, /* final ACK received message */ | ||
27 | RXRPC_SKB_MARK_BUSY, /* server busy message */ | ||
28 | RXRPC_SKB_MARK_REMOTE_ABORT, /* remote abort message */ | ||
29 | RXRPC_SKB_MARK_NET_ERROR, /* network error message */ | ||
30 | RXRPC_SKB_MARK_LOCAL_ERROR, /* local error message */ | ||
31 | RXRPC_SKB_MARK_NEW_CALL, /* local error message */ | ||
32 | }; | ||
33 | |||
34 | typedef void (*rxrpc_interceptor_t)(struct sock *, unsigned long, | ||
35 | struct sk_buff *); | ||
36 | extern void rxrpc_kernel_intercept_rx_messages(struct socket *, | ||
37 | rxrpc_interceptor_t); | ||
38 | extern struct rxrpc_call *rxrpc_kernel_begin_call(struct socket *, | ||
39 | struct sockaddr_rxrpc *, | ||
40 | struct key *, | ||
41 | unsigned long, | ||
42 | gfp_t); | ||
43 | extern int rxrpc_kernel_send_data(struct rxrpc_call *, struct msghdr *, | ||
44 | size_t); | ||
45 | extern void rxrpc_kernel_abort_call(struct rxrpc_call *, u32); | ||
46 | extern void rxrpc_kernel_end_call(struct rxrpc_call *); | ||
47 | extern bool rxrpc_kernel_is_data_last(struct sk_buff *); | ||
48 | extern u32 rxrpc_kernel_get_abort_code(struct sk_buff *); | ||
49 | extern int rxrpc_kernel_get_error_number(struct sk_buff *); | ||
50 | extern void rxrpc_kernel_data_delivered(struct sk_buff *); | ||
51 | extern void rxrpc_kernel_free_skb(struct sk_buff *); | ||
52 | extern struct rxrpc_call *rxrpc_kernel_accept_call(struct socket *, | ||
53 | unsigned long); | ||
54 | extern int rxrpc_kernel_reject_call(struct socket *); | ||
55 | |||
56 | #endif /* __KERNEL__ */ | ||
57 | #endif /* _NET_RXRPC_H */ | ||
diff --git a/include/net/ax25.h b/include/net/ax25.h index 47ff2f46e908..99a4e364c74a 100644 --- a/include/net/ax25.h +++ b/include/net/ax25.h | |||
@@ -263,8 +263,8 @@ static __inline__ void ax25_cb_put(ax25_cb *ax25) | |||
263 | static inline __be16 ax25_type_trans(struct sk_buff *skb, struct net_device *dev) | 263 | static inline __be16 ax25_type_trans(struct sk_buff *skb, struct net_device *dev) |
264 | { | 264 | { |
265 | skb->dev = dev; | 265 | skb->dev = dev; |
266 | skb_reset_mac_header(skb); | ||
266 | skb->pkt_type = PACKET_HOST; | 267 | skb->pkt_type = PACKET_HOST; |
267 | skb->mac.raw = skb->data; | ||
268 | return htons(ETH_P_AX25); | 268 | return htons(ETH_P_AX25); |
269 | } | 269 | } |
270 | 270 | ||
diff --git a/include/net/bluetooth/hci.h b/include/net/bluetooth/hci.h index 41456c148842..93ce272a5d27 100644 --- a/include/net/bluetooth/hci.h +++ b/include/net/bluetooth/hci.h | |||
@@ -709,6 +709,24 @@ struct hci_sco_hdr { | |||
709 | __u8 dlen; | 709 | __u8 dlen; |
710 | } __attribute__ ((packed)); | 710 | } __attribute__ ((packed)); |
711 | 711 | ||
712 | #ifdef __KERNEL__ | ||
713 | #include <linux/skbuff.h> | ||
714 | static inline struct hci_event_hdr *hci_event_hdr(const struct sk_buff *skb) | ||
715 | { | ||
716 | return (struct hci_event_hdr *)skb->data; | ||
717 | } | ||
718 | |||
719 | static inline struct hci_acl_hdr *hci_acl_hdr(const struct sk_buff *skb) | ||
720 | { | ||
721 | return (struct hci_acl_hdr *)skb->data; | ||
722 | } | ||
723 | |||
724 | static inline struct hci_sco_hdr *hci_sco_hdr(const struct sk_buff *skb) | ||
725 | { | ||
726 | return (struct hci_sco_hdr *)skb->data; | ||
727 | } | ||
728 | #endif | ||
729 | |||
712 | /* Command opcode pack/unpack */ | 730 | /* Command opcode pack/unpack */ |
713 | #define hci_opcode_pack(ogf, ocf) (__u16) ((ocf & 0x03ff)|(ogf << 10)) | 731 | #define hci_opcode_pack(ogf, ocf) (__u16) ((ocf & 0x03ff)|(ogf << 10)) |
714 | #define hci_opcode_ogf(op) (op >> 10) | 732 | #define hci_opcode_ogf(op) (op >> 10) |
diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h new file mode 100644 index 000000000000..88171f8ce58a --- /dev/null +++ b/include/net/cfg80211.h | |||
@@ -0,0 +1,40 @@ | |||
1 | #ifndef __NET_CFG80211_H | ||
2 | #define __NET_CFG80211_H | ||
3 | |||
4 | #include <linux/netlink.h> | ||
5 | #include <linux/skbuff.h> | ||
6 | #include <net/genetlink.h> | ||
7 | |||
8 | /* | ||
9 | * 802.11 configuration in-kernel interface | ||
10 | * | ||
11 | * Copyright 2006 Johannes Berg <johannes@sipsolutions.net> | ||
12 | */ | ||
13 | |||
14 | /* from net/wireless.h */ | ||
15 | struct wiphy; | ||
16 | |||
17 | /** | ||
18 | * struct cfg80211_ops - backend description for wireless configuration | ||
19 | * | ||
20 | * This struct is registered by fullmac card drivers and/or wireless stacks | ||
21 | * in order to handle configuration requests on their interfaces. | ||
22 | * | ||
23 | * All callbacks except where otherwise noted should return 0 | ||
24 | * on success or a negative error code. | ||
25 | * | ||
26 | * All operations are currently invoked under rtnl for consistency with the | ||
27 | * wireless extensions but this is subject to reevaluation as soon as this | ||
28 | * code is used more widely and we have a first user without wext. | ||
29 | * | ||
30 | * @add_virtual_intf: create a new virtual interface with the given name | ||
31 | * | ||
32 | * @del_virtual_intf: remove the virtual interface determined by ifindex. | ||
33 | */ | ||
34 | struct cfg80211_ops { | ||
35 | int (*add_virtual_intf)(struct wiphy *wiphy, char *name, | ||
36 | unsigned int type); | ||
37 | int (*del_virtual_intf)(struct wiphy *wiphy, int ifindex); | ||
38 | }; | ||
39 | |||
40 | #endif /* __NET_CFG80211_H */ | ||
diff --git a/include/net/cipso_ipv4.h b/include/net/cipso_ipv4.h index 4c9522c5178f..4f90f5554fac 100644 --- a/include/net/cipso_ipv4.h +++ b/include/net/cipso_ipv4.h | |||
@@ -120,7 +120,7 @@ extern int cipso_v4_rbm_strictvalid; | |||
120 | */ | 120 | */ |
121 | 121 | ||
122 | #define CIPSO_V4_OPTEXIST(x) (IPCB(x)->opt.cipso != 0) | 122 | #define CIPSO_V4_OPTEXIST(x) (IPCB(x)->opt.cipso != 0) |
123 | #define CIPSO_V4_OPTPTR(x) ((x)->nh.raw + IPCB(x)->opt.cipso) | 123 | #define CIPSO_V4_OPTPTR(x) (skb_network_header(x) + IPCB(x)->opt.cipso) |
124 | 124 | ||
125 | /* | 125 | /* |
126 | * DOI List Functions | 126 | * DOI List Functions |
diff --git a/include/net/compat.h b/include/net/compat.h index 9859b60280d5..406db242f73a 100644 --- a/include/net/compat.h +++ b/include/net/compat.h | |||
@@ -25,6 +25,7 @@ struct compat_cmsghdr { | |||
25 | }; | 25 | }; |
26 | 26 | ||
27 | extern int compat_sock_get_timestamp(struct sock *, struct timeval __user *); | 27 | extern int compat_sock_get_timestamp(struct sock *, struct timeval __user *); |
28 | extern int compat_sock_get_timestampns(struct sock *, struct timespec __user *); | ||
28 | 29 | ||
29 | #else /* defined(CONFIG_COMPAT) */ | 30 | #else /* defined(CONFIG_COMPAT) */ |
30 | #define compat_msghdr msghdr /* to avoid compiler warnings */ | 31 | #define compat_msghdr msghdr /* to avoid compiler warnings */ |
diff --git a/include/net/dn_fib.h b/include/net/dn_fib.h index f01626cbbed6..30125119c950 100644 --- a/include/net/dn_fib.h +++ b/include/net/dn_fib.h | |||
@@ -148,17 +148,8 @@ extern void dn_fib_rules_cleanup(void); | |||
148 | extern unsigned dnet_addr_type(__le16 addr); | 148 | extern unsigned dnet_addr_type(__le16 addr); |
149 | extern int dn_fib_lookup(struct flowi *fl, struct dn_fib_res *res); | 149 | extern int dn_fib_lookup(struct flowi *fl, struct dn_fib_res *res); |
150 | 150 | ||
151 | /* | ||
152 | * rtnetlink interface | ||
153 | */ | ||
154 | extern int dn_fib_rtm_delroute(struct sk_buff *skb, struct nlmsghdr *nlh, void *arg); | ||
155 | extern int dn_fib_rtm_newroute(struct sk_buff *skb, struct nlmsghdr *nlh, void *arg); | ||
156 | extern int dn_fib_dump(struct sk_buff *skb, struct netlink_callback *cb); | 151 | extern int dn_fib_dump(struct sk_buff *skb, struct netlink_callback *cb); |
157 | 152 | ||
158 | extern int dn_fib_rtm_delrule(struct sk_buff *skb, struct nlmsghdr *nlh, void *arg); | ||
159 | extern int dn_fib_rtm_newrule(struct sk_buff *skb, struct nlmsghdr *nlh, void *arg); | ||
160 | extern int dn_fib_dump_rules(struct sk_buff *skb, struct netlink_callback *cb); | ||
161 | |||
162 | extern void dn_fib_free_info(struct dn_fib_info *fi); | 153 | extern void dn_fib_free_info(struct dn_fib_info *fi); |
163 | 154 | ||
164 | static inline void dn_fib_info_put(struct dn_fib_info *fi) | 155 | static inline void dn_fib_info_put(struct dn_fib_info *fi) |
diff --git a/include/net/dn_route.h b/include/net/dn_route.h index a566944c4962..c10e8e7e59a7 100644 --- a/include/net/dn_route.h +++ b/include/net/dn_route.h | |||
@@ -18,7 +18,6 @@ | |||
18 | extern struct sk_buff *dn_alloc_skb(struct sock *sk, int size, gfp_t pri); | 18 | extern struct sk_buff *dn_alloc_skb(struct sock *sk, int size, gfp_t pri); |
19 | extern int dn_route_output_sock(struct dst_entry **pprt, struct flowi *, struct sock *sk, int flags); | 19 | extern int dn_route_output_sock(struct dst_entry **pprt, struct flowi *, struct sock *sk, int flags); |
20 | extern int dn_cache_dump(struct sk_buff *skb, struct netlink_callback *cb); | 20 | extern int dn_cache_dump(struct sk_buff *skb, struct netlink_callback *cb); |
21 | extern int dn_cache_getroute(struct sk_buff *skb, struct nlmsghdr *nlh, void *arg); | ||
22 | extern void dn_rt_cache_flush(int delay); | 21 | extern void dn_rt_cache_flush(int delay); |
23 | 22 | ||
24 | /* Masks for flags field */ | 23 | /* Masks for flags field */ |
diff --git a/include/net/esp.h b/include/net/esp.h index 713d039f4af7..d05d8d2c78f4 100644 --- a/include/net/esp.h +++ b/include/net/esp.h | |||
@@ -40,8 +40,6 @@ struct esp_data | |||
40 | } auth; | 40 | } auth; |
41 | }; | 41 | }; |
42 | 42 | ||
43 | extern int skb_to_sgvec(struct sk_buff *skb, struct scatterlist *sg, int offset, int len); | ||
44 | extern int skb_cow_data(struct sk_buff *skb, int tailbits, struct sk_buff **trailer); | ||
45 | extern void *pskb_put(struct sk_buff *skb, struct sk_buff *tail, int len); | 43 | extern void *pskb_put(struct sk_buff *skb, struct sk_buff *tail, int len); |
46 | 44 | ||
47 | static inline int esp_mac_digest(struct esp_data *esp, struct sk_buff *skb, | 45 | static inline int esp_mac_digest(struct esp_data *esp, struct sk_buff *skb, |
diff --git a/include/net/fib_rules.h b/include/net/fib_rules.h index d585ea9fa97d..ed3a8872c6ca 100644 --- a/include/net/fib_rules.h +++ b/include/net/fib_rules.h | |||
@@ -5,7 +5,7 @@ | |||
5 | #include <linux/netdevice.h> | 5 | #include <linux/netdevice.h> |
6 | #include <linux/fib_rules.h> | 6 | #include <linux/fib_rules.h> |
7 | #include <net/flow.h> | 7 | #include <net/flow.h> |
8 | #include <net/netlink.h> | 8 | #include <net/rtnetlink.h> |
9 | 9 | ||
10 | struct fib_rule | 10 | struct fib_rule |
11 | { | 11 | { |
@@ -19,6 +19,8 @@ struct fib_rule | |||
19 | u32 flags; | 19 | u32 flags; |
20 | u32 table; | 20 | u32 table; |
21 | u8 action; | 21 | u8 action; |
22 | u32 target; | ||
23 | struct fib_rule * ctarget; | ||
22 | struct rcu_head rcu; | 24 | struct rcu_head rcu; |
23 | }; | 25 | }; |
24 | 26 | ||
@@ -35,6 +37,8 @@ struct fib_rules_ops | |||
35 | struct list_head list; | 37 | struct list_head list; |
36 | int rule_size; | 38 | int rule_size; |
37 | int addr_size; | 39 | int addr_size; |
40 | int unresolved_rules; | ||
41 | int nr_goto_rules; | ||
38 | 42 | ||
39 | int (*action)(struct fib_rule *, | 43 | int (*action)(struct fib_rule *, |
40 | struct flowi *, int, | 44 | struct flowi *, int, |
@@ -55,6 +59,10 @@ struct fib_rules_ops | |||
55 | u32 (*default_pref)(void); | 59 | u32 (*default_pref)(void); |
56 | size_t (*nlmsg_payload)(struct fib_rule *); | 60 | size_t (*nlmsg_payload)(struct fib_rule *); |
57 | 61 | ||
62 | /* Called after modifications to the rules set, must flush | ||
63 | * the route cache if one exists. */ | ||
64 | void (*flush_cache)(void); | ||
65 | |||
58 | int nlgroup; | 66 | int nlgroup; |
59 | struct nla_policy *policy; | 67 | struct nla_policy *policy; |
60 | struct list_head *rules_list; | 68 | struct list_head *rules_list; |
@@ -66,7 +74,8 @@ struct fib_rules_ops | |||
66 | [FRA_PRIORITY] = { .type = NLA_U32 }, \ | 74 | [FRA_PRIORITY] = { .type = NLA_U32 }, \ |
67 | [FRA_FWMARK] = { .type = NLA_U32 }, \ | 75 | [FRA_FWMARK] = { .type = NLA_U32 }, \ |
68 | [FRA_FWMASK] = { .type = NLA_U32 }, \ | 76 | [FRA_FWMASK] = { .type = NLA_U32 }, \ |
69 | [FRA_TABLE] = { .type = NLA_U32 } | 77 | [FRA_TABLE] = { .type = NLA_U32 }, \ |
78 | [FRA_GOTO] = { .type = NLA_U32 } | ||
70 | 79 | ||
71 | static inline void fib_rule_get(struct fib_rule *rule) | 80 | static inline void fib_rule_get(struct fib_rule *rule) |
72 | { | 81 | { |
@@ -98,11 +107,4 @@ extern int fib_rules_unregister(struct fib_rules_ops *); | |||
98 | extern int fib_rules_lookup(struct fib_rules_ops *, | 107 | extern int fib_rules_lookup(struct fib_rules_ops *, |
99 | struct flowi *, int flags, | 108 | struct flowi *, int flags, |
100 | struct fib_lookup_arg *); | 109 | struct fib_lookup_arg *); |
101 | |||
102 | extern int fib_nl_newrule(struct sk_buff *, | ||
103 | struct nlmsghdr *, void *); | ||
104 | extern int fib_nl_delrule(struct sk_buff *, | ||
105 | struct nlmsghdr *, void *); | ||
106 | extern int fib_rules_dump(struct sk_buff *, | ||
107 | struct netlink_callback *, int); | ||
108 | #endif | 110 | #endif |
diff --git a/include/net/inet6_hashtables.h b/include/net/inet6_hashtables.h index c28e424f53d9..668056b4bb0b 100644 --- a/include/net/inet6_hashtables.h +++ b/include/net/inet6_hashtables.h | |||
@@ -19,6 +19,9 @@ | |||
19 | #include <linux/in6.h> | 19 | #include <linux/in6.h> |
20 | #include <linux/ipv6.h> | 20 | #include <linux/ipv6.h> |
21 | #include <linux/types.h> | 21 | #include <linux/types.h> |
22 | #include <linux/jhash.h> | ||
23 | |||
24 | #include <net/inet_sock.h> | ||
22 | 25 | ||
23 | #include <net/ipv6.h> | 26 | #include <net/ipv6.h> |
24 | 27 | ||
@@ -28,12 +31,11 @@ struct inet_hashinfo; | |||
28 | static inline unsigned int inet6_ehashfn(const struct in6_addr *laddr, const u16 lport, | 31 | static inline unsigned int inet6_ehashfn(const struct in6_addr *laddr, const u16 lport, |
29 | const struct in6_addr *faddr, const __be16 fport) | 32 | const struct in6_addr *faddr, const __be16 fport) |
30 | { | 33 | { |
31 | unsigned int hashent = (lport ^ (__force u16)fport); | 34 | u32 ports = (lport ^ (__force u16)fport); |
32 | 35 | ||
33 | hashent ^= (__force u32)(laddr->s6_addr32[3] ^ faddr->s6_addr32[3]); | 36 | return jhash_3words((__force u32)laddr->s6_addr32[3], |
34 | hashent ^= hashent >> 16; | 37 | (__force u32)faddr->s6_addr32[3], |
35 | hashent ^= hashent >> 8; | 38 | ports, inet_ehash_secret); |
36 | return hashent; | ||
37 | } | 39 | } |
38 | 40 | ||
39 | static inline int inet6_sk_ehashfn(const struct sock *sk) | 41 | static inline int inet6_sk_ehashfn(const struct sock *sk) |
diff --git a/include/net/inet_ecn.h b/include/net/inet_ecn.h index 10117c8503e8..de8399a79774 100644 --- a/include/net/inet_ecn.h +++ b/include/net/inet_ecn.h | |||
@@ -114,13 +114,13 @@ static inline int INET_ECN_set_ce(struct sk_buff *skb) | |||
114 | { | 114 | { |
115 | switch (skb->protocol) { | 115 | switch (skb->protocol) { |
116 | case __constant_htons(ETH_P_IP): | 116 | case __constant_htons(ETH_P_IP): |
117 | if (skb->nh.raw + sizeof(struct iphdr) <= skb->tail) | 117 | if (skb->network_header + sizeof(struct iphdr) <= skb->tail) |
118 | return IP_ECN_set_ce(skb->nh.iph); | 118 | return IP_ECN_set_ce(ip_hdr(skb)); |
119 | break; | 119 | break; |
120 | 120 | ||
121 | case __constant_htons(ETH_P_IPV6): | 121 | case __constant_htons(ETH_P_IPV6): |
122 | if (skb->nh.raw + sizeof(struct ipv6hdr) <= skb->tail) | 122 | if (skb->network_header + sizeof(struct ipv6hdr) <= skb->tail) |
123 | return IP6_ECN_set_ce(skb->nh.ipv6h); | 123 | return IP6_ECN_set_ce(ipv6_hdr(skb)); |
124 | break; | 124 | break; |
125 | } | 125 | } |
126 | 126 | ||
diff --git a/include/net/inet_sock.h b/include/net/inet_sock.h index ce6da97bc848..62daf214931f 100644 --- a/include/net/inet_sock.h +++ b/include/net/inet_sock.h | |||
@@ -19,6 +19,7 @@ | |||
19 | 19 | ||
20 | #include <linux/string.h> | 20 | #include <linux/string.h> |
21 | #include <linux/types.h> | 21 | #include <linux/types.h> |
22 | #include <linux/jhash.h> | ||
22 | 23 | ||
23 | #include <net/flow.h> | 24 | #include <net/flow.h> |
24 | #include <net/sock.h> | 25 | #include <net/sock.h> |
@@ -167,13 +168,15 @@ static inline void inet_sk_copy_descendant(struct sock *sk_to, | |||
167 | 168 | ||
168 | extern int inet_sk_rebuild_header(struct sock *sk); | 169 | extern int inet_sk_rebuild_header(struct sock *sk); |
169 | 170 | ||
171 | extern u32 inet_ehash_secret; | ||
172 | extern void build_ehash_secret(void); | ||
173 | |||
170 | static inline unsigned int inet_ehashfn(const __be32 laddr, const __u16 lport, | 174 | static inline unsigned int inet_ehashfn(const __be32 laddr, const __u16 lport, |
171 | const __be32 faddr, const __be16 fport) | 175 | const __be32 faddr, const __be16 fport) |
172 | { | 176 | { |
173 | unsigned int h = ((__force __u32)laddr ^ lport) ^ ((__force __u32)faddr ^ (__force __u32)fport); | 177 | return jhash_2words((__force __u32) laddr ^ (__force __u32) faddr, |
174 | h ^= h >> 16; | 178 | ((__u32) lport) << 16 | (__force __u32)fport, |
175 | h ^= h >> 8; | 179 | inet_ehash_secret); |
176 | return h; | ||
177 | } | 180 | } |
178 | 181 | ||
179 | static inline int inet_sk_ehashfn(const struct sock *sk) | 182 | static inline int inet_sk_ehashfn(const struct sock *sk) |
diff --git a/include/net/ip.h b/include/net/ip.h index e79c3e3aa4f6..bb207db03675 100644 --- a/include/net/ip.h +++ b/include/net/ip.h | |||
@@ -25,6 +25,7 @@ | |||
25 | #include <linux/types.h> | 25 | #include <linux/types.h> |
26 | #include <linux/ip.h> | 26 | #include <linux/ip.h> |
27 | #include <linux/in.h> | 27 | #include <linux/in.h> |
28 | #include <linux/skbuff.h> | ||
28 | 29 | ||
29 | #include <net/inet_sock.h> | 30 | #include <net/inet_sock.h> |
30 | #include <net/snmp.h> | 31 | #include <net/snmp.h> |
@@ -43,6 +44,11 @@ struct inet_skb_parm | |||
43 | #define IPSKB_REROUTED 16 | 44 | #define IPSKB_REROUTED 16 |
44 | }; | 45 | }; |
45 | 46 | ||
47 | static inline unsigned int ip_hdrlen(const struct sk_buff *skb) | ||
48 | { | ||
49 | return ip_hdr(skb)->ihl * 4; | ||
50 | } | ||
51 | |||
46 | struct ipcm_cookie | 52 | struct ipcm_cookie |
47 | { | 53 | { |
48 | __be32 addr; | 54 | __be32 addr; |
@@ -74,7 +80,6 @@ struct msghdr; | |||
74 | struct net_device; | 80 | struct net_device; |
75 | struct packet_type; | 81 | struct packet_type; |
76 | struct rtable; | 82 | struct rtable; |
77 | struct sk_buff; | ||
78 | struct sockaddr; | 83 | struct sockaddr; |
79 | 84 | ||
80 | extern void ip_mc_dropsocket(struct sock *); | 85 | extern void ip_mc_dropsocket(struct sock *); |
@@ -161,6 +166,10 @@ DECLARE_SNMP_STAT(struct linux_mib, net_statistics); | |||
161 | #define NET_ADD_STATS_BH(field, adnd) SNMP_ADD_STATS_BH(net_statistics, field, adnd) | 166 | #define NET_ADD_STATS_BH(field, adnd) SNMP_ADD_STATS_BH(net_statistics, field, adnd) |
162 | #define NET_ADD_STATS_USER(field, adnd) SNMP_ADD_STATS_USER(net_statistics, field, adnd) | 167 | #define NET_ADD_STATS_USER(field, adnd) SNMP_ADD_STATS_USER(net_statistics, field, adnd) |
163 | 168 | ||
169 | extern unsigned long snmp_fold_field(void *mib[], int offt); | ||
170 | extern int snmp_mib_init(void *ptr[2], size_t mibsize, size_t mibalign); | ||
171 | extern void snmp_mib_free(void *ptr[2]); | ||
172 | |||
164 | extern int sysctl_local_port_range[2]; | 173 | extern int sysctl_local_port_range[2]; |
165 | extern int sysctl_ip_default_ttl; | 174 | extern int sysctl_ip_default_ttl; |
166 | extern int sysctl_ip_nonlocal_bind; | 175 | extern int sysctl_ip_nonlocal_bind; |
diff --git a/include/net/ip6_fib.h b/include/net/ip6_fib.h index cf355a3c2ad5..c48ea873f1e0 100644 --- a/include/net/ip6_fib.h +++ b/include/net/ip6_fib.h | |||
@@ -219,8 +219,6 @@ extern void fib6_init(void); | |||
219 | 219 | ||
220 | extern void fib6_rules_init(void); | 220 | extern void fib6_rules_init(void); |
221 | extern void fib6_rules_cleanup(void); | 221 | extern void fib6_rules_cleanup(void); |
222 | extern int fib6_rules_dump(struct sk_buff *, | ||
223 | struct netlink_callback *); | ||
224 | 222 | ||
225 | #endif | 223 | #endif |
226 | #endif | 224 | #endif |
diff --git a/include/net/ip6_route.h b/include/net/ip6_route.h index 4e927ebd1cb3..5456fdd6d047 100644 --- a/include/net/ip6_route.h +++ b/include/net/ip6_route.h | |||
@@ -116,12 +116,7 @@ extern void rt6_pmtu_discovery(struct in6_addr *daddr, | |||
116 | struct net_device *dev, | 116 | struct net_device *dev, |
117 | u32 pmtu); | 117 | u32 pmtu); |
118 | 118 | ||
119 | struct nlmsghdr; | ||
120 | struct netlink_callback; | 119 | struct netlink_callback; |
121 | extern int inet6_dump_fib(struct sk_buff *skb, struct netlink_callback *cb); | ||
122 | extern int inet6_rtm_newroute(struct sk_buff *skb, struct nlmsghdr* nlh, void *arg); | ||
123 | extern int inet6_rtm_delroute(struct sk_buff *skb, struct nlmsghdr* nlh, void *arg); | ||
124 | extern int inet6_rtm_getroute(struct sk_buff *skb, struct nlmsghdr* nlh, void *arg); | ||
125 | 120 | ||
126 | struct rt6_rtnl_dump_arg | 121 | struct rt6_rtnl_dump_arg |
127 | { | 122 | { |
diff --git a/include/net/ip_fib.h b/include/net/ip_fib.h index 36c635ca1aa6..5a4a0366c24f 100644 --- a/include/net/ip_fib.h +++ b/include/net/ip_fib.h | |||
@@ -215,10 +215,6 @@ extern void fib_select_default(const struct flowi *flp, struct fib_result *res); | |||
215 | /* Exported by fib_frontend.c */ | 215 | /* Exported by fib_frontend.c */ |
216 | extern struct nla_policy rtm_ipv4_policy[]; | 216 | extern struct nla_policy rtm_ipv4_policy[]; |
217 | extern void ip_fib_init(void); | 217 | extern void ip_fib_init(void); |
218 | extern int inet_rtm_delroute(struct sk_buff *skb, struct nlmsghdr* nlh, void *arg); | ||
219 | extern int inet_rtm_newroute(struct sk_buff *skb, struct nlmsghdr* nlh, void *arg); | ||
220 | extern int inet_rtm_getroute(struct sk_buff *skb, struct nlmsghdr* nlh, void *arg); | ||
221 | extern int inet_dump_fib(struct sk_buff *skb, struct netlink_callback *cb); | ||
222 | extern int fib_validate_source(__be32 src, __be32 dst, u8 tos, int oif, | 218 | extern int fib_validate_source(__be32 src, __be32 dst, u8 tos, int oif, |
223 | struct net_device *dev, __be32 *spec_dst, u32 *itag); | 219 | struct net_device *dev, __be32 *spec_dst, u32 *itag); |
224 | extern void fib_select_multipath(const struct flowi *flp, struct fib_result *res); | 220 | extern void fib_select_multipath(const struct flowi *flp, struct fib_result *res); |
@@ -235,8 +231,6 @@ extern __be32 __fib_res_prefsrc(struct fib_result *res); | |||
235 | extern struct fib_table *fib_hash_init(u32 id); | 231 | extern struct fib_table *fib_hash_init(u32 id); |
236 | 232 | ||
237 | #ifdef CONFIG_IP_MULTIPLE_TABLES | 233 | #ifdef CONFIG_IP_MULTIPLE_TABLES |
238 | extern int fib4_rules_dump(struct sk_buff *skb, struct netlink_callback *cb); | ||
239 | |||
240 | extern void __init fib4_rules_init(void); | 234 | extern void __init fib4_rules_init(void); |
241 | 235 | ||
242 | #ifdef CONFIG_NET_CLS_ROUTE | 236 | #ifdef CONFIG_NET_CLS_ROUTE |
diff --git a/include/net/ipv6.h b/include/net/ipv6.h index 00328b71a08c..f70afef9c3cc 100644 --- a/include/net/ipv6.h +++ b/include/net/ipv6.h | |||
@@ -166,13 +166,6 @@ DECLARE_SNMP_STAT(struct udp_mib, udplite_stats_in6); | |||
166 | if (is_udplite) SNMP_INC_STATS_USER(udplite_stats_in6, field); \ | 166 | if (is_udplite) SNMP_INC_STATS_USER(udplite_stats_in6, field); \ |
167 | else SNMP_INC_STATS_USER(udp_stats_in6, field); } while(0) | 167 | else SNMP_INC_STATS_USER(udp_stats_in6, field); } while(0) |
168 | 168 | ||
169 | int snmp6_register_dev(struct inet6_dev *idev); | ||
170 | int snmp6_unregister_dev(struct inet6_dev *idev); | ||
171 | int snmp6_alloc_dev(struct inet6_dev *idev); | ||
172 | int snmp6_free_dev(struct inet6_dev *idev); | ||
173 | int snmp6_mib_init(void *ptr[2], size_t mibsize, size_t mibalign); | ||
174 | void snmp6_mib_free(void *ptr[2]); | ||
175 | |||
176 | struct ip6_ra_chain | 169 | struct ip6_ra_chain |
177 | { | 170 | { |
178 | struct ip6_ra_chain *next; | 171 | struct ip6_ra_chain *next; |
@@ -605,8 +598,20 @@ extern int udplite6_proc_init(void); | |||
605 | extern void udplite6_proc_exit(void); | 598 | extern void udplite6_proc_exit(void); |
606 | extern int ipv6_misc_proc_init(void); | 599 | extern int ipv6_misc_proc_init(void); |
607 | extern void ipv6_misc_proc_exit(void); | 600 | extern void ipv6_misc_proc_exit(void); |
601 | extern int snmp6_register_dev(struct inet6_dev *idev); | ||
602 | extern int snmp6_unregister_dev(struct inet6_dev *idev); | ||
608 | 603 | ||
609 | extern struct rt6_statistics rt6_stats; | 604 | extern struct rt6_statistics rt6_stats; |
605 | #else | ||
606 | static inline int snmp6_register_dev(struct inet6_dev *idev) | ||
607 | { | ||
608 | return 0; | ||
609 | } | ||
610 | |||
611 | static inline int snmp6_unregister_dev(struct inet6_dev *idev) | ||
612 | { | ||
613 | return 0; | ||
614 | } | ||
610 | #endif | 615 | #endif |
611 | 616 | ||
612 | #ifdef CONFIG_SYSCTL | 617 | #ifdef CONFIG_SYSCTL |
diff --git a/include/net/ipx.h b/include/net/ipx.h index c6b2ee610866..4cc0b4eca948 100644 --- a/include/net/ipx.h +++ b/include/net/ipx.h | |||
@@ -43,7 +43,7 @@ struct ipxhdr { | |||
43 | 43 | ||
44 | static __inline__ struct ipxhdr *ipx_hdr(struct sk_buff *skb) | 44 | static __inline__ struct ipxhdr *ipx_hdr(struct sk_buff *skb) |
45 | { | 45 | { |
46 | return (struct ipxhdr *)skb->h.raw; | 46 | return (struct ipxhdr *)skb_transport_header(skb); |
47 | } | 47 | } |
48 | 48 | ||
49 | struct ipx_interface { | 49 | struct ipx_interface { |
diff --git a/include/net/iw_handler.h b/include/net/iw_handler.h index 8a830188354d..f23d07ca7c59 100644 --- a/include/net/iw_handler.h +++ b/include/net/iw_handler.h | |||
@@ -431,26 +431,7 @@ struct iw_public_data { | |||
431 | * Those may be called only within the kernel. | 431 | * Those may be called only within the kernel. |
432 | */ | 432 | */ |
433 | 433 | ||
434 | /* First : function strictly used inside the kernel */ | 434 | /* functions that may be called by driver modules */ |
435 | |||
436 | /* Handle /proc/net/wireless, called in net/code/dev.c */ | ||
437 | extern int dev_get_wireless_info(char * buffer, char **start, off_t offset, | ||
438 | int length); | ||
439 | |||
440 | /* Handle IOCTLs, called in net/core/dev.c */ | ||
441 | extern int wireless_process_ioctl(struct ifreq *ifr, unsigned int cmd); | ||
442 | |||
443 | /* Handle RtNetlink requests, called in net/core/rtnetlink.c */ | ||
444 | extern int wireless_rtnetlink_set(struct net_device * dev, | ||
445 | char * data, | ||
446 | int len); | ||
447 | extern int wireless_rtnetlink_get(struct net_device * dev, | ||
448 | char * data, | ||
449 | int len, | ||
450 | char ** p_buf, | ||
451 | int * p_len); | ||
452 | |||
453 | /* Second : functions that may be called by driver modules */ | ||
454 | 435 | ||
455 | /* Send a single event to user space */ | 436 | /* Send a single event to user space */ |
456 | extern void wireless_send_event(struct net_device * dev, | 437 | extern void wireless_send_event(struct net_device * dev, |
diff --git a/include/net/llc_pdu.h b/include/net/llc_pdu.h index aa33a477c3fb..4a8f58b17e43 100644 --- a/include/net/llc_pdu.h +++ b/include/net/llc_pdu.h | |||
@@ -203,7 +203,7 @@ struct llc_pdu_sn { | |||
203 | 203 | ||
204 | static inline struct llc_pdu_sn *llc_pdu_sn_hdr(struct sk_buff *skb) | 204 | static inline struct llc_pdu_sn *llc_pdu_sn_hdr(struct sk_buff *skb) |
205 | { | 205 | { |
206 | return (struct llc_pdu_sn *)skb->nh.raw; | 206 | return (struct llc_pdu_sn *)skb_network_header(skb); |
207 | } | 207 | } |
208 | 208 | ||
209 | /* Un-numbered PDU format (3 bytes in length) */ | 209 | /* Un-numbered PDU format (3 bytes in length) */ |
@@ -215,12 +215,7 @@ struct llc_pdu_un { | |||
215 | 215 | ||
216 | static inline struct llc_pdu_un *llc_pdu_un_hdr(struct sk_buff *skb) | 216 | static inline struct llc_pdu_un *llc_pdu_un_hdr(struct sk_buff *skb) |
217 | { | 217 | { |
218 | return (struct llc_pdu_un *)skb->nh.raw; | 218 | return (struct llc_pdu_un *)skb_network_header(skb); |
219 | } | ||
220 | |||
221 | static inline void *llc_set_pdu_hdr(struct sk_buff *skb, void *ptr) | ||
222 | { | ||
223 | return skb->nh.raw = ptr; | ||
224 | } | 219 | } |
225 | 220 | ||
226 | /** | 221 | /** |
@@ -237,7 +232,11 @@ static inline void llc_pdu_header_init(struct sk_buff *skb, u8 type, | |||
237 | u8 ssap, u8 dsap, u8 cr) | 232 | u8 ssap, u8 dsap, u8 cr) |
238 | { | 233 | { |
239 | const int hlen = type == LLC_PDU_TYPE_U ? 3 : 4; | 234 | const int hlen = type == LLC_PDU_TYPE_U ? 3 : 4; |
240 | struct llc_pdu_un *pdu = llc_set_pdu_hdr(skb, skb_push(skb, hlen)); | 235 | struct llc_pdu_un *pdu; |
236 | |||
237 | skb_push(skb, hlen); | ||
238 | skb_reset_network_header(skb); | ||
239 | pdu = llc_pdu_un_hdr(skb); | ||
241 | pdu->dsap = dsap; | 240 | pdu->dsap = dsap; |
242 | pdu->ssap = ssap; | 241 | pdu->ssap = ssap; |
243 | pdu->ssap |= cr; | 242 | pdu->ssap |= cr; |
diff --git a/include/net/neighbour.h b/include/net/neighbour.h index ad7fe1121412..a4f26187fc1a 100644 --- a/include/net/neighbour.h +++ b/include/net/neighbour.h | |||
@@ -24,6 +24,7 @@ | |||
24 | 24 | ||
25 | #include <linux/err.h> | 25 | #include <linux/err.h> |
26 | #include <linux/sysctl.h> | 26 | #include <linux/sysctl.h> |
27 | #include <net/rtnetlink.h> | ||
27 | 28 | ||
28 | #define NUD_IN_TIMER (NUD_INCOMPLETE|NUD_REACHABLE|NUD_DELAY|NUD_PROBE) | 29 | #define NUD_IN_TIMER (NUD_INCOMPLETE|NUD_REACHABLE|NUD_DELAY|NUD_PROBE) |
29 | #define NUD_VALID (NUD_PERMANENT|NUD_NOARP|NUD_REACHABLE|NUD_PROBE|NUD_STALE|NUD_DELAY) | 30 | #define NUD_VALID (NUD_PERMANENT|NUD_NOARP|NUD_REACHABLE|NUD_PROBE|NUD_STALE|NUD_DELAY) |
@@ -213,16 +214,7 @@ extern void pneigh_enqueue(struct neigh_table *tbl, struct neigh_parms *p, | |||
213 | extern struct pneigh_entry *pneigh_lookup(struct neigh_table *tbl, const void *key, struct net_device *dev, int creat); | 214 | extern struct pneigh_entry *pneigh_lookup(struct neigh_table *tbl, const void *key, struct net_device *dev, int creat); |
214 | extern int pneigh_delete(struct neigh_table *tbl, const void *key, struct net_device *dev); | 215 | extern int pneigh_delete(struct neigh_table *tbl, const void *key, struct net_device *dev); |
215 | 216 | ||
216 | struct netlink_callback; | ||
217 | struct nlmsghdr; | ||
218 | extern int neigh_dump_info(struct sk_buff *skb, struct netlink_callback *cb); | ||
219 | extern int neigh_add(struct sk_buff *skb, struct nlmsghdr *nlh, void *arg); | ||
220 | extern int neigh_delete(struct sk_buff *skb, struct nlmsghdr *nlh, void *arg); | ||
221 | extern void neigh_app_ns(struct neighbour *n); | 217 | extern void neigh_app_ns(struct neighbour *n); |
222 | |||
223 | extern int neightbl_dump_info(struct sk_buff *skb, struct netlink_callback *cb); | ||
224 | extern int neightbl_set(struct sk_buff *skb, struct nlmsghdr *nlh, void *arg); | ||
225 | |||
226 | extern void neigh_for_each(struct neigh_table *tbl, void (*cb)(struct neighbour *, void *), void *cookie); | 218 | extern void neigh_for_each(struct neigh_table *tbl, void (*cb)(struct neighbour *, void *), void *cookie); |
227 | extern void __neigh_for_each_release(struct neigh_table *tbl, int (*cb)(struct neighbour *)); | 219 | extern void __neigh_for_each_release(struct neigh_table *tbl, int (*cb)(struct neighbour *)); |
228 | extern void pneigh_for_each(struct neigh_table *tbl, void (*cb)(struct pneigh_entry *)); | 220 | extern void pneigh_for_each(struct neigh_table *tbl, void (*cb)(struct pneigh_entry *)); |
diff --git a/include/net/netfilter/nf_conntrack.h b/include/net/netfilter/nf_conntrack.h index 0e690e34c00b..1c6b8bd09b9a 100644 --- a/include/net/netfilter/nf_conntrack.h +++ b/include/net/netfilter/nf_conntrack.h | |||
@@ -250,6 +250,11 @@ static inline int nf_ct_is_dying(struct nf_conn *ct) | |||
250 | return test_bit(IPS_DYING_BIT, &ct->status); | 250 | return test_bit(IPS_DYING_BIT, &ct->status); |
251 | } | 251 | } |
252 | 252 | ||
253 | static inline int nf_ct_is_untracked(const struct sk_buff *skb) | ||
254 | { | ||
255 | return (skb->nfct == &nf_conntrack_untracked.ct_general); | ||
256 | } | ||
257 | |||
253 | extern unsigned int nf_conntrack_htable_size; | 258 | extern unsigned int nf_conntrack_htable_size; |
254 | extern int nf_conntrack_checksum; | 259 | extern int nf_conntrack_checksum; |
255 | extern atomic_t nf_conntrack_count; | 260 | extern atomic_t nf_conntrack_count; |
diff --git a/include/net/netfilter/nf_conntrack_compat.h b/include/net/netfilter/nf_conntrack_compat.h deleted file mode 100644 index 6f84c1f7fcd4..000000000000 --- a/include/net/netfilter/nf_conntrack_compat.h +++ /dev/null | |||
@@ -1,145 +0,0 @@ | |||
1 | #ifndef _NF_CONNTRACK_COMPAT_H | ||
2 | #define _NF_CONNTRACK_COMPAT_H | ||
3 | |||
4 | #ifdef __KERNEL__ | ||
5 | |||
6 | #if defined(CONFIG_IP_NF_CONNTRACK) || defined(CONFIG_IP_NF_CONNTRACK_MODULE) | ||
7 | |||
8 | #include <linux/netfilter_ipv4/ip_conntrack.h> | ||
9 | #include <linux/socket.h> | ||
10 | |||
11 | #ifdef CONFIG_IP_NF_CONNTRACK_MARK | ||
12 | static inline u_int32_t *nf_ct_get_mark(const struct sk_buff *skb, | ||
13 | u_int32_t *ctinfo) | ||
14 | { | ||
15 | struct ip_conntrack *ct = ip_conntrack_get(skb, ctinfo); | ||
16 | |||
17 | if (ct) | ||
18 | return &ct->mark; | ||
19 | else | ||
20 | return NULL; | ||
21 | } | ||
22 | #endif /* CONFIG_IP_NF_CONNTRACK_MARK */ | ||
23 | |||
24 | #ifdef CONFIG_IP_NF_CONNTRACK_SECMARK | ||
25 | static inline u_int32_t *nf_ct_get_secmark(const struct sk_buff *skb, | ||
26 | u_int32_t *ctinfo) | ||
27 | { | ||
28 | struct ip_conntrack *ct = ip_conntrack_get(skb, ctinfo); | ||
29 | |||
30 | if (ct) | ||
31 | return &ct->secmark; | ||
32 | else | ||
33 | return NULL; | ||
34 | } | ||
35 | #endif /* CONFIG_IP_NF_CONNTRACK_SECMARK */ | ||
36 | |||
37 | #ifdef CONFIG_IP_NF_CT_ACCT | ||
38 | static inline struct ip_conntrack_counter * | ||
39 | nf_ct_get_counters(const struct sk_buff *skb) | ||
40 | { | ||
41 | enum ip_conntrack_info ctinfo; | ||
42 | struct ip_conntrack *ct = ip_conntrack_get(skb, &ctinfo); | ||
43 | |||
44 | if (ct) | ||
45 | return ct->counters; | ||
46 | else | ||
47 | return NULL; | ||
48 | } | ||
49 | #endif /* CONFIG_IP_NF_CT_ACCT */ | ||
50 | |||
51 | static inline int nf_ct_is_untracked(const struct sk_buff *skb) | ||
52 | { | ||
53 | return (skb->nfct == &ip_conntrack_untracked.ct_general); | ||
54 | } | ||
55 | |||
56 | static inline void nf_ct_untrack(struct sk_buff *skb) | ||
57 | { | ||
58 | skb->nfct = &ip_conntrack_untracked.ct_general; | ||
59 | } | ||
60 | |||
61 | static inline int nf_ct_get_ctinfo(const struct sk_buff *skb, | ||
62 | enum ip_conntrack_info *ctinfo) | ||
63 | { | ||
64 | struct ip_conntrack *ct = ip_conntrack_get(skb, ctinfo); | ||
65 | return (ct != NULL); | ||
66 | } | ||
67 | |||
68 | static inline int nf_ct_l3proto_try_module_get(unsigned short l3proto) | ||
69 | { | ||
70 | need_conntrack(); | ||
71 | return l3proto == PF_INET ? 0 : -1; | ||
72 | } | ||
73 | |||
74 | static inline void nf_ct_l3proto_module_put(unsigned short l3proto) | ||
75 | { | ||
76 | } | ||
77 | |||
78 | #else /* CONFIG_IP_NF_CONNTRACK */ | ||
79 | |||
80 | #include <net/netfilter/ipv4/nf_conntrack_ipv4.h> | ||
81 | #include <net/netfilter/nf_conntrack.h> | ||
82 | |||
83 | #ifdef CONFIG_NF_CONNTRACK_MARK | ||
84 | |||
85 | static inline u_int32_t *nf_ct_get_mark(const struct sk_buff *skb, | ||
86 | u_int32_t *ctinfo) | ||
87 | { | ||
88 | struct nf_conn *ct = nf_ct_get(skb, ctinfo); | ||
89 | |||
90 | if (ct) | ||
91 | return &ct->mark; | ||
92 | else | ||
93 | return NULL; | ||
94 | } | ||
95 | #endif /* CONFIG_NF_CONNTRACK_MARK */ | ||
96 | |||
97 | #ifdef CONFIG_NF_CONNTRACK_SECMARK | ||
98 | static inline u_int32_t *nf_ct_get_secmark(const struct sk_buff *skb, | ||
99 | u_int32_t *ctinfo) | ||
100 | { | ||
101 | struct nf_conn *ct = nf_ct_get(skb, ctinfo); | ||
102 | |||
103 | if (ct) | ||
104 | return &ct->secmark; | ||
105 | else | ||
106 | return NULL; | ||
107 | } | ||
108 | #endif /* CONFIG_NF_CONNTRACK_MARK */ | ||
109 | |||
110 | #ifdef CONFIG_NF_CT_ACCT | ||
111 | static inline struct ip_conntrack_counter * | ||
112 | nf_ct_get_counters(const struct sk_buff *skb) | ||
113 | { | ||
114 | enum ip_conntrack_info ctinfo; | ||
115 | struct nf_conn *ct = nf_ct_get(skb, &ctinfo); | ||
116 | |||
117 | if (ct) | ||
118 | return ct->counters; | ||
119 | else | ||
120 | return NULL; | ||
121 | } | ||
122 | #endif /* CONFIG_NF_CT_ACCT */ | ||
123 | |||
124 | static inline int nf_ct_is_untracked(const struct sk_buff *skb) | ||
125 | { | ||
126 | return (skb->nfct == &nf_conntrack_untracked.ct_general); | ||
127 | } | ||
128 | |||
129 | static inline void nf_ct_untrack(struct sk_buff *skb) | ||
130 | { | ||
131 | skb->nfct = &nf_conntrack_untracked.ct_general; | ||
132 | } | ||
133 | |||
134 | static inline int nf_ct_get_ctinfo(const struct sk_buff *skb, | ||
135 | enum ip_conntrack_info *ctinfo) | ||
136 | { | ||
137 | struct nf_conn *ct = nf_ct_get(skb, ctinfo); | ||
138 | return (ct != NULL); | ||
139 | } | ||
140 | |||
141 | #endif /* CONFIG_IP_NF_CONNTRACK */ | ||
142 | |||
143 | #endif /* __KERNEL__ */ | ||
144 | |||
145 | #endif /* _NF_CONNTRACK_COMPAT_H */ | ||
diff --git a/include/net/netfilter/nf_conntrack_core.h b/include/net/netfilter/nf_conntrack_core.h index 85634e1865c3..9fb906688ffa 100644 --- a/include/net/netfilter/nf_conntrack_core.h +++ b/include/net/netfilter/nf_conntrack_core.h | |||
@@ -27,6 +27,9 @@ extern unsigned int nf_conntrack_in(int pf, | |||
27 | extern int nf_conntrack_init(void); | 27 | extern int nf_conntrack_init(void); |
28 | extern void nf_conntrack_cleanup(void); | 28 | extern void nf_conntrack_cleanup(void); |
29 | 29 | ||
30 | extern int nf_conntrack_proto_init(void); | ||
31 | extern void nf_conntrack_proto_fini(void); | ||
32 | |||
30 | struct nf_conntrack_l3proto; | 33 | struct nf_conntrack_l3proto; |
31 | extern struct nf_conntrack_l3proto *nf_ct_find_l3proto(u_int16_t pf); | 34 | extern struct nf_conntrack_l3proto *nf_ct_find_l3proto(u_int16_t pf); |
32 | /* Like above, but you already have conntrack read lock. */ | 35 | /* Like above, but you already have conntrack read lock. */ |
diff --git a/include/net/netfilter/nf_conntrack_ecache.h b/include/net/netfilter/nf_conntrack_ecache.h index b62a8a9ec9d8..811c9073c532 100644 --- a/include/net/netfilter/nf_conntrack_ecache.h +++ b/include/net/netfilter/nf_conntrack_ecache.h | |||
@@ -20,30 +20,8 @@ DECLARE_PER_CPU(struct nf_conntrack_ecache, nf_conntrack_ecache); | |||
20 | #define CONNTRACK_ECACHE(x) (__get_cpu_var(nf_conntrack_ecache).x) | 20 | #define CONNTRACK_ECACHE(x) (__get_cpu_var(nf_conntrack_ecache).x) |
21 | 21 | ||
22 | extern struct atomic_notifier_head nf_conntrack_chain; | 22 | extern struct atomic_notifier_head nf_conntrack_chain; |
23 | extern struct atomic_notifier_head nf_conntrack_expect_chain; | 23 | extern int nf_conntrack_register_notifier(struct notifier_block *nb); |
24 | 24 | extern int nf_conntrack_unregister_notifier(struct notifier_block *nb); | |
25 | static inline int nf_conntrack_register_notifier(struct notifier_block *nb) | ||
26 | { | ||
27 | return atomic_notifier_chain_register(&nf_conntrack_chain, nb); | ||
28 | } | ||
29 | |||
30 | static inline int nf_conntrack_unregister_notifier(struct notifier_block *nb) | ||
31 | { | ||
32 | return atomic_notifier_chain_unregister(&nf_conntrack_chain, nb); | ||
33 | } | ||
34 | |||
35 | static inline int | ||
36 | nf_conntrack_expect_register_notifier(struct notifier_block *nb) | ||
37 | { | ||
38 | return atomic_notifier_chain_register(&nf_conntrack_expect_chain, nb); | ||
39 | } | ||
40 | |||
41 | static inline int | ||
42 | nf_conntrack_expect_unregister_notifier(struct notifier_block *nb) | ||
43 | { | ||
44 | return atomic_notifier_chain_unregister(&nf_conntrack_expect_chain, | ||
45 | nb); | ||
46 | } | ||
47 | 25 | ||
48 | extern void nf_ct_deliver_cached_events(const struct nf_conn *ct); | 26 | extern void nf_ct_deliver_cached_events(const struct nf_conn *ct); |
49 | extern void __nf_ct_event_cache_init(struct nf_conn *ct); | 27 | extern void __nf_ct_event_cache_init(struct nf_conn *ct); |
@@ -71,6 +49,10 @@ static inline void nf_conntrack_event(enum ip_conntrack_events event, | |||
71 | atomic_notifier_call_chain(&nf_conntrack_chain, event, ct); | 49 | atomic_notifier_call_chain(&nf_conntrack_chain, event, ct); |
72 | } | 50 | } |
73 | 51 | ||
52 | extern struct atomic_notifier_head nf_conntrack_expect_chain; | ||
53 | extern int nf_conntrack_expect_register_notifier(struct notifier_block *nb); | ||
54 | extern int nf_conntrack_expect_unregister_notifier(struct notifier_block *nb); | ||
55 | |||
74 | static inline void | 56 | static inline void |
75 | nf_conntrack_expect_event(enum ip_conntrack_expect_events event, | 57 | nf_conntrack_expect_event(enum ip_conntrack_expect_events event, |
76 | struct nf_conntrack_expect *exp) | 58 | struct nf_conntrack_expect *exp) |
diff --git a/include/net/netfilter/nf_conntrack_l3proto.h b/include/net/netfilter/nf_conntrack_l3proto.h index eb575cbd4c95..f32f714e5d92 100644 --- a/include/net/netfilter/nf_conntrack_l3proto.h +++ b/include/net/netfilter/nf_conntrack_l3proto.h | |||
@@ -90,10 +90,7 @@ extern struct nf_conntrack_l3proto *nf_ct_l3protos[AF_MAX]; | |||
90 | /* Protocol registration. */ | 90 | /* Protocol registration. */ |
91 | extern int nf_conntrack_l3proto_register(struct nf_conntrack_l3proto *proto); | 91 | extern int nf_conntrack_l3proto_register(struct nf_conntrack_l3proto *proto); |
92 | extern void nf_conntrack_l3proto_unregister(struct nf_conntrack_l3proto *proto); | 92 | extern void nf_conntrack_l3proto_unregister(struct nf_conntrack_l3proto *proto); |
93 | 93 | extern struct nf_conntrack_l3proto *nf_ct_l3proto_find_get(u_int16_t l3proto); | |
94 | extern struct nf_conntrack_l3proto * | ||
95 | nf_ct_l3proto_find_get(u_int16_t l3proto); | ||
96 | |||
97 | extern void nf_ct_l3proto_put(struct nf_conntrack_l3proto *p); | 94 | extern void nf_ct_l3proto_put(struct nf_conntrack_l3proto *p); |
98 | 95 | ||
99 | /* Existing built-in protocols */ | 96 | /* Existing built-in protocols */ |
diff --git a/include/net/netfilter/nf_conntrack_l4proto.h b/include/net/netfilter/nf_conntrack_l4proto.h index 8415182ec126..f46cb930414c 100644 --- a/include/net/netfilter/nf_conntrack_l4proto.h +++ b/include/net/netfilter/nf_conntrack_l4proto.h | |||
@@ -97,7 +97,6 @@ extern struct nf_conntrack_l4proto nf_conntrack_l4proto_udp6; | |||
97 | extern struct nf_conntrack_l4proto nf_conntrack_l4proto_generic; | 97 | extern struct nf_conntrack_l4proto nf_conntrack_l4proto_generic; |
98 | 98 | ||
99 | #define MAX_NF_CT_PROTO 256 | 99 | #define MAX_NF_CT_PROTO 256 |
100 | extern struct nf_conntrack_l4proto **nf_ct_protos[PF_MAX]; | ||
101 | 100 | ||
102 | extern struct nf_conntrack_l4proto * | 101 | extern struct nf_conntrack_l4proto * |
103 | __nf_ct_l4proto_find(u_int16_t l3proto, u_int8_t l4proto); | 102 | __nf_ct_l4proto_find(u_int16_t l3proto, u_int8_t l4proto); |
diff --git a/include/net/netfilter/nf_nat_rule.h b/include/net/netfilter/nf_nat_rule.h index f191c672bcc6..e76565459ad9 100644 --- a/include/net/netfilter/nf_nat_rule.h +++ b/include/net/netfilter/nf_nat_rule.h | |||
@@ -4,16 +4,6 @@ | |||
4 | #include <net/netfilter/nf_nat.h> | 4 | #include <net/netfilter/nf_nat.h> |
5 | #include <linux/netfilter_ipv4/ip_tables.h> | 5 | #include <linux/netfilter_ipv4/ip_tables.h> |
6 | 6 | ||
7 | /* Compatibility definitions for ipt_FOO modules */ | ||
8 | #define ip_nat_range nf_nat_range | ||
9 | #define ip_conntrack_tuple nf_conntrack_tuple | ||
10 | #define ip_conntrack_get nf_ct_get | ||
11 | #define ip_conntrack nf_conn | ||
12 | #define ip_nat_setup_info nf_nat_setup_info | ||
13 | #define ip_nat_multi_range_compat nf_nat_multi_range_compat | ||
14 | #define ip_ct_iterate_cleanup nf_ct_iterate_cleanup | ||
15 | #define IP_NF_ASSERT NF_CT_ASSERT | ||
16 | |||
17 | extern int nf_nat_rule_init(void) __init; | 7 | extern int nf_nat_rule_init(void) __init; |
18 | extern void nf_nat_rule_cleanup(void); | 8 | extern void nf_nat_rule_cleanup(void); |
19 | extern int nf_nat_rule_find(struct sk_buff **pskb, | 9 | extern int nf_nat_rule_find(struct sk_buff **pskb, |
diff --git a/include/net/netlink.h b/include/net/netlink.h index bcaf67b7a19d..0bf325c29aff 100644 --- a/include/net/netlink.h +++ b/include/net/netlink.h | |||
@@ -171,6 +171,7 @@ enum { | |||
171 | NLA_MSECS, | 171 | NLA_MSECS, |
172 | NLA_NESTED, | 172 | NLA_NESTED, |
173 | NLA_NUL_STRING, | 173 | NLA_NUL_STRING, |
174 | NLA_BINARY, | ||
174 | __NLA_TYPE_MAX, | 175 | __NLA_TYPE_MAX, |
175 | }; | 176 | }; |
176 | 177 | ||
@@ -188,12 +189,13 @@ enum { | |||
188 | * NLA_STRING Maximum length of string | 189 | * NLA_STRING Maximum length of string |
189 | * NLA_NUL_STRING Maximum length of string (excluding NUL) | 190 | * NLA_NUL_STRING Maximum length of string (excluding NUL) |
190 | * NLA_FLAG Unused | 191 | * NLA_FLAG Unused |
192 | * NLA_BINARY Maximum length of attribute payload | ||
191 | * All other Exact length of attribute payload | 193 | * All other Exact length of attribute payload |
192 | * | 194 | * |
193 | * Example: | 195 | * Example: |
194 | * static struct nla_policy my_policy[ATTR_MAX+1] __read_mostly = { | 196 | * static struct nla_policy my_policy[ATTR_MAX+1] __read_mostly = { |
195 | * [ATTR_FOO] = { .type = NLA_U16 }, | 197 | * [ATTR_FOO] = { .type = NLA_U16 }, |
196 | * [ATTR_BAR] = { .type = NLA_STRING, len = BARSIZ }, | 198 | * [ATTR_BAR] = { .type = NLA_STRING, .len = BARSIZ }, |
197 | * [ATTR_BAZ] = { .len = sizeof(struct mystruct) }, | 199 | * [ATTR_BAZ] = { .len = sizeof(struct mystruct) }, |
198 | * }; | 200 | * }; |
199 | */ | 201 | */ |
@@ -214,9 +216,7 @@ struct nl_info { | |||
214 | 216 | ||
215 | extern void netlink_run_queue(struct sock *sk, unsigned int *qlen, | 217 | extern void netlink_run_queue(struct sock *sk, unsigned int *qlen, |
216 | int (*cb)(struct sk_buff *, | 218 | int (*cb)(struct sk_buff *, |
217 | struct nlmsghdr *, int *)); | 219 | struct nlmsghdr *)); |
218 | extern void netlink_queue_skip(struct nlmsghdr *nlh, | ||
219 | struct sk_buff *skb); | ||
220 | extern int nlmsg_notify(struct sock *sk, struct sk_buff *skb, | 220 | extern int nlmsg_notify(struct sock *sk, struct sk_buff *skb, |
221 | u32 pid, unsigned int group, int report, | 221 | u32 pid, unsigned int group, int report, |
222 | gfp_t flags); | 222 | gfp_t flags); |
@@ -525,7 +525,7 @@ static inline struct sk_buff *nlmsg_new(size_t payload, gfp_t flags) | |||
525 | */ | 525 | */ |
526 | static inline int nlmsg_end(struct sk_buff *skb, struct nlmsghdr *nlh) | 526 | static inline int nlmsg_end(struct sk_buff *skb, struct nlmsghdr *nlh) |
527 | { | 527 | { |
528 | nlh->nlmsg_len = skb->tail - (unsigned char *) nlh; | 528 | nlh->nlmsg_len = skb_tail_pointer(skb) - (unsigned char *)nlh; |
529 | 529 | ||
530 | return skb->len; | 530 | return skb->len; |
531 | } | 531 | } |
@@ -538,7 +538,7 @@ static inline int nlmsg_end(struct sk_buff *skb, struct nlmsghdr *nlh) | |||
538 | */ | 538 | */ |
539 | static inline void *nlmsg_get_pos(struct sk_buff *skb) | 539 | static inline void *nlmsg_get_pos(struct sk_buff *skb) |
540 | { | 540 | { |
541 | return skb->tail; | 541 | return skb_tail_pointer(skb); |
542 | } | 542 | } |
543 | 543 | ||
544 | /** | 544 | /** |
@@ -548,7 +548,7 @@ static inline void *nlmsg_get_pos(struct sk_buff *skb) | |||
548 | * | 548 | * |
549 | * Trims the message to the provided mark. Returns -1. | 549 | * Trims the message to the provided mark. Returns -1. |
550 | */ | 550 | */ |
551 | static inline int nlmsg_trim(struct sk_buff *skb, void *mark) | 551 | static inline int nlmsg_trim(struct sk_buff *skb, const void *mark) |
552 | { | 552 | { |
553 | if (mark) | 553 | if (mark) |
554 | skb_trim(skb, (unsigned char *) mark - skb->data); | 554 | skb_trim(skb, (unsigned char *) mark - skb->data); |
@@ -940,7 +940,7 @@ static inline unsigned long nla_get_msecs(struct nlattr *nla) | |||
940 | */ | 940 | */ |
941 | static inline struct nlattr *nla_nest_start(struct sk_buff *skb, int attrtype) | 941 | static inline struct nlattr *nla_nest_start(struct sk_buff *skb, int attrtype) |
942 | { | 942 | { |
943 | struct nlattr *start = (struct nlattr *) skb->tail; | 943 | struct nlattr *start = (struct nlattr *)skb_tail_pointer(skb); |
944 | 944 | ||
945 | if (nla_put(skb, attrtype, 0, NULL) < 0) | 945 | if (nla_put(skb, attrtype, 0, NULL) < 0) |
946 | return NULL; | 946 | return NULL; |
@@ -960,7 +960,7 @@ static inline struct nlattr *nla_nest_start(struct sk_buff *skb, int attrtype) | |||
960 | */ | 960 | */ |
961 | static inline int nla_nest_end(struct sk_buff *skb, struct nlattr *start) | 961 | static inline int nla_nest_end(struct sk_buff *skb, struct nlattr *start) |
962 | { | 962 | { |
963 | start->nla_len = skb->tail - (unsigned char *) start; | 963 | start->nla_len = skb_tail_pointer(skb) - (unsigned char *)start; |
964 | return skb->len; | 964 | return skb->len; |
965 | } | 965 | } |
966 | 966 | ||
diff --git a/include/net/pkt_cls.h b/include/net/pkt_cls.h index 02647fe3d74b..4129df708079 100644 --- a/include/net/pkt_cls.h +++ b/include/net/pkt_cls.h | |||
@@ -326,18 +326,18 @@ static inline unsigned char * tcf_get_base_ptr(struct sk_buff *skb, int layer) | |||
326 | case TCF_LAYER_LINK: | 326 | case TCF_LAYER_LINK: |
327 | return skb->data; | 327 | return skb->data; |
328 | case TCF_LAYER_NETWORK: | 328 | case TCF_LAYER_NETWORK: |
329 | return skb->nh.raw; | 329 | return skb_network_header(skb); |
330 | case TCF_LAYER_TRANSPORT: | 330 | case TCF_LAYER_TRANSPORT: |
331 | return skb->h.raw; | 331 | return skb_transport_header(skb); |
332 | } | 332 | } |
333 | 333 | ||
334 | return NULL; | 334 | return NULL; |
335 | } | 335 | } |
336 | 336 | ||
337 | static inline int tcf_valid_offset(struct sk_buff *skb, unsigned char *ptr, | 337 | static inline int tcf_valid_offset(const struct sk_buff *skb, |
338 | int len) | 338 | const unsigned char *ptr, const int len) |
339 | { | 339 | { |
340 | return unlikely((ptr + len) < skb->tail && ptr > skb->head); | 340 | return unlikely((ptr + len) < skb_tail_pointer(skb) && ptr > skb->head); |
341 | } | 341 | } |
342 | 342 | ||
343 | #ifdef CONFIG_NET_CLS_IND | 343 | #ifdef CONFIG_NET_CLS_IND |
diff --git a/include/net/pkt_sched.h b/include/net/pkt_sched.h index f6afee73235d..5754d53d9efc 100644 --- a/include/net/pkt_sched.h +++ b/include/net/pkt_sched.h | |||
@@ -2,6 +2,7 @@ | |||
2 | #define __NET_PKT_SCHED_H | 2 | #define __NET_PKT_SCHED_H |
3 | 3 | ||
4 | #include <linux/jiffies.h> | 4 | #include <linux/jiffies.h> |
5 | #include <linux/ktime.h> | ||
5 | #include <net/sch_generic.h> | 6 | #include <net/sch_generic.h> |
6 | 7 | ||
7 | struct qdisc_walker | 8 | struct qdisc_walker |
@@ -12,8 +13,6 @@ struct qdisc_walker | |||
12 | int (*fn)(struct Qdisc *, unsigned long cl, struct qdisc_walker *); | 13 | int (*fn)(struct Qdisc *, unsigned long cl, struct qdisc_walker *); |
13 | }; | 14 | }; |
14 | 15 | ||
15 | extern rwlock_t qdisc_tree_lock; | ||
16 | |||
17 | #define QDISC_ALIGNTO 32 | 16 | #define QDISC_ALIGNTO 32 |
18 | #define QDISC_ALIGN(len) (((len) + QDISC_ALIGNTO-1) & ~(QDISC_ALIGNTO-1)) | 17 | #define QDISC_ALIGN(len) (((len) + QDISC_ALIGNTO-1) & ~(QDISC_ALIGNTO-1)) |
19 | 18 | ||
@@ -37,175 +36,38 @@ static inline void *qdisc_priv(struct Qdisc *q) | |||
37 | The things are not so bad, because we may use artifical | 36 | The things are not so bad, because we may use artifical |
38 | clock evaluated by integration of network data flow | 37 | clock evaluated by integration of network data flow |
39 | in the most critical places. | 38 | in the most critical places. |
40 | |||
41 | Note: we do not use fastgettimeofday. | ||
42 | The reason is that, when it is not the same thing as | ||
43 | gettimeofday, it returns invalid timestamp, which is | ||
44 | not updated, when net_bh is active. | ||
45 | */ | ||
46 | |||
47 | /* General note about internal clock. | ||
48 | |||
49 | Any clock source returns time intervals, measured in units | ||
50 | close to 1usec. With source CONFIG_NET_SCH_CLK_GETTIMEOFDAY it is precisely | ||
51 | microseconds, otherwise something close but different chosen to minimize | ||
52 | arithmetic cost. Ratio usec/internal untis in form nominator/denominator | ||
53 | may be read from /proc/net/psched. | ||
54 | */ | 39 | */ |
55 | 40 | ||
56 | |||
57 | #ifdef CONFIG_NET_SCH_CLK_GETTIMEOFDAY | ||
58 | |||
59 | typedef struct timeval psched_time_t; | ||
60 | typedef long psched_tdiff_t; | ||
61 | |||
62 | #define PSCHED_GET_TIME(stamp) do_gettimeofday(&(stamp)) | ||
63 | #define PSCHED_US2JIFFIE(usecs) usecs_to_jiffies(usecs) | ||
64 | #define PSCHED_JIFFIE2US(delay) jiffies_to_usecs(delay) | ||
65 | |||
66 | #else /* !CONFIG_NET_SCH_CLK_GETTIMEOFDAY */ | ||
67 | |||
68 | typedef u64 psched_time_t; | 41 | typedef u64 psched_time_t; |
69 | typedef long psched_tdiff_t; | 42 | typedef long psched_tdiff_t; |
70 | 43 | ||
71 | #ifdef CONFIG_NET_SCH_CLK_JIFFIES | 44 | /* Avoid doing 64 bit divide by 1000 */ |
72 | 45 | #define PSCHED_US2NS(x) ((s64)(x) << 10) | |
73 | #if HZ < 96 | 46 | #define PSCHED_NS2US(x) ((x) >> 10) |
74 | #define PSCHED_JSCALE 14 | ||
75 | #elif HZ >= 96 && HZ < 192 | ||
76 | #define PSCHED_JSCALE 13 | ||
77 | #elif HZ >= 192 && HZ < 384 | ||
78 | #define PSCHED_JSCALE 12 | ||
79 | #elif HZ >= 384 && HZ < 768 | ||
80 | #define PSCHED_JSCALE 11 | ||
81 | #elif HZ >= 768 | ||
82 | #define PSCHED_JSCALE 10 | ||
83 | #endif | ||
84 | 47 | ||
85 | #define PSCHED_GET_TIME(stamp) ((stamp) = (get_jiffies_64()<<PSCHED_JSCALE)) | 48 | #define PSCHED_TICKS_PER_SEC PSCHED_NS2US(NSEC_PER_SEC) |
86 | #define PSCHED_US2JIFFIE(delay) (((delay)+(1<<PSCHED_JSCALE)-1)>>PSCHED_JSCALE) | 49 | #define PSCHED_PASTPERFECT 0 |
87 | #define PSCHED_JIFFIE2US(delay) ((delay)<<PSCHED_JSCALE) | 50 | |
88 | 51 | static inline psched_time_t psched_get_time(void) | |
89 | #endif /* CONFIG_NET_SCH_CLK_JIFFIES */ | ||
90 | #ifdef CONFIG_NET_SCH_CLK_CPU | ||
91 | #include <asm/timex.h> | ||
92 | |||
93 | extern psched_tdiff_t psched_clock_per_hz; | ||
94 | extern int psched_clock_scale; | ||
95 | extern psched_time_t psched_time_base; | ||
96 | extern cycles_t psched_time_mark; | ||
97 | |||
98 | #define PSCHED_GET_TIME(stamp) \ | ||
99 | do { \ | ||
100 | cycles_t cur = get_cycles(); \ | ||
101 | if (sizeof(cycles_t) == sizeof(u32)) { \ | ||
102 | if (cur <= psched_time_mark) \ | ||
103 | psched_time_base += 0x100000000ULL; \ | ||
104 | psched_time_mark = cur; \ | ||
105 | (stamp) = (psched_time_base + cur)>>psched_clock_scale; \ | ||
106 | } else { \ | ||
107 | (stamp) = cur>>psched_clock_scale; \ | ||
108 | } \ | ||
109 | } while (0) | ||
110 | #define PSCHED_US2JIFFIE(delay) (((delay)+psched_clock_per_hz-1)/psched_clock_per_hz) | ||
111 | #define PSCHED_JIFFIE2US(delay) ((delay)*psched_clock_per_hz) | ||
112 | |||
113 | #endif /* CONFIG_NET_SCH_CLK_CPU */ | ||
114 | |||
115 | #endif /* !CONFIG_NET_SCH_CLK_GETTIMEOFDAY */ | ||
116 | |||
117 | #ifdef CONFIG_NET_SCH_CLK_GETTIMEOFDAY | ||
118 | #define PSCHED_TDIFF(tv1, tv2) \ | ||
119 | ({ \ | ||
120 | int __delta_sec = (tv1).tv_sec - (tv2).tv_sec; \ | ||
121 | int __delta = (tv1).tv_usec - (tv2).tv_usec; \ | ||
122 | if (__delta_sec) { \ | ||
123 | switch (__delta_sec) { \ | ||
124 | default: \ | ||
125 | __delta = 0; \ | ||
126 | case 2: \ | ||
127 | __delta += USEC_PER_SEC; \ | ||
128 | case 1: \ | ||
129 | __delta += USEC_PER_SEC; \ | ||
130 | } \ | ||
131 | } \ | ||
132 | __delta; \ | ||
133 | }) | ||
134 | |||
135 | static inline int | ||
136 | psched_tod_diff(int delta_sec, int bound) | ||
137 | { | 52 | { |
138 | int delta; | 53 | return PSCHED_NS2US(ktime_to_ns(ktime_get())); |
139 | |||
140 | if (bound <= USEC_PER_SEC || delta_sec > (0x7FFFFFFF/USEC_PER_SEC)-1) | ||
141 | return bound; | ||
142 | delta = delta_sec * USEC_PER_SEC; | ||
143 | if (delta > bound || delta < 0) | ||
144 | delta = bound; | ||
145 | return delta; | ||
146 | } | 54 | } |
147 | 55 | ||
148 | #define PSCHED_TDIFF_SAFE(tv1, tv2, bound) \ | 56 | static inline psched_tdiff_t |
149 | ({ \ | 57 | psched_tdiff_bounded(psched_time_t tv1, psched_time_t tv2, psched_time_t bound) |
150 | int __delta_sec = (tv1).tv_sec - (tv2).tv_sec; \ | 58 | { |
151 | int __delta = (tv1).tv_usec - (tv2).tv_usec; \ | 59 | return min(tv1 - tv2, bound); |
152 | switch (__delta_sec) { \ | 60 | } |
153 | default: \ | ||
154 | __delta = psched_tod_diff(__delta_sec, bound); break; \ | ||
155 | case 2: \ | ||
156 | __delta += USEC_PER_SEC; \ | ||
157 | case 1: \ | ||
158 | __delta += USEC_PER_SEC; \ | ||
159 | case 0: \ | ||
160 | if (__delta > bound || __delta < 0) \ | ||
161 | __delta = bound; \ | ||
162 | } \ | ||
163 | __delta; \ | ||
164 | }) | ||
165 | |||
166 | #define PSCHED_TLESS(tv1, tv2) (((tv1).tv_usec < (tv2).tv_usec && \ | ||
167 | (tv1).tv_sec <= (tv2).tv_sec) || \ | ||
168 | (tv1).tv_sec < (tv2).tv_sec) | ||
169 | |||
170 | #define PSCHED_TADD2(tv, delta, tv_res) \ | ||
171 | ({ \ | ||
172 | int __delta = (tv).tv_usec + (delta); \ | ||
173 | (tv_res).tv_sec = (tv).tv_sec; \ | ||
174 | while (__delta >= USEC_PER_SEC) { (tv_res).tv_sec++; __delta -= USEC_PER_SEC; } \ | ||
175 | (tv_res).tv_usec = __delta; \ | ||
176 | }) | ||
177 | |||
178 | #define PSCHED_TADD(tv, delta) \ | ||
179 | ({ \ | ||
180 | (tv).tv_usec += (delta); \ | ||
181 | while ((tv).tv_usec >= USEC_PER_SEC) { (tv).tv_sec++; \ | ||
182 | (tv).tv_usec -= USEC_PER_SEC; } \ | ||
183 | }) | ||
184 | |||
185 | /* Set/check that time is in the "past perfect"; | ||
186 | it depends on concrete representation of system time | ||
187 | */ | ||
188 | |||
189 | #define PSCHED_SET_PASTPERFECT(t) ((t).tv_sec = 0) | ||
190 | #define PSCHED_IS_PASTPERFECT(t) ((t).tv_sec == 0) | ||
191 | |||
192 | #define PSCHED_AUDIT_TDIFF(t) ({ if ((t) > 2000000) (t) = 2000000; }) | ||
193 | |||
194 | #else /* !CONFIG_NET_SCH_CLK_GETTIMEOFDAY */ | ||
195 | |||
196 | #define PSCHED_TDIFF(tv1, tv2) (long)((tv1) - (tv2)) | ||
197 | #define PSCHED_TDIFF_SAFE(tv1, tv2, bound) \ | ||
198 | min_t(long long, (tv1) - (tv2), bound) | ||
199 | |||
200 | 61 | ||
201 | #define PSCHED_TLESS(tv1, tv2) ((tv1) < (tv2)) | 62 | struct qdisc_watchdog { |
202 | #define PSCHED_TADD2(tv, delta, tv_res) ((tv_res) = (tv) + (delta)) | 63 | struct hrtimer timer; |
203 | #define PSCHED_TADD(tv, delta) ((tv) += (delta)) | 64 | struct Qdisc *qdisc; |
204 | #define PSCHED_SET_PASTPERFECT(t) ((t) = 0) | 65 | }; |
205 | #define PSCHED_IS_PASTPERFECT(t) ((t) == 0) | ||
206 | #define PSCHED_AUDIT_TDIFF(t) | ||
207 | 66 | ||
208 | #endif /* !CONFIG_NET_SCH_CLK_GETTIMEOFDAY */ | 67 | extern void qdisc_watchdog_init(struct qdisc_watchdog *wd, struct Qdisc *qdisc); |
68 | extern void qdisc_watchdog_schedule(struct qdisc_watchdog *wd, | ||
69 | psched_time_t expires); | ||
70 | extern void qdisc_watchdog_cancel(struct qdisc_watchdog *wd); | ||
209 | 71 | ||
210 | extern struct Qdisc_ops pfifo_qdisc_ops; | 72 | extern struct Qdisc_ops pfifo_qdisc_ops; |
211 | extern struct Qdisc_ops bfifo_qdisc_ops; | 73 | extern struct Qdisc_ops bfifo_qdisc_ops; |
diff --git a/include/net/red.h b/include/net/red.h index a4eb37946f2c..3cf31d466a81 100644 --- a/include/net/red.h +++ b/include/net/red.h | |||
@@ -151,17 +151,17 @@ static inline void red_set_parms(struct red_parms *p, | |||
151 | 151 | ||
152 | static inline int red_is_idling(struct red_parms *p) | 152 | static inline int red_is_idling(struct red_parms *p) |
153 | { | 153 | { |
154 | return !PSCHED_IS_PASTPERFECT(p->qidlestart); | 154 | return p->qidlestart != PSCHED_PASTPERFECT; |
155 | } | 155 | } |
156 | 156 | ||
157 | static inline void red_start_of_idle_period(struct red_parms *p) | 157 | static inline void red_start_of_idle_period(struct red_parms *p) |
158 | { | 158 | { |
159 | PSCHED_GET_TIME(p->qidlestart); | 159 | p->qidlestart = psched_get_time(); |
160 | } | 160 | } |
161 | 161 | ||
162 | static inline void red_end_of_idle_period(struct red_parms *p) | 162 | static inline void red_end_of_idle_period(struct red_parms *p) |
163 | { | 163 | { |
164 | PSCHED_SET_PASTPERFECT(p->qidlestart); | 164 | p->qidlestart = PSCHED_PASTPERFECT; |
165 | } | 165 | } |
166 | 166 | ||
167 | static inline void red_restart(struct red_parms *p) | 167 | static inline void red_restart(struct red_parms *p) |
@@ -177,8 +177,8 @@ static inline unsigned long red_calc_qavg_from_idle_time(struct red_parms *p) | |||
177 | long us_idle; | 177 | long us_idle; |
178 | int shift; | 178 | int shift; |
179 | 179 | ||
180 | PSCHED_GET_TIME(now); | 180 | now = psched_get_time(); |
181 | us_idle = PSCHED_TDIFF_SAFE(now, p->qidlestart, p->Scell_max); | 181 | us_idle = psched_tdiff_bounded(now, p->qidlestart, p->Scell_max); |
182 | 182 | ||
183 | /* | 183 | /* |
184 | * The problem: ideally, average length queue recalcultion should | 184 | * The problem: ideally, average length queue recalcultion should |
diff --git a/include/net/rtnetlink.h b/include/net/rtnetlink.h new file mode 100644 index 000000000000..3b3d4745618d --- /dev/null +++ b/include/net/rtnetlink.h | |||
@@ -0,0 +1,25 @@ | |||
1 | #ifndef __NET_RTNETLINK_H | ||
2 | #define __NET_RTNETLINK_H | ||
3 | |||
4 | #include <linux/rtnetlink.h> | ||
5 | #include <net/netlink.h> | ||
6 | |||
7 | typedef int (*rtnl_doit_func)(struct sk_buff *, struct nlmsghdr *, void *); | ||
8 | typedef int (*rtnl_dumpit_func)(struct sk_buff *, struct netlink_callback *); | ||
9 | |||
10 | extern int __rtnl_register(int protocol, int msgtype, | ||
11 | rtnl_doit_func, rtnl_dumpit_func); | ||
12 | extern void rtnl_register(int protocol, int msgtype, | ||
13 | rtnl_doit_func, rtnl_dumpit_func); | ||
14 | extern int rtnl_unregister(int protocol, int msgtype); | ||
15 | extern void rtnl_unregister_all(int protocol); | ||
16 | |||
17 | static inline int rtnl_msg_family(struct nlmsghdr *nlh) | ||
18 | { | ||
19 | if (nlmsg_len(nlh) >= sizeof(struct rtgenmsg)) | ||
20 | return ((struct rtgenmsg *) nlmsg_data(nlh))->rtgen_family; | ||
21 | else | ||
22 | return AF_UNSPEC; | ||
23 | } | ||
24 | |||
25 | #endif | ||
diff --git a/include/net/sch_generic.h b/include/net/sch_generic.h index 82086392735a..1b8e35197ebe 100644 --- a/include/net/sch_generic.h +++ b/include/net/sch_generic.h | |||
@@ -5,10 +5,10 @@ | |||
5 | #include <linux/types.h> | 5 | #include <linux/types.h> |
6 | #include <linux/rcupdate.h> | 6 | #include <linux/rcupdate.h> |
7 | #include <linux/module.h> | 7 | #include <linux/module.h> |
8 | #include <linux/rtnetlink.h> | ||
9 | #include <linux/pkt_sched.h> | 8 | #include <linux/pkt_sched.h> |
10 | #include <linux/pkt_cls.h> | 9 | #include <linux/pkt_cls.h> |
11 | #include <net/gen_stats.h> | 10 | #include <net/gen_stats.h> |
11 | #include <net/rtnetlink.h> | ||
12 | 12 | ||
13 | struct Qdisc_ops; | 13 | struct Qdisc_ops; |
14 | struct qdisc_walker; | 14 | struct qdisc_walker; |
@@ -177,14 +177,8 @@ extern void qdisc_tree_decrease_qlen(struct Qdisc *qdisc, unsigned int n); | |||
177 | extern struct Qdisc *qdisc_alloc(struct net_device *dev, struct Qdisc_ops *ops); | 177 | extern struct Qdisc *qdisc_alloc(struct net_device *dev, struct Qdisc_ops *ops); |
178 | extern struct Qdisc *qdisc_create_dflt(struct net_device *dev, | 178 | extern struct Qdisc *qdisc_create_dflt(struct net_device *dev, |
179 | struct Qdisc_ops *ops, u32 parentid); | 179 | struct Qdisc_ops *ops, u32 parentid); |
180 | 180 | extern void tcf_destroy(struct tcf_proto *tp); | |
181 | static inline void | 181 | extern void tcf_destroy_chain(struct tcf_proto *fl); |
182 | tcf_destroy(struct tcf_proto *tp) | ||
183 | { | ||
184 | tp->ops->destroy(tp); | ||
185 | module_put(tp->ops->owner); | ||
186 | kfree(tp); | ||
187 | } | ||
188 | 182 | ||
189 | static inline int __qdisc_enqueue_tail(struct sk_buff *skb, struct Qdisc *sch, | 183 | static inline int __qdisc_enqueue_tail(struct sk_buff *skb, struct Qdisc *sch, |
190 | struct sk_buff_head *list) | 184 | struct sk_buff_head *list) |
diff --git a/include/net/sctp/constants.h b/include/net/sctp/constants.h index 5ddb85599863..bb37724495a5 100644 --- a/include/net/sctp/constants.h +++ b/include/net/sctp/constants.h | |||
@@ -283,7 +283,7 @@ enum { SCTP_MAX_GABS = 16 }; | |||
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. */ |
284 | 284 | ||
285 | /* Maximum number of new data packets that can be sent in a burst. */ | 285 | /* Maximum number of new data packets that can be sent in a burst. */ |
286 | #define SCTP_MAX_BURST 4 | 286 | #define SCTP_DEFAULT_MAX_BURST 4 |
287 | 287 | ||
288 | #define SCTP_CLOCK_GRANULARITY 1 /* 1 jiffy */ | 288 | #define SCTP_CLOCK_GRANULARITY 1 /* 1 jiffy */ |
289 | 289 | ||
diff --git a/include/net/sctp/structs.h b/include/net/sctp/structs.h index f431acf3dcea..7b4fff93ba7f 100644 --- a/include/net/sctp/structs.h +++ b/include/net/sctp/structs.h | |||
@@ -276,6 +276,7 @@ struct sctp_sock { | |||
276 | __u32 default_context; | 276 | __u32 default_context; |
277 | __u32 default_timetolive; | 277 | __u32 default_timetolive; |
278 | __u32 default_rcv_context; | 278 | __u32 default_rcv_context; |
279 | int max_burst; | ||
279 | 280 | ||
280 | /* Heartbeat interval: The endpoint sends out a Heartbeat chunk to | 281 | /* Heartbeat interval: The endpoint sends out a Heartbeat chunk to |
281 | * the destination address every heartbeat interval. This value | 282 | * the destination address every heartbeat interval. This value |
@@ -304,10 +305,12 @@ struct sctp_sock { | |||
304 | __u32 autoclose; | 305 | __u32 autoclose; |
305 | __u8 nodelay; | 306 | __u8 nodelay; |
306 | __u8 disable_fragments; | 307 | __u8 disable_fragments; |
307 | __u8 pd_mode; | ||
308 | __u8 v4mapped; | 308 | __u8 v4mapped; |
309 | __u8 frag_interleave; | ||
309 | __u32 adaptation_ind; | 310 | __u32 adaptation_ind; |
311 | __u32 pd_point; | ||
310 | 312 | ||
313 | atomic_t pd_mode; | ||
311 | /* Receive to here while partial delivery is in effect. */ | 314 | /* Receive to here while partial delivery is in effect. */ |
312 | struct sk_buff_head pd_lobby; | 315 | struct sk_buff_head pd_lobby; |
313 | }; | 316 | }; |
diff --git a/include/net/sctp/ulpevent.h b/include/net/sctp/ulpevent.h index 2923e3d31a08..de88ed5b0ba6 100644 --- a/include/net/sctp/ulpevent.h +++ b/include/net/sctp/ulpevent.h | |||
@@ -89,6 +89,7 @@ struct sctp_ulpevent *sctp_ulpevent_make_assoc_change( | |||
89 | __u16 error, | 89 | __u16 error, |
90 | __u16 outbound, | 90 | __u16 outbound, |
91 | __u16 inbound, | 91 | __u16 inbound, |
92 | struct sctp_chunk *chunk, | ||
92 | gfp_t gfp); | 93 | gfp_t gfp); |
93 | 94 | ||
94 | struct sctp_ulpevent *sctp_ulpevent_make_peer_addr_change( | 95 | struct sctp_ulpevent *sctp_ulpevent_make_peer_addr_change( |
diff --git a/include/net/sctp/ulpqueue.h b/include/net/sctp/ulpqueue.h index ab26ab3adae1..39ea3f442b47 100644 --- a/include/net/sctp/ulpqueue.h +++ b/include/net/sctp/ulpqueue.h | |||
@@ -78,7 +78,7 @@ void sctp_ulpq_partial_delivery(struct sctp_ulpq *, struct sctp_chunk *, gfp_t); | |||
78 | void sctp_ulpq_abort_pd(struct sctp_ulpq *, gfp_t); | 78 | void sctp_ulpq_abort_pd(struct sctp_ulpq *, gfp_t); |
79 | 79 | ||
80 | /* Clear the partial data delivery condition on this socket. */ | 80 | /* Clear the partial data delivery condition on this socket. */ |
81 | int sctp_clear_pd(struct sock *sk); | 81 | int sctp_clear_pd(struct sock *sk, struct sctp_association *asoc); |
82 | 82 | ||
83 | /* Skip over an SSN. */ | 83 | /* Skip over an SSN. */ |
84 | void sctp_ulpq_skip(struct sctp_ulpq *ulpq, __u16 sid, __u16 ssn); | 84 | void sctp_ulpq_skip(struct sctp_ulpq *ulpq, __u16 sid, __u16 ssn); |
diff --git a/include/net/sctp/user.h b/include/net/sctp/user.h index 67a30eb2b3a4..6d2b57758cca 100644 --- a/include/net/sctp/user.h +++ b/include/net/sctp/user.h | |||
@@ -97,6 +97,12 @@ enum sctp_optname { | |||
97 | #define SCTP_DELAYED_ACK_TIME SCTP_DELAYED_ACK_TIME | 97 | #define SCTP_DELAYED_ACK_TIME SCTP_DELAYED_ACK_TIME |
98 | SCTP_CONTEXT, /* Receive Context */ | 98 | SCTP_CONTEXT, /* Receive Context */ |
99 | #define SCTP_CONTEXT SCTP_CONTEXT | 99 | #define SCTP_CONTEXT SCTP_CONTEXT |
100 | SCTP_FRAGMENT_INTERLEAVE, | ||
101 | #define SCTP_FRAGMENT_INTERLEAVE SCTP_FRAGMENT_INTERLEAVE | ||
102 | SCTP_PARTIAL_DELIVERY_POINT, /* Set/Get partial delivery point */ | ||
103 | #define SCTP_PARTIAL_DELIVERY_POINT SCTP_PARTIAL_DELIVERY_POINT | ||
104 | SCTP_MAX_BURST, /* Set/Get max burst */ | ||
105 | #define SCTP_MAX_BURST SCTP_MAX_BURST | ||
100 | 106 | ||
101 | /* Internal Socket Options. Some of the sctp library functions are | 107 | /* Internal Socket Options. Some of the sctp library functions are |
102 | * implemented using these socket options. | 108 | * implemented using these socket options. |
@@ -213,6 +219,7 @@ struct sctp_assoc_change { | |||
213 | __u16 sac_outbound_streams; | 219 | __u16 sac_outbound_streams; |
214 | __u16 sac_inbound_streams; | 220 | __u16 sac_inbound_streams; |
215 | sctp_assoc_t sac_assoc_id; | 221 | sctp_assoc_t sac_assoc_id; |
222 | __u8 sac_info[0]; | ||
216 | }; | 223 | }; |
217 | 224 | ||
218 | /* | 225 | /* |
@@ -261,6 +268,7 @@ enum sctp_spc_state { | |||
261 | SCTP_ADDR_REMOVED, | 268 | SCTP_ADDR_REMOVED, |
262 | SCTP_ADDR_ADDED, | 269 | SCTP_ADDR_ADDED, |
263 | SCTP_ADDR_MADE_PRIM, | 270 | SCTP_ADDR_MADE_PRIM, |
271 | SCTP_ADDR_CONFIRMED, | ||
264 | }; | 272 | }; |
265 | 273 | ||
266 | 274 | ||
@@ -508,16 +516,17 @@ struct sctp_setadaptation { | |||
508 | * address's parameters: | 516 | * address's parameters: |
509 | */ | 517 | */ |
510 | enum sctp_spp_flags { | 518 | enum sctp_spp_flags { |
511 | SPP_HB_ENABLE = 1, /*Enable heartbeats*/ | 519 | SPP_HB_ENABLE = 1<<0, /*Enable heartbeats*/ |
512 | SPP_HB_DISABLE = 2, /*Disable heartbeats*/ | 520 | SPP_HB_DISABLE = 1<<1, /*Disable heartbeats*/ |
513 | SPP_HB = SPP_HB_ENABLE | SPP_HB_DISABLE, | 521 | SPP_HB = SPP_HB_ENABLE | SPP_HB_DISABLE, |
514 | SPP_HB_DEMAND = 4, /*Send heartbeat immediately*/ | 522 | SPP_HB_DEMAND = 1<<2, /*Send heartbeat immediately*/ |
515 | SPP_PMTUD_ENABLE = 8, /*Enable PMTU discovery*/ | 523 | SPP_PMTUD_ENABLE = 1<<3, /*Enable PMTU discovery*/ |
516 | SPP_PMTUD_DISABLE = 16, /*Disable PMTU discovery*/ | 524 | SPP_PMTUD_DISABLE = 1<<4, /*Disable PMTU discovery*/ |
517 | SPP_PMTUD = SPP_PMTUD_ENABLE | SPP_PMTUD_DISABLE, | 525 | SPP_PMTUD = SPP_PMTUD_ENABLE | SPP_PMTUD_DISABLE, |
518 | SPP_SACKDELAY_ENABLE = 32, /*Enable SACK*/ | 526 | SPP_SACKDELAY_ENABLE = 1<<5, /*Enable SACK*/ |
519 | SPP_SACKDELAY_DISABLE = 64, /*Disable SACK*/ | 527 | SPP_SACKDELAY_DISABLE = 1<<6, /*Disable SACK*/ |
520 | SPP_SACKDELAY = SPP_SACKDELAY_ENABLE | SPP_SACKDELAY_DISABLE, | 528 | SPP_SACKDELAY = SPP_SACKDELAY_ENABLE | SPP_SACKDELAY_DISABLE, |
529 | SPP_HB_TIME_IS_ZERO = 1<<7, /* Set HB delay to 0 */ | ||
521 | }; | 530 | }; |
522 | 531 | ||
523 | struct sctp_paddrparams { | 532 | struct sctp_paddrparams { |
@@ -530,7 +539,7 @@ struct sctp_paddrparams { | |||
530 | __u32 spp_flags; | 539 | __u32 spp_flags; |
531 | } __attribute__((packed, aligned(4))); | 540 | } __attribute__((packed, aligned(4))); |
532 | 541 | ||
533 | /* 7.1.24. Delayed Ack Timer (SCTP_DELAYED_ACK_TIME) | 542 | /* 7.1.23. Delayed Ack Timer (SCTP_DELAYED_ACK_TIME) |
534 | * | 543 | * |
535 | * This options will get or set the delayed ack timer. The time is set | 544 | * This options will get or set the delayed ack timer. The time is set |
536 | * in milliseconds. If the assoc_id is 0, then this sets or gets the | 545 | * in milliseconds. If the assoc_id is 0, then this sets or gets the |
diff --git a/include/net/sock.h b/include/net/sock.h index 2c7d60ca3548..25c37e34bfdc 100644 --- a/include/net/sock.h +++ b/include/net/sock.h | |||
@@ -202,6 +202,15 @@ struct sock { | |||
202 | unsigned short sk_type; | 202 | unsigned short sk_type; |
203 | int sk_rcvbuf; | 203 | int sk_rcvbuf; |
204 | socket_lock_t sk_lock; | 204 | socket_lock_t sk_lock; |
205 | /* | ||
206 | * The backlog queue is special, it is always used with | ||
207 | * the per-socket spinlock held and requires low latency | ||
208 | * access. Therefore we special case it's implementation. | ||
209 | */ | ||
210 | struct { | ||
211 | struct sk_buff *head; | ||
212 | struct sk_buff *tail; | ||
213 | } sk_backlog; | ||
205 | wait_queue_head_t *sk_sleep; | 214 | wait_queue_head_t *sk_sleep; |
206 | struct dst_entry *sk_dst_cache; | 215 | struct dst_entry *sk_dst_cache; |
207 | struct xfrm_policy *sk_policy[2]; | 216 | struct xfrm_policy *sk_policy[2]; |
@@ -221,15 +230,6 @@ struct sock { | |||
221 | int sk_rcvlowat; | 230 | int sk_rcvlowat; |
222 | unsigned long sk_flags; | 231 | unsigned long sk_flags; |
223 | unsigned long sk_lingertime; | 232 | unsigned long sk_lingertime; |
224 | /* | ||
225 | * The backlog queue is special, it is always used with | ||
226 | * the per-socket spinlock held and requires low latency | ||
227 | * access. Therefore we special case it's implementation. | ||
228 | */ | ||
229 | struct { | ||
230 | struct sk_buff *head; | ||
231 | struct sk_buff *tail; | ||
232 | } sk_backlog; | ||
233 | struct sk_buff_head sk_error_queue; | 233 | struct sk_buff_head sk_error_queue; |
234 | struct proto *sk_prot_creator; | 234 | struct proto *sk_prot_creator; |
235 | rwlock_t sk_callback_lock; | 235 | rwlock_t sk_callback_lock; |
@@ -244,7 +244,7 @@ struct sock { | |||
244 | struct sk_filter *sk_filter; | 244 | struct sk_filter *sk_filter; |
245 | void *sk_protinfo; | 245 | void *sk_protinfo; |
246 | struct timer_list sk_timer; | 246 | struct timer_list sk_timer; |
247 | struct timeval sk_stamp; | 247 | ktime_t sk_stamp; |
248 | struct socket *sk_socket; | 248 | struct socket *sk_socket; |
249 | void *sk_user_data; | 249 | void *sk_user_data; |
250 | struct page *sk_sndmsg_page; | 250 | struct page *sk_sndmsg_page; |
@@ -390,6 +390,7 @@ enum sock_flags { | |||
390 | SOCK_USE_WRITE_QUEUE, /* whether to call sk->sk_write_space in sock_wfree */ | 390 | SOCK_USE_WRITE_QUEUE, /* whether to call sk->sk_write_space in sock_wfree */ |
391 | SOCK_DBG, /* %SO_DEBUG setting */ | 391 | SOCK_DBG, /* %SO_DEBUG setting */ |
392 | SOCK_RCVTSTAMP, /* %SO_TIMESTAMP setting */ | 392 | SOCK_RCVTSTAMP, /* %SO_TIMESTAMP setting */ |
393 | SOCK_RCVTSTAMPNS, /* %SO_TIMESTAMPNS setting */ | ||
393 | SOCK_LOCALROUTE, /* route locally only, %SO_DONTROUTE setting */ | 394 | SOCK_LOCALROUTE, /* route locally only, %SO_DONTROUTE setting */ |
394 | SOCK_QUEUE_SHRUNK, /* write queue has been shrunk recently */ | 395 | SOCK_QUEUE_SHRUNK, /* write queue has been shrunk recently */ |
395 | }; | 396 | }; |
@@ -710,15 +711,6 @@ static inline void sk_stream_mem_reclaim(struct sock *sk) | |||
710 | __sk_stream_mem_reclaim(sk); | 711 | __sk_stream_mem_reclaim(sk); |
711 | } | 712 | } |
712 | 713 | ||
713 | static inline void sk_stream_writequeue_purge(struct sock *sk) | ||
714 | { | ||
715 | struct sk_buff *skb; | ||
716 | |||
717 | while ((skb = __skb_dequeue(&sk->sk_write_queue)) != NULL) | ||
718 | sk_stream_free_skb(sk, skb); | ||
719 | sk_stream_mem_reclaim(sk); | ||
720 | } | ||
721 | |||
722 | static inline int sk_stream_rmem_schedule(struct sock *sk, struct sk_buff *skb) | 714 | static inline int sk_stream_rmem_schedule(struct sock *sk, struct sk_buff *skb) |
723 | { | 715 | { |
724 | return (int)skb->truesize <= sk->sk_forward_alloc || | 716 | return (int)skb->truesize <= sk->sk_forward_alloc || |
@@ -1083,19 +1075,7 @@ static inline int sk_can_gso(const struct sock *sk) | |||
1083 | return net_gso_ok(sk->sk_route_caps, sk->sk_gso_type); | 1075 | return net_gso_ok(sk->sk_route_caps, sk->sk_gso_type); |
1084 | } | 1076 | } |
1085 | 1077 | ||
1086 | static inline void sk_setup_caps(struct sock *sk, struct dst_entry *dst) | 1078 | extern void sk_setup_caps(struct sock *sk, struct dst_entry *dst); |
1087 | { | ||
1088 | __sk_dst_set(sk, dst); | ||
1089 | sk->sk_route_caps = dst->dev->features; | ||
1090 | if (sk->sk_route_caps & NETIF_F_GSO) | ||
1091 | sk->sk_route_caps |= NETIF_F_GSO_MASK; | ||
1092 | if (sk_can_gso(sk)) { | ||
1093 | if (dst->header_len) | ||
1094 | sk->sk_route_caps &= ~NETIF_F_GSO_MASK; | ||
1095 | else | ||
1096 | sk->sk_route_caps |= NETIF_F_SG | NETIF_F_HW_CSUM; | ||
1097 | } | ||
1098 | } | ||
1099 | 1079 | ||
1100 | static inline void sk_charge_skb(struct sock *sk, struct sk_buff *skb) | 1080 | static inline void sk_charge_skb(struct sock *sk, struct sk_buff *skb) |
1101 | { | 1081 | { |
@@ -1256,18 +1236,6 @@ static inline struct page *sk_stream_alloc_page(struct sock *sk) | |||
1256 | return page; | 1236 | return page; |
1257 | } | 1237 | } |
1258 | 1238 | ||
1259 | #define sk_stream_for_retrans_queue(skb, sk) \ | ||
1260 | for (skb = (sk)->sk_write_queue.next; \ | ||
1261 | (skb != (sk)->sk_send_head) && \ | ||
1262 | (skb != (struct sk_buff *)&(sk)->sk_write_queue); \ | ||
1263 | skb = skb->next) | ||
1264 | |||
1265 | /*from STCP for fast SACK Process*/ | ||
1266 | #define sk_stream_for_retrans_queue_from(skb, sk) \ | ||
1267 | for (; (skb != (sk)->sk_send_head) && \ | ||
1268 | (skb != (struct sk_buff *)&(sk)->sk_write_queue); \ | ||
1269 | skb = skb->next) | ||
1270 | |||
1271 | /* | 1239 | /* |
1272 | * Default write policy as shown to user space via poll/select/SIGIO | 1240 | * Default write policy as shown to user space via poll/select/SIGIO |
1273 | */ | 1241 | */ |
@@ -1304,22 +1272,18 @@ static inline int sock_intr_errno(long timeo) | |||
1304 | return timeo == MAX_SCHEDULE_TIMEOUT ? -ERESTARTSYS : -EINTR; | 1272 | return timeo == MAX_SCHEDULE_TIMEOUT ? -ERESTARTSYS : -EINTR; |
1305 | } | 1273 | } |
1306 | 1274 | ||
1275 | extern void __sock_recv_timestamp(struct msghdr *msg, struct sock *sk, | ||
1276 | struct sk_buff *skb); | ||
1277 | |||
1307 | static __inline__ void | 1278 | static __inline__ void |
1308 | sock_recv_timestamp(struct msghdr *msg, struct sock *sk, struct sk_buff *skb) | 1279 | sock_recv_timestamp(struct msghdr *msg, struct sock *sk, struct sk_buff *skb) |
1309 | { | 1280 | { |
1310 | struct timeval stamp; | 1281 | ktime_t kt = skb->tstamp; |
1311 | 1282 | ||
1312 | skb_get_timestamp(skb, &stamp); | 1283 | if (sock_flag(sk, SOCK_RCVTSTAMP)) |
1313 | if (sock_flag(sk, SOCK_RCVTSTAMP)) { | 1284 | __sock_recv_timestamp(msg, sk, skb); |
1314 | /* Race occurred between timestamp enabling and packet | 1285 | else |
1315 | receiving. Fill in the current time for now. */ | 1286 | sk->sk_stamp = kt; |
1316 | if (stamp.tv_sec == 0) | ||
1317 | do_gettimeofday(&stamp); | ||
1318 | skb_set_timestamp(skb, &stamp); | ||
1319 | put_cmsg(msg, SOL_SOCKET, SO_TIMESTAMP, sizeof(struct timeval), | ||
1320 | &stamp); | ||
1321 | } else | ||
1322 | sk->sk_stamp = stamp; | ||
1323 | } | 1287 | } |
1324 | 1288 | ||
1325 | /** | 1289 | /** |
@@ -1350,18 +1314,17 @@ static inline void sk_eat_skb(struct sock *sk, struct sk_buff *skb, int copied_e | |||
1350 | 1314 | ||
1351 | extern void sock_enable_timestamp(struct sock *sk); | 1315 | extern void sock_enable_timestamp(struct sock *sk); |
1352 | extern int sock_get_timestamp(struct sock *, struct timeval __user *); | 1316 | extern int sock_get_timestamp(struct sock *, struct timeval __user *); |
1317 | extern int sock_get_timestampns(struct sock *, struct timespec __user *); | ||
1353 | 1318 | ||
1354 | /* | 1319 | /* |
1355 | * Enable debug/info messages | 1320 | * Enable debug/info messages |
1356 | */ | 1321 | */ |
1322 | extern int net_msg_warn; | ||
1323 | #define NETDEBUG(fmt, args...) \ | ||
1324 | do { if (net_msg_warn) printk(fmt,##args); } while (0) | ||
1357 | 1325 | ||
1358 | #ifdef CONFIG_NETDEBUG | 1326 | #define LIMIT_NETDEBUG(fmt, args...) \ |
1359 | #define NETDEBUG(fmt, args...) printk(fmt,##args) | 1327 | do { if (net_msg_warn && net_ratelimit()) printk(fmt,##args); } while(0) |
1360 | #define LIMIT_NETDEBUG(fmt, args...) do { if (net_ratelimit()) printk(fmt,##args); } while(0) | ||
1361 | #else | ||
1362 | #define NETDEBUG(fmt, args...) do { } while (0) | ||
1363 | #define LIMIT_NETDEBUG(fmt, args...) do { } while(0) | ||
1364 | #endif | ||
1365 | 1328 | ||
1366 | /* | 1329 | /* |
1367 | * Macros for sleeping on a socket. Use them like this: | 1330 | * Macros for sleeping on a socket. Use them like this: |
diff --git a/include/net/tcp.h b/include/net/tcp.h index 5c472f255b77..a385797f160a 100644 --- a/include/net/tcp.h +++ b/include/net/tcp.h | |||
@@ -220,6 +220,7 @@ extern int sysctl_tcp_app_win; | |||
220 | extern int sysctl_tcp_adv_win_scale; | 220 | extern int sysctl_tcp_adv_win_scale; |
221 | extern int sysctl_tcp_tw_reuse; | 221 | extern int sysctl_tcp_tw_reuse; |
222 | extern int sysctl_tcp_frto; | 222 | extern int sysctl_tcp_frto; |
223 | extern int sysctl_tcp_frto_response; | ||
223 | extern int sysctl_tcp_low_latency; | 224 | extern int sysctl_tcp_low_latency; |
224 | extern int sysctl_tcp_dma_copybreak; | 225 | extern int sysctl_tcp_dma_copybreak; |
225 | extern int sysctl_tcp_nometrics_save; | 226 | extern int sysctl_tcp_nometrics_save; |
@@ -230,6 +231,7 @@ extern int sysctl_tcp_mtu_probing; | |||
230 | extern int sysctl_tcp_base_mss; | 231 | extern int sysctl_tcp_base_mss; |
231 | extern int sysctl_tcp_workaround_signed_windows; | 232 | extern int sysctl_tcp_workaround_signed_windows; |
232 | extern int sysctl_tcp_slow_start_after_idle; | 233 | extern int sysctl_tcp_slow_start_after_idle; |
234 | extern int sysctl_tcp_max_ssthresh; | ||
233 | 235 | ||
234 | extern atomic_t tcp_memory_allocated; | 236 | extern atomic_t tcp_memory_allocated; |
235 | extern atomic_t tcp_sockets_allocated; | 237 | extern atomic_t tcp_sockets_allocated; |
@@ -341,6 +343,7 @@ extern struct sock * tcp_check_req(struct sock *sk,struct sk_buff *skb, | |||
341 | extern int tcp_child_process(struct sock *parent, | 343 | extern int tcp_child_process(struct sock *parent, |
342 | struct sock *child, | 344 | struct sock *child, |
343 | struct sk_buff *skb); | 345 | struct sk_buff *skb); |
346 | extern int tcp_use_frto(struct sock *sk); | ||
344 | extern void tcp_enter_frto(struct sock *sk); | 347 | extern void tcp_enter_frto(struct sock *sk); |
345 | extern void tcp_enter_loss(struct sock *sk, int how); | 348 | extern void tcp_enter_loss(struct sock *sk, int how); |
346 | extern void tcp_clear_retrans(struct tcp_sock *tp); | 349 | extern void tcp_clear_retrans(struct tcp_sock *tp); |
@@ -417,9 +420,9 @@ extern __u32 cookie_v4_init_sequence(struct sock *sk, struct sk_buff *skb, | |||
417 | 420 | ||
418 | /* tcp_output.c */ | 421 | /* tcp_output.c */ |
419 | 422 | ||
420 | extern void __tcp_push_pending_frames(struct sock *sk, struct tcp_sock *tp, | 423 | extern void __tcp_push_pending_frames(struct sock *sk, unsigned int cur_mss, |
421 | unsigned int cur_mss, int nonagle); | 424 | int nonagle); |
422 | extern int tcp_may_send_now(struct sock *sk, struct tcp_sock *tp); | 425 | extern int tcp_may_send_now(struct sock *sk); |
423 | extern int tcp_retransmit_skb(struct sock *, struct sk_buff *); | 426 | extern int tcp_retransmit_skb(struct sock *, struct sk_buff *); |
424 | extern void tcp_xmit_retransmit_queue(struct sock *); | 427 | extern void tcp_xmit_retransmit_queue(struct sock *); |
425 | extern void tcp_simple_retransmit(struct sock *); | 428 | extern void tcp_simple_retransmit(struct sock *); |
@@ -476,8 +479,10 @@ static inline void tcp_fast_path_on(struct tcp_sock *tp) | |||
476 | __tcp_fast_path_on(tp, tp->snd_wnd >> tp->rx_opt.snd_wscale); | 479 | __tcp_fast_path_on(tp, tp->snd_wnd >> tp->rx_opt.snd_wscale); |
477 | } | 480 | } |
478 | 481 | ||
479 | static inline void tcp_fast_path_check(struct sock *sk, struct tcp_sock *tp) | 482 | static inline void tcp_fast_path_check(struct sock *sk) |
480 | { | 483 | { |
484 | struct tcp_sock *tp = tcp_sk(sk); | ||
485 | |||
481 | if (skb_queue_empty(&tp->out_of_order_queue) && | 486 | if (skb_queue_empty(&tp->out_of_order_queue) && |
482 | tp->rcv_wnd && | 487 | tp->rcv_wnd && |
483 | atomic_read(&sk->sk_rmem_alloc) < sk->sk_rcvbuf && | 488 | atomic_read(&sk->sk_rmem_alloc) < sk->sk_rcvbuf && |
@@ -588,10 +593,10 @@ static inline void tcp_dec_pcount_approx(__u32 *count, | |||
588 | } | 593 | } |
589 | } | 594 | } |
590 | 595 | ||
591 | static inline void tcp_packets_out_inc(struct sock *sk, | 596 | static inline void tcp_packets_out_inc(struct sock *sk, |
592 | struct tcp_sock *tp, | ||
593 | const struct sk_buff *skb) | 597 | const struct sk_buff *skb) |
594 | { | 598 | { |
599 | struct tcp_sock *tp = tcp_sk(sk); | ||
595 | int orig = tp->packets_out; | 600 | int orig = tp->packets_out; |
596 | 601 | ||
597 | tp->packets_out += tcp_skb_pcount(skb); | 602 | tp->packets_out += tcp_skb_pcount(skb); |
@@ -624,9 +629,12 @@ enum tcp_ca_event { | |||
624 | #define TCP_CA_MAX 128 | 629 | #define TCP_CA_MAX 128 |
625 | #define TCP_CA_BUF_MAX (TCP_CA_NAME_MAX*TCP_CA_MAX) | 630 | #define TCP_CA_BUF_MAX (TCP_CA_NAME_MAX*TCP_CA_MAX) |
626 | 631 | ||
632 | #define TCP_CONG_NON_RESTRICTED 0x1 | ||
633 | #define TCP_CONG_RTT_STAMP 0x2 | ||
634 | |||
627 | struct tcp_congestion_ops { | 635 | struct tcp_congestion_ops { |
628 | struct list_head list; | 636 | struct list_head list; |
629 | int non_restricted; | 637 | unsigned long flags; |
630 | 638 | ||
631 | /* initialize private data (optional) */ | 639 | /* initialize private data (optional) */ |
632 | void (*init)(struct sock *sk); | 640 | void (*init)(struct sock *sk); |
@@ -640,8 +648,6 @@ struct tcp_congestion_ops { | |||
640 | /* do new cwnd calculation (required) */ | 648 | /* do new cwnd calculation (required) */ |
641 | void (*cong_avoid)(struct sock *sk, u32 ack, | 649 | void (*cong_avoid)(struct sock *sk, u32 ack, |
642 | u32 rtt, u32 in_flight, int good_ack); | 650 | u32 rtt, u32 in_flight, int good_ack); |
643 | /* round trip time sample per acked packet (optional) */ | ||
644 | void (*rtt_sample)(struct sock *sk, u32 usrtt); | ||
645 | /* call before changing ca_state (optional) */ | 651 | /* call before changing ca_state (optional) */ |
646 | void (*set_state)(struct sock *sk, u8 new_state); | 652 | void (*set_state)(struct sock *sk, u8 new_state); |
647 | /* call when cwnd event occurs (optional) */ | 653 | /* call when cwnd event occurs (optional) */ |
@@ -649,7 +655,7 @@ struct tcp_congestion_ops { | |||
649 | /* new value of cwnd after loss (optional) */ | 655 | /* new value of cwnd after loss (optional) */ |
650 | u32 (*undo_cwnd)(struct sock *sk); | 656 | u32 (*undo_cwnd)(struct sock *sk); |
651 | /* hook for packet ack accounting (optional) */ | 657 | /* hook for packet ack accounting (optional) */ |
652 | void (*pkts_acked)(struct sock *sk, u32 num_acked); | 658 | void (*pkts_acked)(struct sock *sk, u32 num_acked, ktime_t last); |
653 | /* get info for inet_diag (optional) */ | 659 | /* get info for inet_diag (optional) */ |
654 | void (*get_info)(struct sock *sk, u32 ext, struct sk_buff *skb); | 660 | void (*get_info)(struct sock *sk, u32 ext, struct sk_buff *skb); |
655 | 661 | ||
@@ -736,7 +742,7 @@ static inline void tcp_sync_left_out(struct tcp_sock *tp) | |||
736 | tp->left_out = tp->sacked_out + tp->lost_out; | 742 | tp->left_out = tp->sacked_out + tp->lost_out; |
737 | } | 743 | } |
738 | 744 | ||
739 | extern void tcp_enter_cwr(struct sock *sk); | 745 | extern void tcp_enter_cwr(struct sock *sk, const int set_ssthresh); |
740 | extern __u32 tcp_init_cwnd(struct tcp_sock *tp, struct dst_entry *dst); | 746 | extern __u32 tcp_init_cwnd(struct tcp_sock *tp, struct dst_entry *dst); |
741 | 747 | ||
742 | /* Slow start with delack produces 3 packets of burst, so that | 748 | /* Slow start with delack produces 3 packets of burst, so that |
@@ -775,18 +781,21 @@ static inline void tcp_minshall_update(struct tcp_sock *tp, int mss, | |||
775 | tp->snd_sml = TCP_SKB_CB(skb)->end_seq; | 781 | tp->snd_sml = TCP_SKB_CB(skb)->end_seq; |
776 | } | 782 | } |
777 | 783 | ||
778 | static inline void tcp_check_probe_timer(struct sock *sk, struct tcp_sock *tp) | 784 | static inline void tcp_check_probe_timer(struct sock *sk) |
779 | { | 785 | { |
786 | struct tcp_sock *tp = tcp_sk(sk); | ||
780 | const struct inet_connection_sock *icsk = inet_csk(sk); | 787 | const struct inet_connection_sock *icsk = inet_csk(sk); |
788 | |||
781 | if (!tp->packets_out && !icsk->icsk_pending) | 789 | if (!tp->packets_out && !icsk->icsk_pending) |
782 | inet_csk_reset_xmit_timer(sk, ICSK_TIME_PROBE0, | 790 | inet_csk_reset_xmit_timer(sk, ICSK_TIME_PROBE0, |
783 | icsk->icsk_rto, TCP_RTO_MAX); | 791 | icsk->icsk_rto, TCP_RTO_MAX); |
784 | } | 792 | } |
785 | 793 | ||
786 | static inline void tcp_push_pending_frames(struct sock *sk, | 794 | static inline void tcp_push_pending_frames(struct sock *sk) |
787 | struct tcp_sock *tp) | ||
788 | { | 795 | { |
789 | __tcp_push_pending_frames(sk, tp, tcp_current_mss(sk, 1), tp->nonagle); | 796 | struct tcp_sock *tp = tcp_sk(sk); |
797 | |||
798 | __tcp_push_pending_frames(sk, tcp_current_mss(sk, 1), tp->nonagle); | ||
790 | } | 799 | } |
791 | 800 | ||
792 | static inline void tcp_init_wl(struct tcp_sock *tp, u32 ack, u32 seq) | 801 | static inline void tcp_init_wl(struct tcp_sock *tp, u32 ack, u32 seq) |
@@ -815,7 +824,7 @@ static inline __sum16 __tcp_checksum_complete(struct sk_buff *skb) | |||
815 | 824 | ||
816 | static inline int tcp_checksum_complete(struct sk_buff *skb) | 825 | static inline int tcp_checksum_complete(struct sk_buff *skb) |
817 | { | 826 | { |
818 | return skb->ip_summed != CHECKSUM_UNNECESSARY && | 827 | return !skb_csum_unnecessary(skb) && |
819 | __tcp_checksum_complete(skb); | 828 | __tcp_checksum_complete(skb); |
820 | } | 829 | } |
821 | 830 | ||
@@ -918,21 +927,7 @@ static inline void tcp_set_state(struct sock *sk, int state) | |||
918 | #endif | 927 | #endif |
919 | } | 928 | } |
920 | 929 | ||
921 | static inline void tcp_done(struct sock *sk) | 930 | extern void tcp_done(struct sock *sk); |
922 | { | ||
923 | if(sk->sk_state == TCP_SYN_SENT || sk->sk_state == TCP_SYN_RECV) | ||
924 | TCP_INC_STATS_BH(TCP_MIB_ATTEMPTFAILS); | ||
925 | |||
926 | tcp_set_state(sk, TCP_CLOSE); | ||
927 | tcp_clear_xmit_timers(sk); | ||
928 | |||
929 | sk->sk_shutdown = SHUTDOWN_MASK; | ||
930 | |||
931 | if (!sock_flag(sk, SOCK_DEAD)) | ||
932 | sk->sk_state_change(sk); | ||
933 | else | ||
934 | inet_csk_destroy_sock(sk); | ||
935 | } | ||
936 | 931 | ||
937 | static inline void tcp_sack_reset(struct tcp_options_received *rx_opt) | 932 | static inline void tcp_sack_reset(struct tcp_options_received *rx_opt) |
938 | { | 933 | { |
@@ -981,7 +976,7 @@ static inline void tcp_openreq_init(struct request_sock *req, | |||
981 | ireq->wscale_ok = rx_opt->wscale_ok; | 976 | ireq->wscale_ok = rx_opt->wscale_ok; |
982 | ireq->acked = 0; | 977 | ireq->acked = 0; |
983 | ireq->ecn_ok = 0; | 978 | ireq->ecn_ok = 0; |
984 | ireq->rmt_port = skb->h.th->source; | 979 | ireq->rmt_port = tcp_hdr(skb)->source; |
985 | } | 980 | } |
986 | 981 | ||
987 | extern void tcp_enter_memory_pressure(void); | 982 | extern void tcp_enter_memory_pressure(void); |
@@ -1011,7 +1006,7 @@ static inline int tcp_paws_check(const struct tcp_options_received *rx_opt, int | |||
1011 | { | 1006 | { |
1012 | if ((s32)(rx_opt->rcv_tsval - rx_opt->ts_recent) >= 0) | 1007 | if ((s32)(rx_opt->rcv_tsval - rx_opt->ts_recent) >= 0) |
1013 | return 0; | 1008 | return 0; |
1014 | if (xtime.tv_sec >= rx_opt->ts_recent_stamp + TCP_PAWS_24DAYS) | 1009 | if (get_seconds() >= rx_opt->ts_recent_stamp + TCP_PAWS_24DAYS) |
1015 | return 0; | 1010 | return 0; |
1016 | 1011 | ||
1017 | /* RST segments are not recommended to carry timestamp, | 1012 | /* RST segments are not recommended to carry timestamp, |
@@ -1026,26 +1021,13 @@ static inline int tcp_paws_check(const struct tcp_options_received *rx_opt, int | |||
1026 | 1021 | ||
1027 | However, we can relax time bounds for RST segments to MSL. | 1022 | However, we can relax time bounds for RST segments to MSL. |
1028 | */ | 1023 | */ |
1029 | if (rst && xtime.tv_sec >= rx_opt->ts_recent_stamp + TCP_PAWS_MSL) | 1024 | if (rst && get_seconds() >= rx_opt->ts_recent_stamp + TCP_PAWS_MSL) |
1030 | return 0; | 1025 | return 0; |
1031 | return 1; | 1026 | return 1; |
1032 | } | 1027 | } |
1033 | 1028 | ||
1034 | #define TCP_CHECK_TIMER(sk) do { } while (0) | 1029 | #define TCP_CHECK_TIMER(sk) do { } while (0) |
1035 | 1030 | ||
1036 | static inline int tcp_use_frto(const struct sock *sk) | ||
1037 | { | ||
1038 | const struct tcp_sock *tp = tcp_sk(sk); | ||
1039 | |||
1040 | /* F-RTO must be activated in sysctl and there must be some | ||
1041 | * unsent new data, and the advertised window should allow | ||
1042 | * sending it. | ||
1043 | */ | ||
1044 | return (sysctl_tcp_frto && sk->sk_send_head && | ||
1045 | !after(TCP_SKB_CB(sk->sk_send_head)->end_seq, | ||
1046 | tp->snd_una + tp->snd_wnd)); | ||
1047 | } | ||
1048 | |||
1049 | static inline void tcp_mib_init(void) | 1031 | static inline void tcp_mib_init(void) |
1050 | { | 1032 | { |
1051 | /* See RFC 2012 */ | 1033 | /* See RFC 2012 */ |
@@ -1172,6 +1154,120 @@ static inline void tcp_put_md5sig_pool(void) | |||
1172 | put_cpu(); | 1154 | put_cpu(); |
1173 | } | 1155 | } |
1174 | 1156 | ||
1157 | /* write queue abstraction */ | ||
1158 | static inline void tcp_write_queue_purge(struct sock *sk) | ||
1159 | { | ||
1160 | struct sk_buff *skb; | ||
1161 | |||
1162 | while ((skb = __skb_dequeue(&sk->sk_write_queue)) != NULL) | ||
1163 | sk_stream_free_skb(sk, skb); | ||
1164 | sk_stream_mem_reclaim(sk); | ||
1165 | } | ||
1166 | |||
1167 | static inline struct sk_buff *tcp_write_queue_head(struct sock *sk) | ||
1168 | { | ||
1169 | struct sk_buff *skb = sk->sk_write_queue.next; | ||
1170 | if (skb == (struct sk_buff *) &sk->sk_write_queue) | ||
1171 | return NULL; | ||
1172 | return skb; | ||
1173 | } | ||
1174 | |||
1175 | static inline struct sk_buff *tcp_write_queue_tail(struct sock *sk) | ||
1176 | { | ||
1177 | struct sk_buff *skb = sk->sk_write_queue.prev; | ||
1178 | if (skb == (struct sk_buff *) &sk->sk_write_queue) | ||
1179 | return NULL; | ||
1180 | return skb; | ||
1181 | } | ||
1182 | |||
1183 | static inline struct sk_buff *tcp_write_queue_next(struct sock *sk, struct sk_buff *skb) | ||
1184 | { | ||
1185 | return skb->next; | ||
1186 | } | ||
1187 | |||
1188 | #define tcp_for_write_queue(skb, sk) \ | ||
1189 | for (skb = (sk)->sk_write_queue.next; \ | ||
1190 | (skb != (struct sk_buff *)&(sk)->sk_write_queue); \ | ||
1191 | skb = skb->next) | ||
1192 | |||
1193 | #define tcp_for_write_queue_from(skb, sk) \ | ||
1194 | for (; (skb != (struct sk_buff *)&(sk)->sk_write_queue);\ | ||
1195 | skb = skb->next) | ||
1196 | |||
1197 | static inline struct sk_buff *tcp_send_head(struct sock *sk) | ||
1198 | { | ||
1199 | return sk->sk_send_head; | ||
1200 | } | ||
1201 | |||
1202 | static inline void tcp_advance_send_head(struct sock *sk, struct sk_buff *skb) | ||
1203 | { | ||
1204 | sk->sk_send_head = skb->next; | ||
1205 | if (sk->sk_send_head == (struct sk_buff *)&sk->sk_write_queue) | ||
1206 | sk->sk_send_head = NULL; | ||
1207 | } | ||
1208 | |||
1209 | static inline void tcp_check_send_head(struct sock *sk, struct sk_buff *skb_unlinked) | ||
1210 | { | ||
1211 | if (sk->sk_send_head == skb_unlinked) | ||
1212 | sk->sk_send_head = NULL; | ||
1213 | } | ||
1214 | |||
1215 | static inline void tcp_init_send_head(struct sock *sk) | ||
1216 | { | ||
1217 | sk->sk_send_head = NULL; | ||
1218 | } | ||
1219 | |||
1220 | static inline void __tcp_add_write_queue_tail(struct sock *sk, struct sk_buff *skb) | ||
1221 | { | ||
1222 | __skb_queue_tail(&sk->sk_write_queue, skb); | ||
1223 | } | ||
1224 | |||
1225 | static inline void tcp_add_write_queue_tail(struct sock *sk, struct sk_buff *skb) | ||
1226 | { | ||
1227 | __tcp_add_write_queue_tail(sk, skb); | ||
1228 | |||
1229 | /* Queue it, remembering where we must start sending. */ | ||
1230 | if (sk->sk_send_head == NULL) | ||
1231 | sk->sk_send_head = skb; | ||
1232 | } | ||
1233 | |||
1234 | static inline void __tcp_add_write_queue_head(struct sock *sk, struct sk_buff *skb) | ||
1235 | { | ||
1236 | __skb_queue_head(&sk->sk_write_queue, skb); | ||
1237 | } | ||
1238 | |||
1239 | /* Insert buff after skb on the write queue of sk. */ | ||
1240 | static inline void tcp_insert_write_queue_after(struct sk_buff *skb, | ||
1241 | struct sk_buff *buff, | ||
1242 | struct sock *sk) | ||
1243 | { | ||
1244 | __skb_append(skb, buff, &sk->sk_write_queue); | ||
1245 | } | ||
1246 | |||
1247 | /* Insert skb between prev and next on the write queue of sk. */ | ||
1248 | static inline void tcp_insert_write_queue_before(struct sk_buff *new, | ||
1249 | struct sk_buff *skb, | ||
1250 | struct sock *sk) | ||
1251 | { | ||
1252 | __skb_insert(new, skb->prev, skb, &sk->sk_write_queue); | ||
1253 | } | ||
1254 | |||
1255 | static inline void tcp_unlink_write_queue(struct sk_buff *skb, struct sock *sk) | ||
1256 | { | ||
1257 | __skb_unlink(skb, &sk->sk_write_queue); | ||
1258 | } | ||
1259 | |||
1260 | static inline int tcp_skb_is_last(const struct sock *sk, | ||
1261 | const struct sk_buff *skb) | ||
1262 | { | ||
1263 | return skb->next == (struct sk_buff *)&sk->sk_write_queue; | ||
1264 | } | ||
1265 | |||
1266 | static inline int tcp_write_queue_empty(struct sock *sk) | ||
1267 | { | ||
1268 | return skb_queue_empty(&sk->sk_write_queue); | ||
1269 | } | ||
1270 | |||
1175 | /* /proc */ | 1271 | /* /proc */ |
1176 | enum tcp_seq_states { | 1272 | enum tcp_seq_states { |
1177 | TCP_SEQ_STATE_LISTENING, | 1273 | TCP_SEQ_STATE_LISTENING, |
diff --git a/include/net/tcp_ecn.h b/include/net/tcp_ecn.h index 4629d77173f2..89eb3e05116d 100644 --- a/include/net/tcp_ecn.h +++ b/include/net/tcp_ecn.h | |||
@@ -27,9 +27,10 @@ static inline void TCP_ECN_send_synack(struct tcp_sock *tp, | |||
27 | TCP_SKB_CB(skb)->flags &= ~TCPCB_FLAG_ECE; | 27 | TCP_SKB_CB(skb)->flags &= ~TCPCB_FLAG_ECE; |
28 | } | 28 | } |
29 | 29 | ||
30 | static inline void TCP_ECN_send_syn(struct sock *sk, struct tcp_sock *tp, | 30 | static inline void TCP_ECN_send_syn(struct sock *sk, struct sk_buff *skb) |
31 | struct sk_buff *skb) | ||
32 | { | 31 | { |
32 | struct tcp_sock *tp = tcp_sk(sk); | ||
33 | |||
33 | tp->ecn_flags = 0; | 34 | tp->ecn_flags = 0; |
34 | if (sysctl_tcp_ecn) { | 35 | if (sysctl_tcp_ecn) { |
35 | TCP_SKB_CB(skb)->flags |= TCPCB_FLAG_ECE|TCPCB_FLAG_CWR; | 36 | TCP_SKB_CB(skb)->flags |= TCPCB_FLAG_ECE|TCPCB_FLAG_CWR; |
@@ -44,9 +45,11 @@ TCP_ECN_make_synack(struct request_sock *req, struct tcphdr *th) | |||
44 | th->ece = 1; | 45 | th->ece = 1; |
45 | } | 46 | } |
46 | 47 | ||
47 | static inline void TCP_ECN_send(struct sock *sk, struct tcp_sock *tp, | 48 | static inline void TCP_ECN_send(struct sock *sk, struct sk_buff *skb, |
48 | struct sk_buff *skb, int tcp_header_len) | 49 | int tcp_header_len) |
49 | { | 50 | { |
51 | struct tcp_sock *tp = tcp_sk(sk); | ||
52 | |||
50 | if (tp->ecn_flags & TCP_ECN_OK) { | 53 | if (tp->ecn_flags & TCP_ECN_OK) { |
51 | /* Not-retransmitted data segment: set ECT and inject CWR. */ | 54 | /* Not-retransmitted data segment: set ECT and inject CWR. */ |
52 | if (skb->len != tcp_header_len && | 55 | if (skb->len != tcp_header_len && |
@@ -54,7 +57,7 @@ static inline void TCP_ECN_send(struct sock *sk, struct tcp_sock *tp, | |||
54 | INET_ECN_xmit(sk); | 57 | INET_ECN_xmit(sk); |
55 | if (tp->ecn_flags&TCP_ECN_QUEUE_CWR) { | 58 | if (tp->ecn_flags&TCP_ECN_QUEUE_CWR) { |
56 | tp->ecn_flags &= ~TCP_ECN_QUEUE_CWR; | 59 | tp->ecn_flags &= ~TCP_ECN_QUEUE_CWR; |
57 | skb->h.th->cwr = 1; | 60 | tcp_hdr(skb)->cwr = 1; |
58 | skb_shinfo(skb)->gso_type |= SKB_GSO_TCP_ECN; | 61 | skb_shinfo(skb)->gso_type |= SKB_GSO_TCP_ECN; |
59 | } | 62 | } |
60 | } else { | 63 | } else { |
@@ -62,7 +65,7 @@ static inline void TCP_ECN_send(struct sock *sk, struct tcp_sock *tp, | |||
62 | INET_ECN_dontxmit(sk); | 65 | INET_ECN_dontxmit(sk); |
63 | } | 66 | } |
64 | if (tp->ecn_flags & TCP_ECN_DEMAND_CWR) | 67 | if (tp->ecn_flags & TCP_ECN_DEMAND_CWR) |
65 | skb->h.th->ece = 1; | 68 | tcp_hdr(skb)->ece = 1; |
66 | } | 69 | } |
67 | } | 70 | } |
68 | 71 | ||
@@ -70,7 +73,7 @@ static inline void TCP_ECN_send(struct sock *sk, struct tcp_sock *tp, | |||
70 | 73 | ||
71 | static inline void TCP_ECN_accept_cwr(struct tcp_sock *tp, struct sk_buff *skb) | 74 | static inline void TCP_ECN_accept_cwr(struct tcp_sock *tp, struct sk_buff *skb) |
72 | { | 75 | { |
73 | if (skb->h.th->cwr) | 76 | if (tcp_hdr(skb)->cwr) |
74 | tp->ecn_flags &= ~TCP_ECN_DEMAND_CWR; | 77 | tp->ecn_flags &= ~TCP_ECN_DEMAND_CWR; |
75 | } | 78 | } |
76 | 79 | ||
diff --git a/include/net/udp.h b/include/net/udp.h index 1b921fa81474..98755ebaf163 100644 --- a/include/net/udp.h +++ b/include/net/udp.h | |||
@@ -72,15 +72,12 @@ struct sk_buff; | |||
72 | */ | 72 | */ |
73 | static inline __sum16 __udp_lib_checksum_complete(struct sk_buff *skb) | 73 | static inline __sum16 __udp_lib_checksum_complete(struct sk_buff *skb) |
74 | { | 74 | { |
75 | if (! UDP_SKB_CB(skb)->partial_cov) | 75 | return __skb_checksum_complete_head(skb, UDP_SKB_CB(skb)->cscov); |
76 | return __skb_checksum_complete(skb); | ||
77 | return csum_fold(skb_checksum(skb, 0, UDP_SKB_CB(skb)->cscov, | ||
78 | skb->csum)); | ||
79 | } | 76 | } |
80 | 77 | ||
81 | static inline int udp_lib_checksum_complete(struct sk_buff *skb) | 78 | static inline int udp_lib_checksum_complete(struct sk_buff *skb) |
82 | { | 79 | { |
83 | return skb->ip_summed != CHECKSUM_UNNECESSARY && | 80 | return !skb_csum_unnecessary(skb) && |
84 | __udp_lib_checksum_complete(skb); | 81 | __udp_lib_checksum_complete(skb); |
85 | } | 82 | } |
86 | 83 | ||
@@ -92,8 +89,8 @@ static inline int udp_lib_checksum_complete(struct sk_buff *skb) | |||
92 | */ | 89 | */ |
93 | static inline __wsum udp_csum_outgoing(struct sock *sk, struct sk_buff *skb) | 90 | static inline __wsum udp_csum_outgoing(struct sock *sk, struct sk_buff *skb) |
94 | { | 91 | { |
95 | __wsum csum = csum_partial(skb->h.raw, sizeof(struct udphdr), 0); | 92 | __wsum csum = csum_partial(skb_transport_header(skb), |
96 | 93 | sizeof(struct udphdr), 0); | |
97 | skb_queue_walk(&sk->sk_write_queue, skb) { | 94 | skb_queue_walk(&sk->sk_write_queue, skb) { |
98 | csum = csum_add(csum, skb->csum); | 95 | csum = csum_add(csum, skb->csum); |
99 | } | 96 | } |
diff --git a/include/net/udplite.h b/include/net/udplite.h index 67ac51424307..635b0eafca95 100644 --- a/include/net/udplite.h +++ b/include/net/udplite.h | |||
@@ -47,11 +47,10 @@ static inline int udplite_checksum_init(struct sk_buff *skb, struct udphdr *uh) | |||
47 | return 1; | 47 | return 1; |
48 | } | 48 | } |
49 | 49 | ||
50 | UDP_SKB_CB(skb)->partial_cov = 0; | ||
51 | cscov = ntohs(uh->len); | 50 | cscov = ntohs(uh->len); |
52 | 51 | ||
53 | if (cscov == 0) /* Indicates that full coverage is required. */ | 52 | if (cscov == 0) /* Indicates that full coverage is required. */ |
54 | cscov = skb->len; | 53 | ; |
55 | else if (cscov < 8 || cscov > skb->len) { | 54 | else if (cscov < 8 || cscov > skb->len) { |
56 | /* | 55 | /* |
57 | * Coverage length violates RFC 3828: log and discard silently. | 56 | * Coverage length violates RFC 3828: log and discard silently. |
@@ -60,42 +59,16 @@ static inline int udplite_checksum_init(struct sk_buff *skb, struct udphdr *uh) | |||
60 | cscov, skb->len); | 59 | cscov, skb->len); |
61 | return 1; | 60 | return 1; |
62 | 61 | ||
63 | } else if (cscov < skb->len) | 62 | } else if (cscov < skb->len) { |
64 | UDP_SKB_CB(skb)->partial_cov = 1; | 63 | UDP_SKB_CB(skb)->partial_cov = 1; |
65 | 64 | UDP_SKB_CB(skb)->cscov = cscov; | |
66 | UDP_SKB_CB(skb)->cscov = cscov; | 65 | if (skb->ip_summed == CHECKSUM_COMPLETE) |
67 | 66 | skb->ip_summed = CHECKSUM_NONE; | |
68 | /* | 67 | } |
69 | * There is no known NIC manufacturer supporting UDP-Lite yet, | ||
70 | * hence ip_summed is always (re-)set to CHECKSUM_NONE. | ||
71 | */ | ||
72 | skb->ip_summed = CHECKSUM_NONE; | ||
73 | 68 | ||
74 | return 0; | 69 | return 0; |
75 | } | 70 | } |
76 | 71 | ||
77 | static __inline__ int udplite4_csum_init(struct sk_buff *skb, struct udphdr *uh) | ||
78 | { | ||
79 | int rc = udplite_checksum_init(skb, uh); | ||
80 | |||
81 | if (!rc) | ||
82 | skb->csum = csum_tcpudp_nofold(skb->nh.iph->saddr, | ||
83 | skb->nh.iph->daddr, | ||
84 | skb->len, IPPROTO_UDPLITE, 0); | ||
85 | return rc; | ||
86 | } | ||
87 | |||
88 | static __inline__ int udplite6_csum_init(struct sk_buff *skb, struct udphdr *uh) | ||
89 | { | ||
90 | int rc = udplite_checksum_init(skb, uh); | ||
91 | |||
92 | if (!rc) | ||
93 | skb->csum = ~csum_unfold(csum_ipv6_magic(&skb->nh.ipv6h->saddr, | ||
94 | &skb->nh.ipv6h->daddr, | ||
95 | skb->len, IPPROTO_UDPLITE, 0)); | ||
96 | return rc; | ||
97 | } | ||
98 | |||
99 | static inline int udplite_sender_cscov(struct udp_sock *up, struct udphdr *uh) | 72 | static inline int udplite_sender_cscov(struct udp_sock *up, struct udphdr *uh) |
100 | { | 73 | { |
101 | int cscov = up->len; | 74 | int cscov = up->len; |
@@ -128,14 +101,14 @@ static inline int udplite_sender_cscov(struct udp_sock *up, struct udphdr *uh) | |||
128 | 101 | ||
129 | static inline __wsum udplite_csum_outgoing(struct sock *sk, struct sk_buff *skb) | 102 | static inline __wsum udplite_csum_outgoing(struct sock *sk, struct sk_buff *skb) |
130 | { | 103 | { |
131 | int off, len, cscov = udplite_sender_cscov(udp_sk(sk), skb->h.uh); | 104 | int cscov = udplite_sender_cscov(udp_sk(sk), udp_hdr(skb)); |
132 | __wsum csum = 0; | 105 | __wsum csum = 0; |
133 | 106 | ||
134 | skb->ip_summed = CHECKSUM_NONE; /* no HW support for checksumming */ | 107 | skb->ip_summed = CHECKSUM_NONE; /* no HW support for checksumming */ |
135 | 108 | ||
136 | skb_queue_walk(&sk->sk_write_queue, skb) { | 109 | skb_queue_walk(&sk->sk_write_queue, skb) { |
137 | off = skb->h.raw - skb->data; | 110 | const int off = skb_transport_offset(skb); |
138 | len = skb->len - off; | 111 | const int len = skb->len - off; |
139 | 112 | ||
140 | csum = skb_checksum(skb, off, (cscov > len)? len : cscov, csum); | 113 | csum = skb_checksum(skb, off, (cscov > len)? len : cscov, csum); |
141 | 114 | ||
diff --git a/include/net/wext.h b/include/net/wext.h new file mode 100644 index 000000000000..c02b8decf3af --- /dev/null +++ b/include/net/wext.h | |||
@@ -0,0 +1,24 @@ | |||
1 | #ifndef __NET_WEXT_H | ||
2 | #define __NET_WEXT_H | ||
3 | |||
4 | /* | ||
5 | * wireless extensions interface to the core code | ||
6 | */ | ||
7 | |||
8 | #ifdef CONFIG_WIRELESS_EXT | ||
9 | extern int wext_proc_init(void); | ||
10 | extern int wext_handle_ioctl(struct ifreq *ifr, unsigned int cmd, | ||
11 | void __user *arg); | ||
12 | #else | ||
13 | static inline int wext_proc_init(void) | ||
14 | { | ||
15 | return 0; | ||
16 | } | ||
17 | static inline int wext_handle_ioctl(struct ifreq *ifr, unsigned int cmd, | ||
18 | void __user *arg) | ||
19 | { | ||
20 | return -EINVAL; | ||
21 | } | ||
22 | #endif | ||
23 | |||
24 | #endif /* __NET_WEXT_H */ | ||
diff --git a/include/net/wireless.h b/include/net/wireless.h new file mode 100644 index 000000000000..d30c4ba8fd99 --- /dev/null +++ b/include/net/wireless.h | |||
@@ -0,0 +1,139 @@ | |||
1 | #ifndef __NET_WIRELESS_H | ||
2 | #define __NET_WIRELESS_H | ||
3 | |||
4 | /* | ||
5 | * 802.11 device management | ||
6 | * | ||
7 | * Copyright 2007 Johannes Berg <johannes@sipsolutions.net> | ||
8 | */ | ||
9 | |||
10 | #include <linux/netdevice.h> | ||
11 | #include <linux/debugfs.h> | ||
12 | #include <linux/list.h> | ||
13 | #include <net/cfg80211.h> | ||
14 | |||
15 | /** | ||
16 | * struct wiphy - wireless hardware description | ||
17 | * @idx: the wiphy index assigned to this item | ||
18 | * @class_dev: the class device representing /sys/class/ieee80211/<wiphy-name> | ||
19 | */ | ||
20 | struct wiphy { | ||
21 | /* assign these fields before you register the wiphy */ | ||
22 | |||
23 | /* permanent MAC address */ | ||
24 | u8 perm_addr[ETH_ALEN]; | ||
25 | |||
26 | /* If multiple wiphys are registered and you're handed e.g. | ||
27 | * a regular netdev with assigned ieee80211_ptr, you won't | ||
28 | * know whether it points to a wiphy your driver has registered | ||
29 | * or not. Assign this to something global to your driver to | ||
30 | * help determine whether you own this wiphy or not. */ | ||
31 | void *privid; | ||
32 | |||
33 | /* fields below are read-only, assigned by cfg80211 */ | ||
34 | |||
35 | /* the item in /sys/class/ieee80211/ points to this, | ||
36 | * you need use set_wiphy_dev() (see below) */ | ||
37 | struct device dev; | ||
38 | |||
39 | /* dir in debugfs: ieee80211/<wiphyname> */ | ||
40 | struct dentry *debugfsdir; | ||
41 | |||
42 | char priv[0] __attribute__((__aligned__(NETDEV_ALIGN))); | ||
43 | }; | ||
44 | |||
45 | /** struct wireless_dev - wireless per-netdev state | ||
46 | * | ||
47 | * This structure must be allocated by the driver/stack | ||
48 | * that uses the ieee80211_ptr field in struct net_device | ||
49 | * (this is intentional so it can be allocated along with | ||
50 | * the netdev.) | ||
51 | * | ||
52 | * @wiphy: pointer to hardware description | ||
53 | */ | ||
54 | struct wireless_dev { | ||
55 | struct wiphy *wiphy; | ||
56 | |||
57 | /* private to the generic wireless code */ | ||
58 | struct list_head list; | ||
59 | struct net_device *netdev; | ||
60 | }; | ||
61 | |||
62 | /** | ||
63 | * wiphy_priv - return priv from wiphy | ||
64 | */ | ||
65 | static inline void *wiphy_priv(struct wiphy *wiphy) | ||
66 | { | ||
67 | BUG_ON(!wiphy); | ||
68 | return &wiphy->priv; | ||
69 | } | ||
70 | |||
71 | /** | ||
72 | * set_wiphy_dev - set device pointer for wiphy | ||
73 | */ | ||
74 | static inline void set_wiphy_dev(struct wiphy *wiphy, struct device *dev) | ||
75 | { | ||
76 | wiphy->dev.parent = dev; | ||
77 | } | ||
78 | |||
79 | /** | ||
80 | * wiphy_dev - get wiphy dev pointer | ||
81 | */ | ||
82 | static inline struct device *wiphy_dev(struct wiphy *wiphy) | ||
83 | { | ||
84 | return wiphy->dev.parent; | ||
85 | } | ||
86 | |||
87 | /** | ||
88 | * wiphy_name - get wiphy name | ||
89 | */ | ||
90 | static inline char *wiphy_name(struct wiphy *wiphy) | ||
91 | { | ||
92 | return wiphy->dev.bus_id; | ||
93 | } | ||
94 | |||
95 | /** | ||
96 | * wdev_priv - return wiphy priv from wireless_dev | ||
97 | */ | ||
98 | static inline void *wdev_priv(struct wireless_dev *wdev) | ||
99 | { | ||
100 | BUG_ON(!wdev); | ||
101 | return wiphy_priv(wdev->wiphy); | ||
102 | } | ||
103 | |||
104 | /** | ||
105 | * wiphy_new - create a new wiphy for use with cfg80211 | ||
106 | * | ||
107 | * create a new wiphy and associate the given operations with it. | ||
108 | * @sizeof_priv bytes are allocated for private use. | ||
109 | * | ||
110 | * the returned pointer must be assigned to each netdev's | ||
111 | * ieee80211_ptr for proper operation. | ||
112 | */ | ||
113 | struct wiphy *wiphy_new(struct cfg80211_ops *ops, int sizeof_priv); | ||
114 | |||
115 | /** | ||
116 | * wiphy_register - register a wiphy with cfg80211 | ||
117 | * | ||
118 | * register the given wiphy | ||
119 | * | ||
120 | * Returns a non-negative wiphy index or a negative error code. | ||
121 | */ | ||
122 | extern int wiphy_register(struct wiphy *wiphy); | ||
123 | |||
124 | /** | ||
125 | * wiphy_unregister - deregister a wiphy from cfg80211 | ||
126 | * | ||
127 | * unregister a device with the given priv pointer. | ||
128 | * After this call, no more requests can be made with this priv | ||
129 | * pointer, but the call may sleep to wait for an outstanding | ||
130 | * request that is being handled. | ||
131 | */ | ||
132 | extern void wiphy_unregister(struct wiphy *wiphy); | ||
133 | |||
134 | /** | ||
135 | * wiphy_free - free wiphy | ||
136 | */ | ||
137 | extern void wiphy_free(struct wiphy *wiphy); | ||
138 | |||
139 | #endif /* __NET_WIRELESS_H */ | ||
diff --git a/include/net/x25device.h b/include/net/x25device.h index 1d10c879f7e2..1415bcf93980 100644 --- a/include/net/x25device.h +++ b/include/net/x25device.h | |||
@@ -7,8 +7,8 @@ | |||
7 | 7 | ||
8 | static inline __be16 x25_type_trans(struct sk_buff *skb, struct net_device *dev) | 8 | static inline __be16 x25_type_trans(struct sk_buff *skb, struct net_device *dev) |
9 | { | 9 | { |
10 | skb->mac.raw = skb->data; | ||
11 | skb->dev = dev; | 10 | skb->dev = dev; |
11 | skb_reset_mac_header(skb); | ||
12 | skb->pkt_type = PACKET_HOST; | 12 | skb->pkt_type = PACKET_HOST; |
13 | 13 | ||
14 | return htons(ETH_P_X25); | 14 | return htons(ETH_P_X25); |
diff --git a/include/net/xfrm.h b/include/net/xfrm.h index 5a00aa85b756..8287081d77f2 100644 --- a/include/net/xfrm.h +++ b/include/net/xfrm.h | |||
@@ -279,7 +279,7 @@ struct xfrm_type | |||
279 | xfrm_address_t *(*local_addr)(struct xfrm_state *, xfrm_address_t *); | 279 | xfrm_address_t *(*local_addr)(struct xfrm_state *, xfrm_address_t *); |
280 | xfrm_address_t *(*remote_addr)(struct xfrm_state *, xfrm_address_t *); | 280 | xfrm_address_t *(*remote_addr)(struct xfrm_state *, xfrm_address_t *); |
281 | /* Estimate maximal size of result of transformation of a dgram */ | 281 | /* Estimate maximal size of result of transformation of a dgram */ |
282 | u32 (*get_max_size)(struct xfrm_state *, int size); | 282 | u32 (*get_mtu)(struct xfrm_state *, int size); |
283 | }; | 283 | }; |
284 | 284 | ||
285 | extern int xfrm_register_type(struct xfrm_type *type, unsigned short family); | 285 | extern int xfrm_register_type(struct xfrm_type *type, unsigned short family); |
@@ -416,6 +416,13 @@ struct xfrm_audit | |||
416 | u32 secid; | 416 | u32 secid; |
417 | }; | 417 | }; |
418 | 418 | ||
419 | /* SAD metadata, add more later */ | ||
420 | struct xfrm_sadinfo | ||
421 | { | ||
422 | u32 sadhcnt; /* current hash bkts */ | ||
423 | u32 sadhmcnt; /* max allowed hash bkts */ | ||
424 | u32 sadcnt; /* current running count */ | ||
425 | }; | ||
419 | #ifdef CONFIG_AUDITSYSCALL | 426 | #ifdef CONFIG_AUDITSYSCALL |
420 | extern void xfrm_audit_log(uid_t auid, u32 secid, int type, int result, | 427 | extern void xfrm_audit_log(uid_t auid, u32 secid, int type, int result, |
421 | struct xfrm_policy *xp, struct xfrm_state *x); | 428 | struct xfrm_policy *xp, struct xfrm_state *x); |
@@ -938,6 +945,7 @@ static inline int xfrm_state_sort(struct xfrm_state **dst, struct xfrm_state **s | |||
938 | extern struct xfrm_state *xfrm_find_acq_byseq(u32 seq); | 945 | extern struct xfrm_state *xfrm_find_acq_byseq(u32 seq); |
939 | extern int xfrm_state_delete(struct xfrm_state *x); | 946 | extern int xfrm_state_delete(struct xfrm_state *x); |
940 | extern void xfrm_state_flush(u8 proto, struct xfrm_audit *audit_info); | 947 | extern void xfrm_state_flush(u8 proto, struct xfrm_audit *audit_info); |
948 | extern void xfrm_sad_getinfo(struct xfrm_sadinfo *si); | ||
941 | extern int xfrm_replay_check(struct xfrm_state *x, __be32 seq); | 949 | extern int xfrm_replay_check(struct xfrm_state *x, __be32 seq); |
942 | extern void xfrm_replay_advance(struct xfrm_state *x, __be32 seq); | 950 | extern void xfrm_replay_advance(struct xfrm_state *x, __be32 seq); |
943 | extern void xfrm_replay_notify(struct xfrm_state *x, int event); | 951 | extern void xfrm_replay_notify(struct xfrm_state *x, int event); |
diff --git a/include/rxrpc/call.h b/include/rxrpc/call.h deleted file mode 100644 index b86f83743510..000000000000 --- a/include/rxrpc/call.h +++ /dev/null | |||
@@ -1,212 +0,0 @@ | |||
1 | /* call.h: Rx call record | ||
2 | * | ||
3 | * Copyright (C) 2002 Red Hat, Inc. All Rights Reserved. | ||
4 | * Written by David Howells (dhowells@redhat.com) | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or | ||
7 | * modify it under the terms of the GNU General Public License | ||
8 | * as published by the Free Software Foundation; either version | ||
9 | * 2 of the License, or (at your option) any later version. | ||
10 | */ | ||
11 | |||
12 | #ifndef _LINUX_RXRPC_CALL_H | ||
13 | #define _LINUX_RXRPC_CALL_H | ||
14 | |||
15 | #include <rxrpc/types.h> | ||
16 | #include <rxrpc/rxrpc.h> | ||
17 | #include <rxrpc/packet.h> | ||
18 | #include <linux/timer.h> | ||
19 | |||
20 | #define RXRPC_CALL_ACK_WINDOW_SIZE 16 | ||
21 | |||
22 | extern unsigned rxrpc_call_rcv_timeout; /* receive activity timeout (secs) */ | ||
23 | |||
24 | /* application call state | ||
25 | * - only state 0 and ffff are reserved, the state is set to 1 after an opid is received | ||
26 | */ | ||
27 | enum rxrpc_app_cstate { | ||
28 | RXRPC_CSTATE_COMPLETE = 0, /* operation complete */ | ||
29 | RXRPC_CSTATE_ERROR, /* operation ICMP error or aborted */ | ||
30 | RXRPC_CSTATE_SRVR_RCV_OPID, /* [SERVER] receiving operation ID */ | ||
31 | RXRPC_CSTATE_SRVR_RCV_ARGS, /* [SERVER] receiving operation data */ | ||
32 | RXRPC_CSTATE_SRVR_GOT_ARGS, /* [SERVER] completely received operation data */ | ||
33 | RXRPC_CSTATE_SRVR_SND_REPLY, /* [SERVER] sending operation reply */ | ||
34 | RXRPC_CSTATE_SRVR_RCV_FINAL_ACK, /* [SERVER] receiving final ACK */ | ||
35 | RXRPC_CSTATE_CLNT_SND_ARGS, /* [CLIENT] sending operation args */ | ||
36 | RXRPC_CSTATE_CLNT_RCV_REPLY, /* [CLIENT] receiving operation reply */ | ||
37 | RXRPC_CSTATE_CLNT_GOT_REPLY, /* [CLIENT] completely received operation reply */ | ||
38 | } __attribute__((packed)); | ||
39 | |||
40 | extern const char *rxrpc_call_states[]; | ||
41 | |||
42 | enum rxrpc_app_estate { | ||
43 | RXRPC_ESTATE_NO_ERROR = 0, /* no error */ | ||
44 | RXRPC_ESTATE_LOCAL_ABORT, /* aborted locally by application layer */ | ||
45 | RXRPC_ESTATE_PEER_ABORT, /* aborted remotely by peer */ | ||
46 | RXRPC_ESTATE_LOCAL_ERROR, /* local ICMP network error */ | ||
47 | RXRPC_ESTATE_REMOTE_ERROR, /* remote ICMP network error */ | ||
48 | } __attribute__((packed)); | ||
49 | |||
50 | extern const char *rxrpc_call_error_states[]; | ||
51 | |||
52 | /*****************************************************************************/ | ||
53 | /* | ||
54 | * Rx call record and application scratch buffer | ||
55 | * - the call record occupies the bottom of a complete page | ||
56 | * - the application scratch buffer occupies the rest | ||
57 | */ | ||
58 | struct rxrpc_call | ||
59 | { | ||
60 | atomic_t usage; | ||
61 | struct rxrpc_connection *conn; /* connection upon which active */ | ||
62 | spinlock_t lock; /* access lock */ | ||
63 | struct module *owner; /* owner module */ | ||
64 | wait_queue_head_t waitq; /* wait queue for events to happen */ | ||
65 | struct list_head link; /* general internal list link */ | ||
66 | struct list_head call_link; /* master call list link */ | ||
67 | __be32 chan_ix; /* connection channel index */ | ||
68 | __be32 call_id; /* call ID on connection */ | ||
69 | unsigned long cjif; /* jiffies at call creation */ | ||
70 | unsigned long flags; /* control flags */ | ||
71 | #define RXRPC_CALL_ACKS_TIMO 0x00000001 /* ACKS timeout reached */ | ||
72 | #define RXRPC_CALL_ACKR_TIMO 0x00000002 /* ACKR timeout reached */ | ||
73 | #define RXRPC_CALL_RCV_TIMO 0x00000004 /* RCV timeout reached */ | ||
74 | #define RXRPC_CALL_RCV_PKT 0x00000008 /* received packet */ | ||
75 | |||
76 | /* transmission */ | ||
77 | rxrpc_seq_t snd_seq_count; /* outgoing packet sequence number counter */ | ||
78 | struct rxrpc_message *snd_nextmsg; /* next message being constructed for sending */ | ||
79 | struct rxrpc_message *snd_ping; /* last ping message sent */ | ||
80 | unsigned short snd_resend_cnt; /* count of resends since last ACK */ | ||
81 | |||
82 | /* transmission ACK tracking */ | ||
83 | struct list_head acks_pendq; /* messages pending ACK (ordered by seq) */ | ||
84 | unsigned acks_pend_cnt; /* number of un-ACK'd packets */ | ||
85 | rxrpc_seq_t acks_dftv_seq; /* highest definitively ACK'd msg seq */ | ||
86 | struct timer_list acks_timeout; /* timeout on expected ACK */ | ||
87 | |||
88 | /* reception */ | ||
89 | struct list_head rcv_receiveq; /* messages pending reception (ordered by seq) */ | ||
90 | struct list_head rcv_krxiodq_lk; /* krxiod queue for new inbound packets */ | ||
91 | struct timer_list rcv_timeout; /* call receive activity timeout */ | ||
92 | |||
93 | /* reception ACK'ing */ | ||
94 | rxrpc_seq_t ackr_win_bot; /* bottom of ACK window */ | ||
95 | rxrpc_seq_t ackr_win_top; /* top of ACK window */ | ||
96 | rxrpc_seq_t ackr_high_seq; /* highest seqno yet received */ | ||
97 | rxrpc_seq_net_t ackr_prev_seq; /* previous seqno received */ | ||
98 | unsigned ackr_pend_cnt; /* number of pending ACKs */ | ||
99 | struct timer_list ackr_dfr_timo; /* timeout on deferred ACK */ | ||
100 | char ackr_dfr_perm; /* request for deferred ACKs permitted */ | ||
101 | rxrpc_seq_t ackr_dfr_seq; /* seqno for deferred ACK */ | ||
102 | struct rxrpc_ackpacket ackr; /* pending normal ACK packet */ | ||
103 | uint8_t ackr_array[RXRPC_CALL_ACK_WINDOW_SIZE]; /* ACK records */ | ||
104 | |||
105 | /* presentation layer */ | ||
106 | char app_last_rcv; /* T if received last packet from remote end */ | ||
107 | enum rxrpc_app_cstate app_call_state; /* call state */ | ||
108 | enum rxrpc_app_estate app_err_state; /* abort/error state */ | ||
109 | struct list_head app_readyq; /* ordered ready received packet queue */ | ||
110 | struct list_head app_unreadyq; /* ordered post-hole recv'd packet queue */ | ||
111 | rxrpc_seq_t app_ready_seq; /* last seq number dropped into readyq */ | ||
112 | size_t app_ready_qty; /* amount of data ready in readyq */ | ||
113 | unsigned app_opcode; /* operation ID */ | ||
114 | unsigned app_abort_code; /* abort code (when aborted) */ | ||
115 | int app_errno; /* error number (when ICMP error received) */ | ||
116 | |||
117 | /* statisics */ | ||
118 | unsigned pkt_rcv_count; /* count of received packets on this call */ | ||
119 | unsigned pkt_snd_count; /* count of sent packets on this call */ | ||
120 | unsigned app_read_count; /* number of reads issued */ | ||
121 | |||
122 | /* bits for the application to use */ | ||
123 | rxrpc_call_attn_func_t app_attn_func; /* callback when attention required */ | ||
124 | rxrpc_call_error_func_t app_error_func; /* callback when abort sent (cleanup and put) */ | ||
125 | rxrpc_call_aemap_func_t app_aemap_func; /* callback to map abort code to/from errno */ | ||
126 | void *app_user; /* application data */ | ||
127 | struct list_head app_link; /* application list linkage */ | ||
128 | struct list_head app_attn_link; /* application attention list linkage */ | ||
129 | size_t app_mark; /* trigger callback when app_ready_qty>=app_mark */ | ||
130 | char app_async_read; /* T if in async-read mode */ | ||
131 | uint8_t *app_read_buf; /* application async read buffer (app_mark size) */ | ||
132 | uint8_t *app_scr_alloc; /* application scratch allocation pointer */ | ||
133 | void *app_scr_ptr; /* application pointer into scratch buffer */ | ||
134 | |||
135 | #define RXRPC_APP_MARK_EOF 0xFFFFFFFFU /* mark at end of input */ | ||
136 | |||
137 | /* application scratch buffer */ | ||
138 | uint8_t app_scratch[0] __attribute__((aligned(sizeof(long)))); | ||
139 | }; | ||
140 | |||
141 | #define RXRPC_CALL_SCRATCH_SIZE (PAGE_SIZE - sizeof(struct rxrpc_call)) | ||
142 | |||
143 | #define rxrpc_call_reset_scratch(CALL) \ | ||
144 | do { (CALL)->app_scr_alloc = (CALL)->app_scratch; } while(0) | ||
145 | |||
146 | #define rxrpc_call_alloc_scratch(CALL,SIZE) \ | ||
147 | ({ \ | ||
148 | void *ptr; \ | ||
149 | ptr = (CALL)->app_scr_alloc; \ | ||
150 | (CALL)->app_scr_alloc += (SIZE); \ | ||
151 | if ((SIZE)>RXRPC_CALL_SCRATCH_SIZE || \ | ||
152 | (size_t)((CALL)->app_scr_alloc - (u8*)(CALL)) > RXRPC_CALL_SCRATCH_SIZE) { \ | ||
153 | printk("rxrpc_call_alloc_scratch(%p,%Zu)\n",(CALL),(size_t)(SIZE)); \ | ||
154 | BUG(); \ | ||
155 | } \ | ||
156 | ptr; \ | ||
157 | }) | ||
158 | |||
159 | #define rxrpc_call_alloc_scratch_s(CALL,TYPE) \ | ||
160 | ({ \ | ||
161 | size_t size = sizeof(TYPE); \ | ||
162 | TYPE *ptr; \ | ||
163 | ptr = (TYPE*)(CALL)->app_scr_alloc; \ | ||
164 | (CALL)->app_scr_alloc += size; \ | ||
165 | if (size>RXRPC_CALL_SCRATCH_SIZE || \ | ||
166 | (size_t)((CALL)->app_scr_alloc - (u8*)(CALL)) > RXRPC_CALL_SCRATCH_SIZE) { \ | ||
167 | printk("rxrpc_call_alloc_scratch(%p,%Zu)\n",(CALL),size); \ | ||
168 | BUG(); \ | ||
169 | } \ | ||
170 | ptr; \ | ||
171 | }) | ||
172 | |||
173 | #define rxrpc_call_is_ack_pending(CALL) ((CALL)->ackr.reason != 0) | ||
174 | |||
175 | extern int rxrpc_create_call(struct rxrpc_connection *conn, | ||
176 | rxrpc_call_attn_func_t attn, | ||
177 | rxrpc_call_error_func_t error, | ||
178 | rxrpc_call_aemap_func_t aemap, | ||
179 | struct rxrpc_call **_call); | ||
180 | |||
181 | extern int rxrpc_incoming_call(struct rxrpc_connection *conn, | ||
182 | struct rxrpc_message *msg, | ||
183 | struct rxrpc_call **_call); | ||
184 | |||
185 | static inline void rxrpc_get_call(struct rxrpc_call *call) | ||
186 | { | ||
187 | BUG_ON(atomic_read(&call->usage)<=0); | ||
188 | atomic_inc(&call->usage); | ||
189 | /*printk("rxrpc_get_call(%p{u=%d})\n",(C),atomic_read(&(C)->usage));*/ | ||
190 | } | ||
191 | |||
192 | extern void rxrpc_put_call(struct rxrpc_call *call); | ||
193 | |||
194 | extern void rxrpc_call_do_stuff(struct rxrpc_call *call); | ||
195 | |||
196 | extern int rxrpc_call_abort(struct rxrpc_call *call, int error); | ||
197 | |||
198 | #define RXRPC_CALL_READ_BLOCK 0x0001 /* block if not enough data and not yet EOF */ | ||
199 | #define RXRPC_CALL_READ_ALL 0x0002 /* error if insufficient data received */ | ||
200 | extern int rxrpc_call_read_data(struct rxrpc_call *call, void *buffer, size_t size, int flags); | ||
201 | |||
202 | extern int rxrpc_call_write_data(struct rxrpc_call *call, | ||
203 | size_t sioc, | ||
204 | struct kvec *siov, | ||
205 | uint8_t rxhdr_flags, | ||
206 | gfp_t alloc_flags, | ||
207 | int dup_data, | ||
208 | size_t *size_sent); | ||
209 | |||
210 | extern void rxrpc_call_handle_error(struct rxrpc_call *conn, int local, int errno); | ||
211 | |||
212 | #endif /* _LINUX_RXRPC_CALL_H */ | ||
diff --git a/include/rxrpc/connection.h b/include/rxrpc/connection.h deleted file mode 100644 index 41e6781ad067..000000000000 --- a/include/rxrpc/connection.h +++ /dev/null | |||
@@ -1,83 +0,0 @@ | |||
1 | /* connection.h: Rx connection record | ||
2 | * | ||
3 | * Copyright (C) 2002 Red Hat, Inc. All Rights Reserved. | ||
4 | * Written by David Howells (dhowells@redhat.com) | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or | ||
7 | * modify it under the terms of the GNU General Public License | ||
8 | * as published by the Free Software Foundation; either version | ||
9 | * 2 of the License, or (at your option) any later version. | ||
10 | */ | ||
11 | |||
12 | #ifndef _LINUX_RXRPC_CONNECTION_H | ||
13 | #define _LINUX_RXRPC_CONNECTION_H | ||
14 | |||
15 | #include <rxrpc/types.h> | ||
16 | #include <rxrpc/krxtimod.h> | ||
17 | |||
18 | struct sk_buff; | ||
19 | |||
20 | /*****************************************************************************/ | ||
21 | /* | ||
22 | * Rx connection | ||
23 | * - connections are matched by (rmt_port,rmt_addr,service_id,conn_id,clientflag) | ||
24 | * - connections only retain a refcount on the peer when they are active | ||
25 | * - connections with refcount==0 are inactive and reside in the peer's graveyard | ||
26 | */ | ||
27 | struct rxrpc_connection | ||
28 | { | ||
29 | atomic_t usage; | ||
30 | struct rxrpc_transport *trans; /* transport endpoint */ | ||
31 | struct rxrpc_peer *peer; /* peer from/to which connected */ | ||
32 | struct rxrpc_service *service; /* responsible service (inbound conns) */ | ||
33 | struct rxrpc_timer timeout; /* decaching timer */ | ||
34 | struct list_head link; /* link in peer's list */ | ||
35 | struct list_head proc_link; /* link in proc list */ | ||
36 | struct list_head err_link; /* link in ICMP error processing list */ | ||
37 | struct list_head id_link; /* link in ID grant list */ | ||
38 | struct sockaddr_in addr; /* remote address */ | ||
39 | struct rxrpc_call *channels[4]; /* channels (active calls) */ | ||
40 | wait_queue_head_t chanwait; /* wait for channel to become available */ | ||
41 | spinlock_t lock; /* access lock */ | ||
42 | struct timeval atime; /* last access time */ | ||
43 | size_t mtu_size; /* MTU size for outbound messages */ | ||
44 | unsigned call_counter; /* call ID counter */ | ||
45 | rxrpc_serial_t serial_counter; /* packet serial number counter */ | ||
46 | |||
47 | /* the following should all be in net order */ | ||
48 | __be32 in_epoch; /* peer's epoch */ | ||
49 | __be32 out_epoch; /* my epoch */ | ||
50 | __be32 conn_id; /* connection ID, appropriately shifted */ | ||
51 | __be16 service_id; /* service ID */ | ||
52 | uint8_t security_ix; /* security ID */ | ||
53 | uint8_t in_clientflag; /* RXRPC_CLIENT_INITIATED if we are server */ | ||
54 | uint8_t out_clientflag; /* RXRPC_CLIENT_INITIATED if we are client */ | ||
55 | }; | ||
56 | |||
57 | extern int rxrpc_create_connection(struct rxrpc_transport *trans, | ||
58 | __be16 port, | ||
59 | __be32 addr, | ||
60 | uint16_t service_id, | ||
61 | void *security, | ||
62 | struct rxrpc_connection **_conn); | ||
63 | |||
64 | extern int rxrpc_connection_lookup(struct rxrpc_peer *peer, | ||
65 | struct rxrpc_message *msg, | ||
66 | struct rxrpc_connection **_conn); | ||
67 | |||
68 | static inline void rxrpc_get_connection(struct rxrpc_connection *conn) | ||
69 | { | ||
70 | BUG_ON(atomic_read(&conn->usage)<0); | ||
71 | atomic_inc(&conn->usage); | ||
72 | //printk("rxrpc_get_conn(%p{u=%d})\n",conn,atomic_read(&conn->usage)); | ||
73 | } | ||
74 | |||
75 | extern void rxrpc_put_connection(struct rxrpc_connection *conn); | ||
76 | |||
77 | extern int rxrpc_conn_receive_call_packet(struct rxrpc_connection *conn, | ||
78 | struct rxrpc_call *call, | ||
79 | struct rxrpc_message *msg); | ||
80 | |||
81 | extern void rxrpc_conn_handle_error(struct rxrpc_connection *conn, int local, int errno); | ||
82 | |||
83 | #endif /* _LINUX_RXRPC_CONNECTION_H */ | ||
diff --git a/include/rxrpc/krxiod.h b/include/rxrpc/krxiod.h deleted file mode 100644 index c0e0e82e4df2..000000000000 --- a/include/rxrpc/krxiod.h +++ /dev/null | |||
@@ -1,27 +0,0 @@ | |||
1 | /* krxiod.h: Rx RPC I/O kernel thread interface | ||
2 | * | ||
3 | * Copyright (C) 2002 Red Hat, Inc. All Rights Reserved. | ||
4 | * Written by David Howells (dhowells@redhat.com) | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or | ||
7 | * modify it under the terms of the GNU General Public License | ||
8 | * as published by the Free Software Foundation; either version | ||
9 | * 2 of the License, or (at your option) any later version. | ||
10 | */ | ||
11 | |||
12 | #ifndef _LINUX_RXRPC_KRXIOD_H | ||
13 | #define _LINUX_RXRPC_KRXIOD_H | ||
14 | |||
15 | #include <rxrpc/types.h> | ||
16 | |||
17 | extern int rxrpc_krxiod_init(void); | ||
18 | extern void rxrpc_krxiod_kill(void); | ||
19 | extern void rxrpc_krxiod_queue_transport(struct rxrpc_transport *trans); | ||
20 | extern void rxrpc_krxiod_dequeue_transport(struct rxrpc_transport *trans); | ||
21 | extern void rxrpc_krxiod_queue_peer(struct rxrpc_peer *peer); | ||
22 | extern void rxrpc_krxiod_dequeue_peer(struct rxrpc_peer *peer); | ||
23 | extern void rxrpc_krxiod_clear_peers(struct rxrpc_transport *trans); | ||
24 | extern void rxrpc_krxiod_queue_call(struct rxrpc_call *call); | ||
25 | extern void rxrpc_krxiod_dequeue_call(struct rxrpc_call *call); | ||
26 | |||
27 | #endif /* _LINUX_RXRPC_KRXIOD_H */ | ||
diff --git a/include/rxrpc/krxsecd.h b/include/rxrpc/krxsecd.h deleted file mode 100644 index 55ce43a25b38..000000000000 --- a/include/rxrpc/krxsecd.h +++ /dev/null | |||
@@ -1,22 +0,0 @@ | |||
1 | /* krxsecd.h: Rx RPC security kernel thread interface | ||
2 | * | ||
3 | * Copyright (C) 2002 Red Hat, Inc. All Rights Reserved. | ||
4 | * Written by David Howells (dhowells@redhat.com) | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or | ||
7 | * modify it under the terms of the GNU General Public License | ||
8 | * as published by the Free Software Foundation; either version | ||
9 | * 2 of the License, or (at your option) any later version. | ||
10 | */ | ||
11 | |||
12 | #ifndef _LINUX_RXRPC_KRXSECD_H | ||
13 | #define _LINUX_RXRPC_KRXSECD_H | ||
14 | |||
15 | #include <rxrpc/types.h> | ||
16 | |||
17 | extern int rxrpc_krxsecd_init(void); | ||
18 | extern void rxrpc_krxsecd_kill(void); | ||
19 | extern void rxrpc_krxsecd_clear_transport(struct rxrpc_transport *trans); | ||
20 | extern void rxrpc_krxsecd_queue_incoming_call(struct rxrpc_message *msg); | ||
21 | |||
22 | #endif /* _LINUX_RXRPC_KRXSECD_H */ | ||
diff --git a/include/rxrpc/krxtimod.h b/include/rxrpc/krxtimod.h deleted file mode 100644 index b3d298b612f2..000000000000 --- a/include/rxrpc/krxtimod.h +++ /dev/null | |||
@@ -1,45 +0,0 @@ | |||
1 | /* krxtimod.h: RxRPC timeout daemon | ||
2 | * | ||
3 | * Copyright (C) 2002 Red Hat, Inc. All Rights Reserved. | ||
4 | * Written by David Howells (dhowells@redhat.com) | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or | ||
7 | * modify it under the terms of the GNU General Public License | ||
8 | * as published by the Free Software Foundation; either version | ||
9 | * 2 of the License, or (at your option) any later version. | ||
10 | */ | ||
11 | |||
12 | #ifndef _LINUX_RXRPC_KRXTIMOD_H | ||
13 | #define _LINUX_RXRPC_KRXTIMOD_H | ||
14 | |||
15 | #include <rxrpc/types.h> | ||
16 | |||
17 | struct rxrpc_timer_ops { | ||
18 | /* called when the front of the timer queue has timed out */ | ||
19 | void (*timed_out)(struct rxrpc_timer *timer); | ||
20 | }; | ||
21 | |||
22 | /*****************************************************************************/ | ||
23 | /* | ||
24 | * RXRPC timer/timeout record | ||
25 | */ | ||
26 | struct rxrpc_timer | ||
27 | { | ||
28 | struct list_head link; /* link in timer queue */ | ||
29 | unsigned long timo_jif; /* timeout time */ | ||
30 | const struct rxrpc_timer_ops *ops; /* timeout expiry function */ | ||
31 | }; | ||
32 | |||
33 | static inline void rxrpc_timer_init(rxrpc_timer_t *timer, const struct rxrpc_timer_ops *ops) | ||
34 | { | ||
35 | INIT_LIST_HEAD(&timer->link); | ||
36 | timer->ops = ops; | ||
37 | } | ||
38 | |||
39 | extern int rxrpc_krxtimod_start(void); | ||
40 | extern void rxrpc_krxtimod_kill(void); | ||
41 | |||
42 | extern void rxrpc_krxtimod_add_timer(rxrpc_timer_t *timer, unsigned long timeout); | ||
43 | extern int rxrpc_krxtimod_del_timer(rxrpc_timer_t *timer); | ||
44 | |||
45 | #endif /* _LINUX_RXRPC_KRXTIMOD_H */ | ||
diff --git a/include/rxrpc/message.h b/include/rxrpc/message.h deleted file mode 100644 index b318f273d4f2..000000000000 --- a/include/rxrpc/message.h +++ /dev/null | |||
@@ -1,71 +0,0 @@ | |||
1 | /* message.h: Rx message caching | ||
2 | * | ||
3 | * Copyright (C) 2002 Red Hat, Inc. All Rights Reserved. | ||
4 | * Written by David Howells (dhowells@redhat.com) | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or | ||
7 | * modify it under the terms of the GNU General Public License | ||
8 | * as published by the Free Software Foundation; either version | ||
9 | * 2 of the License, or (at your option) any later version. | ||
10 | */ | ||
11 | |||
12 | #ifndef _LINUX_RXRPC_MESSAGE_H | ||
13 | #define _LINUX_RXRPC_MESSAGE_H | ||
14 | |||
15 | #include <rxrpc/packet.h> | ||
16 | |||
17 | /*****************************************************************************/ | ||
18 | /* | ||
19 | * Rx message record | ||
20 | */ | ||
21 | struct rxrpc_message | ||
22 | { | ||
23 | atomic_t usage; | ||
24 | struct list_head link; /* list link */ | ||
25 | struct timeval stamp; /* time received or last sent */ | ||
26 | rxrpc_seq_t seq; /* message sequence number */ | ||
27 | |||
28 | int state; /* the state the message is currently in */ | ||
29 | #define RXRPC_MSG_PREPARED 0 | ||
30 | #define RXRPC_MSG_SENT 1 | ||
31 | #define RXRPC_MSG_ACKED 2 /* provisionally ACK'd */ | ||
32 | #define RXRPC_MSG_DONE 3 /* definitively ACK'd (msg->seq<ack.firstPacket) */ | ||
33 | #define RXRPC_MSG_RECEIVED 4 | ||
34 | #define RXRPC_MSG_ERROR -1 | ||
35 | char rttdone; /* used for RTT */ | ||
36 | |||
37 | struct rxrpc_transport *trans; /* transport received through */ | ||
38 | struct rxrpc_connection *conn; /* connection received over */ | ||
39 | struct sk_buff *pkt; /* received packet */ | ||
40 | off_t offset; /* offset into pkt of next byte of data */ | ||
41 | |||
42 | struct rxrpc_header hdr; /* message header */ | ||
43 | |||
44 | int dcount; /* data part count */ | ||
45 | size_t dsize; /* data size */ | ||
46 | #define RXRPC_MSG_MAX_IOCS 8 | ||
47 | struct kvec data[RXRPC_MSG_MAX_IOCS]; /* message data */ | ||
48 | unsigned long dfree; /* bit mask indicating kfree(data[x]) if T */ | ||
49 | }; | ||
50 | |||
51 | #define rxrpc_get_message(M) do { atomic_inc(&(M)->usage); } while(0) | ||
52 | |||
53 | extern void __rxrpc_put_message(struct rxrpc_message *msg); | ||
54 | static inline void rxrpc_put_message(struct rxrpc_message *msg) | ||
55 | { | ||
56 | BUG_ON(atomic_read(&msg->usage)<=0); | ||
57 | if (atomic_dec_and_test(&msg->usage)) | ||
58 | __rxrpc_put_message(msg); | ||
59 | } | ||
60 | |||
61 | extern int rxrpc_conn_newmsg(struct rxrpc_connection *conn, | ||
62 | struct rxrpc_call *call, | ||
63 | uint8_t type, | ||
64 | int count, | ||
65 | struct kvec *diov, | ||
66 | gfp_t alloc_flags, | ||
67 | struct rxrpc_message **_msg); | ||
68 | |||
69 | extern int rxrpc_conn_sendmsg(struct rxrpc_connection *conn, struct rxrpc_message *msg); | ||
70 | |||
71 | #endif /* _LINUX_RXRPC_MESSAGE_H */ | ||
diff --git a/include/rxrpc/packet.h b/include/rxrpc/packet.h index 1447f0aaa0eb..b69e6e173ea1 100644 --- a/include/rxrpc/packet.h +++ b/include/rxrpc/packet.h | |||
@@ -1,6 +1,6 @@ | |||
1 | /* packet.h: Rx packet layout and definitions | 1 | /* packet.h: Rx packet layout and definitions |
2 | * | 2 | * |
3 | * Copyright (C) 2002 Red Hat, Inc. All Rights Reserved. | 3 | * Copyright (C) 2002, 2007 Red Hat, Inc. All Rights Reserved. |
4 | * Written by David Howells (dhowells@redhat.com) | 4 | * Written by David Howells (dhowells@redhat.com) |
5 | * | 5 | * |
6 | * This program is free software; you can redistribute it and/or | 6 | * This program is free software; you can redistribute it and/or |
@@ -12,28 +12,25 @@ | |||
12 | #ifndef _LINUX_RXRPC_PACKET_H | 12 | #ifndef _LINUX_RXRPC_PACKET_H |
13 | #define _LINUX_RXRPC_PACKET_H | 13 | #define _LINUX_RXRPC_PACKET_H |
14 | 14 | ||
15 | #include <rxrpc/types.h> | 15 | typedef u32 rxrpc_seq_t; /* Rx message sequence number */ |
16 | 16 | typedef u32 rxrpc_serial_t; /* Rx message serial number */ | |
17 | #define RXRPC_IPUDP_SIZE 28 | 17 | typedef __be32 rxrpc_seq_net_t; /* on-the-wire Rx message sequence number */ |
18 | extern size_t RXRPC_MAX_PACKET_SIZE; | 18 | typedef __be32 rxrpc_serial_net_t; /* on-the-wire Rx message serial number */ |
19 | #define RXRPC_MAX_PACKET_DATA_SIZE (RXRPC_MAX_PACKET_SIZE - sizeof(struct rxrpc_header)) | ||
20 | #define RXRPC_LOCAL_PACKET_SIZE RXRPC_MAX_PACKET_SIZE | ||
21 | #define RXRPC_REMOTE_PACKET_SIZE (576 - RXRPC_IPUDP_SIZE) | ||
22 | 19 | ||
23 | /*****************************************************************************/ | 20 | /*****************************************************************************/ |
24 | /* | 21 | /* |
25 | * on-the-wire Rx packet header | 22 | * on-the-wire Rx packet header |
26 | * - all multibyte fields should be in network byte order | 23 | * - all multibyte fields should be in network byte order |
27 | */ | 24 | */ |
28 | struct rxrpc_header | 25 | struct rxrpc_header { |
29 | { | ||
30 | __be32 epoch; /* client boot timestamp */ | 26 | __be32 epoch; /* client boot timestamp */ |
31 | 27 | ||
32 | __be32 cid; /* connection and channel ID */ | 28 | __be32 cid; /* connection and channel ID */ |
33 | #define RXRPC_MAXCALLS 4 /* max active calls per conn */ | 29 | #define RXRPC_MAXCALLS 4 /* max active calls per conn */ |
34 | #define RXRPC_CHANNELMASK (RXRPC_MAXCALLS-1) /* mask for channel ID */ | 30 | #define RXRPC_CHANNELMASK (RXRPC_MAXCALLS-1) /* mask for channel ID */ |
35 | #define RXRPC_CIDMASK (~RXRPC_CHANNELMASK) /* mask for connection ID */ | 31 | #define RXRPC_CIDMASK (~RXRPC_CHANNELMASK) /* mask for connection ID */ |
36 | #define RXRPC_CIDSHIFT 2 /* shift for connection ID */ | 32 | #define RXRPC_CIDSHIFT ilog2(RXRPC_MAXCALLS) /* shift for connection ID */ |
33 | #define RXRPC_CID_INC (1 << RXRPC_CIDSHIFT) /* connection ID increment */ | ||
37 | 34 | ||
38 | __be32 callNumber; /* call ID (0 for connection-level packets) */ | 35 | __be32 callNumber; /* call ID (0 for connection-level packets) */ |
39 | #define RXRPC_PROCESS_MAXCALLS (1<<2) /* maximum number of active calls per conn (power of 2) */ | 36 | #define RXRPC_PROCESS_MAXCALLS (1<<2) /* maximum number of active calls per conn (power of 2) */ |
@@ -62,7 +59,10 @@ struct rxrpc_header | |||
62 | 59 | ||
63 | uint8_t userStatus; /* app-layer defined status */ | 60 | uint8_t userStatus; /* app-layer defined status */ |
64 | uint8_t securityIndex; /* security protocol ID */ | 61 | uint8_t securityIndex; /* security protocol ID */ |
65 | __be16 _rsvd; /* reserved (used by kerberos security as cksum) */ | 62 | union { |
63 | __be16 _rsvd; /* reserved */ | ||
64 | __be16 cksum; /* kerberos security checksum */ | ||
65 | }; | ||
66 | __be16 serviceId; /* service ID */ | 66 | __be16 serviceId; /* service ID */ |
67 | 67 | ||
68 | } __attribute__((packed)); | 68 | } __attribute__((packed)); |
@@ -81,8 +81,7 @@ extern const char *rxrpc_pkts[]; | |||
81 | * - new__rsvd = j__rsvd | 81 | * - new__rsvd = j__rsvd |
82 | * - duplicating all other fields | 82 | * - duplicating all other fields |
83 | */ | 83 | */ |
84 | struct rxrpc_jumbo_header | 84 | struct rxrpc_jumbo_header { |
85 | { | ||
86 | uint8_t flags; /* packet flags (as per rxrpc_header) */ | 85 | uint8_t flags; /* packet flags (as per rxrpc_header) */ |
87 | uint8_t pad; | 86 | uint8_t pad; |
88 | __be16 _rsvd; /* reserved (used by kerberos security as cksum) */ | 87 | __be16 _rsvd; /* reserved (used by kerberos security as cksum) */ |
@@ -95,8 +94,7 @@ struct rxrpc_jumbo_header | |||
95 | * on-the-wire Rx ACK packet data payload | 94 | * on-the-wire Rx ACK packet data payload |
96 | * - all multibyte fields should be in network byte order | 95 | * - all multibyte fields should be in network byte order |
97 | */ | 96 | */ |
98 | struct rxrpc_ackpacket | 97 | struct rxrpc_ackpacket { |
99 | { | ||
100 | __be16 bufferSpace; /* number of packet buffers available */ | 98 | __be16 bufferSpace; /* number of packet buffers available */ |
101 | __be16 maxSkew; /* diff between serno being ACK'd and highest serial no | 99 | __be16 maxSkew; /* diff between serno being ACK'd and highest serial no |
102 | * received */ | 100 | * received */ |
@@ -124,4 +122,93 @@ struct rxrpc_ackpacket | |||
124 | 122 | ||
125 | } __attribute__((packed)); | 123 | } __attribute__((packed)); |
126 | 124 | ||
125 | /* | ||
126 | * ACK packets can have a further piece of information tagged on the end | ||
127 | */ | ||
128 | struct rxrpc_ackinfo { | ||
129 | __be32 rxMTU; /* maximum Rx MTU size (bytes) [AFS 3.3] */ | ||
130 | __be32 maxMTU; /* maximum interface MTU size (bytes) [AFS 3.3] */ | ||
131 | __be32 rwind; /* Rx window size (packets) [AFS 3.4] */ | ||
132 | __be32 jumbo_max; /* max packets to stick into a jumbo packet [AFS 3.5] */ | ||
133 | }; | ||
134 | |||
135 | /*****************************************************************************/ | ||
136 | /* | ||
137 | * Kerberos security type-2 challenge packet | ||
138 | */ | ||
139 | struct rxkad_challenge { | ||
140 | __be32 version; /* version of this challenge type */ | ||
141 | __be32 nonce; /* encrypted random number */ | ||
142 | __be32 min_level; /* minimum security level */ | ||
143 | __be32 __padding; /* padding to 8-byte boundary */ | ||
144 | } __attribute__((packed)); | ||
145 | |||
146 | /*****************************************************************************/ | ||
147 | /* | ||
148 | * Kerberos security type-2 response packet | ||
149 | */ | ||
150 | struct rxkad_response { | ||
151 | __be32 version; /* version of this reponse type */ | ||
152 | __be32 __pad; | ||
153 | |||
154 | /* encrypted bit of the response */ | ||
155 | struct { | ||
156 | __be32 epoch; /* current epoch */ | ||
157 | __be32 cid; /* parent connection ID */ | ||
158 | __be32 checksum; /* checksum */ | ||
159 | __be32 securityIndex; /* security type */ | ||
160 | __be32 call_id[4]; /* encrypted call IDs */ | ||
161 | __be32 inc_nonce; /* challenge nonce + 1 */ | ||
162 | __be32 level; /* desired level */ | ||
163 | } encrypted; | ||
164 | |||
165 | __be32 kvno; /* Kerberos key version number */ | ||
166 | __be32 ticket_len; /* Kerberos ticket length */ | ||
167 | } __attribute__((packed)); | ||
168 | |||
169 | /*****************************************************************************/ | ||
170 | /* | ||
171 | * RxRPC-level abort codes | ||
172 | */ | ||
173 | #define RX_CALL_DEAD -1 /* call/conn has been inactive and is shut down */ | ||
174 | #define RX_INVALID_OPERATION -2 /* invalid operation requested / attempted */ | ||
175 | #define RX_CALL_TIMEOUT -3 /* call timeout exceeded */ | ||
176 | #define RX_EOF -4 /* unexpected end of data on read op */ | ||
177 | #define RX_PROTOCOL_ERROR -5 /* low-level protocol error */ | ||
178 | #define RX_USER_ABORT -6 /* generic user abort */ | ||
179 | #define RX_ADDRINUSE -7 /* UDP port in use */ | ||
180 | #define RX_DEBUGI_BADTYPE -8 /* bad debugging packet type */ | ||
181 | |||
182 | /* | ||
183 | * (un)marshalling abort codes (rxgen) | ||
184 | */ | ||
185 | #define RXGEN_CC_MARSHAL -450 | ||
186 | #define RXGEN_CC_UNMARSHAL -451 | ||
187 | #define RXGEN_SS_MARSHAL -452 | ||
188 | #define RXGEN_SS_UNMARSHAL -453 | ||
189 | #define RXGEN_DECODE -454 | ||
190 | #define RXGEN_OPCODE -455 | ||
191 | #define RXGEN_SS_XDRFREE -456 | ||
192 | #define RXGEN_CC_XDRFREE -457 | ||
193 | |||
194 | /* | ||
195 | * Rx kerberos security abort codes | ||
196 | * - unfortunately we have no generalised security abort codes to say things | ||
197 | * like "unsupported security", so we have to use these instead and hope the | ||
198 | * other side understands | ||
199 | */ | ||
200 | #define RXKADINCONSISTENCY 19270400 /* security module structure inconsistent */ | ||
201 | #define RXKADPACKETSHORT 19270401 /* packet too short for security challenge */ | ||
202 | #define RXKADLEVELFAIL 19270402 /* security level negotiation failed */ | ||
203 | #define RXKADTICKETLEN 19270403 /* ticket length too short or too long */ | ||
204 | #define RXKADOUTOFSEQUENCE 19270404 /* packet had bad sequence number */ | ||
205 | #define RXKADNOAUTH 19270405 /* caller not authorised */ | ||
206 | #define RXKADBADKEY 19270406 /* illegal key: bad parity or weak */ | ||
207 | #define RXKADBADTICKET 19270407 /* security object was passed a bad ticket */ | ||
208 | #define RXKADUNKNOWNKEY 19270408 /* ticket contained unknown key version number */ | ||
209 | #define RXKADEXPIRED 19270409 /* authentication expired */ | ||
210 | #define RXKADSEALEDINCON 19270410 /* sealed data inconsistent */ | ||
211 | #define RXKADDATALEN 19270411 /* user data too long */ | ||
212 | #define RXKADILLEGALLEVEL 19270412 /* caller not authorised to use encrypted conns */ | ||
213 | |||
127 | #endif /* _LINUX_RXRPC_PACKET_H */ | 214 | #endif /* _LINUX_RXRPC_PACKET_H */ |
diff --git a/include/rxrpc/peer.h b/include/rxrpc/peer.h deleted file mode 100644 index 8b8fe97cbbcc..000000000000 --- a/include/rxrpc/peer.h +++ /dev/null | |||
@@ -1,82 +0,0 @@ | |||
1 | /* peer.h: Rx RPC per-transport peer record | ||
2 | * | ||
3 | * Copyright (C) 2002 Red Hat, Inc. All Rights Reserved. | ||
4 | * Written by David Howells (dhowells@redhat.com) | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or | ||
7 | * modify it under the terms of the GNU General Public License | ||
8 | * as published by the Free Software Foundation; either version | ||
9 | * 2 of the License, or (at your option) any later version. | ||
10 | */ | ||
11 | |||
12 | #ifndef _LINUX_RXRPC_PEER_H | ||
13 | #define _LINUX_RXRPC_PEER_H | ||
14 | |||
15 | #include <linux/wait.h> | ||
16 | #include <rxrpc/types.h> | ||
17 | #include <rxrpc/krxtimod.h> | ||
18 | |||
19 | struct rxrpc_peer_ops | ||
20 | { | ||
21 | /* peer record being added */ | ||
22 | int (*adding)(struct rxrpc_peer *peer); | ||
23 | |||
24 | /* peer record being discarded from graveyard */ | ||
25 | void (*discarding)(struct rxrpc_peer *peer); | ||
26 | |||
27 | /* change of epoch detected on connection */ | ||
28 | void (*change_of_epoch)(struct rxrpc_connection *conn); | ||
29 | }; | ||
30 | |||
31 | /*****************************************************************************/ | ||
32 | /* | ||
33 | * Rx RPC per-transport peer record | ||
34 | * - peers only retain a refcount on the transport when they are active | ||
35 | * - peers with refcount==0 are inactive and reside in the transport's graveyard | ||
36 | */ | ||
37 | struct rxrpc_peer | ||
38 | { | ||
39 | atomic_t usage; | ||
40 | struct rxrpc_peer_ops *ops; /* operations on this peer */ | ||
41 | struct rxrpc_transport *trans; /* owner transport */ | ||
42 | struct rxrpc_timer timeout; /* timeout for grave destruction */ | ||
43 | struct list_head link; /* link in transport's peer list */ | ||
44 | struct list_head proc_link; /* link in /proc list */ | ||
45 | rwlock_t conn_idlock; /* lock for connection IDs */ | ||
46 | struct list_head conn_idlist; /* list of connections granted IDs */ | ||
47 | uint32_t conn_idcounter; /* connection ID counter */ | ||
48 | rwlock_t conn_lock; /* lock for active/dead connections */ | ||
49 | struct list_head conn_active; /* active connections to/from this peer */ | ||
50 | struct list_head conn_graveyard; /* graveyard for inactive connections */ | ||
51 | spinlock_t conn_gylock; /* lock for conn_graveyard */ | ||
52 | wait_queue_head_t conn_gy_waitq; /* wait queue hit when graveyard is empty */ | ||
53 | atomic_t conn_count; /* number of attached connections */ | ||
54 | struct in_addr addr; /* remote address */ | ||
55 | size_t if_mtu; /* interface MTU for this peer */ | ||
56 | spinlock_t lock; /* access lock */ | ||
57 | |||
58 | void *user; /* application layer data */ | ||
59 | |||
60 | /* calculated RTT cache */ | ||
61 | #define RXRPC_RTT_CACHE_SIZE 32 | ||
62 | suseconds_t rtt; /* current RTT estimate (in uS) */ | ||
63 | unsigned rtt_point; /* next entry at which to insert */ | ||
64 | unsigned rtt_usage; /* amount of cache actually used */ | ||
65 | suseconds_t rtt_cache[RXRPC_RTT_CACHE_SIZE]; /* calculated RTT cache */ | ||
66 | }; | ||
67 | |||
68 | |||
69 | extern int rxrpc_peer_lookup(struct rxrpc_transport *trans, | ||
70 | __be32 addr, | ||
71 | struct rxrpc_peer **_peer); | ||
72 | |||
73 | static inline void rxrpc_get_peer(struct rxrpc_peer *peer) | ||
74 | { | ||
75 | BUG_ON(atomic_read(&peer->usage)<0); | ||
76 | atomic_inc(&peer->usage); | ||
77 | //printk("rxrpc_get_peer(%p{u=%d})\n",peer,atomic_read(&peer->usage)); | ||
78 | } | ||
79 | |||
80 | extern void rxrpc_put_peer(struct rxrpc_peer *peer); | ||
81 | |||
82 | #endif /* _LINUX_RXRPC_PEER_H */ | ||
diff --git a/include/rxrpc/rxrpc.h b/include/rxrpc/rxrpc.h deleted file mode 100644 index 8d9874cef991..000000000000 --- a/include/rxrpc/rxrpc.h +++ /dev/null | |||
@@ -1,36 +0,0 @@ | |||
1 | /* rx.h: Rx RPC interface | ||
2 | * | ||
3 | * Copyright (C) 2002 Red Hat, Inc. All Rights Reserved. | ||
4 | * Written by David Howells (dhowells@redhat.com) | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or | ||
7 | * modify it under the terms of the GNU General Public License | ||
8 | * as published by the Free Software Foundation; either version | ||
9 | * 2 of the License, or (at your option) any later version. | ||
10 | */ | ||
11 | |||
12 | #ifndef _LINUX_RXRPC_RXRPC_H | ||
13 | #define _LINUX_RXRPC_RXRPC_H | ||
14 | |||
15 | #ifdef __KERNEL__ | ||
16 | |||
17 | extern __be32 rxrpc_epoch; | ||
18 | |||
19 | #ifdef CONFIG_SYSCTL | ||
20 | extern int rxrpc_ktrace; | ||
21 | extern int rxrpc_kdebug; | ||
22 | extern int rxrpc_kproto; | ||
23 | extern int rxrpc_knet; | ||
24 | #else | ||
25 | #define rxrpc_ktrace 0 | ||
26 | #define rxrpc_kdebug 0 | ||
27 | #define rxrpc_kproto 0 | ||
28 | #define rxrpc_knet 0 | ||
29 | #endif | ||
30 | |||
31 | extern int rxrpc_sysctl_init(void); | ||
32 | extern void rxrpc_sysctl_cleanup(void); | ||
33 | |||
34 | #endif /* __KERNEL__ */ | ||
35 | |||
36 | #endif /* _LINUX_RXRPC_RXRPC_H */ | ||
diff --git a/include/rxrpc/transport.h b/include/rxrpc/transport.h deleted file mode 100644 index 7c7b9683fa39..000000000000 --- a/include/rxrpc/transport.h +++ /dev/null | |||
@@ -1,106 +0,0 @@ | |||
1 | /* transport.h: Rx transport management | ||
2 | * | ||
3 | * Copyright (C) 2002 Red Hat, Inc. All Rights Reserved. | ||
4 | * Written by David Howells (dhowells@redhat.com) | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or | ||
7 | * modify it under the terms of the GNU General Public License | ||
8 | * as published by the Free Software Foundation; either version | ||
9 | * 2 of the License, or (at your option) any later version. | ||
10 | */ | ||
11 | |||
12 | #ifndef _LINUX_RXRPC_TRANSPORT_H | ||
13 | #define _LINUX_RXRPC_TRANSPORT_H | ||
14 | |||
15 | #include <rxrpc/types.h> | ||
16 | #include <rxrpc/krxiod.h> | ||
17 | #include <rxrpc/rxrpc.h> | ||
18 | #include <linux/skbuff.h> | ||
19 | #include <linux/rwsem.h> | ||
20 | |||
21 | typedef int (*rxrpc_newcall_fnx_t)(struct rxrpc_call *call); | ||
22 | |||
23 | extern wait_queue_head_t rxrpc_krxiod_wq; | ||
24 | |||
25 | /*****************************************************************************/ | ||
26 | /* | ||
27 | * Rx operation specification | ||
28 | * - tables of these must be sorted by op ID so that they can be binary-chop searched | ||
29 | */ | ||
30 | struct rxrpc_operation | ||
31 | { | ||
32 | unsigned id; /* operation ID */ | ||
33 | size_t asize; /* minimum size of argument block */ | ||
34 | const char *name; /* name of operation */ | ||
35 | void *user; /* initial user data */ | ||
36 | }; | ||
37 | |||
38 | /*****************************************************************************/ | ||
39 | /* | ||
40 | * Rx transport service record | ||
41 | */ | ||
42 | struct rxrpc_service | ||
43 | { | ||
44 | struct list_head link; /* link in services list on transport */ | ||
45 | struct module *owner; /* owner module */ | ||
46 | rxrpc_newcall_fnx_t new_call; /* new call handler function */ | ||
47 | const char *name; /* name of service */ | ||
48 | unsigned short service_id; /* Rx service ID */ | ||
49 | rxrpc_call_attn_func_t attn_func; /* call requires attention callback */ | ||
50 | rxrpc_call_error_func_t error_func; /* call error callback */ | ||
51 | rxrpc_call_aemap_func_t aemap_func; /* abort -> errno mapping callback */ | ||
52 | |||
53 | const struct rxrpc_operation *ops_begin; /* beginning of operations table */ | ||
54 | const struct rxrpc_operation *ops_end; /* end of operations table */ | ||
55 | }; | ||
56 | |||
57 | /*****************************************************************************/ | ||
58 | /* | ||
59 | * Rx transport endpoint record | ||
60 | */ | ||
61 | struct rxrpc_transport | ||
62 | { | ||
63 | atomic_t usage; | ||
64 | struct socket *socket; /* my UDP socket */ | ||
65 | struct list_head services; /* services listening on this socket */ | ||
66 | struct list_head link; /* link in transport list */ | ||
67 | struct list_head proc_link; /* link in transport proc list */ | ||
68 | struct list_head krxiodq_link; /* krxiod attention queue link */ | ||
69 | spinlock_t lock; /* access lock */ | ||
70 | struct list_head peer_active; /* active peers connected to over this socket */ | ||
71 | struct list_head peer_graveyard; /* inactive peer list */ | ||
72 | spinlock_t peer_gylock; /* peer graveyard lock */ | ||
73 | wait_queue_head_t peer_gy_waitq; /* wait queue hit when peer graveyard is empty */ | ||
74 | rwlock_t peer_lock; /* peer list access lock */ | ||
75 | atomic_t peer_count; /* number of peers */ | ||
76 | struct rxrpc_peer_ops *peer_ops; /* default peer operations */ | ||
77 | unsigned short port; /* port upon which listening */ | ||
78 | volatile char error_rcvd; /* T if received ICMP error outstanding */ | ||
79 | }; | ||
80 | |||
81 | extern int rxrpc_create_transport(unsigned short port, | ||
82 | struct rxrpc_transport **_trans); | ||
83 | |||
84 | static inline void rxrpc_get_transport(struct rxrpc_transport *trans) | ||
85 | { | ||
86 | BUG_ON(atomic_read(&trans->usage) <= 0); | ||
87 | atomic_inc(&trans->usage); | ||
88 | //printk("rxrpc_get_transport(%p{u=%d})\n", | ||
89 | // trans, atomic_read(&trans->usage)); | ||
90 | } | ||
91 | |||
92 | extern void rxrpc_put_transport(struct rxrpc_transport *trans); | ||
93 | |||
94 | extern int rxrpc_add_service(struct rxrpc_transport *trans, | ||
95 | struct rxrpc_service *srv); | ||
96 | |||
97 | extern void rxrpc_del_service(struct rxrpc_transport *trans, | ||
98 | struct rxrpc_service *srv); | ||
99 | |||
100 | extern void rxrpc_trans_receive_packet(struct rxrpc_transport *trans); | ||
101 | |||
102 | extern int rxrpc_trans_immediate_abort(struct rxrpc_transport *trans, | ||
103 | struct rxrpc_message *msg, | ||
104 | int error); | ||
105 | |||
106 | #endif /* _LINUX_RXRPC_TRANSPORT_H */ | ||