diff options
101 files changed, 790 insertions, 461 deletions
diff --git a/Documentation/filesystems/proc.txt b/Documentation/filesystems/proc.txt index fad18f9456e..ffead13f944 100644 --- a/Documentation/filesystems/proc.txt +++ b/Documentation/filesystems/proc.txt | |||
@@ -1167,13 +1167,11 @@ CHAPTER 3: PER-PROCESS PARAMETERS | |||
1167 | 3.1 /proc/<pid>/oom_adj - Adjust the oom-killer score | 1167 | 3.1 /proc/<pid>/oom_adj - Adjust the oom-killer score |
1168 | ------------------------------------------------------ | 1168 | ------------------------------------------------------ |
1169 | 1169 | ||
1170 | This file can be used to adjust the score used to select which processes should | 1170 | This file can be used to adjust the score used to select which processes |
1171 | be killed in an out-of-memory situation. The oom_adj value is a characteristic | 1171 | should be killed in an out-of-memory situation. Giving it a high score will |
1172 | of the task's mm, so all threads that share an mm with pid will have the same | 1172 | increase the likelihood of this process being killed by the oom-killer. Valid |
1173 | oom_adj value. A high value will increase the likelihood of this process being | 1173 | values are in the range -16 to +15, plus the special value -17, which disables |
1174 | killed by the oom-killer. Valid values are in the range -16 to +15 as | 1174 | oom-killing altogether for this process. |
1175 | explained below and a special value of -17, which disables oom-killing | ||
1176 | altogether for threads sharing pid's mm. | ||
1177 | 1175 | ||
1178 | The process to be killed in an out-of-memory situation is selected among all others | 1176 | The process to be killed in an out-of-memory situation is selected among all others |
1179 | based on its badness score. This value equals the original memory size of the process | 1177 | based on its badness score. This value equals the original memory size of the process |
@@ -1187,9 +1185,6 @@ the parent's score if they do not share the same memory. Thus forking servers | |||
1187 | are the prime candidates to be killed. Having only one 'hungry' child will make | 1185 | are the prime candidates to be killed. Having only one 'hungry' child will make |
1188 | parent less preferable than the child. | 1186 | parent less preferable than the child. |
1189 | 1187 | ||
1190 | /proc/<pid>/oom_adj cannot be changed for kthreads since they are immune from | ||
1191 | oom-killing already. | ||
1192 | |||
1193 | /proc/<pid>/oom_score shows process' current badness score. | 1188 | /proc/<pid>/oom_score shows process' current badness score. |
1194 | 1189 | ||
1195 | The following heuristics are then applied: | 1190 | The following heuristics are then applied: |
diff --git a/MAINTAINERS b/MAINTAINERS index 2c4326c0de9..60299a9a7ad 100644 --- a/MAINTAINERS +++ b/MAINTAINERS | |||
@@ -904,7 +904,7 @@ F: drivers/input/misc/ati_remote2.c | |||
904 | 904 | ||
905 | ATLX ETHERNET DRIVERS | 905 | ATLX ETHERNET DRIVERS |
906 | M: Jay Cliburn <jcliburn@gmail.com> | 906 | M: Jay Cliburn <jcliburn@gmail.com> |
907 | M: Chris Snook <csnook@redhat.com> | 907 | M: Chris Snook <chris.snook@gmail.com> |
908 | M: Jie Yang <jie.yang@atheros.com> | 908 | M: Jie Yang <jie.yang@atheros.com> |
909 | L: atl1-devel@lists.sourceforge.net | 909 | L: atl1-devel@lists.sourceforge.net |
910 | W: http://sourceforge.net/projects/atl1 | 910 | W: http://sourceforge.net/projects/atl1 |
@@ -3429,6 +3429,7 @@ F: drivers/mfd/ | |||
3429 | 3429 | ||
3430 | MULTIMEDIA CARD (MMC), SECURE DIGITAL (SD) AND SDIO SUBSYSTEM | 3430 | MULTIMEDIA CARD (MMC), SECURE DIGITAL (SD) AND SDIO SUBSYSTEM |
3431 | S: Orphan | 3431 | S: Orphan |
3432 | L: linux-mmc@vger.kernel.org | ||
3432 | F: drivers/mmc/ | 3433 | F: drivers/mmc/ |
3433 | F: include/linux/mmc/ | 3434 | F: include/linux/mmc/ |
3434 | 3435 | ||
@@ -3563,6 +3564,9 @@ T: git git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-2.6.git | |||
3563 | S: Maintained | 3564 | S: Maintained |
3564 | F: net/ | 3565 | F: net/ |
3565 | F: include/net/ | 3566 | F: include/net/ |
3567 | F: include/linux/in.h | ||
3568 | F: include/linux/net.h | ||
3569 | F: include/linux/netdevice.h | ||
3566 | 3570 | ||
3567 | NETWORKING [IPv4/IPv6] | 3571 | NETWORKING [IPv4/IPv6] |
3568 | M: "David S. Miller" <davem@davemloft.net> | 3572 | M: "David S. Miller" <davem@davemloft.net> |
@@ -3598,6 +3602,8 @@ W: http://www.linuxfoundation.org/en/Net | |||
3598 | T: git git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-2.6.git | 3602 | T: git git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-2.6.git |
3599 | S: Odd Fixes | 3603 | S: Odd Fixes |
3600 | F: drivers/net/ | 3604 | F: drivers/net/ |
3605 | F: include/linux/if_* | ||
3606 | F: include/linux/*device.h | ||
3601 | 3607 | ||
3602 | NETXEN (1/10) GbE SUPPORT | 3608 | NETXEN (1/10) GbE SUPPORT |
3603 | M: Dhananjay Phadke <dhananjay@netxen.com> | 3609 | M: Dhananjay Phadke <dhananjay@netxen.com> |
@@ -3804,7 +3810,7 @@ W: http://open-osd.org | |||
3804 | T: git git://git.open-osd.org/open-osd.git | 3810 | T: git git://git.open-osd.org/open-osd.git |
3805 | S: Maintained | 3811 | S: Maintained |
3806 | F: drivers/scsi/osd/ | 3812 | F: drivers/scsi/osd/ |
3807 | F: drivers/include/scsi/osd_* | 3813 | F: include/scsi/osd_* |
3808 | F: fs/exofs/ | 3814 | F: fs/exofs/ |
3809 | 3815 | ||
3810 | P54 WIRELESS DRIVER | 3816 | P54 WIRELESS DRIVER |
diff --git a/REPORTING-BUGS b/REPORTING-BUGS index ab0c56630a8..55a6074ccbb 100644 --- a/REPORTING-BUGS +++ b/REPORTING-BUGS | |||
@@ -15,7 +15,10 @@ worry too much about getting the wrong person. If you are unsure send it | |||
15 | to the person responsible for the code relevant to what you were doing. | 15 | to the person responsible for the code relevant to what you were doing. |
16 | If it occurs repeatably try and describe how to recreate it. That is | 16 | If it occurs repeatably try and describe how to recreate it. That is |
17 | worth even more than the oops itself. The list of maintainers and | 17 | worth even more than the oops itself. The list of maintainers and |
18 | mailing lists is in the MAINTAINERS file in this directory. | 18 | mailing lists is in the MAINTAINERS file in this directory. If you |
19 | know the file name that causes the problem you can use the following | ||
20 | command in this directory to find some of the maintainers of that file: | ||
21 | perl scripts/get_maintainer.pl -f <filename> | ||
19 | 22 | ||
20 | If it is a security bug, please copy the Security Contact listed | 23 | If it is a security bug, please copy the Security Contact listed |
21 | in the MAINTAINERS file. They can help coordinate bugfix and disclosure. | 24 | in the MAINTAINERS file. They can help coordinate bugfix and disclosure. |
diff --git a/arch/sh/boards/mach-se/7724/setup.c b/arch/sh/boards/mach-se/7724/setup.c index 8fed45a2fb8..15456a0773b 100644 --- a/arch/sh/boards/mach-se/7724/setup.c +++ b/arch/sh/boards/mach-se/7724/setup.c | |||
@@ -238,7 +238,7 @@ static struct platform_device ceu1_device = { | |||
238 | }, | 238 | }, |
239 | }; | 239 | }; |
240 | 240 | ||
241 | /* KEYSC */ | 241 | /* KEYSC in SoC (Needs SW33-2 set to ON) */ |
242 | static struct sh_keysc_info keysc_info = { | 242 | static struct sh_keysc_info keysc_info = { |
243 | .mode = SH_KEYSC_MODE_1, | 243 | .mode = SH_KEYSC_MODE_1, |
244 | .scan_timing = 10, | 244 | .scan_timing = 10, |
@@ -255,12 +255,13 @@ static struct sh_keysc_info keysc_info = { | |||
255 | 255 | ||
256 | static struct resource keysc_resources[] = { | 256 | static struct resource keysc_resources[] = { |
257 | [0] = { | 257 | [0] = { |
258 | .start = 0x1a204000, | 258 | .name = "KEYSC", |
259 | .end = 0x1a20400f, | 259 | .start = 0x044b0000, |
260 | .end = 0x044b000f, | ||
260 | .flags = IORESOURCE_MEM, | 261 | .flags = IORESOURCE_MEM, |
261 | }, | 262 | }, |
262 | [1] = { | 263 | [1] = { |
263 | .start = IRQ0_KEY, | 264 | .start = 79, |
264 | .flags = IORESOURCE_IRQ, | 265 | .flags = IORESOURCE_IRQ, |
265 | }, | 266 | }, |
266 | }; | 267 | }; |
diff --git a/arch/sh/kernel/cpu/shmobile/sleep.S b/arch/sh/kernel/cpu/shmobile/sleep.S index 5d888ef53d8..baf2d7d46b0 100644 --- a/arch/sh/kernel/cpu/shmobile/sleep.S +++ b/arch/sh/kernel/cpu/shmobile/sleep.S | |||
@@ -26,8 +26,30 @@ ENTRY(sh_mobile_standby) | |||
26 | 26 | ||
27 | tst #SUSP_SH_SF, r0 | 27 | tst #SUSP_SH_SF, r0 |
28 | bt skip_set_sf | 28 | bt skip_set_sf |
29 | #ifdef CONFIG_CPU_SUBTYPE_SH7724 | ||
30 | /* DBSC: put memory in self-refresh mode */ | ||
29 | 31 | ||
30 | /* SDRAM: disable power down and put in self-refresh mode */ | 32 | mov.l dben_reg, r4 |
33 | mov.l dben_data0, r1 | ||
34 | mov.l r1, @r4 | ||
35 | |||
36 | mov.l dbrfpdn0_reg, r4 | ||
37 | mov.l dbrfpdn0_data0, r1 | ||
38 | mov.l r1, @r4 | ||
39 | |||
40 | mov.l dbcmdcnt_reg, r4 | ||
41 | mov.l dbcmdcnt_data0, r1 | ||
42 | mov.l r1, @r4 | ||
43 | |||
44 | mov.l dbcmdcnt_reg, r4 | ||
45 | mov.l dbcmdcnt_data1, r1 | ||
46 | mov.l r1, @r4 | ||
47 | |||
48 | mov.l dbrfpdn0_reg, r4 | ||
49 | mov.l dbrfpdn0_data1, r1 | ||
50 | mov.l r1, @r4 | ||
51 | #else | ||
52 | /* SBSC: disable power down and put in self-refresh mode */ | ||
31 | mov.l 1f, r4 | 53 | mov.l 1f, r4 |
32 | mov.l 2f, r1 | 54 | mov.l 2f, r1 |
33 | mov.l @r4, r2 | 55 | mov.l @r4, r2 |
@@ -35,6 +57,7 @@ ENTRY(sh_mobile_standby) | |||
35 | mov.l 3f, r3 | 57 | mov.l 3f, r3 |
36 | and r3, r2 | 58 | and r3, r2 |
37 | mov.l r2, @r4 | 59 | mov.l r2, @r4 |
60 | #endif | ||
38 | 61 | ||
39 | skip_set_sf: | 62 | skip_set_sf: |
40 | tst #SUSP_SH_SLEEP, r0 | 63 | tst #SUSP_SH_SLEEP, r0 |
@@ -84,7 +107,36 @@ done_sleep: | |||
84 | tst #SUSP_SH_SF, r0 | 107 | tst #SUSP_SH_SF, r0 |
85 | bt skip_restore_sf | 108 | bt skip_restore_sf |
86 | 109 | ||
87 | /* SDRAM: set auto-refresh mode */ | 110 | #ifdef CONFIG_CPU_SUBTYPE_SH7724 |
111 | /* DBSC: put memory in auto-refresh mode */ | ||
112 | |||
113 | mov.l dbrfpdn0_reg, r4 | ||
114 | mov.l dbrfpdn0_data0, r1 | ||
115 | mov.l r1, @r4 | ||
116 | |||
117 | /* sleep 140 ns */ | ||
118 | nop | ||
119 | nop | ||
120 | nop | ||
121 | nop | ||
122 | |||
123 | mov.l dbcmdcnt_reg, r4 | ||
124 | mov.l dbcmdcnt_data0, r1 | ||
125 | mov.l r1, @r4 | ||
126 | |||
127 | mov.l dbcmdcnt_reg, r4 | ||
128 | mov.l dbcmdcnt_data1, r1 | ||
129 | mov.l r1, @r4 | ||
130 | |||
131 | mov.l dben_reg, r4 | ||
132 | mov.l dben_data1, r1 | ||
133 | mov.l r1, @r4 | ||
134 | |||
135 | mov.l dbrfpdn0_reg, r4 | ||
136 | mov.l dbrfpdn0_data2, r1 | ||
137 | mov.l r1, @r4 | ||
138 | #else | ||
139 | /* SBSC: set auto-refresh mode */ | ||
88 | mov.l 1f, r4 | 140 | mov.l 1f, r4 |
89 | mov.l @r4, r2 | 141 | mov.l @r4, r2 |
90 | mov.l 4f, r3 | 142 | mov.l 4f, r3 |
@@ -98,15 +150,29 @@ done_sleep: | |||
98 | add r4, r3 | 150 | add r4, r3 |
99 | or r2, r3 | 151 | or r2, r3 |
100 | mov.l r3, @r1 | 152 | mov.l r3, @r1 |
153 | #endif | ||
101 | skip_restore_sf: | 154 | skip_restore_sf: |
102 | rts | 155 | rts |
103 | nop | 156 | nop |
104 | 157 | ||
105 | .balign 4 | 158 | .balign 4 |
159 | #ifdef CONFIG_CPU_SUBTYPE_SH7724 | ||
160 | dben_reg: .long 0xfd000010 /* DBEN */ | ||
161 | dben_data0: .long 0 | ||
162 | dben_data1: .long 1 | ||
163 | dbrfpdn0_reg: .long 0xfd000040 /* DBRFPDN0 */ | ||
164 | dbrfpdn0_data0: .long 0 | ||
165 | dbrfpdn0_data1: .long 1 | ||
166 | dbrfpdn0_data2: .long 0x00010000 | ||
167 | dbcmdcnt_reg: .long 0xfd000014 /* DBCMDCNT */ | ||
168 | dbcmdcnt_data0: .long 2 | ||
169 | dbcmdcnt_data1: .long 4 | ||
170 | #else | ||
106 | 1: .long 0xfe400008 /* SDCR0 */ | 171 | 1: .long 0xfe400008 /* SDCR0 */ |
107 | 2: .long 0x00000400 | 172 | 2: .long 0x00000400 |
108 | 3: .long 0xffff7fff | 173 | 3: .long 0xffff7fff |
109 | 4: .long 0xfffffbff | 174 | 4: .long 0xfffffbff |
175 | #endif | ||
110 | 5: .long 0xa4150020 /* STBCR */ | 176 | 5: .long 0xa4150020 /* STBCR */ |
111 | 6: .long 0xfe40001c /* RTCOR */ | 177 | 6: .long 0xfe40001c /* RTCOR */ |
112 | 7: .long 0xfe400018 /* RTCNT */ | 178 | 7: .long 0xfe400018 /* RTCNT */ |
diff --git a/arch/sparc/kernel/smp_64.c b/arch/sparc/kernel/smp_64.c index fa44eaf8d89..3691907a43b 100644 --- a/arch/sparc/kernel/smp_64.c +++ b/arch/sparc/kernel/smp_64.c | |||
@@ -1499,7 +1499,7 @@ void __init setup_per_cpu_areas(void) | |||
1499 | dyn_size = pcpur_size - static_size - PERCPU_MODULE_RESERVE; | 1499 | dyn_size = pcpur_size - static_size - PERCPU_MODULE_RESERVE; |
1500 | 1500 | ||
1501 | 1501 | ||
1502 | ptrs_size = PFN_ALIGN(num_possible_cpus() * sizeof(pcpur_ptrs[0])); | 1502 | ptrs_size = PFN_ALIGN(nr_cpu_ids * sizeof(pcpur_ptrs[0])); |
1503 | pcpur_ptrs = alloc_bootmem(ptrs_size); | 1503 | pcpur_ptrs = alloc_bootmem(ptrs_size); |
1504 | 1504 | ||
1505 | for_each_possible_cpu(cpu) { | 1505 | for_each_possible_cpu(cpu) { |
@@ -1514,7 +1514,7 @@ void __init setup_per_cpu_areas(void) | |||
1514 | 1514 | ||
1515 | /* allocate address and map */ | 1515 | /* allocate address and map */ |
1516 | vm.flags = VM_ALLOC; | 1516 | vm.flags = VM_ALLOC; |
1517 | vm.size = num_possible_cpus() * PCPU_CHUNK_SIZE; | 1517 | vm.size = nr_cpu_ids * PCPU_CHUNK_SIZE; |
1518 | vm_area_register_early(&vm, PCPU_CHUNK_SIZE); | 1518 | vm_area_register_early(&vm, PCPU_CHUNK_SIZE); |
1519 | 1519 | ||
1520 | for_each_possible_cpu(cpu) { | 1520 | for_each_possible_cpu(cpu) { |
diff --git a/arch/x86/include/asm/uv/uv_bau.h b/arch/x86/include/asm/uv/uv_bau.h index bddd44f2f0a..80e2984f521 100644 --- a/arch/x86/include/asm/uv/uv_bau.h +++ b/arch/x86/include/asm/uv/uv_bau.h | |||
@@ -133,7 +133,7 @@ struct bau_msg_payload { | |||
133 | * see table 4.2.3.0.1 in broacast_assist spec. | 133 | * see table 4.2.3.0.1 in broacast_assist spec. |
134 | */ | 134 | */ |
135 | struct bau_msg_header { | 135 | struct bau_msg_header { |
136 | unsigned int dest_subnodeid:6; /* must be zero */ | 136 | unsigned int dest_subnodeid:6; /* must be 0x10, for the LB */ |
137 | /* bits 5:0 */ | 137 | /* bits 5:0 */ |
138 | unsigned int base_dest_nodeid:15; /* nasid>>1 (pnode) of */ | 138 | unsigned int base_dest_nodeid:15; /* nasid>>1 (pnode) of */ |
139 | /* bits 20:6 */ /* first bit in node_map */ | 139 | /* bits 20:6 */ /* first bit in node_map */ |
diff --git a/arch/x86/kernel/apic/x2apic_uv_x.c b/arch/x86/kernel/apic/x2apic_uv_x.c index 832e908adcb..601159374e8 100644 --- a/arch/x86/kernel/apic/x2apic_uv_x.c +++ b/arch/x86/kernel/apic/x2apic_uv_x.c | |||
@@ -46,7 +46,7 @@ static int early_get_nodeid(void) | |||
46 | return node_id.s.node_id; | 46 | return node_id.s.node_id; |
47 | } | 47 | } |
48 | 48 | ||
49 | static int uv_acpi_madt_oem_check(char *oem_id, char *oem_table_id) | 49 | static int __init uv_acpi_madt_oem_check(char *oem_id, char *oem_table_id) |
50 | { | 50 | { |
51 | if (!strcmp(oem_id, "SGI")) { | 51 | if (!strcmp(oem_id, "SGI")) { |
52 | if (!strcmp(oem_table_id, "UVL")) | 52 | if (!strcmp(oem_table_id, "UVL")) |
@@ -253,7 +253,7 @@ static void uv_send_IPI_self(int vector) | |||
253 | apic_write(APIC_SELF_IPI, vector); | 253 | apic_write(APIC_SELF_IPI, vector); |
254 | } | 254 | } |
255 | 255 | ||
256 | struct apic apic_x2apic_uv_x = { | 256 | struct apic __refdata apic_x2apic_uv_x = { |
257 | 257 | ||
258 | .name = "UV large system", | 258 | .name = "UV large system", |
259 | .probe = NULL, | 259 | .probe = NULL, |
diff --git a/arch/x86/kernel/cpu/mcheck/mce.c b/arch/x86/kernel/cpu/mcheck/mce.c index 1cfb623ce11..01213048f62 100644 --- a/arch/x86/kernel/cpu/mcheck/mce.c +++ b/arch/x86/kernel/cpu/mcheck/mce.c | |||
@@ -1226,8 +1226,13 @@ static void mce_init(void) | |||
1226 | } | 1226 | } |
1227 | 1227 | ||
1228 | /* Add per CPU specific workarounds here */ | 1228 | /* Add per CPU specific workarounds here */ |
1229 | static void mce_cpu_quirks(struct cpuinfo_x86 *c) | 1229 | static int mce_cpu_quirks(struct cpuinfo_x86 *c) |
1230 | { | 1230 | { |
1231 | if (c->x86_vendor == X86_VENDOR_UNKNOWN) { | ||
1232 | pr_info("MCE: unknown CPU type - not enabling MCE support.\n"); | ||
1233 | return -EOPNOTSUPP; | ||
1234 | } | ||
1235 | |||
1231 | /* This should be disabled by the BIOS, but isn't always */ | 1236 | /* This should be disabled by the BIOS, but isn't always */ |
1232 | if (c->x86_vendor == X86_VENDOR_AMD) { | 1237 | if (c->x86_vendor == X86_VENDOR_AMD) { |
1233 | if (c->x86 == 15 && banks > 4) { | 1238 | if (c->x86 == 15 && banks > 4) { |
@@ -1273,11 +1278,20 @@ static void mce_cpu_quirks(struct cpuinfo_x86 *c) | |||
1273 | if ((c->x86 > 6 || (c->x86 == 6 && c->x86_model >= 0xe)) && | 1278 | if ((c->x86 > 6 || (c->x86 == 6 && c->x86_model >= 0xe)) && |
1274 | monarch_timeout < 0) | 1279 | monarch_timeout < 0) |
1275 | monarch_timeout = USEC_PER_SEC; | 1280 | monarch_timeout = USEC_PER_SEC; |
1281 | |||
1282 | /* | ||
1283 | * There are also broken BIOSes on some Pentium M and | ||
1284 | * earlier systems: | ||
1285 | */ | ||
1286 | if (c->x86 == 6 && c->x86_model <= 13 && mce_bootlog < 0) | ||
1287 | mce_bootlog = 0; | ||
1276 | } | 1288 | } |
1277 | if (monarch_timeout < 0) | 1289 | if (monarch_timeout < 0) |
1278 | monarch_timeout = 0; | 1290 | monarch_timeout = 0; |
1279 | if (mce_bootlog != 0) | 1291 | if (mce_bootlog != 0) |
1280 | mce_panic_timeout = 30; | 1292 | mce_panic_timeout = 30; |
1293 | |||
1294 | return 0; | ||
1281 | } | 1295 | } |
1282 | 1296 | ||
1283 | static void __cpuinit mce_ancient_init(struct cpuinfo_x86 *c) | 1297 | static void __cpuinit mce_ancient_init(struct cpuinfo_x86 *c) |
@@ -1338,11 +1352,10 @@ void __cpuinit mcheck_init(struct cpuinfo_x86 *c) | |||
1338 | if (!mce_available(c)) | 1352 | if (!mce_available(c)) |
1339 | return; | 1353 | return; |
1340 | 1354 | ||
1341 | if (mce_cap_init() < 0) { | 1355 | if (mce_cap_init() < 0 || mce_cpu_quirks(c) < 0) { |
1342 | mce_disabled = 1; | 1356 | mce_disabled = 1; |
1343 | return; | 1357 | return; |
1344 | } | 1358 | } |
1345 | mce_cpu_quirks(c); | ||
1346 | 1359 | ||
1347 | machine_check_vector = do_machine_check; | 1360 | machine_check_vector = do_machine_check; |
1348 | 1361 | ||
diff --git a/arch/x86/kernel/cpu/mcheck/therm_throt.c b/arch/x86/kernel/cpu/mcheck/therm_throt.c index 8bc64cfbe93..5957a93e517 100644 --- a/arch/x86/kernel/cpu/mcheck/therm_throt.c +++ b/arch/x86/kernel/cpu/mcheck/therm_throt.c | |||
@@ -116,11 +116,14 @@ static int therm_throt_process(int curr) | |||
116 | cpu, __get_cpu_var(thermal_throttle_count)); | 116 | cpu, __get_cpu_var(thermal_throttle_count)); |
117 | 117 | ||
118 | add_taint(TAINT_MACHINE_CHECK); | 118 | add_taint(TAINT_MACHINE_CHECK); |
119 | } else if (was_throttled) { | 119 | return 1; |
120 | } | ||
121 | if (was_throttled) { | ||
120 | printk(KERN_INFO "CPU%d: Temperature/speed normal\n", cpu); | 122 | printk(KERN_INFO "CPU%d: Temperature/speed normal\n", cpu); |
123 | return 1; | ||
121 | } | 124 | } |
122 | 125 | ||
123 | return 1; | 126 | return 0; |
124 | } | 127 | } |
125 | 128 | ||
126 | #ifdef CONFIG_SYSFS | 129 | #ifdef CONFIG_SYSFS |
diff --git a/arch/x86/kernel/setup_percpu.c b/arch/x86/kernel/setup_percpu.c index 29a3eef7cf4..07d81916f21 100644 --- a/arch/x86/kernel/setup_percpu.c +++ b/arch/x86/kernel/setup_percpu.c | |||
@@ -165,7 +165,7 @@ static ssize_t __init setup_pcpu_lpage(size_t static_size, bool chosen) | |||
165 | 165 | ||
166 | if (!chosen) { | 166 | if (!chosen) { |
167 | size_t vm_size = VMALLOC_END - VMALLOC_START; | 167 | size_t vm_size = VMALLOC_END - VMALLOC_START; |
168 | size_t tot_size = num_possible_cpus() * PMD_SIZE; | 168 | size_t tot_size = nr_cpu_ids * PMD_SIZE; |
169 | 169 | ||
170 | /* on non-NUMA, embedding is better */ | 170 | /* on non-NUMA, embedding is better */ |
171 | if (!pcpu_need_numa()) | 171 | if (!pcpu_need_numa()) |
@@ -199,7 +199,7 @@ static ssize_t __init setup_pcpu_lpage(size_t static_size, bool chosen) | |||
199 | dyn_size = pcpul_size - static_size - PERCPU_FIRST_CHUNK_RESERVE; | 199 | dyn_size = pcpul_size - static_size - PERCPU_FIRST_CHUNK_RESERVE; |
200 | 200 | ||
201 | /* allocate pointer array and alloc large pages */ | 201 | /* allocate pointer array and alloc large pages */ |
202 | map_size = PFN_ALIGN(num_possible_cpus() * sizeof(pcpul_map[0])); | 202 | map_size = PFN_ALIGN(nr_cpu_ids * sizeof(pcpul_map[0])); |
203 | pcpul_map = alloc_bootmem(map_size); | 203 | pcpul_map = alloc_bootmem(map_size); |
204 | 204 | ||
205 | for_each_possible_cpu(cpu) { | 205 | for_each_possible_cpu(cpu) { |
@@ -228,7 +228,7 @@ static ssize_t __init setup_pcpu_lpage(size_t static_size, bool chosen) | |||
228 | 228 | ||
229 | /* allocate address and map */ | 229 | /* allocate address and map */ |
230 | pcpul_vm.flags = VM_ALLOC; | 230 | pcpul_vm.flags = VM_ALLOC; |
231 | pcpul_vm.size = num_possible_cpus() * PMD_SIZE; | 231 | pcpul_vm.size = nr_cpu_ids * PMD_SIZE; |
232 | vm_area_register_early(&pcpul_vm, PMD_SIZE); | 232 | vm_area_register_early(&pcpul_vm, PMD_SIZE); |
233 | 233 | ||
234 | for_each_possible_cpu(cpu) { | 234 | for_each_possible_cpu(cpu) { |
@@ -250,8 +250,8 @@ static ssize_t __init setup_pcpu_lpage(size_t static_size, bool chosen) | |||
250 | PMD_SIZE, pcpul_vm.addr, NULL); | 250 | PMD_SIZE, pcpul_vm.addr, NULL); |
251 | 251 | ||
252 | /* sort pcpul_map array for pcpu_lpage_remapped() */ | 252 | /* sort pcpul_map array for pcpu_lpage_remapped() */ |
253 | for (i = 0; i < num_possible_cpus() - 1; i++) | 253 | for (i = 0; i < nr_cpu_ids - 1; i++) |
254 | for (j = i + 1; j < num_possible_cpus(); j++) | 254 | for (j = i + 1; j < nr_cpu_ids; j++) |
255 | if (pcpul_map[i].ptr > pcpul_map[j].ptr) { | 255 | if (pcpul_map[i].ptr > pcpul_map[j].ptr) { |
256 | struct pcpul_ent tmp = pcpul_map[i]; | 256 | struct pcpul_ent tmp = pcpul_map[i]; |
257 | pcpul_map[i] = pcpul_map[j]; | 257 | pcpul_map[i] = pcpul_map[j]; |
@@ -288,7 +288,7 @@ void *pcpu_lpage_remapped(void *kaddr) | |||
288 | { | 288 | { |
289 | void *pmd_addr = (void *)((unsigned long)kaddr & PMD_MASK); | 289 | void *pmd_addr = (void *)((unsigned long)kaddr & PMD_MASK); |
290 | unsigned long offset = (unsigned long)kaddr & ~PMD_MASK; | 290 | unsigned long offset = (unsigned long)kaddr & ~PMD_MASK; |
291 | int left = 0, right = num_possible_cpus() - 1; | 291 | int left = 0, right = nr_cpu_ids - 1; |
292 | int pos; | 292 | int pos; |
293 | 293 | ||
294 | /* pcpul in use at all? */ | 294 | /* pcpul in use at all? */ |
@@ -377,7 +377,7 @@ static ssize_t __init setup_pcpu_4k(size_t static_size) | |||
377 | pcpu4k_nr_static_pages = PFN_UP(static_size); | 377 | pcpu4k_nr_static_pages = PFN_UP(static_size); |
378 | 378 | ||
379 | /* unaligned allocations can't be freed, round up to page size */ | 379 | /* unaligned allocations can't be freed, round up to page size */ |
380 | pages_size = PFN_ALIGN(pcpu4k_nr_static_pages * num_possible_cpus() | 380 | pages_size = PFN_ALIGN(pcpu4k_nr_static_pages * nr_cpu_ids |
381 | * sizeof(pcpu4k_pages[0])); | 381 | * sizeof(pcpu4k_pages[0])); |
382 | pcpu4k_pages = alloc_bootmem(pages_size); | 382 | pcpu4k_pages = alloc_bootmem(pages_size); |
383 | 383 | ||
diff --git a/arch/x86/kernel/tlb_uv.c b/arch/x86/kernel/tlb_uv.c index 8ccabb8a2f6..77b9689f8ed 100644 --- a/arch/x86/kernel/tlb_uv.c +++ b/arch/x86/kernel/tlb_uv.c | |||
@@ -744,6 +744,7 @@ uv_activation_descriptor_init(int node, int pnode) | |||
744 | * note that base_dest_nodeid is actually a nasid. | 744 | * note that base_dest_nodeid is actually a nasid. |
745 | */ | 745 | */ |
746 | ad2->header.base_dest_nodeid = uv_partition_base_pnode << 1; | 746 | ad2->header.base_dest_nodeid = uv_partition_base_pnode << 1; |
747 | ad2->header.dest_subnodeid = 0x10; /* the LB */ | ||
747 | ad2->header.command = UV_NET_ENDPOINT_INTD; | 748 | ad2->header.command = UV_NET_ENDPOINT_INTD; |
748 | ad2->header.int_both = 1; | 749 | ad2->header.int_both = 1; |
749 | /* | 750 | /* |
diff --git a/drivers/clocksource/sh_cmt.c b/drivers/clocksource/sh_cmt.c index 2964f5f4a7e..6b3e0c2f33e 100644 --- a/drivers/clocksource/sh_cmt.c +++ b/drivers/clocksource/sh_cmt.c | |||
@@ -40,6 +40,7 @@ struct sh_cmt_priv { | |||
40 | struct platform_device *pdev; | 40 | struct platform_device *pdev; |
41 | 41 | ||
42 | unsigned long flags; | 42 | unsigned long flags; |
43 | unsigned long flags_suspend; | ||
43 | unsigned long match_value; | 44 | unsigned long match_value; |
44 | unsigned long next_match_value; | 45 | unsigned long next_match_value; |
45 | unsigned long max_match_value; | 46 | unsigned long max_match_value; |
@@ -667,11 +668,38 @@ static int __devexit sh_cmt_remove(struct platform_device *pdev) | |||
667 | return -EBUSY; /* cannot unregister clockevent and clocksource */ | 668 | return -EBUSY; /* cannot unregister clockevent and clocksource */ |
668 | } | 669 | } |
669 | 670 | ||
671 | static int sh_cmt_suspend(struct device *dev) | ||
672 | { | ||
673 | struct platform_device *pdev = to_platform_device(dev); | ||
674 | struct sh_cmt_priv *p = platform_get_drvdata(pdev); | ||
675 | |||
676 | /* save flag state and stop CMT channel */ | ||
677 | p->flags_suspend = p->flags; | ||
678 | sh_cmt_stop(p, p->flags); | ||
679 | return 0; | ||
680 | } | ||
681 | |||
682 | static int sh_cmt_resume(struct device *dev) | ||
683 | { | ||
684 | struct platform_device *pdev = to_platform_device(dev); | ||
685 | struct sh_cmt_priv *p = platform_get_drvdata(pdev); | ||
686 | |||
687 | /* start CMT channel from saved state */ | ||
688 | sh_cmt_start(p, p->flags_suspend); | ||
689 | return 0; | ||
690 | } | ||
691 | |||
692 | static struct dev_pm_ops sh_cmt_dev_pm_ops = { | ||
693 | .suspend = sh_cmt_suspend, | ||
694 | .resume = sh_cmt_resume, | ||
695 | }; | ||
696 | |||
670 | static struct platform_driver sh_cmt_device_driver = { | 697 | static struct platform_driver sh_cmt_device_driver = { |
671 | .probe = sh_cmt_probe, | 698 | .probe = sh_cmt_probe, |
672 | .remove = __devexit_p(sh_cmt_remove), | 699 | .remove = __devexit_p(sh_cmt_remove), |
673 | .driver = { | 700 | .driver = { |
674 | .name = "sh_cmt", | 701 | .name = "sh_cmt", |
702 | .pm = &sh_cmt_dev_pm_ops, | ||
675 | } | 703 | } |
676 | }; | 704 | }; |
677 | 705 | ||
diff --git a/drivers/md/md.c b/drivers/md/md.c index 103f2d33fa8..9dd872000ce 100644 --- a/drivers/md/md.c +++ b/drivers/md/md.c | |||
@@ -4364,6 +4364,7 @@ static int do_md_stop(mddev_t * mddev, int mode, int is_open) | |||
4364 | if (mode == 1) | 4364 | if (mode == 1) |
4365 | set_disk_ro(disk, 1); | 4365 | set_disk_ro(disk, 1); |
4366 | clear_bit(MD_RECOVERY_FROZEN, &mddev->recovery); | 4366 | clear_bit(MD_RECOVERY_FROZEN, &mddev->recovery); |
4367 | err = 0; | ||
4367 | } | 4368 | } |
4368 | out: | 4369 | out: |
4369 | mutex_unlock(&mddev->open_mutex); | 4370 | mutex_unlock(&mddev->open_mutex); |
diff --git a/drivers/net/3c59x.c b/drivers/net/3c59x.c index c2041685094..45675889850 100644 --- a/drivers/net/3c59x.c +++ b/drivers/net/3c59x.c | |||
@@ -235,6 +235,7 @@ enum vortex_chips { | |||
235 | CH_3C900B_FL, | 235 | CH_3C900B_FL, |
236 | CH_3C905_1, | 236 | CH_3C905_1, |
237 | CH_3C905_2, | 237 | CH_3C905_2, |
238 | CH_3C905B_TX, | ||
238 | CH_3C905B_1, | 239 | CH_3C905B_1, |
239 | 240 | ||
240 | CH_3C905B_2, | 241 | CH_3C905B_2, |
@@ -307,6 +308,8 @@ static struct vortex_chip_info { | |||
307 | PCI_USES_MASTER, IS_BOOMERANG|HAS_MII|EEPROM_RESET, 64, }, | 308 | PCI_USES_MASTER, IS_BOOMERANG|HAS_MII|EEPROM_RESET, 64, }, |
308 | {"3c905 Boomerang 100baseT4", | 309 | {"3c905 Boomerang 100baseT4", |
309 | PCI_USES_MASTER, IS_BOOMERANG|HAS_MII|EEPROM_RESET, 64, }, | 310 | PCI_USES_MASTER, IS_BOOMERANG|HAS_MII|EEPROM_RESET, 64, }, |
311 | {"3C905B-TX Fast Etherlink XL PCI", | ||
312 | PCI_USES_MASTER, IS_CYCLONE|HAS_NWAY|HAS_HWCKSM|EXTRA_PREAMBLE, 128, }, | ||
310 | {"3c905B Cyclone 100baseTx", | 313 | {"3c905B Cyclone 100baseTx", |
311 | PCI_USES_MASTER, IS_CYCLONE|HAS_NWAY|HAS_HWCKSM|EXTRA_PREAMBLE, 128, }, | 314 | PCI_USES_MASTER, IS_CYCLONE|HAS_NWAY|HAS_HWCKSM|EXTRA_PREAMBLE, 128, }, |
312 | 315 | ||
@@ -389,6 +392,7 @@ static struct pci_device_id vortex_pci_tbl[] = { | |||
389 | { 0x10B7, 0x900A, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CH_3C900B_FL }, | 392 | { 0x10B7, 0x900A, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CH_3C900B_FL }, |
390 | { 0x10B7, 0x9050, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CH_3C905_1 }, | 393 | { 0x10B7, 0x9050, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CH_3C905_1 }, |
391 | { 0x10B7, 0x9051, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CH_3C905_2 }, | 394 | { 0x10B7, 0x9051, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CH_3C905_2 }, |
395 | { 0x10B7, 0x9054, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CH_3C905B_TX }, | ||
392 | { 0x10B7, 0x9055, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CH_3C905B_1 }, | 396 | { 0x10B7, 0x9055, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CH_3C905B_1 }, |
393 | 397 | ||
394 | { 0x10B7, 0x9058, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CH_3C905B_2 }, | 398 | { 0x10B7, 0x9058, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CH_3C905B_2 }, |
diff --git a/drivers/net/8139cp.c b/drivers/net/8139cp.c index 50efde11ea6..d0dbbf39349 100644 --- a/drivers/net/8139cp.c +++ b/drivers/net/8139cp.c | |||
@@ -515,7 +515,7 @@ rx_status_loop: | |||
515 | dma_addr_t mapping; | 515 | dma_addr_t mapping; |
516 | struct sk_buff *skb, *new_skb; | 516 | struct sk_buff *skb, *new_skb; |
517 | struct cp_desc *desc; | 517 | struct cp_desc *desc; |
518 | unsigned buflen; | 518 | const unsigned buflen = cp->rx_buf_sz; |
519 | 519 | ||
520 | skb = cp->rx_skb[rx_tail]; | 520 | skb = cp->rx_skb[rx_tail]; |
521 | BUG_ON(!skb); | 521 | BUG_ON(!skb); |
@@ -549,8 +549,7 @@ rx_status_loop: | |||
549 | pr_debug("%s: rx slot %d status 0x%x len %d\n", | 549 | pr_debug("%s: rx slot %d status 0x%x len %d\n", |
550 | dev->name, rx_tail, status, len); | 550 | dev->name, rx_tail, status, len); |
551 | 551 | ||
552 | buflen = cp->rx_buf_sz + NET_IP_ALIGN; | 552 | new_skb = netdev_alloc_skb(dev, buflen + NET_IP_ALIGN); |
553 | new_skb = netdev_alloc_skb(dev, buflen); | ||
554 | if (!new_skb) { | 553 | if (!new_skb) { |
555 | dev->stats.rx_dropped++; | 554 | dev->stats.rx_dropped++; |
556 | goto rx_next; | 555 | goto rx_next; |
diff --git a/drivers/net/atl1c/atl1c_ethtool.c b/drivers/net/atl1c/atl1c_ethtool.c index 607007d75b6..00d11b480af 100644 --- a/drivers/net/atl1c/atl1c_ethtool.c +++ b/drivers/net/atl1c/atl1c_ethtool.c | |||
@@ -232,11 +232,11 @@ static void atl1c_get_drvinfo(struct net_device *netdev, | |||
232 | { | 232 | { |
233 | struct atl1c_adapter *adapter = netdev_priv(netdev); | 233 | struct atl1c_adapter *adapter = netdev_priv(netdev); |
234 | 234 | ||
235 | strncpy(drvinfo->driver, atl1c_driver_name, sizeof(drvinfo->driver)); | 235 | strlcpy(drvinfo->driver, atl1c_driver_name, sizeof(drvinfo->driver)); |
236 | strncpy(drvinfo->version, atl1c_driver_version, | 236 | strlcpy(drvinfo->version, atl1c_driver_version, |
237 | sizeof(drvinfo->version)); | 237 | sizeof(drvinfo->version)); |
238 | strncpy(drvinfo->fw_version, "N/A", sizeof(drvinfo->fw_version)); | 238 | strlcpy(drvinfo->fw_version, "N/A", sizeof(drvinfo->fw_version)); |
239 | strncpy(drvinfo->bus_info, pci_name(adapter->pdev), | 239 | strlcpy(drvinfo->bus_info, pci_name(adapter->pdev), |
240 | sizeof(drvinfo->bus_info)); | 240 | sizeof(drvinfo->bus_info)); |
241 | drvinfo->n_stats = 0; | 241 | drvinfo->n_stats = 0; |
242 | drvinfo->testinfo_len = 0; | 242 | drvinfo->testinfo_len = 0; |
diff --git a/drivers/net/atlx/atl1.c b/drivers/net/atlx/atl1.c index 94d7325caf4..8bca12f7139 100644 --- a/drivers/net/atlx/atl1.c +++ b/drivers/net/atlx/atl1.c | |||
@@ -3378,11 +3378,11 @@ static void atl1_get_drvinfo(struct net_device *netdev, | |||
3378 | { | 3378 | { |
3379 | struct atl1_adapter *adapter = netdev_priv(netdev); | 3379 | struct atl1_adapter *adapter = netdev_priv(netdev); |
3380 | 3380 | ||
3381 | strncpy(drvinfo->driver, ATLX_DRIVER_NAME, sizeof(drvinfo->driver)); | 3381 | strlcpy(drvinfo->driver, ATLX_DRIVER_NAME, sizeof(drvinfo->driver)); |
3382 | strncpy(drvinfo->version, ATLX_DRIVER_VERSION, | 3382 | strlcpy(drvinfo->version, ATLX_DRIVER_VERSION, |
3383 | sizeof(drvinfo->version)); | 3383 | sizeof(drvinfo->version)); |
3384 | strncpy(drvinfo->fw_version, "N/A", sizeof(drvinfo->fw_version)); | 3384 | strlcpy(drvinfo->fw_version, "N/A", sizeof(drvinfo->fw_version)); |
3385 | strncpy(drvinfo->bus_info, pci_name(adapter->pdev), | 3385 | strlcpy(drvinfo->bus_info, pci_name(adapter->pdev), |
3386 | sizeof(drvinfo->bus_info)); | 3386 | sizeof(drvinfo->bus_info)); |
3387 | drvinfo->eedump_len = ATL1_EEDUMP_LEN; | 3387 | drvinfo->eedump_len = ATL1_EEDUMP_LEN; |
3388 | } | 3388 | } |
diff --git a/drivers/net/b44.c b/drivers/net/b44.c index 36d4d377ec2..bafca672ea7 100644 --- a/drivers/net/b44.c +++ b/drivers/net/b44.c | |||
@@ -952,9 +952,10 @@ static int b44_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
952 | int rc = NETDEV_TX_OK; | 952 | int rc = NETDEV_TX_OK; |
953 | dma_addr_t mapping; | 953 | dma_addr_t mapping; |
954 | u32 len, entry, ctrl; | 954 | u32 len, entry, ctrl; |
955 | unsigned long flags; | ||
955 | 956 | ||
956 | len = skb->len; | 957 | len = skb->len; |
957 | spin_lock_irq(&bp->lock); | 958 | spin_lock_irqsave(&bp->lock, flags); |
958 | 959 | ||
959 | /* This is a hard error, log it. */ | 960 | /* This is a hard error, log it. */ |
960 | if (unlikely(TX_BUFFS_AVAIL(bp) < 1)) { | 961 | if (unlikely(TX_BUFFS_AVAIL(bp) < 1)) { |
@@ -1027,7 +1028,7 @@ static int b44_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
1027 | dev->trans_start = jiffies; | 1028 | dev->trans_start = jiffies; |
1028 | 1029 | ||
1029 | out_unlock: | 1030 | out_unlock: |
1030 | spin_unlock_irq(&bp->lock); | 1031 | spin_unlock_irqrestore(&bp->lock, flags); |
1031 | 1032 | ||
1032 | return rc; | 1033 | return rc; |
1033 | 1034 | ||
diff --git a/drivers/net/bnx2.c b/drivers/net/bnx2.c index b70cc99962f..06b901152d4 100644 --- a/drivers/net/bnx2.c +++ b/drivers/net/bnx2.c | |||
@@ -399,9 +399,11 @@ static int bnx2_unregister_cnic(struct net_device *dev) | |||
399 | struct bnx2_napi *bnapi = &bp->bnx2_napi[0]; | 399 | struct bnx2_napi *bnapi = &bp->bnx2_napi[0]; |
400 | struct cnic_eth_dev *cp = &bp->cnic_eth_dev; | 400 | struct cnic_eth_dev *cp = &bp->cnic_eth_dev; |
401 | 401 | ||
402 | mutex_lock(&bp->cnic_lock); | ||
402 | cp->drv_state = 0; | 403 | cp->drv_state = 0; |
403 | bnapi->cnic_present = 0; | 404 | bnapi->cnic_present = 0; |
404 | rcu_assign_pointer(bp->cnic_ops, NULL); | 405 | rcu_assign_pointer(bp->cnic_ops, NULL); |
406 | mutex_unlock(&bp->cnic_lock); | ||
405 | synchronize_rcu(); | 407 | synchronize_rcu(); |
406 | return 0; | 408 | return 0; |
407 | } | 409 | } |
@@ -429,13 +431,13 @@ bnx2_cnic_stop(struct bnx2 *bp) | |||
429 | struct cnic_ops *c_ops; | 431 | struct cnic_ops *c_ops; |
430 | struct cnic_ctl_info info; | 432 | struct cnic_ctl_info info; |
431 | 433 | ||
432 | rcu_read_lock(); | 434 | mutex_lock(&bp->cnic_lock); |
433 | c_ops = rcu_dereference(bp->cnic_ops); | 435 | c_ops = bp->cnic_ops; |
434 | if (c_ops) { | 436 | if (c_ops) { |
435 | info.cmd = CNIC_CTL_STOP_CMD; | 437 | info.cmd = CNIC_CTL_STOP_CMD; |
436 | c_ops->cnic_ctl(bp->cnic_data, &info); | 438 | c_ops->cnic_ctl(bp->cnic_data, &info); |
437 | } | 439 | } |
438 | rcu_read_unlock(); | 440 | mutex_unlock(&bp->cnic_lock); |
439 | } | 441 | } |
440 | 442 | ||
441 | static void | 443 | static void |
@@ -444,8 +446,8 @@ bnx2_cnic_start(struct bnx2 *bp) | |||
444 | struct cnic_ops *c_ops; | 446 | struct cnic_ops *c_ops; |
445 | struct cnic_ctl_info info; | 447 | struct cnic_ctl_info info; |
446 | 448 | ||
447 | rcu_read_lock(); | 449 | mutex_lock(&bp->cnic_lock); |
448 | c_ops = rcu_dereference(bp->cnic_ops); | 450 | c_ops = bp->cnic_ops; |
449 | if (c_ops) { | 451 | if (c_ops) { |
450 | if (!(bp->flags & BNX2_FLAG_USING_MSIX)) { | 452 | if (!(bp->flags & BNX2_FLAG_USING_MSIX)) { |
451 | struct bnx2_napi *bnapi = &bp->bnx2_napi[0]; | 453 | struct bnx2_napi *bnapi = &bp->bnx2_napi[0]; |
@@ -455,7 +457,7 @@ bnx2_cnic_start(struct bnx2 *bp) | |||
455 | info.cmd = CNIC_CTL_START_CMD; | 457 | info.cmd = CNIC_CTL_START_CMD; |
456 | c_ops->cnic_ctl(bp->cnic_data, &info); | 458 | c_ops->cnic_ctl(bp->cnic_data, &info); |
457 | } | 459 | } |
458 | rcu_read_unlock(); | 460 | mutex_unlock(&bp->cnic_lock); |
459 | } | 461 | } |
460 | 462 | ||
461 | #else | 463 | #else |
@@ -7663,6 +7665,9 @@ bnx2_init_board(struct pci_dev *pdev, struct net_device *dev) | |||
7663 | 7665 | ||
7664 | spin_lock_init(&bp->phy_lock); | 7666 | spin_lock_init(&bp->phy_lock); |
7665 | spin_lock_init(&bp->indirect_lock); | 7667 | spin_lock_init(&bp->indirect_lock); |
7668 | #ifdef BCM_CNIC | ||
7669 | mutex_init(&bp->cnic_lock); | ||
7670 | #endif | ||
7666 | INIT_WORK(&bp->reset_task, bnx2_reset_task); | 7671 | INIT_WORK(&bp->reset_task, bnx2_reset_task); |
7667 | 7672 | ||
7668 | dev->base_addr = dev->mem_start = pci_resource_start(pdev, 0); | 7673 | dev->base_addr = dev->mem_start = pci_resource_start(pdev, 0); |
diff --git a/drivers/net/bnx2.h b/drivers/net/bnx2.h index f1edfaa9e56..a4f12fd0ecd 100644 --- a/drivers/net/bnx2.h +++ b/drivers/net/bnx2.h | |||
@@ -6902,6 +6902,7 @@ struct bnx2 { | |||
6902 | u32 idle_chk_status_idx; | 6902 | u32 idle_chk_status_idx; |
6903 | 6903 | ||
6904 | #ifdef BCM_CNIC | 6904 | #ifdef BCM_CNIC |
6905 | struct mutex cnic_lock; | ||
6905 | struct cnic_eth_dev cnic_eth_dev; | 6906 | struct cnic_eth_dev cnic_eth_dev; |
6906 | #endif | 6907 | #endif |
6907 | 6908 | ||
diff --git a/drivers/net/can/dev.c b/drivers/net/can/dev.c index 9e4283aff82..e1a4f821423 100644 --- a/drivers/net/can/dev.c +++ b/drivers/net/can/dev.c | |||
@@ -611,11 +611,18 @@ nla_put_failure: | |||
611 | return -EMSGSIZE; | 611 | return -EMSGSIZE; |
612 | } | 612 | } |
613 | 613 | ||
614 | static int can_newlink(struct net_device *dev, | ||
615 | struct nlattr *tb[], struct nlattr *data[]) | ||
616 | { | ||
617 | return -EOPNOTSUPP; | ||
618 | } | ||
619 | |||
614 | static struct rtnl_link_ops can_link_ops __read_mostly = { | 620 | static struct rtnl_link_ops can_link_ops __read_mostly = { |
615 | .kind = "can", | 621 | .kind = "can", |
616 | .maxtype = IFLA_CAN_MAX, | 622 | .maxtype = IFLA_CAN_MAX, |
617 | .policy = can_policy, | 623 | .policy = can_policy, |
618 | .setup = can_setup, | 624 | .setup = can_setup, |
625 | .newlink = can_newlink, | ||
619 | .changelink = can_changelink, | 626 | .changelink = can_changelink, |
620 | .fill_info = can_fill_info, | 627 | .fill_info = can_fill_info, |
621 | .fill_xstats = can_fill_xstats, | 628 | .fill_xstats = can_fill_xstats, |
diff --git a/drivers/net/cnic.c b/drivers/net/cnic.c index 4869d77cbe9..74c342959b7 100644 --- a/drivers/net/cnic.c +++ b/drivers/net/cnic.c | |||
@@ -138,6 +138,16 @@ static struct cnic_dev *cnic_from_netdev(struct net_device *netdev) | |||
138 | return NULL; | 138 | return NULL; |
139 | } | 139 | } |
140 | 140 | ||
141 | static inline void ulp_get(struct cnic_ulp_ops *ulp_ops) | ||
142 | { | ||
143 | atomic_inc(&ulp_ops->ref_count); | ||
144 | } | ||
145 | |||
146 | static inline void ulp_put(struct cnic_ulp_ops *ulp_ops) | ||
147 | { | ||
148 | atomic_dec(&ulp_ops->ref_count); | ||
149 | } | ||
150 | |||
141 | static void cnic_ctx_wr(struct cnic_dev *dev, u32 cid_addr, u32 off, u32 val) | 151 | static void cnic_ctx_wr(struct cnic_dev *dev, u32 cid_addr, u32 off, u32 val) |
142 | { | 152 | { |
143 | struct cnic_local *cp = dev->cnic_priv; | 153 | struct cnic_local *cp = dev->cnic_priv; |
@@ -358,6 +368,7 @@ int cnic_register_driver(int ulp_type, struct cnic_ulp_ops *ulp_ops) | |||
358 | } | 368 | } |
359 | read_unlock(&cnic_dev_lock); | 369 | read_unlock(&cnic_dev_lock); |
360 | 370 | ||
371 | atomic_set(&ulp_ops->ref_count, 0); | ||
361 | rcu_assign_pointer(cnic_ulp_tbl[ulp_type], ulp_ops); | 372 | rcu_assign_pointer(cnic_ulp_tbl[ulp_type], ulp_ops); |
362 | mutex_unlock(&cnic_lock); | 373 | mutex_unlock(&cnic_lock); |
363 | 374 | ||
@@ -379,6 +390,8 @@ int cnic_register_driver(int ulp_type, struct cnic_ulp_ops *ulp_ops) | |||
379 | int cnic_unregister_driver(int ulp_type) | 390 | int cnic_unregister_driver(int ulp_type) |
380 | { | 391 | { |
381 | struct cnic_dev *dev; | 392 | struct cnic_dev *dev; |
393 | struct cnic_ulp_ops *ulp_ops; | ||
394 | int i = 0; | ||
382 | 395 | ||
383 | if (ulp_type >= MAX_CNIC_ULP_TYPE) { | 396 | if (ulp_type >= MAX_CNIC_ULP_TYPE) { |
384 | printk(KERN_ERR PFX "cnic_unregister_driver: Bad type %d\n", | 397 | printk(KERN_ERR PFX "cnic_unregister_driver: Bad type %d\n", |
@@ -386,7 +399,8 @@ int cnic_unregister_driver(int ulp_type) | |||
386 | return -EINVAL; | 399 | return -EINVAL; |
387 | } | 400 | } |
388 | mutex_lock(&cnic_lock); | 401 | mutex_lock(&cnic_lock); |
389 | if (!cnic_ulp_tbl[ulp_type]) { | 402 | ulp_ops = cnic_ulp_tbl[ulp_type]; |
403 | if (!ulp_ops) { | ||
390 | printk(KERN_ERR PFX "cnic_unregister_driver: Type %d has not " | 404 | printk(KERN_ERR PFX "cnic_unregister_driver: Type %d has not " |
391 | "been registered\n", ulp_type); | 405 | "been registered\n", ulp_type); |
392 | goto out_unlock; | 406 | goto out_unlock; |
@@ -411,6 +425,14 @@ int cnic_unregister_driver(int ulp_type) | |||
411 | 425 | ||
412 | mutex_unlock(&cnic_lock); | 426 | mutex_unlock(&cnic_lock); |
413 | synchronize_rcu(); | 427 | synchronize_rcu(); |
428 | while ((atomic_read(&ulp_ops->ref_count) != 0) && (i < 20)) { | ||
429 | msleep(100); | ||
430 | i++; | ||
431 | } | ||
432 | |||
433 | if (atomic_read(&ulp_ops->ref_count) != 0) | ||
434 | printk(KERN_WARNING PFX "%s: Failed waiting for ref count to go" | ||
435 | " to zero.\n", dev->netdev->name); | ||
414 | return 0; | 436 | return 0; |
415 | 437 | ||
416 | out_unlock: | 438 | out_unlock: |
@@ -466,6 +488,7 @@ EXPORT_SYMBOL(cnic_register_driver); | |||
466 | static int cnic_unregister_device(struct cnic_dev *dev, int ulp_type) | 488 | static int cnic_unregister_device(struct cnic_dev *dev, int ulp_type) |
467 | { | 489 | { |
468 | struct cnic_local *cp = dev->cnic_priv; | 490 | struct cnic_local *cp = dev->cnic_priv; |
491 | int i = 0; | ||
469 | 492 | ||
470 | if (ulp_type >= MAX_CNIC_ULP_TYPE) { | 493 | if (ulp_type >= MAX_CNIC_ULP_TYPE) { |
471 | printk(KERN_ERR PFX "cnic_unregister_device: Bad type %d\n", | 494 | printk(KERN_ERR PFX "cnic_unregister_device: Bad type %d\n", |
@@ -486,6 +509,15 @@ static int cnic_unregister_device(struct cnic_dev *dev, int ulp_type) | |||
486 | 509 | ||
487 | synchronize_rcu(); | 510 | synchronize_rcu(); |
488 | 511 | ||
512 | while (test_bit(ULP_F_CALL_PENDING, &cp->ulp_flags[ulp_type]) && | ||
513 | i < 20) { | ||
514 | msleep(100); | ||
515 | i++; | ||
516 | } | ||
517 | if (test_bit(ULP_F_CALL_PENDING, &cp->ulp_flags[ulp_type])) | ||
518 | printk(KERN_WARNING PFX "%s: Failed waiting for ULP up call" | ||
519 | " to complete.\n", dev->netdev->name); | ||
520 | |||
489 | return 0; | 521 | return 0; |
490 | } | 522 | } |
491 | EXPORT_SYMBOL(cnic_unregister_driver); | 523 | EXPORT_SYMBOL(cnic_unregister_driver); |
@@ -1076,18 +1108,23 @@ static void cnic_ulp_stop(struct cnic_dev *dev) | |||
1076 | if (cp->cnic_uinfo) | 1108 | if (cp->cnic_uinfo) |
1077 | cnic_send_nlmsg(cp, ISCSI_KEVENT_IF_DOWN, NULL); | 1109 | cnic_send_nlmsg(cp, ISCSI_KEVENT_IF_DOWN, NULL); |
1078 | 1110 | ||
1079 | rcu_read_lock(); | ||
1080 | for (if_type = 0; if_type < MAX_CNIC_ULP_TYPE; if_type++) { | 1111 | for (if_type = 0; if_type < MAX_CNIC_ULP_TYPE; if_type++) { |
1081 | struct cnic_ulp_ops *ulp_ops; | 1112 | struct cnic_ulp_ops *ulp_ops; |
1082 | 1113 | ||
1083 | ulp_ops = rcu_dereference(cp->ulp_ops[if_type]); | 1114 | mutex_lock(&cnic_lock); |
1084 | if (!ulp_ops) | 1115 | ulp_ops = cp->ulp_ops[if_type]; |
1116 | if (!ulp_ops) { | ||
1117 | mutex_unlock(&cnic_lock); | ||
1085 | continue; | 1118 | continue; |
1119 | } | ||
1120 | set_bit(ULP_F_CALL_PENDING, &cp->ulp_flags[if_type]); | ||
1121 | mutex_unlock(&cnic_lock); | ||
1086 | 1122 | ||
1087 | if (test_and_clear_bit(ULP_F_START, &cp->ulp_flags[if_type])) | 1123 | if (test_and_clear_bit(ULP_F_START, &cp->ulp_flags[if_type])) |
1088 | ulp_ops->cnic_stop(cp->ulp_handle[if_type]); | 1124 | ulp_ops->cnic_stop(cp->ulp_handle[if_type]); |
1125 | |||
1126 | clear_bit(ULP_F_CALL_PENDING, &cp->ulp_flags[if_type]); | ||
1089 | } | 1127 | } |
1090 | rcu_read_unlock(); | ||
1091 | } | 1128 | } |
1092 | 1129 | ||
1093 | static void cnic_ulp_start(struct cnic_dev *dev) | 1130 | static void cnic_ulp_start(struct cnic_dev *dev) |
@@ -1095,18 +1132,23 @@ static void cnic_ulp_start(struct cnic_dev *dev) | |||
1095 | struct cnic_local *cp = dev->cnic_priv; | 1132 | struct cnic_local *cp = dev->cnic_priv; |
1096 | int if_type; | 1133 | int if_type; |
1097 | 1134 | ||
1098 | rcu_read_lock(); | ||
1099 | for (if_type = 0; if_type < MAX_CNIC_ULP_TYPE; if_type++) { | 1135 | for (if_type = 0; if_type < MAX_CNIC_ULP_TYPE; if_type++) { |
1100 | struct cnic_ulp_ops *ulp_ops; | 1136 | struct cnic_ulp_ops *ulp_ops; |
1101 | 1137 | ||
1102 | ulp_ops = rcu_dereference(cp->ulp_ops[if_type]); | 1138 | mutex_lock(&cnic_lock); |
1103 | if (!ulp_ops || !ulp_ops->cnic_start) | 1139 | ulp_ops = cp->ulp_ops[if_type]; |
1140 | if (!ulp_ops || !ulp_ops->cnic_start) { | ||
1141 | mutex_unlock(&cnic_lock); | ||
1104 | continue; | 1142 | continue; |
1143 | } | ||
1144 | set_bit(ULP_F_CALL_PENDING, &cp->ulp_flags[if_type]); | ||
1145 | mutex_unlock(&cnic_lock); | ||
1105 | 1146 | ||
1106 | if (!test_and_set_bit(ULP_F_START, &cp->ulp_flags[if_type])) | 1147 | if (!test_and_set_bit(ULP_F_START, &cp->ulp_flags[if_type])) |
1107 | ulp_ops->cnic_start(cp->ulp_handle[if_type]); | 1148 | ulp_ops->cnic_start(cp->ulp_handle[if_type]); |
1149 | |||
1150 | clear_bit(ULP_F_CALL_PENDING, &cp->ulp_flags[if_type]); | ||
1108 | } | 1151 | } |
1109 | rcu_read_unlock(); | ||
1110 | } | 1152 | } |
1111 | 1153 | ||
1112 | static int cnic_ctl(void *data, struct cnic_ctl_info *info) | 1154 | static int cnic_ctl(void *data, struct cnic_ctl_info *info) |
@@ -1116,22 +1158,18 @@ static int cnic_ctl(void *data, struct cnic_ctl_info *info) | |||
1116 | switch (info->cmd) { | 1158 | switch (info->cmd) { |
1117 | case CNIC_CTL_STOP_CMD: | 1159 | case CNIC_CTL_STOP_CMD: |
1118 | cnic_hold(dev); | 1160 | cnic_hold(dev); |
1119 | mutex_lock(&cnic_lock); | ||
1120 | 1161 | ||
1121 | cnic_ulp_stop(dev); | 1162 | cnic_ulp_stop(dev); |
1122 | cnic_stop_hw(dev); | 1163 | cnic_stop_hw(dev); |
1123 | 1164 | ||
1124 | mutex_unlock(&cnic_lock); | ||
1125 | cnic_put(dev); | 1165 | cnic_put(dev); |
1126 | break; | 1166 | break; |
1127 | case CNIC_CTL_START_CMD: | 1167 | case CNIC_CTL_START_CMD: |
1128 | cnic_hold(dev); | 1168 | cnic_hold(dev); |
1129 | mutex_lock(&cnic_lock); | ||
1130 | 1169 | ||
1131 | if (!cnic_start_hw(dev)) | 1170 | if (!cnic_start_hw(dev)) |
1132 | cnic_ulp_start(dev); | 1171 | cnic_ulp_start(dev); |
1133 | 1172 | ||
1134 | mutex_unlock(&cnic_lock); | ||
1135 | cnic_put(dev); | 1173 | cnic_put(dev); |
1136 | break; | 1174 | break; |
1137 | default: | 1175 | default: |
@@ -1145,19 +1183,23 @@ static void cnic_ulp_init(struct cnic_dev *dev) | |||
1145 | int i; | 1183 | int i; |
1146 | struct cnic_local *cp = dev->cnic_priv; | 1184 | struct cnic_local *cp = dev->cnic_priv; |
1147 | 1185 | ||
1148 | rcu_read_lock(); | ||
1149 | for (i = 0; i < MAX_CNIC_ULP_TYPE_EXT; i++) { | 1186 | for (i = 0; i < MAX_CNIC_ULP_TYPE_EXT; i++) { |
1150 | struct cnic_ulp_ops *ulp_ops; | 1187 | struct cnic_ulp_ops *ulp_ops; |
1151 | 1188 | ||
1152 | ulp_ops = rcu_dereference(cnic_ulp_tbl[i]); | 1189 | mutex_lock(&cnic_lock); |
1153 | if (!ulp_ops || !ulp_ops->cnic_init) | 1190 | ulp_ops = cnic_ulp_tbl[i]; |
1191 | if (!ulp_ops || !ulp_ops->cnic_init) { | ||
1192 | mutex_unlock(&cnic_lock); | ||
1154 | continue; | 1193 | continue; |
1194 | } | ||
1195 | ulp_get(ulp_ops); | ||
1196 | mutex_unlock(&cnic_lock); | ||
1155 | 1197 | ||
1156 | if (!test_and_set_bit(ULP_F_INIT, &cp->ulp_flags[i])) | 1198 | if (!test_and_set_bit(ULP_F_INIT, &cp->ulp_flags[i])) |
1157 | ulp_ops->cnic_init(dev); | 1199 | ulp_ops->cnic_init(dev); |
1158 | 1200 | ||
1201 | ulp_put(ulp_ops); | ||
1159 | } | 1202 | } |
1160 | rcu_read_unlock(); | ||
1161 | } | 1203 | } |
1162 | 1204 | ||
1163 | static void cnic_ulp_exit(struct cnic_dev *dev) | 1205 | static void cnic_ulp_exit(struct cnic_dev *dev) |
@@ -1165,19 +1207,23 @@ static void cnic_ulp_exit(struct cnic_dev *dev) | |||
1165 | int i; | 1207 | int i; |
1166 | struct cnic_local *cp = dev->cnic_priv; | 1208 | struct cnic_local *cp = dev->cnic_priv; |
1167 | 1209 | ||
1168 | rcu_read_lock(); | ||
1169 | for (i = 0; i < MAX_CNIC_ULP_TYPE_EXT; i++) { | 1210 | for (i = 0; i < MAX_CNIC_ULP_TYPE_EXT; i++) { |
1170 | struct cnic_ulp_ops *ulp_ops; | 1211 | struct cnic_ulp_ops *ulp_ops; |
1171 | 1212 | ||
1172 | ulp_ops = rcu_dereference(cnic_ulp_tbl[i]); | 1213 | mutex_lock(&cnic_lock); |
1173 | if (!ulp_ops || !ulp_ops->cnic_exit) | 1214 | ulp_ops = cnic_ulp_tbl[i]; |
1215 | if (!ulp_ops || !ulp_ops->cnic_exit) { | ||
1216 | mutex_unlock(&cnic_lock); | ||
1174 | continue; | 1217 | continue; |
1218 | } | ||
1219 | ulp_get(ulp_ops); | ||
1220 | mutex_unlock(&cnic_lock); | ||
1175 | 1221 | ||
1176 | if (test_and_clear_bit(ULP_F_INIT, &cp->ulp_flags[i])) | 1222 | if (test_and_clear_bit(ULP_F_INIT, &cp->ulp_flags[i])) |
1177 | ulp_ops->cnic_exit(dev); | 1223 | ulp_ops->cnic_exit(dev); |
1178 | 1224 | ||
1225 | ulp_put(ulp_ops); | ||
1179 | } | 1226 | } |
1180 | rcu_read_unlock(); | ||
1181 | } | 1227 | } |
1182 | 1228 | ||
1183 | static int cnic_cm_offload_pg(struct cnic_sock *csk) | 1229 | static int cnic_cm_offload_pg(struct cnic_sock *csk) |
@@ -2393,21 +2439,45 @@ static int cnic_start_bnx2_hw(struct cnic_dev *dev) | |||
2393 | return 0; | 2439 | return 0; |
2394 | } | 2440 | } |
2395 | 2441 | ||
2396 | static int cnic_start_hw(struct cnic_dev *dev) | 2442 | static int cnic_register_netdev(struct cnic_dev *dev) |
2397 | { | 2443 | { |
2398 | struct cnic_local *cp = dev->cnic_priv; | 2444 | struct cnic_local *cp = dev->cnic_priv; |
2399 | struct cnic_eth_dev *ethdev = cp->ethdev; | 2445 | struct cnic_eth_dev *ethdev = cp->ethdev; |
2400 | int err; | 2446 | int err; |
2401 | 2447 | ||
2402 | if (test_bit(CNIC_F_CNIC_UP, &dev->flags)) | 2448 | if (!ethdev) |
2403 | return -EALREADY; | 2449 | return -ENODEV; |
2450 | |||
2451 | if (ethdev->drv_state & CNIC_DRV_STATE_REGD) | ||
2452 | return 0; | ||
2404 | 2453 | ||
2405 | err = ethdev->drv_register_cnic(dev->netdev, cp->cnic_ops, dev); | 2454 | err = ethdev->drv_register_cnic(dev->netdev, cp->cnic_ops, dev); |
2406 | if (err) { | 2455 | if (err) |
2407 | printk(KERN_ERR PFX "%s: register_cnic failed\n", | 2456 | printk(KERN_ERR PFX "%s: register_cnic failed\n", |
2408 | dev->netdev->name); | 2457 | dev->netdev->name); |
2409 | goto err2; | 2458 | |
2410 | } | 2459 | return err; |
2460 | } | ||
2461 | |||
2462 | static void cnic_unregister_netdev(struct cnic_dev *dev) | ||
2463 | { | ||
2464 | struct cnic_local *cp = dev->cnic_priv; | ||
2465 | struct cnic_eth_dev *ethdev = cp->ethdev; | ||
2466 | |||
2467 | if (!ethdev) | ||
2468 | return; | ||
2469 | |||
2470 | ethdev->drv_unregister_cnic(dev->netdev); | ||
2471 | } | ||
2472 | |||
2473 | static int cnic_start_hw(struct cnic_dev *dev) | ||
2474 | { | ||
2475 | struct cnic_local *cp = dev->cnic_priv; | ||
2476 | struct cnic_eth_dev *ethdev = cp->ethdev; | ||
2477 | int err; | ||
2478 | |||
2479 | if (test_bit(CNIC_F_CNIC_UP, &dev->flags)) | ||
2480 | return -EALREADY; | ||
2411 | 2481 | ||
2412 | dev->regview = ethdev->io_base; | 2482 | dev->regview = ethdev->io_base; |
2413 | cp->chip_id = ethdev->chip_id; | 2483 | cp->chip_id = ethdev->chip_id; |
@@ -2438,18 +2508,13 @@ static int cnic_start_hw(struct cnic_dev *dev) | |||
2438 | return 0; | 2508 | return 0; |
2439 | 2509 | ||
2440 | err1: | 2510 | err1: |
2441 | ethdev->drv_unregister_cnic(dev->netdev); | ||
2442 | cp->free_resc(dev); | 2511 | cp->free_resc(dev); |
2443 | pci_dev_put(dev->pcidev); | 2512 | pci_dev_put(dev->pcidev); |
2444 | err2: | ||
2445 | return err; | 2513 | return err; |
2446 | } | 2514 | } |
2447 | 2515 | ||
2448 | static void cnic_stop_bnx2_hw(struct cnic_dev *dev) | 2516 | static void cnic_stop_bnx2_hw(struct cnic_dev *dev) |
2449 | { | 2517 | { |
2450 | struct cnic_local *cp = dev->cnic_priv; | ||
2451 | struct cnic_eth_dev *ethdev = cp->ethdev; | ||
2452 | |||
2453 | cnic_disable_bnx2_int_sync(dev); | 2518 | cnic_disable_bnx2_int_sync(dev); |
2454 | 2519 | ||
2455 | cnic_reg_wr_ind(dev, BNX2_CP_SCRATCH + 0x20, 0); | 2520 | cnic_reg_wr_ind(dev, BNX2_CP_SCRATCH + 0x20, 0); |
@@ -2461,8 +2526,6 @@ static void cnic_stop_bnx2_hw(struct cnic_dev *dev) | |||
2461 | cnic_setup_5709_context(dev, 0); | 2526 | cnic_setup_5709_context(dev, 0); |
2462 | cnic_free_irq(dev); | 2527 | cnic_free_irq(dev); |
2463 | 2528 | ||
2464 | ethdev->drv_unregister_cnic(dev->netdev); | ||
2465 | |||
2466 | cnic_free_resc(dev); | 2529 | cnic_free_resc(dev); |
2467 | } | 2530 | } |
2468 | 2531 | ||
@@ -2543,7 +2606,7 @@ static struct cnic_dev *init_bnx2_cnic(struct net_device *dev) | |||
2543 | probe = symbol_get(bnx2_cnic_probe); | 2606 | probe = symbol_get(bnx2_cnic_probe); |
2544 | if (probe) { | 2607 | if (probe) { |
2545 | ethdev = (*probe)(dev); | 2608 | ethdev = (*probe)(dev); |
2546 | symbol_put_addr(probe); | 2609 | symbol_put(bnx2_cnic_probe); |
2547 | } | 2610 | } |
2548 | if (!ethdev) | 2611 | if (!ethdev) |
2549 | return NULL; | 2612 | return NULL; |
@@ -2646,10 +2709,12 @@ static int cnic_netdev_event(struct notifier_block *this, unsigned long event, | |||
2646 | else if (event == NETDEV_UNREGISTER) | 2709 | else if (event == NETDEV_UNREGISTER) |
2647 | cnic_ulp_exit(dev); | 2710 | cnic_ulp_exit(dev); |
2648 | else if (event == NETDEV_UP) { | 2711 | else if (event == NETDEV_UP) { |
2649 | mutex_lock(&cnic_lock); | 2712 | if (cnic_register_netdev(dev) != 0) { |
2713 | cnic_put(dev); | ||
2714 | goto done; | ||
2715 | } | ||
2650 | if (!cnic_start_hw(dev)) | 2716 | if (!cnic_start_hw(dev)) |
2651 | cnic_ulp_start(dev); | 2717 | cnic_ulp_start(dev); |
2652 | mutex_unlock(&cnic_lock); | ||
2653 | } | 2718 | } |
2654 | 2719 | ||
2655 | rcu_read_lock(); | 2720 | rcu_read_lock(); |
@@ -2668,10 +2733,9 @@ static int cnic_netdev_event(struct notifier_block *this, unsigned long event, | |||
2668 | rcu_read_unlock(); | 2733 | rcu_read_unlock(); |
2669 | 2734 | ||
2670 | if (event == NETDEV_GOING_DOWN) { | 2735 | if (event == NETDEV_GOING_DOWN) { |
2671 | mutex_lock(&cnic_lock); | ||
2672 | cnic_ulp_stop(dev); | 2736 | cnic_ulp_stop(dev); |
2673 | cnic_stop_hw(dev); | 2737 | cnic_stop_hw(dev); |
2674 | mutex_unlock(&cnic_lock); | 2738 | cnic_unregister_netdev(dev); |
2675 | } else if (event == NETDEV_UNREGISTER) { | 2739 | } else if (event == NETDEV_UNREGISTER) { |
2676 | write_lock(&cnic_dev_lock); | 2740 | write_lock(&cnic_dev_lock); |
2677 | list_del_init(&dev->list); | 2741 | list_del_init(&dev->list); |
@@ -2703,6 +2767,7 @@ static void cnic_release(void) | |||
2703 | } | 2767 | } |
2704 | 2768 | ||
2705 | cnic_ulp_exit(dev); | 2769 | cnic_ulp_exit(dev); |
2770 | cnic_unregister_netdev(dev); | ||
2706 | list_del_init(&dev->list); | 2771 | list_del_init(&dev->list); |
2707 | cnic_free_dev(dev); | 2772 | cnic_free_dev(dev); |
2708 | } | 2773 | } |
diff --git a/drivers/net/cnic.h b/drivers/net/cnic.h index 5192d4a9df5..a94b302bb46 100644 --- a/drivers/net/cnic.h +++ b/drivers/net/cnic.h | |||
@@ -176,6 +176,7 @@ struct cnic_local { | |||
176 | unsigned long ulp_flags[MAX_CNIC_ULP_TYPE]; | 176 | unsigned long ulp_flags[MAX_CNIC_ULP_TYPE]; |
177 | #define ULP_F_INIT 0 | 177 | #define ULP_F_INIT 0 |
178 | #define ULP_F_START 1 | 178 | #define ULP_F_START 1 |
179 | #define ULP_F_CALL_PENDING 2 | ||
179 | struct cnic_ulp_ops *ulp_ops[MAX_CNIC_ULP_TYPE]; | 180 | struct cnic_ulp_ops *ulp_ops[MAX_CNIC_ULP_TYPE]; |
180 | 181 | ||
181 | /* protected by ulp_lock */ | 182 | /* protected by ulp_lock */ |
diff --git a/drivers/net/cnic_if.h b/drivers/net/cnic_if.h index d1bce27ee99..a49235739ee 100644 --- a/drivers/net/cnic_if.h +++ b/drivers/net/cnic_if.h | |||
@@ -290,6 +290,7 @@ struct cnic_ulp_ops { | |||
290 | void (*iscsi_nl_send_msg)(struct cnic_dev *dev, u32 msg_type, | 290 | void (*iscsi_nl_send_msg)(struct cnic_dev *dev, u32 msg_type, |
291 | char *data, u16 data_size); | 291 | char *data, u16 data_size); |
292 | struct module *owner; | 292 | struct module *owner; |
293 | atomic_t ref_count; | ||
293 | }; | 294 | }; |
294 | 295 | ||
295 | extern int cnic_register_driver(int ulp_type, struct cnic_ulp_ops *ulp_ops); | 296 | extern int cnic_register_driver(int ulp_type, struct cnic_ulp_ops *ulp_ops); |
diff --git a/drivers/net/e1000e/ich8lan.c b/drivers/net/e1000e/ich8lan.c index d56c7473144..99df2abf82a 100644 --- a/drivers/net/e1000e/ich8lan.c +++ b/drivers/net/e1000e/ich8lan.c | |||
@@ -338,10 +338,7 @@ static s32 e1000_init_nvm_params_ich8lan(struct e1000_hw *hw) | |||
338 | { | 338 | { |
339 | struct e1000_nvm_info *nvm = &hw->nvm; | 339 | struct e1000_nvm_info *nvm = &hw->nvm; |
340 | struct e1000_dev_spec_ich8lan *dev_spec = &hw->dev_spec.ich8lan; | 340 | struct e1000_dev_spec_ich8lan *dev_spec = &hw->dev_spec.ich8lan; |
341 | union ich8_hws_flash_status hsfsts; | 341 | u32 gfpreg, sector_base_addr, sector_end_addr; |
342 | u32 gfpreg; | ||
343 | u32 sector_base_addr; | ||
344 | u32 sector_end_addr; | ||
345 | u16 i; | 342 | u16 i; |
346 | 343 | ||
347 | /* Can't read flash registers if the register set isn't mapped. */ | 344 | /* Can't read flash registers if the register set isn't mapped. */ |
@@ -375,20 +372,6 @@ static s32 e1000_init_nvm_params_ich8lan(struct e1000_hw *hw) | |||
375 | /* Adjust to word count */ | 372 | /* Adjust to word count */ |
376 | nvm->flash_bank_size /= sizeof(u16); | 373 | nvm->flash_bank_size /= sizeof(u16); |
377 | 374 | ||
378 | /* | ||
379 | * Make sure the flash bank size does not overwrite the 4k | ||
380 | * sector ranges. We may have 64k allotted to us but we only care | ||
381 | * about the first 2 4k sectors. Therefore, if we have anything less | ||
382 | * than 64k set in the HSFSTS register, we will reduce the bank size | ||
383 | * down to 4k and let the rest remain unused. If berasesz == 3, then | ||
384 | * we are working in 64k mode. Otherwise we are not. | ||
385 | */ | ||
386 | if (nvm->flash_bank_size > E1000_ICH8_SHADOW_RAM_WORDS) { | ||
387 | hsfsts.regval = er16flash(ICH_FLASH_HSFSTS); | ||
388 | if (hsfsts.hsf_status.berasesz != 3) | ||
389 | nvm->flash_bank_size = E1000_ICH8_SHADOW_RAM_WORDS; | ||
390 | } | ||
391 | |||
392 | nvm->word_size = E1000_ICH8_SHADOW_RAM_WORDS; | 375 | nvm->word_size = E1000_ICH8_SHADOW_RAM_WORDS; |
393 | 376 | ||
394 | /* Clear shadow ram */ | 377 | /* Clear shadow ram */ |
@@ -594,8 +577,8 @@ static DEFINE_MUTEX(nvm_mutex); | |||
594 | **/ | 577 | **/ |
595 | static s32 e1000_acquire_swflag_ich8lan(struct e1000_hw *hw) | 578 | static s32 e1000_acquire_swflag_ich8lan(struct e1000_hw *hw) |
596 | { | 579 | { |
597 | u32 extcnf_ctrl; | 580 | u32 extcnf_ctrl, timeout = PHY_CFG_TIMEOUT; |
598 | u32 timeout = PHY_CFG_TIMEOUT; | 581 | s32 ret_val = 0; |
599 | 582 | ||
600 | might_sleep(); | 583 | might_sleep(); |
601 | 584 | ||
@@ -603,28 +586,46 @@ static s32 e1000_acquire_swflag_ich8lan(struct e1000_hw *hw) | |||
603 | 586 | ||
604 | while (timeout) { | 587 | while (timeout) { |
605 | extcnf_ctrl = er32(EXTCNF_CTRL); | 588 | extcnf_ctrl = er32(EXTCNF_CTRL); |
589 | if (!(extcnf_ctrl & E1000_EXTCNF_CTRL_SWFLAG)) | ||
590 | break; | ||
606 | 591 | ||
607 | if (!(extcnf_ctrl & E1000_EXTCNF_CTRL_SWFLAG)) { | 592 | mdelay(1); |
608 | extcnf_ctrl |= E1000_EXTCNF_CTRL_SWFLAG; | 593 | timeout--; |
609 | ew32(EXTCNF_CTRL, extcnf_ctrl); | 594 | } |
595 | |||
596 | if (!timeout) { | ||
597 | hw_dbg(hw, "SW/FW/HW has locked the resource for too long.\n"); | ||
598 | ret_val = -E1000_ERR_CONFIG; | ||
599 | goto out; | ||
600 | } | ||
601 | |||
602 | timeout = PHY_CFG_TIMEOUT * 2; | ||
603 | |||
604 | extcnf_ctrl |= E1000_EXTCNF_CTRL_SWFLAG; | ||
605 | ew32(EXTCNF_CTRL, extcnf_ctrl); | ||
606 | |||
607 | while (timeout) { | ||
608 | extcnf_ctrl = er32(EXTCNF_CTRL); | ||
609 | if (extcnf_ctrl & E1000_EXTCNF_CTRL_SWFLAG) | ||
610 | break; | ||
610 | 611 | ||
611 | extcnf_ctrl = er32(EXTCNF_CTRL); | ||
612 | if (extcnf_ctrl & E1000_EXTCNF_CTRL_SWFLAG) | ||
613 | break; | ||
614 | } | ||
615 | mdelay(1); | 612 | mdelay(1); |
616 | timeout--; | 613 | timeout--; |
617 | } | 614 | } |
618 | 615 | ||
619 | if (!timeout) { | 616 | if (!timeout) { |
620 | hw_dbg(hw, "FW or HW has locked the resource for too long.\n"); | 617 | hw_dbg(hw, "Failed to acquire the semaphore.\n"); |
621 | extcnf_ctrl &= ~E1000_EXTCNF_CTRL_SWFLAG; | 618 | extcnf_ctrl &= ~E1000_EXTCNF_CTRL_SWFLAG; |
622 | ew32(EXTCNF_CTRL, extcnf_ctrl); | 619 | ew32(EXTCNF_CTRL, extcnf_ctrl); |
623 | mutex_unlock(&nvm_mutex); | 620 | ret_val = -E1000_ERR_CONFIG; |
624 | return -E1000_ERR_CONFIG; | 621 | goto out; |
625 | } | 622 | } |
626 | 623 | ||
627 | return 0; | 624 | out: |
625 | if (ret_val) | ||
626 | mutex_unlock(&nvm_mutex); | ||
627 | |||
628 | return ret_val; | ||
628 | } | 629 | } |
629 | 630 | ||
630 | /** | 631 | /** |
@@ -1306,7 +1307,7 @@ static s32 e1000_read_nvm_ich8lan(struct e1000_hw *hw, u16 offset, u16 words, | |||
1306 | struct e1000_nvm_info *nvm = &hw->nvm; | 1307 | struct e1000_nvm_info *nvm = &hw->nvm; |
1307 | struct e1000_dev_spec_ich8lan *dev_spec = &hw->dev_spec.ich8lan; | 1308 | struct e1000_dev_spec_ich8lan *dev_spec = &hw->dev_spec.ich8lan; |
1308 | u32 act_offset; | 1309 | u32 act_offset; |
1309 | s32 ret_val; | 1310 | s32 ret_val = 0; |
1310 | u32 bank = 0; | 1311 | u32 bank = 0; |
1311 | u16 i, word; | 1312 | u16 i, word; |
1312 | 1313 | ||
@@ -1321,12 +1322,15 @@ static s32 e1000_read_nvm_ich8lan(struct e1000_hw *hw, u16 offset, u16 words, | |||
1321 | goto out; | 1322 | goto out; |
1322 | 1323 | ||
1323 | ret_val = e1000_valid_nvm_bank_detect_ich8lan(hw, &bank); | 1324 | ret_val = e1000_valid_nvm_bank_detect_ich8lan(hw, &bank); |
1324 | if (ret_val) | 1325 | if (ret_val) { |
1325 | goto release; | 1326 | hw_dbg(hw, "Could not detect valid bank, assuming bank 0\n"); |
1327 | bank = 0; | ||
1328 | } | ||
1326 | 1329 | ||
1327 | act_offset = (bank) ? nvm->flash_bank_size : 0; | 1330 | act_offset = (bank) ? nvm->flash_bank_size : 0; |
1328 | act_offset += offset; | 1331 | act_offset += offset; |
1329 | 1332 | ||
1333 | ret_val = 0; | ||
1330 | for (i = 0; i < words; i++) { | 1334 | for (i = 0; i < words; i++) { |
1331 | if ((dev_spec->shadow_ram) && | 1335 | if ((dev_spec->shadow_ram) && |
1332 | (dev_spec->shadow_ram[offset+i].modified)) { | 1336 | (dev_spec->shadow_ram[offset+i].modified)) { |
@@ -1341,7 +1345,6 @@ static s32 e1000_read_nvm_ich8lan(struct e1000_hw *hw, u16 offset, u16 words, | |||
1341 | } | 1345 | } |
1342 | } | 1346 | } |
1343 | 1347 | ||
1344 | release: | ||
1345 | e1000_release_swflag_ich8lan(hw); | 1348 | e1000_release_swflag_ich8lan(hw); |
1346 | 1349 | ||
1347 | out: | 1350 | out: |
@@ -1592,7 +1595,6 @@ static s32 e1000_write_nvm_ich8lan(struct e1000_hw *hw, u16 offset, u16 words, | |||
1592 | { | 1595 | { |
1593 | struct e1000_nvm_info *nvm = &hw->nvm; | 1596 | struct e1000_nvm_info *nvm = &hw->nvm; |
1594 | struct e1000_dev_spec_ich8lan *dev_spec = &hw->dev_spec.ich8lan; | 1597 | struct e1000_dev_spec_ich8lan *dev_spec = &hw->dev_spec.ich8lan; |
1595 | s32 ret_val; | ||
1596 | u16 i; | 1598 | u16 i; |
1597 | 1599 | ||
1598 | if ((offset >= nvm->word_size) || (words > nvm->word_size - offset) || | 1600 | if ((offset >= nvm->word_size) || (words > nvm->word_size - offset) || |
@@ -1601,17 +1603,11 @@ static s32 e1000_write_nvm_ich8lan(struct e1000_hw *hw, u16 offset, u16 words, | |||
1601 | return -E1000_ERR_NVM; | 1603 | return -E1000_ERR_NVM; |
1602 | } | 1604 | } |
1603 | 1605 | ||
1604 | ret_val = e1000_acquire_swflag_ich8lan(hw); | ||
1605 | if (ret_val) | ||
1606 | return ret_val; | ||
1607 | |||
1608 | for (i = 0; i < words; i++) { | 1606 | for (i = 0; i < words; i++) { |
1609 | dev_spec->shadow_ram[offset+i].modified = 1; | 1607 | dev_spec->shadow_ram[offset+i].modified = 1; |
1610 | dev_spec->shadow_ram[offset+i].value = data[i]; | 1608 | dev_spec->shadow_ram[offset+i].value = data[i]; |
1611 | } | 1609 | } |
1612 | 1610 | ||
1613 | e1000_release_swflag_ich8lan(hw); | ||
1614 | |||
1615 | return 0; | 1611 | return 0; |
1616 | } | 1612 | } |
1617 | 1613 | ||
@@ -1652,8 +1648,8 @@ static s32 e1000_update_nvm_checksum_ich8lan(struct e1000_hw *hw) | |||
1652 | */ | 1648 | */ |
1653 | ret_val = e1000_valid_nvm_bank_detect_ich8lan(hw, &bank); | 1649 | ret_val = e1000_valid_nvm_bank_detect_ich8lan(hw, &bank); |
1654 | if (ret_val) { | 1650 | if (ret_val) { |
1655 | e1000_release_swflag_ich8lan(hw); | 1651 | hw_dbg(hw, "Could not detect valid bank, assuming bank 0\n"); |
1656 | goto out; | 1652 | bank = 0; |
1657 | } | 1653 | } |
1658 | 1654 | ||
1659 | if (bank == 0) { | 1655 | if (bank == 0) { |
@@ -2039,12 +2035,8 @@ static s32 e1000_erase_flash_bank_ich8lan(struct e1000_hw *hw, u32 bank) | |||
2039 | iteration = 1; | 2035 | iteration = 1; |
2040 | break; | 2036 | break; |
2041 | case 2: | 2037 | case 2: |
2042 | if (hw->mac.type == e1000_ich9lan) { | 2038 | sector_size = ICH_FLASH_SEG_SIZE_8K; |
2043 | sector_size = ICH_FLASH_SEG_SIZE_8K; | 2039 | iteration = 1; |
2044 | iteration = flash_bank_size / ICH_FLASH_SEG_SIZE_8K; | ||
2045 | } else { | ||
2046 | return -E1000_ERR_NVM; | ||
2047 | } | ||
2048 | break; | 2040 | break; |
2049 | case 3: | 2041 | case 3: |
2050 | sector_size = ICH_FLASH_SEG_SIZE_64K; | 2042 | sector_size = ICH_FLASH_SEG_SIZE_64K; |
@@ -2056,7 +2048,7 @@ static s32 e1000_erase_flash_bank_ich8lan(struct e1000_hw *hw, u32 bank) | |||
2056 | 2048 | ||
2057 | /* Start with the base address, then add the sector offset. */ | 2049 | /* Start with the base address, then add the sector offset. */ |
2058 | flash_linear_addr = hw->nvm.flash_base_addr; | 2050 | flash_linear_addr = hw->nvm.flash_base_addr; |
2059 | flash_linear_addr += (bank) ? (sector_size * iteration) : 0; | 2051 | flash_linear_addr += (bank) ? flash_bank_size : 0; |
2060 | 2052 | ||
2061 | for (j = 0; j < iteration ; j++) { | 2053 | for (j = 0; j < iteration ; j++) { |
2062 | do { | 2054 | do { |
diff --git a/drivers/net/e1000e/netdev.c b/drivers/net/e1000e/netdev.c index 63415bb6f48..fa92a683aef 100644 --- a/drivers/net/e1000e/netdev.c +++ b/drivers/net/e1000e/netdev.c | |||
@@ -4538,8 +4538,7 @@ static int __e1000_shutdown(struct pci_dev *pdev, bool *enable_wake) | |||
4538 | /* Allow time for pending master requests to run */ | 4538 | /* Allow time for pending master requests to run */ |
4539 | e1000e_disable_pcie_master(&adapter->hw); | 4539 | e1000e_disable_pcie_master(&adapter->hw); |
4540 | 4540 | ||
4541 | if ((adapter->flags2 & FLAG2_HAS_PHY_WAKEUP) && | 4541 | if (adapter->flags2 & FLAG2_HAS_PHY_WAKEUP) { |
4542 | !(hw->mac.ops.check_mng_mode(hw))) { | ||
4543 | /* enable wakeup by the PHY */ | 4542 | /* enable wakeup by the PHY */ |
4544 | retval = e1000_init_phy_wakeup(adapter, wufc); | 4543 | retval = e1000_init_phy_wakeup(adapter, wufc); |
4545 | if (retval) | 4544 | if (retval) |
@@ -4557,7 +4556,8 @@ static int __e1000_shutdown(struct pci_dev *pdev, bool *enable_wake) | |||
4557 | *enable_wake = !!wufc; | 4556 | *enable_wake = !!wufc; |
4558 | 4557 | ||
4559 | /* make sure adapter isn't asleep if manageability is enabled */ | 4558 | /* make sure adapter isn't asleep if manageability is enabled */ |
4560 | if (adapter->flags & FLAG_MNG_PT_ENABLED) | 4559 | if ((adapter->flags & FLAG_MNG_PT_ENABLED) || |
4560 | (hw->mac.ops.check_mng_mode(hw))) | ||
4561 | *enable_wake = true; | 4561 | *enable_wake = true; |
4562 | 4562 | ||
4563 | if (adapter->hw.phy.type == e1000_phy_igp_3) | 4563 | if (adapter->hw.phy.type == e1000_phy_igp_3) |
@@ -4670,14 +4670,6 @@ static int e1000_resume(struct pci_dev *pdev) | |||
4670 | return err; | 4670 | return err; |
4671 | } | 4671 | } |
4672 | 4672 | ||
4673 | /* AER (Advanced Error Reporting) hooks */ | ||
4674 | err = pci_enable_pcie_error_reporting(pdev); | ||
4675 | if (err) { | ||
4676 | dev_err(&pdev->dev, "pci_enable_pcie_error_reporting failed " | ||
4677 | "0x%x\n", err); | ||
4678 | /* non-fatal, continue */ | ||
4679 | } | ||
4680 | |||
4681 | pci_set_master(pdev); | 4673 | pci_set_master(pdev); |
4682 | 4674 | ||
4683 | pci_enable_wake(pdev, PCI_D3hot, 0); | 4675 | pci_enable_wake(pdev, PCI_D3hot, 0); |
@@ -4990,6 +4982,14 @@ static int __devinit e1000_probe(struct pci_dev *pdev, | |||
4990 | if (err) | 4982 | if (err) |
4991 | goto err_pci_reg; | 4983 | goto err_pci_reg; |
4992 | 4984 | ||
4985 | /* AER (Advanced Error Reporting) hooks */ | ||
4986 | err = pci_enable_pcie_error_reporting(pdev); | ||
4987 | if (err) { | ||
4988 | dev_err(&pdev->dev, "pci_enable_pcie_error_reporting failed " | ||
4989 | "0x%x\n", err); | ||
4990 | /* non-fatal, continue */ | ||
4991 | } | ||
4992 | |||
4993 | pci_set_master(pdev); | 4993 | pci_set_master(pdev); |
4994 | /* PCI config space info */ | 4994 | /* PCI config space info */ |
4995 | err = pci_save_state(pdev); | 4995 | err = pci_save_state(pdev); |
diff --git a/drivers/net/fec.c b/drivers/net/fec.c index d4b98074b1b..c9fd82d3a80 100644 --- a/drivers/net/fec.c +++ b/drivers/net/fec.c | |||
@@ -285,6 +285,7 @@ fec_enet_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
285 | { | 285 | { |
286 | struct fec_enet_private *fep = netdev_priv(dev); | 286 | struct fec_enet_private *fep = netdev_priv(dev); |
287 | struct bufdesc *bdp; | 287 | struct bufdesc *bdp; |
288 | void *bufaddr; | ||
288 | unsigned short status; | 289 | unsigned short status; |
289 | unsigned long flags; | 290 | unsigned long flags; |
290 | 291 | ||
@@ -312,7 +313,7 @@ fec_enet_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
312 | status &= ~BD_ENET_TX_STATS; | 313 | status &= ~BD_ENET_TX_STATS; |
313 | 314 | ||
314 | /* Set buffer length and buffer pointer */ | 315 | /* Set buffer length and buffer pointer */ |
315 | bdp->cbd_bufaddr = __pa(skb->data); | 316 | bufaddr = skb->data; |
316 | bdp->cbd_datlen = skb->len; | 317 | bdp->cbd_datlen = skb->len; |
317 | 318 | ||
318 | /* | 319 | /* |
@@ -320,11 +321,11 @@ fec_enet_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
320 | * 4-byte boundaries. Use bounce buffers to copy data | 321 | * 4-byte boundaries. Use bounce buffers to copy data |
321 | * and get it aligned. Ugh. | 322 | * and get it aligned. Ugh. |
322 | */ | 323 | */ |
323 | if (bdp->cbd_bufaddr & FEC_ALIGNMENT) { | 324 | if (((unsigned long) bufaddr) & FEC_ALIGNMENT) { |
324 | unsigned int index; | 325 | unsigned int index; |
325 | index = bdp - fep->tx_bd_base; | 326 | index = bdp - fep->tx_bd_base; |
326 | memcpy(fep->tx_bounce[index], (void *)skb->data, skb->len); | 327 | memcpy(fep->tx_bounce[index], (void *)skb->data, skb->len); |
327 | bdp->cbd_bufaddr = __pa(fep->tx_bounce[index]); | 328 | bufaddr = fep->tx_bounce[index]; |
328 | } | 329 | } |
329 | 330 | ||
330 | /* Save skb pointer */ | 331 | /* Save skb pointer */ |
@@ -336,7 +337,7 @@ fec_enet_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
336 | /* Push the data cache so the CPM does not get stale memory | 337 | /* Push the data cache so the CPM does not get stale memory |
337 | * data. | 338 | * data. |
338 | */ | 339 | */ |
339 | bdp->cbd_bufaddr = dma_map_single(&dev->dev, skb->data, | 340 | bdp->cbd_bufaddr = dma_map_single(&dev->dev, bufaddr, |
340 | FEC_ENET_TX_FRSIZE, DMA_TO_DEVICE); | 341 | FEC_ENET_TX_FRSIZE, DMA_TO_DEVICE); |
341 | 342 | ||
342 | /* Send it on its way. Tell FEC it's ready, interrupt when done, | 343 | /* Send it on its way. Tell FEC it's ready, interrupt when done, |
diff --git a/drivers/net/gianfar.c b/drivers/net/gianfar.c index f8ffcbf0bc3..e212f2c5448 100644 --- a/drivers/net/gianfar.c +++ b/drivers/net/gianfar.c | |||
@@ -936,6 +936,7 @@ int startup_gfar(struct net_device *dev) | |||
936 | struct gfar __iomem *regs = priv->regs; | 936 | struct gfar __iomem *regs = priv->regs; |
937 | int err = 0; | 937 | int err = 0; |
938 | u32 rctrl = 0; | 938 | u32 rctrl = 0; |
939 | u32 tctrl = 0; | ||
939 | u32 attrs = 0; | 940 | u32 attrs = 0; |
940 | 941 | ||
941 | gfar_write(®s->imask, IMASK_INIT_CLEAR); | 942 | gfar_write(®s->imask, IMASK_INIT_CLEAR); |
@@ -1111,11 +1112,19 @@ int startup_gfar(struct net_device *dev) | |||
1111 | rctrl |= RCTRL_PADDING(priv->padding); | 1112 | rctrl |= RCTRL_PADDING(priv->padding); |
1112 | } | 1113 | } |
1113 | 1114 | ||
1115 | /* keep vlan related bits if it's enabled */ | ||
1116 | if (priv->vlgrp) { | ||
1117 | rctrl |= RCTRL_VLEX | RCTRL_PRSDEP_INIT; | ||
1118 | tctrl |= TCTRL_VLINS; | ||
1119 | } | ||
1120 | |||
1114 | /* Init rctrl based on our settings */ | 1121 | /* Init rctrl based on our settings */ |
1115 | gfar_write(&priv->regs->rctrl, rctrl); | 1122 | gfar_write(&priv->regs->rctrl, rctrl); |
1116 | 1123 | ||
1117 | if (dev->features & NETIF_F_IP_CSUM) | 1124 | if (dev->features & NETIF_F_IP_CSUM) |
1118 | gfar_write(&priv->regs->tctrl, TCTRL_INIT_CSUM); | 1125 | tctrl |= TCTRL_INIT_CSUM; |
1126 | |||
1127 | gfar_write(&priv->regs->tctrl, tctrl); | ||
1119 | 1128 | ||
1120 | /* Set the extraction length and index */ | 1129 | /* Set the extraction length and index */ |
1121 | attrs = ATTRELI_EL(priv->rx_stash_size) | | 1130 | attrs = ATTRELI_EL(priv->rx_stash_size) | |
@@ -1450,7 +1459,6 @@ static void gfar_vlan_rx_register(struct net_device *dev, | |||
1450 | 1459 | ||
1451 | /* Enable VLAN tag extraction */ | 1460 | /* Enable VLAN tag extraction */ |
1452 | tempval = gfar_read(&priv->regs->rctrl); | 1461 | tempval = gfar_read(&priv->regs->rctrl); |
1453 | tempval |= RCTRL_VLEX; | ||
1454 | tempval |= (RCTRL_VLEX | RCTRL_PRSDEP_INIT); | 1462 | tempval |= (RCTRL_VLEX | RCTRL_PRSDEP_INIT); |
1455 | gfar_write(&priv->regs->rctrl, tempval); | 1463 | gfar_write(&priv->regs->rctrl, tempval); |
1456 | } else { | 1464 | } else { |
diff --git a/drivers/net/irda/w83977af_ir.c b/drivers/net/irda/w83977af_ir.c index d0883835b0c..fe4f2b2bff9 100644 --- a/drivers/net/irda/w83977af_ir.c +++ b/drivers/net/irda/w83977af_ir.c | |||
@@ -115,7 +115,7 @@ static int __init w83977af_init(void) | |||
115 | 115 | ||
116 | IRDA_DEBUG(0, "%s()\n", __func__ ); | 116 | IRDA_DEBUG(0, "%s()\n", __func__ ); |
117 | 117 | ||
118 | for (i=0; (io[i] < 2000) && (i < ARRAY_SIZE(dev_self)); i++) { | 118 | for (i=0; i < ARRAY_SIZE(dev_self) && io[i] < 2000; i++) { |
119 | if (w83977af_open(i, io[i], irq[i], dma[i]) == 0) | 119 | if (w83977af_open(i, io[i], irq[i], dma[i]) == 0) |
120 | return 0; | 120 | return 0; |
121 | } | 121 | } |
diff --git a/drivers/net/ixgbe/ixgbe.h b/drivers/net/ixgbe/ixgbe.h index e11d83d5852..2c4dc8221dc 100644 --- a/drivers/net/ixgbe/ixgbe.h +++ b/drivers/net/ixgbe/ixgbe.h | |||
@@ -136,6 +136,8 @@ struct ixgbe_ring { | |||
136 | 136 | ||
137 | u8 queue_index; /* needed for multiqueue queue management */ | 137 | u8 queue_index; /* needed for multiqueue queue management */ |
138 | 138 | ||
139 | #define IXGBE_RING_RX_PS_ENABLED (u8)(1) | ||
140 | u8 flags; /* per ring feature flags */ | ||
139 | u16 head; | 141 | u16 head; |
140 | u16 tail; | 142 | u16 tail; |
141 | 143 | ||
diff --git a/drivers/net/ixgbe/ixgbe_ethtool.c b/drivers/net/ixgbe/ixgbe_ethtool.c index 79144e950a3..dff8dfac7ed 100644 --- a/drivers/net/ixgbe/ixgbe_ethtool.c +++ b/drivers/net/ixgbe/ixgbe_ethtool.c | |||
@@ -1948,6 +1948,7 @@ static int ixgbe_set_coalesce(struct net_device *netdev, | |||
1948 | struct ethtool_coalesce *ec) | 1948 | struct ethtool_coalesce *ec) |
1949 | { | 1949 | { |
1950 | struct ixgbe_adapter *adapter = netdev_priv(netdev); | 1950 | struct ixgbe_adapter *adapter = netdev_priv(netdev); |
1951 | struct ixgbe_q_vector *q_vector; | ||
1951 | int i; | 1952 | int i; |
1952 | 1953 | ||
1953 | if (ec->tx_max_coalesced_frames_irq) | 1954 | if (ec->tx_max_coalesced_frames_irq) |
@@ -1982,14 +1983,24 @@ static int ixgbe_set_coalesce(struct net_device *netdev, | |||
1982 | adapter->itr_setting = 0; | 1983 | adapter->itr_setting = 0; |
1983 | } | 1984 | } |
1984 | 1985 | ||
1985 | for (i = 0; i < adapter->num_msix_vectors - NON_Q_VECTORS; i++) { | 1986 | /* MSI/MSIx Interrupt Mode */ |
1986 | struct ixgbe_q_vector *q_vector = adapter->q_vector[i]; | 1987 | if (adapter->flags & |
1987 | if (q_vector->txr_count && !q_vector->rxr_count) | 1988 | (IXGBE_FLAG_MSIX_ENABLED | IXGBE_FLAG_MSI_ENABLED)) { |
1988 | /* tx vector gets half the rate */ | 1989 | int num_vectors = adapter->num_msix_vectors - NON_Q_VECTORS; |
1989 | q_vector->eitr = (adapter->eitr_param >> 1); | 1990 | for (i = 0; i < num_vectors; i++) { |
1990 | else | 1991 | q_vector = adapter->q_vector[i]; |
1991 | /* rx only or mixed */ | 1992 | if (q_vector->txr_count && !q_vector->rxr_count) |
1992 | q_vector->eitr = adapter->eitr_param; | 1993 | /* tx vector gets half the rate */ |
1994 | q_vector->eitr = (adapter->eitr_param >> 1); | ||
1995 | else | ||
1996 | /* rx only or mixed */ | ||
1997 | q_vector->eitr = adapter->eitr_param; | ||
1998 | ixgbe_write_eitr(q_vector); | ||
1999 | } | ||
2000 | /* Legacy Interrupt Mode */ | ||
2001 | } else { | ||
2002 | q_vector = adapter->q_vector[0]; | ||
2003 | q_vector->eitr = adapter->eitr_param; | ||
1993 | ixgbe_write_eitr(q_vector); | 2004 | ixgbe_write_eitr(q_vector); |
1994 | } | 2005 | } |
1995 | 2006 | ||
diff --git a/drivers/net/ixgbe/ixgbe_fcoe.c b/drivers/net/ixgbe/ixgbe_fcoe.c index fa9f24e2368..28cf104e36c 100644 --- a/drivers/net/ixgbe/ixgbe_fcoe.c +++ b/drivers/net/ixgbe/ixgbe_fcoe.c | |||
@@ -336,7 +336,7 @@ int ixgbe_fcoe_ddp(struct ixgbe_adapter *adapter, | |||
336 | /* return 0 to bypass going to ULD for DDPed data */ | 336 | /* return 0 to bypass going to ULD for DDPed data */ |
337 | if (fcstat == IXGBE_RXDADV_STAT_FCSTAT_DDP) | 337 | if (fcstat == IXGBE_RXDADV_STAT_FCSTAT_DDP) |
338 | rc = 0; | 338 | rc = 0; |
339 | else | 339 | else if (ddp->len) |
340 | rc = ddp->len; | 340 | rc = ddp->len; |
341 | } | 341 | } |
342 | 342 | ||
diff --git a/drivers/net/ixgbe/ixgbe_main.c b/drivers/net/ixgbe/ixgbe_main.c index 110c65ab5cb..77b0381a2b5 100644 --- a/drivers/net/ixgbe/ixgbe_main.c +++ b/drivers/net/ixgbe/ixgbe_main.c | |||
@@ -492,12 +492,12 @@ static void ixgbe_receive_skb(struct ixgbe_q_vector *q_vector, | |||
492 | 492 | ||
493 | skb_record_rx_queue(skb, ring->queue_index); | 493 | skb_record_rx_queue(skb, ring->queue_index); |
494 | if (!(adapter->flags & IXGBE_FLAG_IN_NETPOLL)) { | 494 | if (!(adapter->flags & IXGBE_FLAG_IN_NETPOLL)) { |
495 | if (adapter->vlgrp && is_vlan && (tag != 0)) | 495 | if (adapter->vlgrp && is_vlan && (tag & VLAN_VID_MASK)) |
496 | vlan_gro_receive(napi, adapter->vlgrp, tag, skb); | 496 | vlan_gro_receive(napi, adapter->vlgrp, tag, skb); |
497 | else | 497 | else |
498 | napi_gro_receive(napi, skb); | 498 | napi_gro_receive(napi, skb); |
499 | } else { | 499 | } else { |
500 | if (adapter->vlgrp && is_vlan && (tag != 0)) | 500 | if (adapter->vlgrp && is_vlan && (tag & VLAN_VID_MASK)) |
501 | vlan_hwaccel_rx(skb, adapter->vlgrp, tag); | 501 | vlan_hwaccel_rx(skb, adapter->vlgrp, tag); |
502 | else | 502 | else |
503 | netif_rx(skb); | 503 | netif_rx(skb); |
@@ -585,7 +585,7 @@ static void ixgbe_alloc_rx_buffers(struct ixgbe_adapter *adapter, | |||
585 | rx_desc = IXGBE_RX_DESC_ADV(*rx_ring, i); | 585 | rx_desc = IXGBE_RX_DESC_ADV(*rx_ring, i); |
586 | 586 | ||
587 | if (!bi->page_dma && | 587 | if (!bi->page_dma && |
588 | (adapter->flags & IXGBE_FLAG_RX_PS_ENABLED)) { | 588 | (rx_ring->flags & IXGBE_RING_RX_PS_ENABLED)) { |
589 | if (!bi->page) { | 589 | if (!bi->page) { |
590 | bi->page = alloc_page(GFP_ATOMIC); | 590 | bi->page = alloc_page(GFP_ATOMIC); |
591 | if (!bi->page) { | 591 | if (!bi->page) { |
@@ -629,7 +629,7 @@ static void ixgbe_alloc_rx_buffers(struct ixgbe_adapter *adapter, | |||
629 | } | 629 | } |
630 | /* Refresh the desc even if buffer_addrs didn't change because | 630 | /* Refresh the desc even if buffer_addrs didn't change because |
631 | * each write-back erases this info. */ | 631 | * each write-back erases this info. */ |
632 | if (adapter->flags & IXGBE_FLAG_RX_PS_ENABLED) { | 632 | if (rx_ring->flags & IXGBE_RING_RX_PS_ENABLED) { |
633 | rx_desc->read.pkt_addr = cpu_to_le64(bi->page_dma); | 633 | rx_desc->read.pkt_addr = cpu_to_le64(bi->page_dma); |
634 | rx_desc->read.hdr_addr = cpu_to_le64(bi->dma); | 634 | rx_desc->read.hdr_addr = cpu_to_le64(bi->dma); |
635 | } else { | 635 | } else { |
@@ -726,7 +726,7 @@ static bool ixgbe_clean_rx_irq(struct ixgbe_q_vector *q_vector, | |||
726 | break; | 726 | break; |
727 | (*work_done)++; | 727 | (*work_done)++; |
728 | 728 | ||
729 | if (adapter->flags & IXGBE_FLAG_RX_PS_ENABLED) { | 729 | if (rx_ring->flags & IXGBE_RING_RX_PS_ENABLED) { |
730 | hdr_info = le16_to_cpu(ixgbe_get_hdr_info(rx_desc)); | 730 | hdr_info = le16_to_cpu(ixgbe_get_hdr_info(rx_desc)); |
731 | len = (hdr_info & IXGBE_RXDADV_HDRBUFLEN_MASK) >> | 731 | len = (hdr_info & IXGBE_RXDADV_HDRBUFLEN_MASK) >> |
732 | IXGBE_RXDADV_HDRBUFLEN_SHIFT; | 732 | IXGBE_RXDADV_HDRBUFLEN_SHIFT; |
@@ -798,7 +798,7 @@ static bool ixgbe_clean_rx_irq(struct ixgbe_q_vector *q_vector, | |||
798 | rx_ring->stats.packets++; | 798 | rx_ring->stats.packets++; |
799 | rx_ring->stats.bytes += skb->len; | 799 | rx_ring->stats.bytes += skb->len; |
800 | } else { | 800 | } else { |
801 | if (adapter->flags & IXGBE_FLAG_RX_PS_ENABLED) { | 801 | if (rx_ring->flags & IXGBE_RING_RX_PS_ENABLED) { |
802 | rx_buffer_info->skb = next_buffer->skb; | 802 | rx_buffer_info->skb = next_buffer->skb; |
803 | rx_buffer_info->dma = next_buffer->dma; | 803 | rx_buffer_info->dma = next_buffer->dma; |
804 | next_buffer->skb = skb; | 804 | next_buffer->skb = skb; |
@@ -1898,46 +1898,19 @@ static void ixgbe_configure_tx(struct ixgbe_adapter *adapter) | |||
1898 | 1898 | ||
1899 | #define IXGBE_SRRCTL_BSIZEHDRSIZE_SHIFT 2 | 1899 | #define IXGBE_SRRCTL_BSIZEHDRSIZE_SHIFT 2 |
1900 | 1900 | ||
1901 | static void ixgbe_configure_srrctl(struct ixgbe_adapter *adapter, int index) | 1901 | static void ixgbe_configure_srrctl(struct ixgbe_adapter *adapter, |
1902 | struct ixgbe_ring *rx_ring) | ||
1902 | { | 1903 | { |
1903 | struct ixgbe_ring *rx_ring; | ||
1904 | u32 srrctl; | 1904 | u32 srrctl; |
1905 | int queue0 = 0; | 1905 | int index; |
1906 | unsigned long mask; | ||
1907 | struct ixgbe_ring_feature *feature = adapter->ring_feature; | 1906 | struct ixgbe_ring_feature *feature = adapter->ring_feature; |
1908 | 1907 | ||
1909 | if (adapter->hw.mac.type == ixgbe_mac_82599EB) { | 1908 | index = rx_ring->reg_idx; |
1910 | if (adapter->flags & IXGBE_FLAG_DCB_ENABLED) { | 1909 | if (adapter->hw.mac.type == ixgbe_mac_82598EB) { |
1911 | int dcb_i = feature[RING_F_DCB].indices; | 1910 | unsigned long mask; |
1912 | if (dcb_i == 8) | ||
1913 | queue0 = index >> 4; | ||
1914 | else if (dcb_i == 4) | ||
1915 | queue0 = index >> 5; | ||
1916 | else | ||
1917 | dev_err(&adapter->pdev->dev, "Invalid DCB " | ||
1918 | "configuration\n"); | ||
1919 | #ifdef IXGBE_FCOE | ||
1920 | if (adapter->flags & IXGBE_FLAG_FCOE_ENABLED) { | ||
1921 | struct ixgbe_ring_feature *f; | ||
1922 | |||
1923 | rx_ring = &adapter->rx_ring[queue0]; | ||
1924 | f = &adapter->ring_feature[RING_F_FCOE]; | ||
1925 | if ((queue0 == 0) && (index > rx_ring->reg_idx)) | ||
1926 | queue0 = f->mask + index - | ||
1927 | rx_ring->reg_idx - 1; | ||
1928 | } | ||
1929 | #endif /* IXGBE_FCOE */ | ||
1930 | } else { | ||
1931 | queue0 = index; | ||
1932 | } | ||
1933 | } else { | ||
1934 | mask = (unsigned long) feature[RING_F_RSS].mask; | 1911 | mask = (unsigned long) feature[RING_F_RSS].mask; |
1935 | queue0 = index & mask; | ||
1936 | index = index & mask; | 1912 | index = index & mask; |
1937 | } | 1913 | } |
1938 | |||
1939 | rx_ring = &adapter->rx_ring[queue0]; | ||
1940 | |||
1941 | srrctl = IXGBE_READ_REG(&adapter->hw, IXGBE_SRRCTL(index)); | 1914 | srrctl = IXGBE_READ_REG(&adapter->hw, IXGBE_SRRCTL(index)); |
1942 | 1915 | ||
1943 | srrctl &= ~IXGBE_SRRCTL_BSIZEHDR_MASK; | 1916 | srrctl &= ~IXGBE_SRRCTL_BSIZEHDR_MASK; |
@@ -1946,7 +1919,7 @@ static void ixgbe_configure_srrctl(struct ixgbe_adapter *adapter, int index) | |||
1946 | srrctl |= (IXGBE_RX_HDR_SIZE << IXGBE_SRRCTL_BSIZEHDRSIZE_SHIFT) & | 1919 | srrctl |= (IXGBE_RX_HDR_SIZE << IXGBE_SRRCTL_BSIZEHDRSIZE_SHIFT) & |
1947 | IXGBE_SRRCTL_BSIZEHDR_MASK; | 1920 | IXGBE_SRRCTL_BSIZEHDR_MASK; |
1948 | 1921 | ||
1949 | if (adapter->flags & IXGBE_FLAG_RX_PS_ENABLED) { | 1922 | if (rx_ring->flags & IXGBE_RING_RX_PS_ENABLED) { |
1950 | #if (PAGE_SIZE / 2) > IXGBE_MAX_RXBUFFER | 1923 | #if (PAGE_SIZE / 2) > IXGBE_MAX_RXBUFFER |
1951 | srrctl |= IXGBE_MAX_RXBUFFER >> IXGBE_SRRCTL_BSIZEPKT_SHIFT; | 1924 | srrctl |= IXGBE_MAX_RXBUFFER >> IXGBE_SRRCTL_BSIZEPKT_SHIFT; |
1952 | #else | 1925 | #else |
@@ -2002,6 +1975,7 @@ static void ixgbe_configure_rx(struct ixgbe_adapter *adapter) | |||
2002 | { | 1975 | { |
2003 | u64 rdba; | 1976 | u64 rdba; |
2004 | struct ixgbe_hw *hw = &adapter->hw; | 1977 | struct ixgbe_hw *hw = &adapter->hw; |
1978 | struct ixgbe_ring *rx_ring; | ||
2005 | struct net_device *netdev = adapter->netdev; | 1979 | struct net_device *netdev = adapter->netdev; |
2006 | int max_frame = netdev->mtu + ETH_HLEN + ETH_FCS_LEN; | 1980 | int max_frame = netdev->mtu + ETH_HLEN + ETH_FCS_LEN; |
2007 | int i, j; | 1981 | int i, j; |
@@ -2018,11 +1992,6 @@ static void ixgbe_configure_rx(struct ixgbe_adapter *adapter) | |||
2018 | /* Decide whether to use packet split mode or not */ | 1992 | /* Decide whether to use packet split mode or not */ |
2019 | adapter->flags |= IXGBE_FLAG_RX_PS_ENABLED; | 1993 | adapter->flags |= IXGBE_FLAG_RX_PS_ENABLED; |
2020 | 1994 | ||
2021 | #ifdef IXGBE_FCOE | ||
2022 | if (adapter->flags & IXGBE_FLAG_FCOE_ENABLED) | ||
2023 | adapter->flags &= ~IXGBE_FLAG_RX_PS_ENABLED; | ||
2024 | #endif /* IXGBE_FCOE */ | ||
2025 | |||
2026 | /* Set the RX buffer length according to the mode */ | 1995 | /* Set the RX buffer length according to the mode */ |
2027 | if (adapter->flags & IXGBE_FLAG_RX_PS_ENABLED) { | 1996 | if (adapter->flags & IXGBE_FLAG_RX_PS_ENABLED) { |
2028 | rx_buf_len = IXGBE_RX_HDR_SIZE; | 1997 | rx_buf_len = IXGBE_RX_HDR_SIZE; |
@@ -2070,29 +2039,35 @@ static void ixgbe_configure_rx(struct ixgbe_adapter *adapter) | |||
2070 | * the Base and Length of the Rx Descriptor Ring | 2039 | * the Base and Length of the Rx Descriptor Ring |
2071 | */ | 2040 | */ |
2072 | for (i = 0; i < adapter->num_rx_queues; i++) { | 2041 | for (i = 0; i < adapter->num_rx_queues; i++) { |
2073 | rdba = adapter->rx_ring[i].dma; | 2042 | rx_ring = &adapter->rx_ring[i]; |
2074 | j = adapter->rx_ring[i].reg_idx; | 2043 | rdba = rx_ring->dma; |
2044 | j = rx_ring->reg_idx; | ||
2075 | IXGBE_WRITE_REG(hw, IXGBE_RDBAL(j), (rdba & DMA_BIT_MASK(32))); | 2045 | IXGBE_WRITE_REG(hw, IXGBE_RDBAL(j), (rdba & DMA_BIT_MASK(32))); |
2076 | IXGBE_WRITE_REG(hw, IXGBE_RDBAH(j), (rdba >> 32)); | 2046 | IXGBE_WRITE_REG(hw, IXGBE_RDBAH(j), (rdba >> 32)); |
2077 | IXGBE_WRITE_REG(hw, IXGBE_RDLEN(j), rdlen); | 2047 | IXGBE_WRITE_REG(hw, IXGBE_RDLEN(j), rdlen); |
2078 | IXGBE_WRITE_REG(hw, IXGBE_RDH(j), 0); | 2048 | IXGBE_WRITE_REG(hw, IXGBE_RDH(j), 0); |
2079 | IXGBE_WRITE_REG(hw, IXGBE_RDT(j), 0); | 2049 | IXGBE_WRITE_REG(hw, IXGBE_RDT(j), 0); |
2080 | adapter->rx_ring[i].head = IXGBE_RDH(j); | 2050 | rx_ring->head = IXGBE_RDH(j); |
2081 | adapter->rx_ring[i].tail = IXGBE_RDT(j); | 2051 | rx_ring->tail = IXGBE_RDT(j); |
2082 | adapter->rx_ring[i].rx_buf_len = rx_buf_len; | 2052 | rx_ring->rx_buf_len = rx_buf_len; |
2053 | |||
2054 | if (adapter->flags & IXGBE_FLAG_RX_PS_ENABLED) | ||
2055 | rx_ring->flags |= IXGBE_RING_RX_PS_ENABLED; | ||
2083 | 2056 | ||
2084 | #ifdef IXGBE_FCOE | 2057 | #ifdef IXGBE_FCOE |
2085 | if (adapter->flags & IXGBE_FLAG_FCOE_ENABLED) { | 2058 | if (adapter->flags & IXGBE_FLAG_FCOE_ENABLED) { |
2086 | struct ixgbe_ring_feature *f; | 2059 | struct ixgbe_ring_feature *f; |
2087 | f = &adapter->ring_feature[RING_F_FCOE]; | 2060 | f = &adapter->ring_feature[RING_F_FCOE]; |
2088 | if ((rx_buf_len < IXGBE_FCOE_JUMBO_FRAME_SIZE) && | 2061 | if ((i >= f->mask) && (i < f->mask + f->indices)) { |
2089 | (i >= f->mask) && (i < f->mask + f->indices)) | 2062 | rx_ring->flags &= ~IXGBE_RING_RX_PS_ENABLED; |
2090 | adapter->rx_ring[i].rx_buf_len = | 2063 | if (rx_buf_len < IXGBE_FCOE_JUMBO_FRAME_SIZE) |
2091 | IXGBE_FCOE_JUMBO_FRAME_SIZE; | 2064 | rx_ring->rx_buf_len = |
2065 | IXGBE_FCOE_JUMBO_FRAME_SIZE; | ||
2066 | } | ||
2092 | } | 2067 | } |
2093 | 2068 | ||
2094 | #endif /* IXGBE_FCOE */ | 2069 | #endif /* IXGBE_FCOE */ |
2095 | ixgbe_configure_srrctl(adapter, j); | 2070 | ixgbe_configure_srrctl(adapter, rx_ring); |
2096 | } | 2071 | } |
2097 | 2072 | ||
2098 | if (hw->mac.type == ixgbe_mac_82598EB) { | 2073 | if (hw->mac.type == ixgbe_mac_82598EB) { |
@@ -2168,7 +2143,8 @@ static void ixgbe_configure_rx(struct ixgbe_adapter *adapter) | |||
2168 | if (adapter->flags2 & IXGBE_FLAG2_RSC_ENABLED) { | 2143 | if (adapter->flags2 & IXGBE_FLAG2_RSC_ENABLED) { |
2169 | /* Enable 82599 HW-RSC */ | 2144 | /* Enable 82599 HW-RSC */ |
2170 | for (i = 0; i < adapter->num_rx_queues; i++) { | 2145 | for (i = 0; i < adapter->num_rx_queues; i++) { |
2171 | j = adapter->rx_ring[i].reg_idx; | 2146 | rx_ring = &adapter->rx_ring[i]; |
2147 | j = rx_ring->reg_idx; | ||
2172 | rscctrl = IXGBE_READ_REG(hw, IXGBE_RSCCTL(j)); | 2148 | rscctrl = IXGBE_READ_REG(hw, IXGBE_RSCCTL(j)); |
2173 | rscctrl |= IXGBE_RSCCTL_RSCEN; | 2149 | rscctrl |= IXGBE_RSCCTL_RSCEN; |
2174 | /* | 2150 | /* |
@@ -2176,7 +2152,7 @@ static void ixgbe_configure_rx(struct ixgbe_adapter *adapter) | |||
2176 | * total size of max desc * buf_len is not greater | 2152 | * total size of max desc * buf_len is not greater |
2177 | * than 65535 | 2153 | * than 65535 |
2178 | */ | 2154 | */ |
2179 | if (adapter->flags & IXGBE_FLAG_RX_PS_ENABLED) { | 2155 | if (rx_ring->flags & IXGBE_RING_RX_PS_ENABLED) { |
2180 | #if (MAX_SKB_FRAGS > 16) | 2156 | #if (MAX_SKB_FRAGS > 16) |
2181 | rscctrl |= IXGBE_RSCCTL_MAXDESC_16; | 2157 | rscctrl |= IXGBE_RSCCTL_MAXDESC_16; |
2182 | #elif (MAX_SKB_FRAGS > 8) | 2158 | #elif (MAX_SKB_FRAGS > 8) |
diff --git a/drivers/net/mlx4/en_rx.c b/drivers/net/mlx4/en_rx.c index 91bdfdfd431..3ac0404d0d1 100644 --- a/drivers/net/mlx4/en_rx.c +++ b/drivers/net/mlx4/en_rx.c | |||
@@ -506,8 +506,9 @@ static int mlx4_en_complete_rx_desc(struct mlx4_en_priv *priv, | |||
506 | PCI_DMA_FROMDEVICE); | 506 | PCI_DMA_FROMDEVICE); |
507 | } | 507 | } |
508 | /* Adjust size of last fragment to match actual length */ | 508 | /* Adjust size of last fragment to match actual length */ |
509 | skb_frags_rx[nr - 1].size = length - | 509 | if (nr > 0) |
510 | priv->frag_info[nr - 1].frag_prefix_size; | 510 | skb_frags_rx[nr - 1].size = length - |
511 | priv->frag_info[nr - 1].frag_prefix_size; | ||
511 | return nr; | 512 | return nr; |
512 | 513 | ||
513 | fail: | 514 | fail: |
diff --git a/drivers/net/netxen/netxen_nic.h b/drivers/net/netxen/netxen_nic.h index f86e05047d1..a9c1fcca5e7 100644 --- a/drivers/net/netxen/netxen_nic.h +++ b/drivers/net/netxen/netxen_nic.h | |||
@@ -1254,7 +1254,7 @@ struct netxen_adapter { | |||
1254 | u8 mc_enabled; | 1254 | u8 mc_enabled; |
1255 | u8 max_mc_count; | 1255 | u8 max_mc_count; |
1256 | u8 rss_supported; | 1256 | u8 rss_supported; |
1257 | u8 resv2; | 1257 | u8 link_changed; |
1258 | u32 resv3; | 1258 | u32 resv3; |
1259 | 1259 | ||
1260 | u8 has_link_events; | 1260 | u8 has_link_events; |
diff --git a/drivers/net/netxen/netxen_nic_init.c b/drivers/net/netxen/netxen_nic_init.c index 7acf204e38c..5d3343ef3d8 100644 --- a/drivers/net/netxen/netxen_nic_init.c +++ b/drivers/net/netxen/netxen_nic_init.c | |||
@@ -184,13 +184,6 @@ void netxen_free_sw_resources(struct netxen_adapter *adapter) | |||
184 | kfree(recv_ctx->rds_rings); | 184 | kfree(recv_ctx->rds_rings); |
185 | 185 | ||
186 | skip_rds: | 186 | skip_rds: |
187 | if (recv_ctx->sds_rings == NULL) | ||
188 | goto skip_sds; | ||
189 | |||
190 | for(ring = 0; ring < adapter->max_sds_rings; ring++) | ||
191 | recv_ctx->sds_rings[ring].consumer = 0; | ||
192 | |||
193 | skip_sds: | ||
194 | if (adapter->tx_ring == NULL) | 187 | if (adapter->tx_ring == NULL) |
195 | return; | 188 | return; |
196 | 189 | ||
diff --git a/drivers/net/netxen/netxen_nic_main.c b/drivers/net/netxen/netxen_nic_main.c index 3cd8cfcf627..28f270f5ac7 100644 --- a/drivers/net/netxen/netxen_nic_main.c +++ b/drivers/net/netxen/netxen_nic_main.c | |||
@@ -94,10 +94,6 @@ static struct pci_device_id netxen_pci_tbl[] __devinitdata = { | |||
94 | 94 | ||
95 | MODULE_DEVICE_TABLE(pci, netxen_pci_tbl); | 95 | MODULE_DEVICE_TABLE(pci, netxen_pci_tbl); |
96 | 96 | ||
97 | static struct workqueue_struct *netxen_workq; | ||
98 | #define SCHEDULE_WORK(tp) queue_work(netxen_workq, tp) | ||
99 | #define FLUSH_SCHEDULED_WORK() flush_workqueue(netxen_workq) | ||
100 | |||
101 | static void netxen_watchdog(unsigned long); | 97 | static void netxen_watchdog(unsigned long); |
102 | 98 | ||
103 | static uint32_t crb_cmd_producer[4] = { | 99 | static uint32_t crb_cmd_producer[4] = { |
@@ -171,6 +167,8 @@ netxen_free_sds_rings(struct netxen_recv_context *recv_ctx) | |||
171 | { | 167 | { |
172 | if (recv_ctx->sds_rings != NULL) | 168 | if (recv_ctx->sds_rings != NULL) |
173 | kfree(recv_ctx->sds_rings); | 169 | kfree(recv_ctx->sds_rings); |
170 | |||
171 | recv_ctx->sds_rings = NULL; | ||
174 | } | 172 | } |
175 | 173 | ||
176 | static int | 174 | static int |
@@ -193,6 +191,21 @@ netxen_napi_add(struct netxen_adapter *adapter, struct net_device *netdev) | |||
193 | } | 191 | } |
194 | 192 | ||
195 | static void | 193 | static void |
194 | netxen_napi_del(struct netxen_adapter *adapter) | ||
195 | { | ||
196 | int ring; | ||
197 | struct nx_host_sds_ring *sds_ring; | ||
198 | struct netxen_recv_context *recv_ctx = &adapter->recv_ctx; | ||
199 | |||
200 | for (ring = 0; ring < adapter->max_sds_rings; ring++) { | ||
201 | sds_ring = &recv_ctx->sds_rings[ring]; | ||
202 | netif_napi_del(&sds_ring->napi); | ||
203 | } | ||
204 | |||
205 | netxen_free_sds_rings(&adapter->recv_ctx); | ||
206 | } | ||
207 | |||
208 | static void | ||
196 | netxen_napi_enable(struct netxen_adapter *adapter) | 209 | netxen_napi_enable(struct netxen_adapter *adapter) |
197 | { | 210 | { |
198 | int ring; | 211 | int ring; |
@@ -260,7 +273,7 @@ nx_update_dma_mask(struct netxen_adapter *adapter) | |||
260 | change = 0; | 273 | change = 0; |
261 | 274 | ||
262 | shift = NXRD32(adapter, CRB_DMA_SHIFT); | 275 | shift = NXRD32(adapter, CRB_DMA_SHIFT); |
263 | if (shift >= 32) | 276 | if (shift > 32) |
264 | return 0; | 277 | return 0; |
265 | 278 | ||
266 | if (NX_IS_REVISION_P3(adapter->ahw.revision_id) && (shift > 9)) | 279 | if (NX_IS_REVISION_P3(adapter->ahw.revision_id) && (shift > 9)) |
@@ -272,7 +285,7 @@ nx_update_dma_mask(struct netxen_adapter *adapter) | |||
272 | old_mask = pdev->dma_mask; | 285 | old_mask = pdev->dma_mask; |
273 | old_cmask = pdev->dev.coherent_dma_mask; | 286 | old_cmask = pdev->dev.coherent_dma_mask; |
274 | 287 | ||
275 | mask = (1ULL<<(32+shift)) - 1; | 288 | mask = DMA_BIT_MASK(32+shift); |
276 | 289 | ||
277 | err = pci_set_dma_mask(pdev, mask); | 290 | err = pci_set_dma_mask(pdev, mask); |
278 | if (err) | 291 | if (err) |
@@ -880,7 +893,6 @@ netxen_nic_down(struct netxen_adapter *adapter, struct net_device *netdev) | |||
880 | spin_unlock(&adapter->tx_clean_lock); | 893 | spin_unlock(&adapter->tx_clean_lock); |
881 | 894 | ||
882 | del_timer_sync(&adapter->watchdog_timer); | 895 | del_timer_sync(&adapter->watchdog_timer); |
883 | FLUSH_SCHEDULED_WORK(); | ||
884 | } | 896 | } |
885 | 897 | ||
886 | 898 | ||
@@ -894,10 +906,12 @@ netxen_nic_attach(struct netxen_adapter *adapter) | |||
894 | struct nx_host_tx_ring *tx_ring; | 906 | struct nx_host_tx_ring *tx_ring; |
895 | 907 | ||
896 | err = netxen_init_firmware(adapter); | 908 | err = netxen_init_firmware(adapter); |
897 | if (err != 0) { | 909 | if (err) |
898 | printk(KERN_ERR "Failed to init firmware\n"); | 910 | return err; |
899 | return -EIO; | 911 | |
900 | } | 912 | err = netxen_napi_add(adapter, netdev); |
913 | if (err) | ||
914 | return err; | ||
901 | 915 | ||
902 | if (adapter->fw_major < 4) | 916 | if (adapter->fw_major < 4) |
903 | adapter->max_rds_rings = 3; | 917 | adapter->max_rds_rings = 3; |
@@ -961,6 +975,7 @@ netxen_nic_detach(struct netxen_adapter *adapter) | |||
961 | netxen_free_hw_resources(adapter); | 975 | netxen_free_hw_resources(adapter); |
962 | netxen_release_rx_buffers(adapter); | 976 | netxen_release_rx_buffers(adapter); |
963 | netxen_nic_free_irq(adapter); | 977 | netxen_nic_free_irq(adapter); |
978 | netxen_napi_del(adapter); | ||
964 | netxen_free_sw_resources(adapter); | 979 | netxen_free_sw_resources(adapter); |
965 | 980 | ||
966 | adapter->is_up = 0; | 981 | adapter->is_up = 0; |
@@ -1105,9 +1120,6 @@ netxen_nic_probe(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
1105 | 1120 | ||
1106 | netdev->irq = adapter->msix_entries[0].vector; | 1121 | netdev->irq = adapter->msix_entries[0].vector; |
1107 | 1122 | ||
1108 | if (netxen_napi_add(adapter, netdev)) | ||
1109 | goto err_out_disable_msi; | ||
1110 | |||
1111 | init_timer(&adapter->watchdog_timer); | 1123 | init_timer(&adapter->watchdog_timer); |
1112 | adapter->watchdog_timer.function = &netxen_watchdog; | 1124 | adapter->watchdog_timer.function = &netxen_watchdog; |
1113 | adapter->watchdog_timer.data = (unsigned long)adapter; | 1125 | adapter->watchdog_timer.data = (unsigned long)adapter; |
@@ -1177,6 +1189,9 @@ static void __devexit netxen_nic_remove(struct pci_dev *pdev) | |||
1177 | 1189 | ||
1178 | unregister_netdev(netdev); | 1190 | unregister_netdev(netdev); |
1179 | 1191 | ||
1192 | cancel_work_sync(&adapter->watchdog_task); | ||
1193 | cancel_work_sync(&adapter->tx_timeout_task); | ||
1194 | |||
1180 | if (adapter->is_up == NETXEN_ADAPTER_UP_MAGIC) { | 1195 | if (adapter->is_up == NETXEN_ADAPTER_UP_MAGIC) { |
1181 | netxen_nic_detach(adapter); | 1196 | netxen_nic_detach(adapter); |
1182 | } | 1197 | } |
@@ -1185,7 +1200,6 @@ static void __devexit netxen_nic_remove(struct pci_dev *pdev) | |||
1185 | netxen_free_adapter_offload(adapter); | 1200 | netxen_free_adapter_offload(adapter); |
1186 | 1201 | ||
1187 | netxen_teardown_intr(adapter); | 1202 | netxen_teardown_intr(adapter); |
1188 | netxen_free_sds_rings(&adapter->recv_ctx); | ||
1189 | 1203 | ||
1190 | netxen_cleanup_pci_map(adapter); | 1204 | netxen_cleanup_pci_map(adapter); |
1191 | 1205 | ||
@@ -1211,6 +1225,9 @@ netxen_nic_suspend(struct pci_dev *pdev, pm_message_t state) | |||
1211 | if (netif_running(netdev)) | 1225 | if (netif_running(netdev)) |
1212 | netxen_nic_down(adapter, netdev); | 1226 | netxen_nic_down(adapter, netdev); |
1213 | 1227 | ||
1228 | cancel_work_sync(&adapter->watchdog_task); | ||
1229 | cancel_work_sync(&adapter->tx_timeout_task); | ||
1230 | |||
1214 | if (adapter->is_up == NETXEN_ADAPTER_UP_MAGIC) | 1231 | if (adapter->is_up == NETXEN_ADAPTER_UP_MAGIC) |
1215 | netxen_nic_detach(adapter); | 1232 | netxen_nic_detach(adapter); |
1216 | 1233 | ||
@@ -1549,11 +1566,6 @@ static int netxen_nic_check_temp(struct netxen_adapter *adapter) | |||
1549 | "%s: Device temperature %d degrees C exceeds" | 1566 | "%s: Device temperature %d degrees C exceeds" |
1550 | " maximum allowed. Hardware has been shut down.\n", | 1567 | " maximum allowed. Hardware has been shut down.\n", |
1551 | netdev->name, temp_val); | 1568 | netdev->name, temp_val); |
1552 | |||
1553 | netif_device_detach(netdev); | ||
1554 | netxen_nic_down(adapter, netdev); | ||
1555 | netxen_nic_detach(adapter); | ||
1556 | |||
1557 | rv = 1; | 1569 | rv = 1; |
1558 | } else if (temp_state == NX_TEMP_WARN) { | 1570 | } else if (temp_state == NX_TEMP_WARN) { |
1559 | if (adapter->temp == NX_TEMP_NORMAL) { | 1571 | if (adapter->temp == NX_TEMP_NORMAL) { |
@@ -1587,10 +1599,7 @@ void netxen_advert_link_change(struct netxen_adapter *adapter, int linkup) | |||
1587 | netif_carrier_off(netdev); | 1599 | netif_carrier_off(netdev); |
1588 | netif_stop_queue(netdev); | 1600 | netif_stop_queue(netdev); |
1589 | } | 1601 | } |
1590 | 1602 | adapter->link_changed = !adapter->has_link_events; | |
1591 | if (!adapter->has_link_events) | ||
1592 | netxen_nic_set_link_parameters(adapter); | ||
1593 | |||
1594 | } else if (!adapter->ahw.linkup && linkup) { | 1603 | } else if (!adapter->ahw.linkup && linkup) { |
1595 | printk(KERN_INFO "%s: %s NIC Link is up\n", | 1604 | printk(KERN_INFO "%s: %s NIC Link is up\n", |
1596 | netxen_nic_driver_name, netdev->name); | 1605 | netxen_nic_driver_name, netdev->name); |
@@ -1599,9 +1608,7 @@ void netxen_advert_link_change(struct netxen_adapter *adapter, int linkup) | |||
1599 | netif_carrier_on(netdev); | 1608 | netif_carrier_on(netdev); |
1600 | netif_wake_queue(netdev); | 1609 | netif_wake_queue(netdev); |
1601 | } | 1610 | } |
1602 | 1611 | adapter->link_changed = !adapter->has_link_events; | |
1603 | if (!adapter->has_link_events) | ||
1604 | netxen_nic_set_link_parameters(adapter); | ||
1605 | } | 1612 | } |
1606 | } | 1613 | } |
1607 | 1614 | ||
@@ -1628,11 +1635,36 @@ static void netxen_nic_handle_phy_intr(struct netxen_adapter *adapter) | |||
1628 | netxen_advert_link_change(adapter, linkup); | 1635 | netxen_advert_link_change(adapter, linkup); |
1629 | } | 1636 | } |
1630 | 1637 | ||
1638 | static void netxen_nic_thermal_shutdown(struct netxen_adapter *adapter) | ||
1639 | { | ||
1640 | struct net_device *netdev = adapter->netdev; | ||
1641 | |||
1642 | netif_device_detach(netdev); | ||
1643 | netxen_nic_down(adapter, netdev); | ||
1644 | netxen_nic_detach(adapter); | ||
1645 | } | ||
1646 | |||
1631 | static void netxen_watchdog(unsigned long v) | 1647 | static void netxen_watchdog(unsigned long v) |
1632 | { | 1648 | { |
1633 | struct netxen_adapter *adapter = (struct netxen_adapter *)v; | 1649 | struct netxen_adapter *adapter = (struct netxen_adapter *)v; |
1634 | 1650 | ||
1635 | SCHEDULE_WORK(&adapter->watchdog_task); | 1651 | if (netxen_nic_check_temp(adapter)) |
1652 | goto do_sched; | ||
1653 | |||
1654 | if (!adapter->has_link_events) { | ||
1655 | netxen_nic_handle_phy_intr(adapter); | ||
1656 | |||
1657 | if (adapter->link_changed) | ||
1658 | goto do_sched; | ||
1659 | } | ||
1660 | |||
1661 | if (netif_running(adapter->netdev)) | ||
1662 | mod_timer(&adapter->watchdog_timer, jiffies + 2 * HZ); | ||
1663 | |||
1664 | return; | ||
1665 | |||
1666 | do_sched: | ||
1667 | schedule_work(&adapter->watchdog_task); | ||
1636 | } | 1668 | } |
1637 | 1669 | ||
1638 | void netxen_watchdog_task(struct work_struct *work) | 1670 | void netxen_watchdog_task(struct work_struct *work) |
@@ -1640,11 +1672,13 @@ void netxen_watchdog_task(struct work_struct *work) | |||
1640 | struct netxen_adapter *adapter = | 1672 | struct netxen_adapter *adapter = |
1641 | container_of(work, struct netxen_adapter, watchdog_task); | 1673 | container_of(work, struct netxen_adapter, watchdog_task); |
1642 | 1674 | ||
1643 | if (netxen_nic_check_temp(adapter)) | 1675 | if (adapter->temp == NX_TEMP_PANIC) { |
1676 | netxen_nic_thermal_shutdown(adapter); | ||
1644 | return; | 1677 | return; |
1678 | } | ||
1645 | 1679 | ||
1646 | if (!adapter->has_link_events) | 1680 | if (adapter->link_changed) |
1647 | netxen_nic_handle_phy_intr(adapter); | 1681 | netxen_nic_set_link_parameters(adapter); |
1648 | 1682 | ||
1649 | if (netif_running(adapter->netdev)) | 1683 | if (netif_running(adapter->netdev)) |
1650 | mod_timer(&adapter->watchdog_timer, jiffies + 2 * HZ); | 1684 | mod_timer(&adapter->watchdog_timer, jiffies + 2 * HZ); |
@@ -1652,9 +1686,8 @@ void netxen_watchdog_task(struct work_struct *work) | |||
1652 | 1686 | ||
1653 | static void netxen_tx_timeout(struct net_device *netdev) | 1687 | static void netxen_tx_timeout(struct net_device *netdev) |
1654 | { | 1688 | { |
1655 | struct netxen_adapter *adapter = (struct netxen_adapter *) | 1689 | struct netxen_adapter *adapter = netdev_priv(netdev); |
1656 | netdev_priv(netdev); | 1690 | schedule_work(&adapter->tx_timeout_task); |
1657 | SCHEDULE_WORK(&adapter->tx_timeout_task); | ||
1658 | } | 1691 | } |
1659 | 1692 | ||
1660 | static void netxen_tx_timeout_task(struct work_struct *work) | 1693 | static void netxen_tx_timeout_task(struct work_struct *work) |
@@ -1811,9 +1844,6 @@ static int __init netxen_init_module(void) | |||
1811 | { | 1844 | { |
1812 | printk(KERN_INFO "%s\n", netxen_nic_driver_string); | 1845 | printk(KERN_INFO "%s\n", netxen_nic_driver_string); |
1813 | 1846 | ||
1814 | if ((netxen_workq = create_singlethread_workqueue("netxen")) == NULL) | ||
1815 | return -ENOMEM; | ||
1816 | |||
1817 | return pci_register_driver(&netxen_driver); | 1847 | return pci_register_driver(&netxen_driver); |
1818 | } | 1848 | } |
1819 | 1849 | ||
@@ -1822,7 +1852,6 @@ module_init(netxen_init_module); | |||
1822 | static void __exit netxen_exit_module(void) | 1852 | static void __exit netxen_exit_module(void) |
1823 | { | 1853 | { |
1824 | pci_unregister_driver(&netxen_driver); | 1854 | pci_unregister_driver(&netxen_driver); |
1825 | destroy_workqueue(netxen_workq); | ||
1826 | } | 1855 | } |
1827 | 1856 | ||
1828 | module_exit(netxen_exit_module); | 1857 | module_exit(netxen_exit_module); |
diff --git a/drivers/net/pcnet32.c b/drivers/net/pcnet32.c index a646a445fda..23e1a0750fe 100644 --- a/drivers/net/pcnet32.c +++ b/drivers/net/pcnet32.c | |||
@@ -1839,7 +1839,7 @@ pcnet32_probe1(unsigned long ioaddr, int shared, struct pci_dev *pdev) | |||
1839 | lp->chip_version = chip_version; | 1839 | lp->chip_version = chip_version; |
1840 | lp->msg_enable = pcnet32_debug; | 1840 | lp->msg_enable = pcnet32_debug; |
1841 | if ((cards_found >= MAX_UNITS) | 1841 | if ((cards_found >= MAX_UNITS) |
1842 | || (options[cards_found] > sizeof(options_mapping))) | 1842 | || (options[cards_found] >= sizeof(options_mapping))) |
1843 | lp->options = PCNET32_PORT_ASEL; | 1843 | lp->options = PCNET32_PORT_ASEL; |
1844 | else | 1844 | else |
1845 | lp->options = options_mapping[options[cards_found]]; | 1845 | lp->options = options_mapping[options[cards_found]]; |
diff --git a/drivers/net/tulip/tulip_core.c b/drivers/net/tulip/tulip_core.c index 99a63649f4f..4cf9a658875 100644 --- a/drivers/net/tulip/tulip_core.c +++ b/drivers/net/tulip/tulip_core.c | |||
@@ -652,8 +652,9 @@ tulip_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
652 | int entry; | 652 | int entry; |
653 | u32 flag; | 653 | u32 flag; |
654 | dma_addr_t mapping; | 654 | dma_addr_t mapping; |
655 | unsigned long flags; | ||
655 | 656 | ||
656 | spin_lock_irq(&tp->lock); | 657 | spin_lock_irqsave(&tp->lock, flags); |
657 | 658 | ||
658 | /* Calculate the next Tx descriptor entry. */ | 659 | /* Calculate the next Tx descriptor entry. */ |
659 | entry = tp->cur_tx % TX_RING_SIZE; | 660 | entry = tp->cur_tx % TX_RING_SIZE; |
@@ -688,7 +689,7 @@ tulip_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
688 | /* Trigger an immediate transmit demand. */ | 689 | /* Trigger an immediate transmit demand. */ |
689 | iowrite32(0, tp->base_addr + CSR1); | 690 | iowrite32(0, tp->base_addr + CSR1); |
690 | 691 | ||
691 | spin_unlock_irq(&tp->lock); | 692 | spin_unlock_irqrestore(&tp->lock, flags); |
692 | 693 | ||
693 | dev->trans_start = jiffies; | 694 | dev->trans_start = jiffies; |
694 | 695 | ||
diff --git a/drivers/net/tun.c b/drivers/net/tun.c index 027f7aba26a..42b6c6319bc 100644 --- a/drivers/net/tun.c +++ b/drivers/net/tun.c | |||
@@ -1048,20 +1048,15 @@ static int tun_set_iff(struct net *net, struct file *file, struct ifreq *ifr) | |||
1048 | return err; | 1048 | return err; |
1049 | } | 1049 | } |
1050 | 1050 | ||
1051 | static int tun_get_iff(struct net *net, struct file *file, struct ifreq *ifr) | 1051 | static int tun_get_iff(struct net *net, struct tun_struct *tun, |
1052 | struct ifreq *ifr) | ||
1052 | { | 1053 | { |
1053 | struct tun_struct *tun = tun_get(file); | ||
1054 | |||
1055 | if (!tun) | ||
1056 | return -EBADFD; | ||
1057 | |||
1058 | DBG(KERN_INFO "%s: tun_get_iff\n", tun->dev->name); | 1054 | DBG(KERN_INFO "%s: tun_get_iff\n", tun->dev->name); |
1059 | 1055 | ||
1060 | strcpy(ifr->ifr_name, tun->dev->name); | 1056 | strcpy(ifr->ifr_name, tun->dev->name); |
1061 | 1057 | ||
1062 | ifr->ifr_flags = tun_flags(tun); | 1058 | ifr->ifr_flags = tun_flags(tun); |
1063 | 1059 | ||
1064 | tun_put(tun); | ||
1065 | return 0; | 1060 | return 0; |
1066 | } | 1061 | } |
1067 | 1062 | ||
@@ -1105,8 +1100,8 @@ static int set_offload(struct net_device *dev, unsigned long arg) | |||
1105 | return 0; | 1100 | return 0; |
1106 | } | 1101 | } |
1107 | 1102 | ||
1108 | static int tun_chr_ioctl(struct inode *inode, struct file *file, | 1103 | static long tun_chr_ioctl(struct file *file, unsigned int cmd, |
1109 | unsigned int cmd, unsigned long arg) | 1104 | unsigned long arg) |
1110 | { | 1105 | { |
1111 | struct tun_file *tfile = file->private_data; | 1106 | struct tun_file *tfile = file->private_data; |
1112 | struct tun_struct *tun; | 1107 | struct tun_struct *tun; |
@@ -1128,34 +1123,32 @@ static int tun_chr_ioctl(struct inode *inode, struct file *file, | |||
1128 | (unsigned int __user*)argp); | 1123 | (unsigned int __user*)argp); |
1129 | } | 1124 | } |
1130 | 1125 | ||
1126 | rtnl_lock(); | ||
1127 | |||
1131 | tun = __tun_get(tfile); | 1128 | tun = __tun_get(tfile); |
1132 | if (cmd == TUNSETIFF && !tun) { | 1129 | if (cmd == TUNSETIFF && !tun) { |
1133 | int err; | ||
1134 | |||
1135 | ifr.ifr_name[IFNAMSIZ-1] = '\0'; | 1130 | ifr.ifr_name[IFNAMSIZ-1] = '\0'; |
1136 | 1131 | ||
1137 | rtnl_lock(); | 1132 | ret = tun_set_iff(tfile->net, file, &ifr); |
1138 | err = tun_set_iff(tfile->net, file, &ifr); | ||
1139 | rtnl_unlock(); | ||
1140 | 1133 | ||
1141 | if (err) | 1134 | if (ret) |
1142 | return err; | 1135 | goto unlock; |
1143 | 1136 | ||
1144 | if (copy_to_user(argp, &ifr, sizeof(ifr))) | 1137 | if (copy_to_user(argp, &ifr, sizeof(ifr))) |
1145 | return -EFAULT; | 1138 | ret = -EFAULT; |
1146 | return 0; | 1139 | goto unlock; |
1147 | } | 1140 | } |
1148 | 1141 | ||
1149 | 1142 | ret = -EBADFD; | |
1150 | if (!tun) | 1143 | if (!tun) |
1151 | return -EBADFD; | 1144 | goto unlock; |
1152 | 1145 | ||
1153 | DBG(KERN_INFO "%s: tun_chr_ioctl cmd %d\n", tun->dev->name, cmd); | 1146 | DBG(KERN_INFO "%s: tun_chr_ioctl cmd %d\n", tun->dev->name, cmd); |
1154 | 1147 | ||
1155 | ret = 0; | 1148 | ret = 0; |
1156 | switch (cmd) { | 1149 | switch (cmd) { |
1157 | case TUNGETIFF: | 1150 | case TUNGETIFF: |
1158 | ret = tun_get_iff(current->nsproxy->net_ns, file, &ifr); | 1151 | ret = tun_get_iff(current->nsproxy->net_ns, tun, &ifr); |
1159 | if (ret) | 1152 | if (ret) |
1160 | break; | 1153 | break; |
1161 | 1154 | ||
@@ -1201,7 +1194,6 @@ static int tun_chr_ioctl(struct inode *inode, struct file *file, | |||
1201 | 1194 | ||
1202 | case TUNSETLINK: | 1195 | case TUNSETLINK: |
1203 | /* Only allow setting the type when the interface is down */ | 1196 | /* Only allow setting the type when the interface is down */ |
1204 | rtnl_lock(); | ||
1205 | if (tun->dev->flags & IFF_UP) { | 1197 | if (tun->dev->flags & IFF_UP) { |
1206 | DBG(KERN_INFO "%s: Linktype set failed because interface is up\n", | 1198 | DBG(KERN_INFO "%s: Linktype set failed because interface is up\n", |
1207 | tun->dev->name); | 1199 | tun->dev->name); |
@@ -1211,7 +1203,6 @@ static int tun_chr_ioctl(struct inode *inode, struct file *file, | |||
1211 | DBG(KERN_INFO "%s: linktype set to %d\n", tun->dev->name, tun->dev->type); | 1203 | DBG(KERN_INFO "%s: linktype set to %d\n", tun->dev->name, tun->dev->type); |
1212 | ret = 0; | 1204 | ret = 0; |
1213 | } | 1205 | } |
1214 | rtnl_unlock(); | ||
1215 | break; | 1206 | break; |
1216 | 1207 | ||
1217 | #ifdef TUN_DEBUG | 1208 | #ifdef TUN_DEBUG |
@@ -1220,9 +1211,7 @@ static int tun_chr_ioctl(struct inode *inode, struct file *file, | |||
1220 | break; | 1211 | break; |
1221 | #endif | 1212 | #endif |
1222 | case TUNSETOFFLOAD: | 1213 | case TUNSETOFFLOAD: |
1223 | rtnl_lock(); | ||
1224 | ret = set_offload(tun->dev, arg); | 1214 | ret = set_offload(tun->dev, arg); |
1225 | rtnl_unlock(); | ||
1226 | break; | 1215 | break; |
1227 | 1216 | ||
1228 | case TUNSETTXFILTER: | 1217 | case TUNSETTXFILTER: |
@@ -1230,9 +1219,7 @@ static int tun_chr_ioctl(struct inode *inode, struct file *file, | |||
1230 | ret = -EINVAL; | 1219 | ret = -EINVAL; |
1231 | if ((tun->flags & TUN_TYPE_MASK) != TUN_TAP_DEV) | 1220 | if ((tun->flags & TUN_TYPE_MASK) != TUN_TAP_DEV) |
1232 | break; | 1221 | break; |
1233 | rtnl_lock(); | ||
1234 | ret = update_filter(&tun->txflt, (void __user *)arg); | 1222 | ret = update_filter(&tun->txflt, (void __user *)arg); |
1235 | rtnl_unlock(); | ||
1236 | break; | 1223 | break; |
1237 | 1224 | ||
1238 | case SIOCGIFHWADDR: | 1225 | case SIOCGIFHWADDR: |
@@ -1248,9 +1235,7 @@ static int tun_chr_ioctl(struct inode *inode, struct file *file, | |||
1248 | DBG(KERN_DEBUG "%s: set hw address: %pM\n", | 1235 | DBG(KERN_DEBUG "%s: set hw address: %pM\n", |
1249 | tun->dev->name, ifr.ifr_hwaddr.sa_data); | 1236 | tun->dev->name, ifr.ifr_hwaddr.sa_data); |
1250 | 1237 | ||
1251 | rtnl_lock(); | ||
1252 | ret = dev_set_mac_address(tun->dev, &ifr.ifr_hwaddr); | 1238 | ret = dev_set_mac_address(tun->dev, &ifr.ifr_hwaddr); |
1253 | rtnl_unlock(); | ||
1254 | break; | 1239 | break; |
1255 | 1240 | ||
1256 | case TUNGETSNDBUF: | 1241 | case TUNGETSNDBUF: |
@@ -1273,7 +1258,10 @@ static int tun_chr_ioctl(struct inode *inode, struct file *file, | |||
1273 | break; | 1258 | break; |
1274 | }; | 1259 | }; |
1275 | 1260 | ||
1276 | tun_put(tun); | 1261 | unlock: |
1262 | rtnl_unlock(); | ||
1263 | if (tun) | ||
1264 | tun_put(tun); | ||
1277 | return ret; | 1265 | return ret; |
1278 | } | 1266 | } |
1279 | 1267 | ||
@@ -1361,7 +1349,7 @@ static const struct file_operations tun_fops = { | |||
1361 | .write = do_sync_write, | 1349 | .write = do_sync_write, |
1362 | .aio_write = tun_chr_aio_write, | 1350 | .aio_write = tun_chr_aio_write, |
1363 | .poll = tun_chr_poll, | 1351 | .poll = tun_chr_poll, |
1364 | .ioctl = tun_chr_ioctl, | 1352 | .unlocked_ioctl = tun_chr_ioctl, |
1365 | .open = tun_chr_open, | 1353 | .open = tun_chr_open, |
1366 | .release = tun_chr_close, | 1354 | .release = tun_chr_close, |
1367 | .fasync = tun_chr_fasync | 1355 | .fasync = tun_chr_fasync |
diff --git a/drivers/net/ucc_geth.c b/drivers/net/ucc_geth.c index 3b957e6412e..8a7b8c7bd78 100644 --- a/drivers/net/ucc_geth.c +++ b/drivers/net/ucc_geth.c | |||
@@ -3111,10 +3111,11 @@ static int ucc_geth_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
3111 | u8 __iomem *bd; /* BD pointer */ | 3111 | u8 __iomem *bd; /* BD pointer */ |
3112 | u32 bd_status; | 3112 | u32 bd_status; |
3113 | u8 txQ = 0; | 3113 | u8 txQ = 0; |
3114 | unsigned long flags; | ||
3114 | 3115 | ||
3115 | ugeth_vdbg("%s: IN", __func__); | 3116 | ugeth_vdbg("%s: IN", __func__); |
3116 | 3117 | ||
3117 | spin_lock_irq(&ugeth->lock); | 3118 | spin_lock_irqsave(&ugeth->lock, flags); |
3118 | 3119 | ||
3119 | dev->stats.tx_bytes += skb->len; | 3120 | dev->stats.tx_bytes += skb->len; |
3120 | 3121 | ||
@@ -3171,7 +3172,7 @@ static int ucc_geth_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
3171 | uccf = ugeth->uccf; | 3172 | uccf = ugeth->uccf; |
3172 | out_be16(uccf->p_utodr, UCC_FAST_TOD); | 3173 | out_be16(uccf->p_utodr, UCC_FAST_TOD); |
3173 | #endif | 3174 | #endif |
3174 | spin_unlock_irq(&ugeth->lock); | 3175 | spin_unlock_irqrestore(&ugeth->lock, flags); |
3175 | 3176 | ||
3176 | return 0; | 3177 | return 0; |
3177 | } | 3178 | } |
diff --git a/drivers/net/usb/pegasus.h b/drivers/net/usb/pegasus.h index c7467823cd1..f968c834ff6 100644 --- a/drivers/net/usb/pegasus.h +++ b/drivers/net/usb/pegasus.h | |||
@@ -250,6 +250,8 @@ PEGASUS_DEV( "IO DATA USB ET/TX", VENDOR_IODATA, 0x0904, | |||
250 | DEFAULT_GPIO_RESET ) | 250 | DEFAULT_GPIO_RESET ) |
251 | PEGASUS_DEV( "IO DATA USB ET/TX-S", VENDOR_IODATA, 0x0913, | 251 | PEGASUS_DEV( "IO DATA USB ET/TX-S", VENDOR_IODATA, 0x0913, |
252 | DEFAULT_GPIO_RESET | PEGASUS_II ) | 252 | DEFAULT_GPIO_RESET | PEGASUS_II ) |
253 | PEGASUS_DEV( "IO DATA USB ETX-US2", VENDOR_IODATA, 0x092a, | ||
254 | DEFAULT_GPIO_RESET | PEGASUS_II ) | ||
253 | PEGASUS_DEV( "Kingston KNU101TX Ethernet", VENDOR_KINGSTON, 0x000a, | 255 | PEGASUS_DEV( "Kingston KNU101TX Ethernet", VENDOR_KINGSTON, 0x000a, |
254 | DEFAULT_GPIO_RESET) | 256 | DEFAULT_GPIO_RESET) |
255 | PEGASUS_DEV( "LANEED USB Ethernet LD-USB/TX", VENDOR_LANEED, 0x4002, | 257 | PEGASUS_DEV( "LANEED USB Ethernet LD-USB/TX", VENDOR_LANEED, 0x4002, |
diff --git a/drivers/net/via-rhine.c b/drivers/net/via-rhine.c index 88c30a58b4b..934f7671650 100644 --- a/drivers/net/via-rhine.c +++ b/drivers/net/via-rhine.c | |||
@@ -1218,6 +1218,7 @@ static int rhine_start_tx(struct sk_buff *skb, struct net_device *dev) | |||
1218 | struct rhine_private *rp = netdev_priv(dev); | 1218 | struct rhine_private *rp = netdev_priv(dev); |
1219 | void __iomem *ioaddr = rp->base; | 1219 | void __iomem *ioaddr = rp->base; |
1220 | unsigned entry; | 1220 | unsigned entry; |
1221 | unsigned long flags; | ||
1221 | 1222 | ||
1222 | /* Caution: the write order is important here, set the field | 1223 | /* Caution: the write order is important here, set the field |
1223 | with the "ownership" bits last. */ | 1224 | with the "ownership" bits last. */ |
@@ -1261,7 +1262,7 @@ static int rhine_start_tx(struct sk_buff *skb, struct net_device *dev) | |||
1261 | cpu_to_le32(TXDESC | (skb->len >= ETH_ZLEN ? skb->len : ETH_ZLEN)); | 1262 | cpu_to_le32(TXDESC | (skb->len >= ETH_ZLEN ? skb->len : ETH_ZLEN)); |
1262 | 1263 | ||
1263 | /* lock eth irq */ | 1264 | /* lock eth irq */ |
1264 | spin_lock_irq(&rp->lock); | 1265 | spin_lock_irqsave(&rp->lock, flags); |
1265 | wmb(); | 1266 | wmb(); |
1266 | rp->tx_ring[entry].tx_status = cpu_to_le32(DescOwn); | 1267 | rp->tx_ring[entry].tx_status = cpu_to_le32(DescOwn); |
1267 | wmb(); | 1268 | wmb(); |
@@ -1280,7 +1281,7 @@ static int rhine_start_tx(struct sk_buff *skb, struct net_device *dev) | |||
1280 | 1281 | ||
1281 | dev->trans_start = jiffies; | 1282 | dev->trans_start = jiffies; |
1282 | 1283 | ||
1283 | spin_unlock_irq(&rp->lock); | 1284 | spin_unlock_irqrestore(&rp->lock, flags); |
1284 | 1285 | ||
1285 | if (debug > 4) { | 1286 | if (debug > 4) { |
1286 | printk(KERN_DEBUG "%s: Transmit frame #%d queued in slot %d.\n", | 1287 | printk(KERN_DEBUG "%s: Transmit frame #%d queued in slot %d.\n", |
diff --git a/drivers/net/via-velocity.c b/drivers/net/via-velocity.c index 3ba35956327..cee08a1e497 100644 --- a/drivers/net/via-velocity.c +++ b/drivers/net/via-velocity.c | |||
@@ -1778,7 +1778,7 @@ static void velocity_error(struct velocity_info *vptr, int status) | |||
1778 | * mode | 1778 | * mode |
1779 | */ | 1779 | */ |
1780 | if (vptr->rev_id < REV_ID_VT3216_A0) { | 1780 | if (vptr->rev_id < REV_ID_VT3216_A0) { |
1781 | if (vptr->mii_status | VELOCITY_DUPLEX_FULL) | 1781 | if (vptr->mii_status & VELOCITY_DUPLEX_FULL) |
1782 | BYTE_REG_BITS_ON(TCR_TB2BDIS, ®s->TCR); | 1782 | BYTE_REG_BITS_ON(TCR_TB2BDIS, ®s->TCR); |
1783 | else | 1783 | else |
1784 | BYTE_REG_BITS_OFF(TCR_TB2BDIS, ®s->TCR); | 1784 | BYTE_REG_BITS_OFF(TCR_TB2BDIS, ®s->TCR); |
diff --git a/drivers/net/wireless/ath/ar9170/main.c b/drivers/net/wireless/ath/ar9170/main.c index 9d38cf60a0d..88c3d857386 100644 --- a/drivers/net/wireless/ath/ar9170/main.c +++ b/drivers/net/wireless/ath/ar9170/main.c | |||
@@ -1967,13 +1967,14 @@ static int ar9170_conf_tx(struct ieee80211_hw *hw, u16 queue, | |||
1967 | int ret; | 1967 | int ret; |
1968 | 1968 | ||
1969 | mutex_lock(&ar->mutex); | 1969 | mutex_lock(&ar->mutex); |
1970 | if ((param) && !(queue > __AR9170_NUM_TXQ)) { | 1970 | if (queue < __AR9170_NUM_TXQ) { |
1971 | memcpy(&ar->edcf[ar9170_qos_hwmap[queue]], | 1971 | memcpy(&ar->edcf[ar9170_qos_hwmap[queue]], |
1972 | param, sizeof(*param)); | 1972 | param, sizeof(*param)); |
1973 | 1973 | ||
1974 | ret = ar9170_set_qos(ar); | 1974 | ret = ar9170_set_qos(ar); |
1975 | } else | 1975 | } else { |
1976 | ret = -EINVAL; | 1976 | ret = -EINVAL; |
1977 | } | ||
1977 | 1978 | ||
1978 | mutex_unlock(&ar->mutex); | 1979 | mutex_unlock(&ar->mutex); |
1979 | return ret; | 1980 | return ret; |
diff --git a/drivers/net/wireless/ath/ar9170/usb.c b/drivers/net/wireless/ath/ar9170/usb.c index 754b1f8d8da..007eb85fc67 100644 --- a/drivers/net/wireless/ath/ar9170/usb.c +++ b/drivers/net/wireless/ath/ar9170/usb.c | |||
@@ -598,11 +598,15 @@ static int ar9170_usb_request_firmware(struct ar9170_usb *aru) | |||
598 | 598 | ||
599 | err = request_firmware(&aru->init_values, "ar9170-1.fw", | 599 | err = request_firmware(&aru->init_values, "ar9170-1.fw", |
600 | &aru->udev->dev); | 600 | &aru->udev->dev); |
601 | if (err) { | ||
602 | dev_err(&aru->udev->dev, "file with init values not found.\n"); | ||
603 | return err; | ||
604 | } | ||
601 | 605 | ||
602 | err = request_firmware(&aru->firmware, "ar9170-2.fw", &aru->udev->dev); | 606 | err = request_firmware(&aru->firmware, "ar9170-2.fw", &aru->udev->dev); |
603 | if (err) { | 607 | if (err) { |
604 | release_firmware(aru->init_values); | 608 | release_firmware(aru->init_values); |
605 | dev_err(&aru->udev->dev, "file with init values not found.\n"); | 609 | dev_err(&aru->udev->dev, "firmware file not found.\n"); |
606 | return err; | 610 | return err; |
607 | } | 611 | } |
608 | 612 | ||
diff --git a/drivers/net/wireless/ipw2x00/ipw2200.c b/drivers/net/wireless/ipw2x00/ipw2200.c index 44c29b3f672..6dcac73b4d2 100644 --- a/drivers/net/wireless/ipw2x00/ipw2200.c +++ b/drivers/net/wireless/ipw2x00/ipw2200.c | |||
@@ -6226,7 +6226,7 @@ static void ipw_add_scan_channels(struct ipw_priv *priv, | |||
6226 | }; | 6226 | }; |
6227 | 6227 | ||
6228 | u8 channel; | 6228 | u8 channel; |
6229 | while (channel_index < IPW_SCAN_CHANNELS) { | 6229 | while (channel_index < IPW_SCAN_CHANNELS - 1) { |
6230 | channel = | 6230 | channel = |
6231 | priv->speed_scan[priv->speed_scan_pos]; | 6231 | priv->speed_scan[priv->speed_scan_pos]; |
6232 | if (channel == 0) { | 6232 | if (channel == 0) { |
diff --git a/drivers/net/wireless/libertas/assoc.c b/drivers/net/wireless/libertas/assoc.c index d6997371c27..b9b37411903 100644 --- a/drivers/net/wireless/libertas/assoc.c +++ b/drivers/net/wireless/libertas/assoc.c | |||
@@ -1,7 +1,6 @@ | |||
1 | /* Copyright (C) 2006, Red Hat, Inc. */ | 1 | /* Copyright (C) 2006, Red Hat, Inc. */ |
2 | 2 | ||
3 | #include <linux/types.h> | 3 | #include <linux/types.h> |
4 | #include <linux/kernel.h> | ||
5 | #include <linux/etherdevice.h> | 4 | #include <linux/etherdevice.h> |
6 | #include <linux/ieee80211.h> | 5 | #include <linux/ieee80211.h> |
7 | #include <linux/if_arp.h> | 6 | #include <linux/if_arp.h> |
@@ -44,21 +43,21 @@ static int get_common_rates(struct lbs_private *priv, | |||
44 | u16 *rates_size) | 43 | u16 *rates_size) |
45 | { | 44 | { |
46 | u8 *card_rates = lbs_bg_rates; | 45 | u8 *card_rates = lbs_bg_rates; |
46 | size_t num_card_rates = sizeof(lbs_bg_rates); | ||
47 | int ret = 0, i, j; | 47 | int ret = 0, i, j; |
48 | u8 tmp[(ARRAY_SIZE(lbs_bg_rates) - 1) * (*rates_size - 1)]; | 48 | u8 tmp[30]; |
49 | size_t tmp_size = 0; | 49 | size_t tmp_size = 0; |
50 | 50 | ||
51 | /* For each rate in card_rates that exists in rate1, copy to tmp */ | 51 | /* For each rate in card_rates that exists in rate1, copy to tmp */ |
52 | for (i = 0; i < ARRAY_SIZE(lbs_bg_rates) && card_rates[i]; i++) { | 52 | for (i = 0; card_rates[i] && (i < num_card_rates); i++) { |
53 | for (j = 0; j < *rates_size && rates[j]; j++) { | 53 | for (j = 0; rates[j] && (j < *rates_size); j++) { |
54 | if (rates[j] == card_rates[i]) | 54 | if (rates[j] == card_rates[i]) |
55 | tmp[tmp_size++] = card_rates[i]; | 55 | tmp[tmp_size++] = card_rates[i]; |
56 | } | 56 | } |
57 | } | 57 | } |
58 | 58 | ||
59 | lbs_deb_hex(LBS_DEB_JOIN, "AP rates ", rates, *rates_size); | 59 | lbs_deb_hex(LBS_DEB_JOIN, "AP rates ", rates, *rates_size); |
60 | lbs_deb_hex(LBS_DEB_JOIN, "card rates ", card_rates, | 60 | lbs_deb_hex(LBS_DEB_JOIN, "card rates ", card_rates, num_card_rates); |
61 | ARRAY_SIZE(lbs_bg_rates)); | ||
62 | lbs_deb_hex(LBS_DEB_JOIN, "common rates", tmp, tmp_size); | 61 | lbs_deb_hex(LBS_DEB_JOIN, "common rates", tmp, tmp_size); |
63 | lbs_deb_join("TX data rate 0x%02x\n", priv->cur_rate); | 62 | lbs_deb_join("TX data rate 0x%02x\n", priv->cur_rate); |
64 | 63 | ||
@@ -70,7 +69,10 @@ static int get_common_rates(struct lbs_private *priv, | |||
70 | lbs_pr_alert("Previously set fixed data rate %#x isn't " | 69 | lbs_pr_alert("Previously set fixed data rate %#x isn't " |
71 | "compatible with the network.\n", priv->cur_rate); | 70 | "compatible with the network.\n", priv->cur_rate); |
72 | ret = -1; | 71 | ret = -1; |
72 | goto done; | ||
73 | } | 73 | } |
74 | ret = 0; | ||
75 | |||
74 | done: | 76 | done: |
75 | memset(rates, 0, *rates_size); | 77 | memset(rates, 0, *rates_size); |
76 | *rates_size = min_t(int, tmp_size, *rates_size); | 78 | *rates_size = min_t(int, tmp_size, *rates_size); |
@@ -320,7 +322,7 @@ static int lbs_associate(struct lbs_private *priv, | |||
320 | rates = (struct mrvl_ie_rates_param_set *) pos; | 322 | rates = (struct mrvl_ie_rates_param_set *) pos; |
321 | rates->header.type = cpu_to_le16(TLV_TYPE_RATES); | 323 | rates->header.type = cpu_to_le16(TLV_TYPE_RATES); |
322 | memcpy(&rates->rates, &bss->rates, MAX_RATES); | 324 | memcpy(&rates->rates, &bss->rates, MAX_RATES); |
323 | tmplen = min_t(u16, ARRAY_SIZE(rates->rates), MAX_RATES); | 325 | tmplen = MAX_RATES; |
324 | if (get_common_rates(priv, rates->rates, &tmplen)) { | 326 | if (get_common_rates(priv, rates->rates, &tmplen)) { |
325 | ret = -1; | 327 | ret = -1; |
326 | goto done; | 328 | goto done; |
@@ -596,7 +598,7 @@ static int lbs_adhoc_join(struct lbs_private *priv, | |||
596 | 598 | ||
597 | /* Copy Data rates from the rates recorded in scan response */ | 599 | /* Copy Data rates from the rates recorded in scan response */ |
598 | memset(cmd.bss.rates, 0, sizeof(cmd.bss.rates)); | 600 | memset(cmd.bss.rates, 0, sizeof(cmd.bss.rates)); |
599 | ratesize = min_t(u16, ARRAY_SIZE(cmd.bss.rates), MAX_RATES); | 601 | ratesize = min_t(u16, sizeof(cmd.bss.rates), MAX_RATES); |
600 | memcpy(cmd.bss.rates, bss->rates, ratesize); | 602 | memcpy(cmd.bss.rates, bss->rates, ratesize); |
601 | if (get_common_rates(priv, cmd.bss.rates, &ratesize)) { | 603 | if (get_common_rates(priv, cmd.bss.rates, &ratesize)) { |
602 | lbs_deb_join("ADHOC_JOIN: get_common_rates returned error.\n"); | 604 | lbs_deb_join("ADHOC_JOIN: get_common_rates returned error.\n"); |
diff --git a/drivers/net/wireless/libertas/hostcmd.h b/drivers/net/wireless/libertas/hostcmd.h index 0a2e29140ad..c8a1998d474 100644 --- a/drivers/net/wireless/libertas/hostcmd.h +++ b/drivers/net/wireless/libertas/hostcmd.h | |||
@@ -56,8 +56,8 @@ struct rxpd { | |||
56 | u8 bss_type; | 56 | u8 bss_type; |
57 | /* BSS number */ | 57 | /* BSS number */ |
58 | u8 bss_num; | 58 | u8 bss_num; |
59 | } bss; | 59 | } __attribute__ ((packed)) bss; |
60 | } u; | 60 | } __attribute__ ((packed)) u; |
61 | 61 | ||
62 | /* SNR */ | 62 | /* SNR */ |
63 | u8 snr; | 63 | u8 snr; |
diff --git a/drivers/net/wireless/mwl8k.c b/drivers/net/wireless/mwl8k.c index a263d5c84c0..83967afe082 100644 --- a/drivers/net/wireless/mwl8k.c +++ b/drivers/net/wireless/mwl8k.c | |||
@@ -261,7 +261,7 @@ struct mwl8k_vif { | |||
261 | */ | 261 | */ |
262 | }; | 262 | }; |
263 | 263 | ||
264 | #define MWL8K_VIF(_vif) (struct mwl8k_vif *)(&((_vif)->drv_priv)) | 264 | #define MWL8K_VIF(_vif) ((struct mwl8k_vif *)&((_vif)->drv_priv)) |
265 | 265 | ||
266 | static const struct ieee80211_channel mwl8k_channels[] = { | 266 | static const struct ieee80211_channel mwl8k_channels[] = { |
267 | { .center_freq = 2412, .hw_value = 1, }, | 267 | { .center_freq = 2412, .hw_value = 1, }, |
@@ -1012,6 +1012,8 @@ static int rxq_process(struct ieee80211_hw *hw, int index, int limit) | |||
1012 | rmb(); | 1012 | rmb(); |
1013 | 1013 | ||
1014 | skb = rxq->rx_skb[rxq->rx_head]; | 1014 | skb = rxq->rx_skb[rxq->rx_head]; |
1015 | if (skb == NULL) | ||
1016 | break; | ||
1015 | rxq->rx_skb[rxq->rx_head] = NULL; | 1017 | rxq->rx_skb[rxq->rx_head] = NULL; |
1016 | 1018 | ||
1017 | rxq->rx_head = (rxq->rx_head + 1) % MWL8K_RX_DESCS; | 1019 | rxq->rx_head = (rxq->rx_head + 1) % MWL8K_RX_DESCS; |
@@ -1591,6 +1593,9 @@ static int mwl8k_post_cmd(struct ieee80211_hw *hw, struct mwl8k_cmd_pkt *cmd) | |||
1591 | timeout = wait_for_completion_timeout(&cmd_wait, | 1593 | timeout = wait_for_completion_timeout(&cmd_wait, |
1592 | msecs_to_jiffies(MWL8K_CMD_TIMEOUT_MS)); | 1594 | msecs_to_jiffies(MWL8K_CMD_TIMEOUT_MS)); |
1593 | 1595 | ||
1596 | pci_unmap_single(priv->pdev, dma_addr, dma_size, | ||
1597 | PCI_DMA_BIDIRECTIONAL); | ||
1598 | |||
1594 | result = &cmd->result; | 1599 | result = &cmd->result; |
1595 | if (!timeout) { | 1600 | if (!timeout) { |
1596 | spin_lock_irq(&priv->fw_lock); | 1601 | spin_lock_irq(&priv->fw_lock); |
@@ -1610,8 +1615,6 @@ static int mwl8k_post_cmd(struct ieee80211_hw *hw, struct mwl8k_cmd_pkt *cmd) | |||
1610 | *result); | 1615 | *result); |
1611 | } | 1616 | } |
1612 | 1617 | ||
1613 | pci_unmap_single(priv->pdev, dma_addr, dma_size, | ||
1614 | PCI_DMA_BIDIRECTIONAL); | ||
1615 | return rc; | 1618 | return rc; |
1616 | } | 1619 | } |
1617 | 1620 | ||
@@ -1654,18 +1657,18 @@ static int mwl8k_cmd_get_hw_spec(struct ieee80211_hw *hw) | |||
1654 | memset(cmd->perm_addr, 0xff, sizeof(cmd->perm_addr)); | 1657 | memset(cmd->perm_addr, 0xff, sizeof(cmd->perm_addr)); |
1655 | cmd->ps_cookie = cpu_to_le32(priv->cookie_dma); | 1658 | cmd->ps_cookie = cpu_to_le32(priv->cookie_dma); |
1656 | cmd->rx_queue_ptr = cpu_to_le32(priv->rxq[0].rx_desc_dma); | 1659 | cmd->rx_queue_ptr = cpu_to_le32(priv->rxq[0].rx_desc_dma); |
1657 | cmd->num_tx_queues = MWL8K_TX_QUEUES; | 1660 | cmd->num_tx_queues = cpu_to_le32(MWL8K_TX_QUEUES); |
1658 | for (i = 0; i < MWL8K_TX_QUEUES; i++) | 1661 | for (i = 0; i < MWL8K_TX_QUEUES; i++) |
1659 | cmd->tx_queue_ptrs[i] = cpu_to_le32(priv->txq[i].tx_desc_dma); | 1662 | cmd->tx_queue_ptrs[i] = cpu_to_le32(priv->txq[i].tx_desc_dma); |
1660 | cmd->num_tx_desc_per_queue = MWL8K_TX_DESCS; | 1663 | cmd->num_tx_desc_per_queue = cpu_to_le32(MWL8K_TX_DESCS); |
1661 | cmd->total_rx_desc = MWL8K_RX_DESCS; | 1664 | cmd->total_rx_desc = cpu_to_le32(MWL8K_RX_DESCS); |
1662 | 1665 | ||
1663 | rc = mwl8k_post_cmd(hw, &cmd->header); | 1666 | rc = mwl8k_post_cmd(hw, &cmd->header); |
1664 | 1667 | ||
1665 | if (!rc) { | 1668 | if (!rc) { |
1666 | SET_IEEE80211_PERM_ADDR(hw, cmd->perm_addr); | 1669 | SET_IEEE80211_PERM_ADDR(hw, cmd->perm_addr); |
1667 | priv->num_mcaddrs = le16_to_cpu(cmd->num_mcaddrs); | 1670 | priv->num_mcaddrs = le16_to_cpu(cmd->num_mcaddrs); |
1668 | priv->fw_rev = cmd->fw_rev; | 1671 | priv->fw_rev = le32_to_cpu(cmd->fw_rev); |
1669 | priv->hw_rev = cmd->hw_rev; | 1672 | priv->hw_rev = cmd->hw_rev; |
1670 | priv->region_code = le16_to_cpu(cmd->region_code); | 1673 | priv->region_code = le16_to_cpu(cmd->region_code); |
1671 | } | 1674 | } |
@@ -3216,15 +3219,19 @@ static int mwl8k_configure_filter_wt(struct work_struct *wt) | |||
3216 | struct dev_addr_list *mclist = worker->mclist; | 3219 | struct dev_addr_list *mclist = worker->mclist; |
3217 | 3220 | ||
3218 | struct mwl8k_priv *priv = hw->priv; | 3221 | struct mwl8k_priv *priv = hw->priv; |
3219 | struct mwl8k_vif *mv_vif; | ||
3220 | int rc = 0; | 3222 | int rc = 0; |
3221 | 3223 | ||
3222 | if (changed_flags & FIF_BCN_PRBRESP_PROMISC) { | 3224 | if (changed_flags & FIF_BCN_PRBRESP_PROMISC) { |
3223 | if (*total_flags & FIF_BCN_PRBRESP_PROMISC) | 3225 | if (*total_flags & FIF_BCN_PRBRESP_PROMISC) |
3224 | rc = mwl8k_cmd_set_pre_scan(hw); | 3226 | rc = mwl8k_cmd_set_pre_scan(hw); |
3225 | else { | 3227 | else { |
3226 | mv_vif = MWL8K_VIF(priv->vif); | 3228 | u8 *bssid; |
3227 | rc = mwl8k_cmd_set_post_scan(hw, mv_vif->bssid); | 3229 | |
3230 | bssid = "\x00\x00\x00\x00\x00\x00"; | ||
3231 | if (priv->vif != NULL) | ||
3232 | bssid = MWL8K_VIF(priv->vif)->bssid; | ||
3233 | |||
3234 | rc = mwl8k_cmd_set_post_scan(hw, bssid); | ||
3228 | } | 3235 | } |
3229 | } | 3236 | } |
3230 | 3237 | ||
@@ -3726,6 +3733,8 @@ static void __devexit mwl8k_remove(struct pci_dev *pdev) | |||
3726 | 3733 | ||
3727 | ieee80211_stop_queues(hw); | 3734 | ieee80211_stop_queues(hw); |
3728 | 3735 | ||
3736 | ieee80211_unregister_hw(hw); | ||
3737 | |||
3729 | /* Remove tx reclaim tasklet */ | 3738 | /* Remove tx reclaim tasklet */ |
3730 | tasklet_kill(&priv->tx_reclaim_task); | 3739 | tasklet_kill(&priv->tx_reclaim_task); |
3731 | 3740 | ||
@@ -3739,8 +3748,6 @@ static void __devexit mwl8k_remove(struct pci_dev *pdev) | |||
3739 | for (i = 0; i < MWL8K_TX_QUEUES; i++) | 3748 | for (i = 0; i < MWL8K_TX_QUEUES; i++) |
3740 | mwl8k_txq_reclaim(hw, i, 1); | 3749 | mwl8k_txq_reclaim(hw, i, 1); |
3741 | 3750 | ||
3742 | ieee80211_unregister_hw(hw); | ||
3743 | |||
3744 | for (i = 0; i < MWL8K_TX_QUEUES; i++) | 3751 | for (i = 0; i < MWL8K_TX_QUEUES; i++) |
3745 | mwl8k_txq_deinit(hw, i); | 3752 | mwl8k_txq_deinit(hw, i); |
3746 | 3753 | ||
diff --git a/drivers/net/wireless/rt2x00/rt2x00.h b/drivers/net/wireless/rt2x00/rt2x00.h index a498dde024e..49c9e2c1433 100644 --- a/drivers/net/wireless/rt2x00/rt2x00.h +++ b/drivers/net/wireless/rt2x00/rt2x00.h | |||
@@ -849,13 +849,15 @@ struct rt2x00_dev { | |||
849 | static inline void rt2x00_rf_read(struct rt2x00_dev *rt2x00dev, | 849 | static inline void rt2x00_rf_read(struct rt2x00_dev *rt2x00dev, |
850 | const unsigned int word, u32 *data) | 850 | const unsigned int word, u32 *data) |
851 | { | 851 | { |
852 | *data = rt2x00dev->rf[word]; | 852 | BUG_ON(word < 1 || word > rt2x00dev->ops->rf_size / sizeof(u32)); |
853 | *data = rt2x00dev->rf[word - 1]; | ||
853 | } | 854 | } |
854 | 855 | ||
855 | static inline void rt2x00_rf_write(struct rt2x00_dev *rt2x00dev, | 856 | static inline void rt2x00_rf_write(struct rt2x00_dev *rt2x00dev, |
856 | const unsigned int word, u32 data) | 857 | const unsigned int word, u32 data) |
857 | { | 858 | { |
858 | rt2x00dev->rf[word] = data; | 859 | BUG_ON(word < 1 || word > rt2x00dev->ops->rf_size / sizeof(u32)); |
860 | rt2x00dev->rf[word - 1] = data; | ||
859 | } | 861 | } |
860 | 862 | ||
861 | /* | 863 | /* |
diff --git a/drivers/net/zorro8390.c b/drivers/net/zorro8390.c index 37c84e3b8be..81c753a617a 100644 --- a/drivers/net/zorro8390.c +++ b/drivers/net/zorro8390.c | |||
@@ -120,6 +120,9 @@ static int __devinit zorro8390_init_one(struct zorro_dev *z, | |||
120 | for (i = ARRAY_SIZE(cards)-1; i >= 0; i--) | 120 | for (i = ARRAY_SIZE(cards)-1; i >= 0; i--) |
121 | if (z->id == cards[i].id) | 121 | if (z->id == cards[i].id) |
122 | break; | 122 | break; |
123 | if (i < 0) | ||
124 | return -ENODEV; | ||
125 | |||
123 | board = z->resource.start; | 126 | board = z->resource.start; |
124 | ioaddr = board+cards[i].offset; | 127 | ioaddr = board+cards[i].offset; |
125 | dev = alloc_ei_netdev(); | 128 | dev = alloc_ei_netdev(); |
diff --git a/drivers/spi/spi_s3c24xx.c b/drivers/spi/spi_s3c24xx.c index e0d44af4745..3f3119d760d 100644 --- a/drivers/spi/spi_s3c24xx.c +++ b/drivers/spi/spi_s3c24xx.c | |||
@@ -111,29 +111,32 @@ static int s3c24xx_spi_setupxfer(struct spi_device *spi, | |||
111 | unsigned int bpw; | 111 | unsigned int bpw; |
112 | unsigned int hz; | 112 | unsigned int hz; |
113 | unsigned int div; | 113 | unsigned int div; |
114 | unsigned long clk; | ||
114 | 115 | ||
115 | bpw = t ? t->bits_per_word : spi->bits_per_word; | 116 | bpw = t ? t->bits_per_word : spi->bits_per_word; |
116 | hz = t ? t->speed_hz : spi->max_speed_hz; | 117 | hz = t ? t->speed_hz : spi->max_speed_hz; |
117 | 118 | ||
119 | if (!bpw) | ||
120 | bpw = 8; | ||
121 | |||
122 | if (!hz) | ||
123 | hz = spi->max_speed_hz; | ||
124 | |||
118 | if (bpw != 8) { | 125 | if (bpw != 8) { |
119 | dev_err(&spi->dev, "invalid bits-per-word (%d)\n", bpw); | 126 | dev_err(&spi->dev, "invalid bits-per-word (%d)\n", bpw); |
120 | return -EINVAL; | 127 | return -EINVAL; |
121 | } | 128 | } |
122 | 129 | ||
123 | div = clk_get_rate(hw->clk) / hz; | 130 | clk = clk_get_rate(hw->clk); |
124 | 131 | div = DIV_ROUND_UP(clk, hz * 2) - 1; | |
125 | /* is clk = pclk / (2 * (pre+1)), or is it | ||
126 | * clk = (pclk * 2) / ( pre + 1) */ | ||
127 | |||
128 | div /= 2; | ||
129 | |||
130 | if (div > 0) | ||
131 | div -= 1; | ||
132 | 132 | ||
133 | if (div > 255) | 133 | if (div > 255) |
134 | div = 255; | 134 | div = 255; |
135 | 135 | ||
136 | dev_dbg(&spi->dev, "setting pre-scaler to %d (hz %d)\n", div, hz); | 136 | dev_dbg(&spi->dev, "setting pre-scaler to %d (wanted %d, got %ld)\n", |
137 | div, hz, clk / (2 * (div + 1))); | ||
138 | |||
139 | |||
137 | writeb(div, hw->regs + S3C2410_SPPRE); | 140 | writeb(div, hw->regs + S3C2410_SPPRE); |
138 | 141 | ||
139 | spin_lock(&hw->bitbang.lock); | 142 | spin_lock(&hw->bitbang.lock); |
diff --git a/drivers/video/sh_mobile_lcdcfb.c b/drivers/video/sh_mobile_lcdcfb.c index 8f24564f77b..07f22b62563 100644 --- a/drivers/video/sh_mobile_lcdcfb.c +++ b/drivers/video/sh_mobile_lcdcfb.c | |||
@@ -481,6 +481,9 @@ static int sh_mobile_lcdc_start(struct sh_mobile_lcdc_priv *priv) | |||
481 | /* tell the board code to enable the panel */ | 481 | /* tell the board code to enable the panel */ |
482 | for (k = 0; k < ARRAY_SIZE(priv->ch); k++) { | 482 | for (k = 0; k < ARRAY_SIZE(priv->ch); k++) { |
483 | ch = &priv->ch[k]; | 483 | ch = &priv->ch[k]; |
484 | if (!ch->enabled) | ||
485 | continue; | ||
486 | |||
484 | board_cfg = &ch->cfg.board_cfg; | 487 | board_cfg = &ch->cfg.board_cfg; |
485 | if (board_cfg->display_on) | 488 | if (board_cfg->display_on) |
486 | board_cfg->display_on(board_cfg->board_data); | 489 | board_cfg->display_on(board_cfg->board_data); |
@@ -498,6 +501,8 @@ static void sh_mobile_lcdc_stop(struct sh_mobile_lcdc_priv *priv) | |||
498 | /* clean up deferred io and ask board code to disable panel */ | 501 | /* clean up deferred io and ask board code to disable panel */ |
499 | for (k = 0; k < ARRAY_SIZE(priv->ch); k++) { | 502 | for (k = 0; k < ARRAY_SIZE(priv->ch); k++) { |
500 | ch = &priv->ch[k]; | 503 | ch = &priv->ch[k]; |
504 | if (!ch->enabled) | ||
505 | continue; | ||
501 | 506 | ||
502 | /* deferred io mode: | 507 | /* deferred io mode: |
503 | * flush frame, and wait for frame end interrupt | 508 | * flush frame, and wait for frame end interrupt |
diff --git a/fs/libfs.c b/fs/libfs.c index ddfa89948c3..dcec3d3ea64 100644 --- a/fs/libfs.c +++ b/fs/libfs.c | |||
@@ -217,7 +217,7 @@ int get_sb_pseudo(struct file_system_type *fs_type, char *name, | |||
217 | return PTR_ERR(s); | 217 | return PTR_ERR(s); |
218 | 218 | ||
219 | s->s_flags = MS_NOUSER; | 219 | s->s_flags = MS_NOUSER; |
220 | s->s_maxbytes = ~0ULL; | 220 | s->s_maxbytes = MAX_LFS_FILESIZE; |
221 | s->s_blocksize = PAGE_SIZE; | 221 | s->s_blocksize = PAGE_SIZE; |
222 | s->s_blocksize_bits = PAGE_SHIFT; | 222 | s->s_blocksize_bits = PAGE_SHIFT; |
223 | s->s_magic = magic; | 223 | s->s_magic = magic; |
diff --git a/fs/proc/base.c b/fs/proc/base.c index 175db258942..6f742f6658a 100644 --- a/fs/proc/base.c +++ b/fs/proc/base.c | |||
@@ -1003,12 +1003,7 @@ static ssize_t oom_adjust_read(struct file *file, char __user *buf, | |||
1003 | 1003 | ||
1004 | if (!task) | 1004 | if (!task) |
1005 | return -ESRCH; | 1005 | return -ESRCH; |
1006 | task_lock(task); | 1006 | oom_adjust = task->oomkilladj; |
1007 | if (task->mm) | ||
1008 | oom_adjust = task->mm->oom_adj; | ||
1009 | else | ||
1010 | oom_adjust = OOM_DISABLE; | ||
1011 | task_unlock(task); | ||
1012 | put_task_struct(task); | 1007 | put_task_struct(task); |
1013 | 1008 | ||
1014 | len = snprintf(buffer, sizeof(buffer), "%i\n", oom_adjust); | 1009 | len = snprintf(buffer, sizeof(buffer), "%i\n", oom_adjust); |
@@ -1037,19 +1032,11 @@ static ssize_t oom_adjust_write(struct file *file, const char __user *buf, | |||
1037 | task = get_proc_task(file->f_path.dentry->d_inode); | 1032 | task = get_proc_task(file->f_path.dentry->d_inode); |
1038 | if (!task) | 1033 | if (!task) |
1039 | return -ESRCH; | 1034 | return -ESRCH; |
1040 | task_lock(task); | 1035 | if (oom_adjust < task->oomkilladj && !capable(CAP_SYS_RESOURCE)) { |
1041 | if (!task->mm) { | ||
1042 | task_unlock(task); | ||
1043 | put_task_struct(task); | ||
1044 | return -EINVAL; | ||
1045 | } | ||
1046 | if (oom_adjust < task->mm->oom_adj && !capable(CAP_SYS_RESOURCE)) { | ||
1047 | task_unlock(task); | ||
1048 | put_task_struct(task); | 1036 | put_task_struct(task); |
1049 | return -EACCES; | 1037 | return -EACCES; |
1050 | } | 1038 | } |
1051 | task->mm->oom_adj = oom_adjust; | 1039 | task->oomkilladj = oom_adjust; |
1052 | task_unlock(task); | ||
1053 | put_task_struct(task); | 1040 | put_task_struct(task); |
1054 | if (end - buffer == 0) | 1041 | if (end - buffer == 0) |
1055 | return -EIO; | 1042 | return -EIO; |
diff --git a/include/linux/gen_stats.h b/include/linux/gen_stats.h index 0ffa41df0ee..710e901085d 100644 --- a/include/linux/gen_stats.h +++ b/include/linux/gen_stats.h | |||
@@ -22,6 +22,11 @@ struct gnet_stats_basic | |||
22 | { | 22 | { |
23 | __u64 bytes; | 23 | __u64 bytes; |
24 | __u32 packets; | 24 | __u32 packets; |
25 | }; | ||
26 | struct gnet_stats_basic_packed | ||
27 | { | ||
28 | __u64 bytes; | ||
29 | __u32 packets; | ||
25 | } __attribute__ ((packed)); | 30 | } __attribute__ ((packed)); |
26 | 31 | ||
27 | /** | 32 | /** |
diff --git a/include/linux/mm_types.h b/include/linux/mm_types.h index 7acc8439d9b..0042090a4d7 100644 --- a/include/linux/mm_types.h +++ b/include/linux/mm_types.h | |||
@@ -240,8 +240,6 @@ struct mm_struct { | |||
240 | 240 | ||
241 | unsigned long saved_auxv[AT_VECTOR_SIZE]; /* for /proc/PID/auxv */ | 241 | unsigned long saved_auxv[AT_VECTOR_SIZE]; /* for /proc/PID/auxv */ |
242 | 242 | ||
243 | s8 oom_adj; /* OOM kill score adjustment (bit shift) */ | ||
244 | |||
245 | cpumask_t cpu_vm_mask; | 243 | cpumask_t cpu_vm_mask; |
246 | 244 | ||
247 | /* Architecture-specific MM context */ | 245 | /* Architecture-specific MM context */ |
diff --git a/include/linux/sched.h b/include/linux/sched.h index 3ab08e4bb6b..0f1ea4a6695 100644 --- a/include/linux/sched.h +++ b/include/linux/sched.h | |||
@@ -1198,6 +1198,7 @@ struct task_struct { | |||
1198 | * a short time | 1198 | * a short time |
1199 | */ | 1199 | */ |
1200 | unsigned char fpu_counter; | 1200 | unsigned char fpu_counter; |
1201 | s8 oomkilladj; /* OOM kill score adjustment (bit shift). */ | ||
1201 | #ifdef CONFIG_BLK_DEV_IO_TRACE | 1202 | #ifdef CONFIG_BLK_DEV_IO_TRACE |
1202 | unsigned int btrace_seq; | 1203 | unsigned int btrace_seq; |
1203 | #endif | 1204 | #endif |
diff --git a/include/net/act_api.h b/include/net/act_api.h index 565eed8fe49..c05fd717c58 100644 --- a/include/net/act_api.h +++ b/include/net/act_api.h | |||
@@ -16,7 +16,7 @@ struct tcf_common { | |||
16 | u32 tcfc_capab; | 16 | u32 tcfc_capab; |
17 | int tcfc_action; | 17 | int tcfc_action; |
18 | struct tcf_t tcfc_tm; | 18 | struct tcf_t tcfc_tm; |
19 | struct gnet_stats_basic tcfc_bstats; | 19 | struct gnet_stats_basic_packed tcfc_bstats; |
20 | struct gnet_stats_queue tcfc_qstats; | 20 | struct gnet_stats_queue tcfc_qstats; |
21 | struct gnet_stats_rate_est tcfc_rate_est; | 21 | struct gnet_stats_rate_est tcfc_rate_est; |
22 | spinlock_t tcfc_lock; | 22 | spinlock_t tcfc_lock; |
diff --git a/include/net/gen_stats.h b/include/net/gen_stats.h index d136b5240ef..c1488553e34 100644 --- a/include/net/gen_stats.h +++ b/include/net/gen_stats.h | |||
@@ -28,7 +28,7 @@ extern int gnet_stats_start_copy_compat(struct sk_buff *skb, int type, | |||
28 | spinlock_t *lock, struct gnet_dump *d); | 28 | spinlock_t *lock, struct gnet_dump *d); |
29 | 29 | ||
30 | extern int gnet_stats_copy_basic(struct gnet_dump *d, | 30 | extern int gnet_stats_copy_basic(struct gnet_dump *d, |
31 | struct gnet_stats_basic *b); | 31 | struct gnet_stats_basic_packed *b); |
32 | extern int gnet_stats_copy_rate_est(struct gnet_dump *d, | 32 | extern int gnet_stats_copy_rate_est(struct gnet_dump *d, |
33 | struct gnet_stats_rate_est *r); | 33 | struct gnet_stats_rate_est *r); |
34 | extern int gnet_stats_copy_queue(struct gnet_dump *d, | 34 | extern int gnet_stats_copy_queue(struct gnet_dump *d, |
@@ -37,14 +37,14 @@ extern int gnet_stats_copy_app(struct gnet_dump *d, void *st, int len); | |||
37 | 37 | ||
38 | extern int gnet_stats_finish_copy(struct gnet_dump *d); | 38 | extern int gnet_stats_finish_copy(struct gnet_dump *d); |
39 | 39 | ||
40 | extern int gen_new_estimator(struct gnet_stats_basic *bstats, | 40 | extern int gen_new_estimator(struct gnet_stats_basic_packed *bstats, |
41 | struct gnet_stats_rate_est *rate_est, | 41 | struct gnet_stats_rate_est *rate_est, |
42 | spinlock_t *stats_lock, struct nlattr *opt); | 42 | spinlock_t *stats_lock, struct nlattr *opt); |
43 | extern void gen_kill_estimator(struct gnet_stats_basic *bstats, | 43 | extern void gen_kill_estimator(struct gnet_stats_basic_packed *bstats, |
44 | struct gnet_stats_rate_est *rate_est); | 44 | struct gnet_stats_rate_est *rate_est); |
45 | extern int gen_replace_estimator(struct gnet_stats_basic *bstats, | 45 | extern int gen_replace_estimator(struct gnet_stats_basic_packed *bstats, |
46 | struct gnet_stats_rate_est *rate_est, | 46 | struct gnet_stats_rate_est *rate_est, |
47 | spinlock_t *stats_lock, struct nlattr *opt); | 47 | spinlock_t *stats_lock, struct nlattr *opt); |
48 | extern bool gen_estimator_active(const struct gnet_stats_basic *bstats, | 48 | extern bool gen_estimator_active(const struct gnet_stats_basic_packed *bstats, |
49 | const struct gnet_stats_rate_est *rate_est); | 49 | const struct gnet_stats_rate_est *rate_est); |
50 | #endif | 50 | #endif |
diff --git a/include/net/netfilter/xt_rateest.h b/include/net/netfilter/xt_rateest.h index 65d594dffbf..ddbf37e1961 100644 --- a/include/net/netfilter/xt_rateest.h +++ b/include/net/netfilter/xt_rateest.h | |||
@@ -8,7 +8,7 @@ struct xt_rateest { | |||
8 | spinlock_t lock; | 8 | spinlock_t lock; |
9 | struct gnet_estimator params; | 9 | struct gnet_estimator params; |
10 | struct gnet_stats_rate_est rstats; | 10 | struct gnet_stats_rate_est rstats; |
11 | struct gnet_stats_basic bstats; | 11 | struct gnet_stats_basic_packed bstats; |
12 | }; | 12 | }; |
13 | 13 | ||
14 | extern struct xt_rateest *xt_rateest_lookup(const char *name); | 14 | extern struct xt_rateest *xt_rateest_lookup(const char *name); |
diff --git a/include/net/sch_generic.h b/include/net/sch_generic.h index 964ffa0d881..5482e9582f5 100644 --- a/include/net/sch_generic.h +++ b/include/net/sch_generic.h | |||
@@ -72,7 +72,7 @@ struct Qdisc | |||
72 | */ | 72 | */ |
73 | unsigned long state; | 73 | unsigned long state; |
74 | struct sk_buff_head q; | 74 | struct sk_buff_head q; |
75 | struct gnet_stats_basic bstats; | 75 | struct gnet_stats_basic_packed bstats; |
76 | struct gnet_stats_queue qstats; | 76 | struct gnet_stats_queue qstats; |
77 | }; | 77 | }; |
78 | 78 | ||
diff --git a/init/main.c b/init/main.c index 2c5ade79eb8..2d9d6bdfe7c 100644 --- a/init/main.c +++ b/init/main.c | |||
@@ -584,8 +584,8 @@ asmlinkage void __init start_kernel(void) | |||
584 | setup_arch(&command_line); | 584 | setup_arch(&command_line); |
585 | mm_init_owner(&init_mm, &init_task); | 585 | mm_init_owner(&init_mm, &init_task); |
586 | setup_command_line(command_line); | 586 | setup_command_line(command_line); |
587 | setup_per_cpu_areas(); | ||
588 | setup_nr_cpu_ids(); | 587 | setup_nr_cpu_ids(); |
588 | setup_per_cpu_areas(); | ||
589 | smp_prepare_boot_cpu(); /* arch-specific boot-cpu hooks */ | 589 | smp_prepare_boot_cpu(); /* arch-specific boot-cpu hooks */ |
590 | 590 | ||
591 | build_all_zonelists(); | 591 | build_all_zonelists(); |
diff --git a/kernel/fork.c b/kernel/fork.c index 021e1138556..144326b7af5 100644 --- a/kernel/fork.c +++ b/kernel/fork.c | |||
@@ -426,7 +426,6 @@ static struct mm_struct * mm_init(struct mm_struct * mm, struct task_struct *p) | |||
426 | init_rwsem(&mm->mmap_sem); | 426 | init_rwsem(&mm->mmap_sem); |
427 | INIT_LIST_HEAD(&mm->mmlist); | 427 | INIT_LIST_HEAD(&mm->mmlist); |
428 | mm->flags = (current->mm) ? current->mm->flags : default_dump_filter; | 428 | mm->flags = (current->mm) ? current->mm->flags : default_dump_filter; |
429 | mm->oom_adj = (current->mm) ? current->mm->oom_adj : 0; | ||
430 | mm->core_state = NULL; | 429 | mm->core_state = NULL; |
431 | mm->nr_ptes = 0; | 430 | mm->nr_ptes = 0; |
432 | set_mm_counter(mm, file_rss, 0); | 431 | set_mm_counter(mm, file_rss, 0); |
diff --git a/kernel/irq/manage.c b/kernel/irq/manage.c index d222515a5a0..0ec9ed83173 100644 --- a/kernel/irq/manage.c +++ b/kernel/irq/manage.c | |||
@@ -607,7 +607,6 @@ __setup_irq(unsigned int irq, struct irq_desc *desc, struct irqaction *new) | |||
607 | */ | 607 | */ |
608 | get_task_struct(t); | 608 | get_task_struct(t); |
609 | new->thread = t; | 609 | new->thread = t; |
610 | wake_up_process(t); | ||
611 | } | 610 | } |
612 | 611 | ||
613 | /* | 612 | /* |
@@ -690,6 +689,7 @@ __setup_irq(unsigned int irq, struct irq_desc *desc, struct irqaction *new) | |||
690 | (int)(new->flags & IRQF_TRIGGER_MASK)); | 689 | (int)(new->flags & IRQF_TRIGGER_MASK)); |
691 | } | 690 | } |
692 | 691 | ||
692 | new->irq = irq; | ||
693 | *old_ptr = new; | 693 | *old_ptr = new; |
694 | 694 | ||
695 | /* Reset broken irq detection when installing new handler */ | 695 | /* Reset broken irq detection when installing new handler */ |
@@ -707,7 +707,13 @@ __setup_irq(unsigned int irq, struct irq_desc *desc, struct irqaction *new) | |||
707 | 707 | ||
708 | spin_unlock_irqrestore(&desc->lock, flags); | 708 | spin_unlock_irqrestore(&desc->lock, flags); |
709 | 709 | ||
710 | new->irq = irq; | 710 | /* |
711 | * Strictly no need to wake it up, but hung_task complains | ||
712 | * when no hard interrupt wakes the thread up. | ||
713 | */ | ||
714 | if (new->thread) | ||
715 | wake_up_process(new->thread); | ||
716 | |||
711 | register_irq_proc(irq, desc); | 717 | register_irq_proc(irq, desc); |
712 | new->dir = NULL; | 718 | new->dir = NULL; |
713 | register_handler_proc(irq, new); | 719 | register_handler_proc(irq, new); |
diff --git a/kernel/perf_counter.c b/kernel/perf_counter.c index 534e20d14d6..36f65e2b8b5 100644 --- a/kernel/perf_counter.c +++ b/kernel/perf_counter.c | |||
@@ -1503,10 +1503,21 @@ static void perf_counter_enable_on_exec(struct task_struct *task) | |||
1503 | */ | 1503 | */ |
1504 | static void __perf_counter_read(void *info) | 1504 | static void __perf_counter_read(void *info) |
1505 | { | 1505 | { |
1506 | struct perf_cpu_context *cpuctx = &__get_cpu_var(perf_cpu_context); | ||
1506 | struct perf_counter *counter = info; | 1507 | struct perf_counter *counter = info; |
1507 | struct perf_counter_context *ctx = counter->ctx; | 1508 | struct perf_counter_context *ctx = counter->ctx; |
1508 | unsigned long flags; | 1509 | unsigned long flags; |
1509 | 1510 | ||
1511 | /* | ||
1512 | * If this is a task context, we need to check whether it is | ||
1513 | * the current task context of this cpu. If not it has been | ||
1514 | * scheduled out before the smp call arrived. In that case | ||
1515 | * counter->count would have been updated to a recent sample | ||
1516 | * when the counter was scheduled out. | ||
1517 | */ | ||
1518 | if (ctx->task && cpuctx->task_ctx != ctx) | ||
1519 | return; | ||
1520 | |||
1510 | local_irq_save(flags); | 1521 | local_irq_save(flags); |
1511 | if (ctx->is_active) | 1522 | if (ctx->is_active) |
1512 | update_context_time(ctx); | 1523 | update_context_time(ctx); |
@@ -2008,6 +2019,10 @@ int perf_counter_task_disable(void) | |||
2008 | return 0; | 2019 | return 0; |
2009 | } | 2020 | } |
2010 | 2021 | ||
2022 | #ifndef PERF_COUNTER_INDEX_OFFSET | ||
2023 | # define PERF_COUNTER_INDEX_OFFSET 0 | ||
2024 | #endif | ||
2025 | |||
2011 | static int perf_counter_index(struct perf_counter *counter) | 2026 | static int perf_counter_index(struct perf_counter *counter) |
2012 | { | 2027 | { |
2013 | if (counter->state != PERF_COUNTER_STATE_ACTIVE) | 2028 | if (counter->state != PERF_COUNTER_STATE_ACTIVE) |
diff --git a/mm/nommu.c b/mm/nommu.c index 28754c40be9..4bde489ec43 100644 --- a/mm/nommu.c +++ b/mm/nommu.c | |||
@@ -919,6 +919,10 @@ static int validate_mmap_request(struct file *file, | |||
919 | if (!file->f_op->read) | 919 | if (!file->f_op->read) |
920 | capabilities &= ~BDI_CAP_MAP_COPY; | 920 | capabilities &= ~BDI_CAP_MAP_COPY; |
921 | 921 | ||
922 | /* The file shall have been opened with read permission. */ | ||
923 | if (!(file->f_mode & FMODE_READ)) | ||
924 | return -EACCES; | ||
925 | |||
922 | if (flags & MAP_SHARED) { | 926 | if (flags & MAP_SHARED) { |
923 | /* do checks for writing, appending and locking */ | 927 | /* do checks for writing, appending and locking */ |
924 | if ((prot & PROT_WRITE) && | 928 | if ((prot & PROT_WRITE) && |
diff --git a/mm/oom_kill.c b/mm/oom_kill.c index 175a67a78a9..a7b2460e922 100644 --- a/mm/oom_kill.c +++ b/mm/oom_kill.c | |||
@@ -58,7 +58,6 @@ unsigned long badness(struct task_struct *p, unsigned long uptime) | |||
58 | unsigned long points, cpu_time, run_time; | 58 | unsigned long points, cpu_time, run_time; |
59 | struct mm_struct *mm; | 59 | struct mm_struct *mm; |
60 | struct task_struct *child; | 60 | struct task_struct *child; |
61 | int oom_adj; | ||
62 | 61 | ||
63 | task_lock(p); | 62 | task_lock(p); |
64 | mm = p->mm; | 63 | mm = p->mm; |
@@ -66,11 +65,6 @@ unsigned long badness(struct task_struct *p, unsigned long uptime) | |||
66 | task_unlock(p); | 65 | task_unlock(p); |
67 | return 0; | 66 | return 0; |
68 | } | 67 | } |
69 | oom_adj = mm->oom_adj; | ||
70 | if (oom_adj == OOM_DISABLE) { | ||
71 | task_unlock(p); | ||
72 | return 0; | ||
73 | } | ||
74 | 68 | ||
75 | /* | 69 | /* |
76 | * The memory size of the process is the basis for the badness. | 70 | * The memory size of the process is the basis for the badness. |
@@ -154,15 +148,15 @@ unsigned long badness(struct task_struct *p, unsigned long uptime) | |||
154 | points /= 8; | 148 | points /= 8; |
155 | 149 | ||
156 | /* | 150 | /* |
157 | * Adjust the score by oom_adj. | 151 | * Adjust the score by oomkilladj. |
158 | */ | 152 | */ |
159 | if (oom_adj) { | 153 | if (p->oomkilladj) { |
160 | if (oom_adj > 0) { | 154 | if (p->oomkilladj > 0) { |
161 | if (!points) | 155 | if (!points) |
162 | points = 1; | 156 | points = 1; |
163 | points <<= oom_adj; | 157 | points <<= p->oomkilladj; |
164 | } else | 158 | } else |
165 | points >>= -(oom_adj); | 159 | points >>= -(p->oomkilladj); |
166 | } | 160 | } |
167 | 161 | ||
168 | #ifdef DEBUG | 162 | #ifdef DEBUG |
@@ -257,8 +251,11 @@ static struct task_struct *select_bad_process(unsigned long *ppoints, | |||
257 | *ppoints = ULONG_MAX; | 251 | *ppoints = ULONG_MAX; |
258 | } | 252 | } |
259 | 253 | ||
254 | if (p->oomkilladj == OOM_DISABLE) | ||
255 | continue; | ||
256 | |||
260 | points = badness(p, uptime.tv_sec); | 257 | points = badness(p, uptime.tv_sec); |
261 | if (points > *ppoints) { | 258 | if (points > *ppoints || !chosen) { |
262 | chosen = p; | 259 | chosen = p; |
263 | *ppoints = points; | 260 | *ppoints = points; |
264 | } | 261 | } |
@@ -307,7 +304,8 @@ static void dump_tasks(const struct mem_cgroup *mem) | |||
307 | } | 304 | } |
308 | printk(KERN_INFO "[%5d] %5d %5d %8lu %8lu %3d %3d %s\n", | 305 | printk(KERN_INFO "[%5d] %5d %5d %8lu %8lu %3d %3d %s\n", |
309 | p->pid, __task_cred(p)->uid, p->tgid, mm->total_vm, | 306 | p->pid, __task_cred(p)->uid, p->tgid, mm->total_vm, |
310 | get_mm_rss(mm), (int)task_cpu(p), mm->oom_adj, p->comm); | 307 | get_mm_rss(mm), (int)task_cpu(p), p->oomkilladj, |
308 | p->comm); | ||
311 | task_unlock(p); | 309 | task_unlock(p); |
312 | } while_each_thread(g, p); | 310 | } while_each_thread(g, p); |
313 | } | 311 | } |
@@ -325,8 +323,11 @@ static void __oom_kill_task(struct task_struct *p, int verbose) | |||
325 | return; | 323 | return; |
326 | } | 324 | } |
327 | 325 | ||
328 | if (!p->mm) | 326 | if (!p->mm) { |
327 | WARN_ON(1); | ||
328 | printk(KERN_WARNING "tried to kill an mm-less task!\n"); | ||
329 | return; | 329 | return; |
330 | } | ||
330 | 331 | ||
331 | if (verbose) | 332 | if (verbose) |
332 | printk(KERN_ERR "Killed process %d (%s)\n", | 333 | printk(KERN_ERR "Killed process %d (%s)\n", |
@@ -348,13 +349,28 @@ static int oom_kill_task(struct task_struct *p) | |||
348 | struct mm_struct *mm; | 349 | struct mm_struct *mm; |
349 | struct task_struct *g, *q; | 350 | struct task_struct *g, *q; |
350 | 351 | ||
351 | task_lock(p); | ||
352 | mm = p->mm; | 352 | mm = p->mm; |
353 | if (!mm || mm->oom_adj == OOM_DISABLE) { | 353 | |
354 | task_unlock(p); | 354 | /* WARNING: mm may not be dereferenced since we did not obtain its |
355 | * value from get_task_mm(p). This is OK since all we need to do is | ||
356 | * compare mm to q->mm below. | ||
357 | * | ||
358 | * Furthermore, even if mm contains a non-NULL value, p->mm may | ||
359 | * change to NULL at any time since we do not hold task_lock(p). | ||
360 | * However, this is of no concern to us. | ||
361 | */ | ||
362 | |||
363 | if (mm == NULL) | ||
355 | return 1; | 364 | return 1; |
356 | } | 365 | |
357 | task_unlock(p); | 366 | /* |
367 | * Don't kill the process if any threads are set to OOM_DISABLE | ||
368 | */ | ||
369 | do_each_thread(g, q) { | ||
370 | if (q->mm == mm && q->oomkilladj == OOM_DISABLE) | ||
371 | return 1; | ||
372 | } while_each_thread(g, q); | ||
373 | |||
358 | __oom_kill_task(p, 1); | 374 | __oom_kill_task(p, 1); |
359 | 375 | ||
360 | /* | 376 | /* |
@@ -377,11 +393,10 @@ static int oom_kill_process(struct task_struct *p, gfp_t gfp_mask, int order, | |||
377 | struct task_struct *c; | 393 | struct task_struct *c; |
378 | 394 | ||
379 | if (printk_ratelimit()) { | 395 | if (printk_ratelimit()) { |
380 | task_lock(current); | ||
381 | printk(KERN_WARNING "%s invoked oom-killer: " | 396 | printk(KERN_WARNING "%s invoked oom-killer: " |
382 | "gfp_mask=0x%x, order=%d, oom_adj=%d\n", | 397 | "gfp_mask=0x%x, order=%d, oomkilladj=%d\n", |
383 | current->comm, gfp_mask, order, | 398 | current->comm, gfp_mask, order, current->oomkilladj); |
384 | current->mm ? current->mm->oom_adj : OOM_DISABLE); | 399 | task_lock(current); |
385 | cpuset_print_task_mems_allowed(current); | 400 | cpuset_print_task_mems_allowed(current); |
386 | task_unlock(current); | 401 | task_unlock(current); |
387 | dump_stack(); | 402 | dump_stack(); |
@@ -394,9 +409,8 @@ static int oom_kill_process(struct task_struct *p, gfp_t gfp_mask, int order, | |||
394 | /* | 409 | /* |
395 | * If the task is already exiting, don't alarm the sysadmin or kill | 410 | * If the task is already exiting, don't alarm the sysadmin or kill |
396 | * its children or threads, just set TIF_MEMDIE so it can die quickly | 411 | * its children or threads, just set TIF_MEMDIE so it can die quickly |
397 | * if its mm is still attached. | ||
398 | */ | 412 | */ |
399 | if (p->mm && (p->flags & PF_EXITING)) { | 413 | if (p->flags & PF_EXITING) { |
400 | __oom_kill_task(p, 0); | 414 | __oom_kill_task(p, 0); |
401 | return 0; | 415 | return 0; |
402 | } | 416 | } |
diff --git a/mm/page_alloc.c b/mm/page_alloc.c index d052abbe306..5cc986eb9f6 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c | |||
@@ -2544,7 +2544,6 @@ static void build_zonelists(pg_data_t *pgdat) | |||
2544 | prev_node = local_node; | 2544 | prev_node = local_node; |
2545 | nodes_clear(used_mask); | 2545 | nodes_clear(used_mask); |
2546 | 2546 | ||
2547 | memset(node_load, 0, sizeof(node_load)); | ||
2548 | memset(node_order, 0, sizeof(node_order)); | 2547 | memset(node_order, 0, sizeof(node_order)); |
2549 | j = 0; | 2548 | j = 0; |
2550 | 2549 | ||
@@ -2653,6 +2652,9 @@ static int __build_all_zonelists(void *dummy) | |||
2653 | { | 2652 | { |
2654 | int nid; | 2653 | int nid; |
2655 | 2654 | ||
2655 | #ifdef CONFIG_NUMA | ||
2656 | memset(node_load, 0, sizeof(node_load)); | ||
2657 | #endif | ||
2656 | for_each_online_node(nid) { | 2658 | for_each_online_node(nid) { |
2657 | pg_data_t *pgdat = NODE_DATA(nid); | 2659 | pg_data_t *pgdat = NODE_DATA(nid); |
2658 | 2660 | ||
diff --git a/mm/percpu.c b/mm/percpu.c index b70f2acd885..5fe37842e0e 100644 --- a/mm/percpu.c +++ b/mm/percpu.c | |||
@@ -8,12 +8,12 @@ | |||
8 | * | 8 | * |
9 | * This is percpu allocator which can handle both static and dynamic | 9 | * This is percpu allocator which can handle both static and dynamic |
10 | * areas. Percpu areas are allocated in chunks in vmalloc area. Each | 10 | * areas. Percpu areas are allocated in chunks in vmalloc area. Each |
11 | * chunk is consisted of num_possible_cpus() units and the first chunk | 11 | * chunk is consisted of nr_cpu_ids units and the first chunk is used |
12 | * is used for static percpu variables in the kernel image (special | 12 | * for static percpu variables in the kernel image (special boot time |
13 | * boot time alloc/init handling necessary as these areas need to be | 13 | * alloc/init handling necessary as these areas need to be brought up |
14 | * brought up before allocation services are running). Unit grows as | 14 | * before allocation services are running). Unit grows as necessary |
15 | * necessary and all units grow or shrink in unison. When a chunk is | 15 | * and all units grow or shrink in unison. When a chunk is filled up, |
16 | * filled up, another chunk is allocated. ie. in vmalloc area | 16 | * another chunk is allocated. ie. in vmalloc area |
17 | * | 17 | * |
18 | * c0 c1 c2 | 18 | * c0 c1 c2 |
19 | * ------------------- ------------------- ------------ | 19 | * ------------------- ------------------- ------------ |
@@ -558,7 +558,7 @@ static void pcpu_free_area(struct pcpu_chunk *chunk, int freeme) | |||
558 | static void pcpu_unmap(struct pcpu_chunk *chunk, int page_start, int page_end, | 558 | static void pcpu_unmap(struct pcpu_chunk *chunk, int page_start, int page_end, |
559 | bool flush_tlb) | 559 | bool flush_tlb) |
560 | { | 560 | { |
561 | unsigned int last = num_possible_cpus() - 1; | 561 | unsigned int last = nr_cpu_ids - 1; |
562 | unsigned int cpu; | 562 | unsigned int cpu; |
563 | 563 | ||
564 | /* unmap must not be done on immutable chunk */ | 564 | /* unmap must not be done on immutable chunk */ |
@@ -643,7 +643,7 @@ static void pcpu_depopulate_chunk(struct pcpu_chunk *chunk, int off, int size, | |||
643 | */ | 643 | */ |
644 | static int pcpu_map(struct pcpu_chunk *chunk, int page_start, int page_end) | 644 | static int pcpu_map(struct pcpu_chunk *chunk, int page_start, int page_end) |
645 | { | 645 | { |
646 | unsigned int last = num_possible_cpus() - 1; | 646 | unsigned int last = nr_cpu_ids - 1; |
647 | unsigned int cpu; | 647 | unsigned int cpu; |
648 | int err; | 648 | int err; |
649 | 649 | ||
@@ -749,7 +749,7 @@ static struct pcpu_chunk *alloc_pcpu_chunk(void) | |||
749 | chunk->map[chunk->map_used++] = pcpu_unit_size; | 749 | chunk->map[chunk->map_used++] = pcpu_unit_size; |
750 | chunk->page = chunk->page_ar; | 750 | chunk->page = chunk->page_ar; |
751 | 751 | ||
752 | chunk->vm = get_vm_area(pcpu_chunk_size, GFP_KERNEL); | 752 | chunk->vm = get_vm_area(pcpu_chunk_size, VM_ALLOC); |
753 | if (!chunk->vm) { | 753 | if (!chunk->vm) { |
754 | free_pcpu_chunk(chunk); | 754 | free_pcpu_chunk(chunk); |
755 | return NULL; | 755 | return NULL; |
@@ -1067,9 +1067,9 @@ size_t __init pcpu_setup_first_chunk(pcpu_get_page_fn_t get_page_fn, | |||
1067 | PFN_UP(size_sum)); | 1067 | PFN_UP(size_sum)); |
1068 | 1068 | ||
1069 | pcpu_unit_size = pcpu_unit_pages << PAGE_SHIFT; | 1069 | pcpu_unit_size = pcpu_unit_pages << PAGE_SHIFT; |
1070 | pcpu_chunk_size = num_possible_cpus() * pcpu_unit_size; | 1070 | pcpu_chunk_size = nr_cpu_ids * pcpu_unit_size; |
1071 | pcpu_chunk_struct_size = sizeof(struct pcpu_chunk) | 1071 | pcpu_chunk_struct_size = sizeof(struct pcpu_chunk) |
1072 | + num_possible_cpus() * pcpu_unit_pages * sizeof(struct page *); | 1072 | + nr_cpu_ids * pcpu_unit_pages * sizeof(struct page *); |
1073 | 1073 | ||
1074 | if (dyn_size < 0) | 1074 | if (dyn_size < 0) |
1075 | dyn_size = pcpu_unit_size - static_size - reserved_size; | 1075 | dyn_size = pcpu_unit_size - static_size - reserved_size; |
@@ -1248,7 +1248,7 @@ ssize_t __init pcpu_embed_first_chunk(size_t static_size, size_t reserved_size, | |||
1248 | } else | 1248 | } else |
1249 | pcpue_unit_size = max_t(size_t, pcpue_size, PCPU_MIN_UNIT_SIZE); | 1249 | pcpue_unit_size = max_t(size_t, pcpue_size, PCPU_MIN_UNIT_SIZE); |
1250 | 1250 | ||
1251 | chunk_size = pcpue_unit_size * num_possible_cpus(); | 1251 | chunk_size = pcpue_unit_size * nr_cpu_ids; |
1252 | 1252 | ||
1253 | pcpue_ptr = __alloc_bootmem_nopanic(chunk_size, PAGE_SIZE, | 1253 | pcpue_ptr = __alloc_bootmem_nopanic(chunk_size, PAGE_SIZE, |
1254 | __pa(MAX_DMA_ADDRESS)); | 1254 | __pa(MAX_DMA_ADDRESS)); |
@@ -1259,12 +1259,15 @@ ssize_t __init pcpu_embed_first_chunk(size_t static_size, size_t reserved_size, | |||
1259 | } | 1259 | } |
1260 | 1260 | ||
1261 | /* return the leftover and copy */ | 1261 | /* return the leftover and copy */ |
1262 | for_each_possible_cpu(cpu) { | 1262 | for (cpu = 0; cpu < nr_cpu_ids; cpu++) { |
1263 | void *ptr = pcpue_ptr + cpu * pcpue_unit_size; | 1263 | void *ptr = pcpue_ptr + cpu * pcpue_unit_size; |
1264 | 1264 | ||
1265 | free_bootmem(__pa(ptr + pcpue_size), | 1265 | if (cpu_possible(cpu)) { |
1266 | pcpue_unit_size - pcpue_size); | 1266 | free_bootmem(__pa(ptr + pcpue_size), |
1267 | memcpy(ptr, __per_cpu_load, static_size); | 1267 | pcpue_unit_size - pcpue_size); |
1268 | memcpy(ptr, __per_cpu_load, static_size); | ||
1269 | } else | ||
1270 | free_bootmem(__pa(ptr), pcpue_unit_size); | ||
1268 | } | 1271 | } |
1269 | 1272 | ||
1270 | /* we're ready, commit */ | 1273 | /* we're ready, commit */ |
diff --git a/net/appletalk/ddp.c b/net/appletalk/ddp.c index bfbe13786bb..875eda5dbad 100644 --- a/net/appletalk/ddp.c +++ b/net/appletalk/ddp.c | |||
@@ -1238,6 +1238,7 @@ static int atalk_getname(struct socket *sock, struct sockaddr *uaddr, | |||
1238 | return -ENOBUFS; | 1238 | return -ENOBUFS; |
1239 | 1239 | ||
1240 | *uaddr_len = sizeof(struct sockaddr_at); | 1240 | *uaddr_len = sizeof(struct sockaddr_at); |
1241 | memset(&sat.sat_zero, 0, sizeof(sat.sat_zero)); | ||
1241 | 1242 | ||
1242 | if (peer) { | 1243 | if (peer) { |
1243 | if (sk->sk_state != TCP_ESTABLISHED) | 1244 | if (sk->sk_state != TCP_ESTABLISHED) |
diff --git a/net/can/raw.c b/net/can/raw.c index f4cc44548bd..db3152df7d2 100644 --- a/net/can/raw.c +++ b/net/can/raw.c | |||
@@ -401,6 +401,7 @@ static int raw_getname(struct socket *sock, struct sockaddr *uaddr, | |||
401 | if (peer) | 401 | if (peer) |
402 | return -EOPNOTSUPP; | 402 | return -EOPNOTSUPP; |
403 | 403 | ||
404 | memset(addr, 0, sizeof(*addr)); | ||
404 | addr->can_family = AF_CAN; | 405 | addr->can_family = AF_CAN; |
405 | addr->can_ifindex = ro->ifindex; | 406 | addr->can_ifindex = ro->ifindex; |
406 | 407 | ||
diff --git a/net/core/gen_estimator.c b/net/core/gen_estimator.c index 78e5bfc454a..493775f4f2f 100644 --- a/net/core/gen_estimator.c +++ b/net/core/gen_estimator.c | |||
@@ -81,7 +81,7 @@ | |||
81 | struct gen_estimator | 81 | struct gen_estimator |
82 | { | 82 | { |
83 | struct list_head list; | 83 | struct list_head list; |
84 | struct gnet_stats_basic *bstats; | 84 | struct gnet_stats_basic_packed *bstats; |
85 | struct gnet_stats_rate_est *rate_est; | 85 | struct gnet_stats_rate_est *rate_est; |
86 | spinlock_t *stats_lock; | 86 | spinlock_t *stats_lock; |
87 | int ewma_log; | 87 | int ewma_log; |
@@ -165,7 +165,7 @@ static void gen_add_node(struct gen_estimator *est) | |||
165 | } | 165 | } |
166 | 166 | ||
167 | static | 167 | static |
168 | struct gen_estimator *gen_find_node(const struct gnet_stats_basic *bstats, | 168 | struct gen_estimator *gen_find_node(const struct gnet_stats_basic_packed *bstats, |
169 | const struct gnet_stats_rate_est *rate_est) | 169 | const struct gnet_stats_rate_est *rate_est) |
170 | { | 170 | { |
171 | struct rb_node *p = est_root.rb_node; | 171 | struct rb_node *p = est_root.rb_node; |
@@ -202,7 +202,7 @@ struct gen_estimator *gen_find_node(const struct gnet_stats_basic *bstats, | |||
202 | * | 202 | * |
203 | * NOTE: Called under rtnl_mutex | 203 | * NOTE: Called under rtnl_mutex |
204 | */ | 204 | */ |
205 | int gen_new_estimator(struct gnet_stats_basic *bstats, | 205 | int gen_new_estimator(struct gnet_stats_basic_packed *bstats, |
206 | struct gnet_stats_rate_est *rate_est, | 206 | struct gnet_stats_rate_est *rate_est, |
207 | spinlock_t *stats_lock, | 207 | spinlock_t *stats_lock, |
208 | struct nlattr *opt) | 208 | struct nlattr *opt) |
@@ -262,7 +262,7 @@ static void __gen_kill_estimator(struct rcu_head *head) | |||
262 | * | 262 | * |
263 | * NOTE: Called under rtnl_mutex | 263 | * NOTE: Called under rtnl_mutex |
264 | */ | 264 | */ |
265 | void gen_kill_estimator(struct gnet_stats_basic *bstats, | 265 | void gen_kill_estimator(struct gnet_stats_basic_packed *bstats, |
266 | struct gnet_stats_rate_est *rate_est) | 266 | struct gnet_stats_rate_est *rate_est) |
267 | { | 267 | { |
268 | struct gen_estimator *e; | 268 | struct gen_estimator *e; |
@@ -292,7 +292,7 @@ EXPORT_SYMBOL(gen_kill_estimator); | |||
292 | * | 292 | * |
293 | * Returns 0 on success or a negative error code. | 293 | * Returns 0 on success or a negative error code. |
294 | */ | 294 | */ |
295 | int gen_replace_estimator(struct gnet_stats_basic *bstats, | 295 | int gen_replace_estimator(struct gnet_stats_basic_packed *bstats, |
296 | struct gnet_stats_rate_est *rate_est, | 296 | struct gnet_stats_rate_est *rate_est, |
297 | spinlock_t *stats_lock, struct nlattr *opt) | 297 | spinlock_t *stats_lock, struct nlattr *opt) |
298 | { | 298 | { |
@@ -308,7 +308,7 @@ EXPORT_SYMBOL(gen_replace_estimator); | |||
308 | * | 308 | * |
309 | * Returns true if estimator is active, and false if not. | 309 | * Returns true if estimator is active, and false if not. |
310 | */ | 310 | */ |
311 | bool gen_estimator_active(const struct gnet_stats_basic *bstats, | 311 | bool gen_estimator_active(const struct gnet_stats_basic_packed *bstats, |
312 | const struct gnet_stats_rate_est *rate_est) | 312 | const struct gnet_stats_rate_est *rate_est) |
313 | { | 313 | { |
314 | ASSERT_RTNL(); | 314 | ASSERT_RTNL(); |
diff --git a/net/core/gen_stats.c b/net/core/gen_stats.c index c3d0ffeac24..8569310268a 100644 --- a/net/core/gen_stats.c +++ b/net/core/gen_stats.c | |||
@@ -106,16 +106,21 @@ gnet_stats_start_copy(struct sk_buff *skb, int type, spinlock_t *lock, | |||
106 | * if the room in the socket buffer was not sufficient. | 106 | * if the room in the socket buffer was not sufficient. |
107 | */ | 107 | */ |
108 | int | 108 | int |
109 | gnet_stats_copy_basic(struct gnet_dump *d, struct gnet_stats_basic *b) | 109 | gnet_stats_copy_basic(struct gnet_dump *d, struct gnet_stats_basic_packed *b) |
110 | { | 110 | { |
111 | if (d->compat_tc_stats) { | 111 | if (d->compat_tc_stats) { |
112 | d->tc_stats.bytes = b->bytes; | 112 | d->tc_stats.bytes = b->bytes; |
113 | d->tc_stats.packets = b->packets; | 113 | d->tc_stats.packets = b->packets; |
114 | } | 114 | } |
115 | 115 | ||
116 | if (d->tail) | 116 | if (d->tail) { |
117 | return gnet_stats_copy(d, TCA_STATS_BASIC, b, sizeof(*b)); | 117 | struct gnet_stats_basic sb; |
118 | 118 | ||
119 | memset(&sb, 0, sizeof(sb)); | ||
120 | sb.bytes = b->bytes; | ||
121 | sb.packets = b->packets; | ||
122 | return gnet_stats_copy(d, TCA_STATS_BASIC, &sb, sizeof(sb)); | ||
123 | } | ||
119 | return 0; | 124 | return 0; |
120 | } | 125 | } |
121 | 126 | ||
diff --git a/net/dccp/proto.c b/net/dccp/proto.c index 3281013ce03..1bca9205104 100644 --- a/net/dccp/proto.c +++ b/net/dccp/proto.c | |||
@@ -1159,6 +1159,7 @@ static void __exit dccp_fini(void) | |||
1159 | kmem_cache_destroy(dccp_hashinfo.bind_bucket_cachep); | 1159 | kmem_cache_destroy(dccp_hashinfo.bind_bucket_cachep); |
1160 | dccp_ackvec_exit(); | 1160 | dccp_ackvec_exit(); |
1161 | dccp_sysctl_exit(); | 1161 | dccp_sysctl_exit(); |
1162 | percpu_counter_destroy(&dccp_orphan_count); | ||
1162 | } | 1163 | } |
1163 | 1164 | ||
1164 | module_init(dccp_init); | 1165 | module_init(dccp_init); |
diff --git a/net/econet/af_econet.c b/net/econet/af_econet.c index 2e1f836d424..f0bbc57926c 100644 --- a/net/econet/af_econet.c +++ b/net/econet/af_econet.c | |||
@@ -520,6 +520,7 @@ static int econet_getname(struct socket *sock, struct sockaddr *uaddr, | |||
520 | if (peer) | 520 | if (peer) |
521 | return -EOPNOTSUPP; | 521 | return -EOPNOTSUPP; |
522 | 522 | ||
523 | memset(sec, 0, sizeof(*sec)); | ||
523 | mutex_lock(&econet_mutex); | 524 | mutex_lock(&econet_mutex); |
524 | 525 | ||
525 | sk = sock->sk; | 526 | sk = sock->sk; |
diff --git a/net/ieee802154/af_ieee802154.c b/net/ieee802154/af_ieee802154.c index 3bb6bdb1dac..af661805b9f 100644 --- a/net/ieee802154/af_ieee802154.c +++ b/net/ieee802154/af_ieee802154.c | |||
@@ -136,7 +136,7 @@ static int ieee802154_dev_ioctl(struct sock *sk, struct ifreq __user *arg, | |||
136 | unsigned int cmd) | 136 | unsigned int cmd) |
137 | { | 137 | { |
138 | struct ifreq ifr; | 138 | struct ifreq ifr; |
139 | int ret = -EINVAL; | 139 | int ret = -ENOIOCTLCMD; |
140 | struct net_device *dev; | 140 | struct net_device *dev; |
141 | 141 | ||
142 | if (copy_from_user(&ifr, arg, sizeof(struct ifreq))) | 142 | if (copy_from_user(&ifr, arg, sizeof(struct ifreq))) |
@@ -146,8 +146,10 @@ static int ieee802154_dev_ioctl(struct sock *sk, struct ifreq __user *arg, | |||
146 | 146 | ||
147 | dev_load(sock_net(sk), ifr.ifr_name); | 147 | dev_load(sock_net(sk), ifr.ifr_name); |
148 | dev = dev_get_by_name(sock_net(sk), ifr.ifr_name); | 148 | dev = dev_get_by_name(sock_net(sk), ifr.ifr_name); |
149 | if (dev->type == ARPHRD_IEEE802154 || | 149 | |
150 | dev->type == ARPHRD_IEEE802154_PHY) | 150 | if ((dev->type == ARPHRD_IEEE802154 || |
151 | dev->type == ARPHRD_IEEE802154_PHY) && | ||
152 | dev->netdev_ops->ndo_do_ioctl) | ||
151 | ret = dev->netdev_ops->ndo_do_ioctl(dev, &ifr, cmd); | 153 | ret = dev->netdev_ops->ndo_do_ioctl(dev, &ifr, cmd); |
152 | 154 | ||
153 | if (!ret && copy_to_user(arg, &ifr, sizeof(struct ifreq))) | 155 | if (!ret && copy_to_user(arg, &ifr, sizeof(struct ifreq))) |
diff --git a/net/ieee802154/dgram.c b/net/ieee802154/dgram.c index 14d39840dd6..ba8b214dda8 100644 --- a/net/ieee802154/dgram.c +++ b/net/ieee802154/dgram.c | |||
@@ -377,6 +377,18 @@ int ieee802154_dgram_deliver(struct net_device *dev, struct sk_buff *skb) | |||
377 | return ret; | 377 | return ret; |
378 | } | 378 | } |
379 | 379 | ||
380 | static int dgram_getsockopt(struct sock *sk, int level, int optname, | ||
381 | char __user *optval, int __user *optlen) | ||
382 | { | ||
383 | return -EOPNOTSUPP; | ||
384 | } | ||
385 | |||
386 | static int dgram_setsockopt(struct sock *sk, int level, int optname, | ||
387 | char __user *optval, int __user optlen) | ||
388 | { | ||
389 | return -EOPNOTSUPP; | ||
390 | } | ||
391 | |||
380 | struct proto ieee802154_dgram_prot = { | 392 | struct proto ieee802154_dgram_prot = { |
381 | .name = "IEEE-802.15.4-MAC", | 393 | .name = "IEEE-802.15.4-MAC", |
382 | .owner = THIS_MODULE, | 394 | .owner = THIS_MODULE, |
@@ -391,5 +403,7 @@ struct proto ieee802154_dgram_prot = { | |||
391 | .connect = dgram_connect, | 403 | .connect = dgram_connect, |
392 | .disconnect = dgram_disconnect, | 404 | .disconnect = dgram_disconnect, |
393 | .ioctl = dgram_ioctl, | 405 | .ioctl = dgram_ioctl, |
406 | .getsockopt = dgram_getsockopt, | ||
407 | .setsockopt = dgram_setsockopt, | ||
394 | }; | 408 | }; |
395 | 409 | ||
diff --git a/net/ieee802154/raw.c b/net/ieee802154/raw.c index fca44d59f97..9315977c4c6 100644 --- a/net/ieee802154/raw.c +++ b/net/ieee802154/raw.c | |||
@@ -238,6 +238,18 @@ void ieee802154_raw_deliver(struct net_device *dev, struct sk_buff *skb) | |||
238 | read_unlock(&raw_lock); | 238 | read_unlock(&raw_lock); |
239 | } | 239 | } |
240 | 240 | ||
241 | static int raw_getsockopt(struct sock *sk, int level, int optname, | ||
242 | char __user *optval, int __user *optlen) | ||
243 | { | ||
244 | return -EOPNOTSUPP; | ||
245 | } | ||
246 | |||
247 | static int raw_setsockopt(struct sock *sk, int level, int optname, | ||
248 | char __user *optval, int __user optlen) | ||
249 | { | ||
250 | return -EOPNOTSUPP; | ||
251 | } | ||
252 | |||
241 | struct proto ieee802154_raw_prot = { | 253 | struct proto ieee802154_raw_prot = { |
242 | .name = "IEEE-802.15.4-RAW", | 254 | .name = "IEEE-802.15.4-RAW", |
243 | .owner = THIS_MODULE, | 255 | .owner = THIS_MODULE, |
@@ -250,5 +262,7 @@ struct proto ieee802154_raw_prot = { | |||
250 | .unhash = raw_unhash, | 262 | .unhash = raw_unhash, |
251 | .connect = raw_connect, | 263 | .connect = raw_connect, |
252 | .disconnect = raw_disconnect, | 264 | .disconnect = raw_disconnect, |
265 | .getsockopt = raw_getsockopt, | ||
266 | .setsockopt = raw_setsockopt, | ||
253 | }; | 267 | }; |
254 | 268 | ||
diff --git a/net/ipv4/ip_gre.c b/net/ipv4/ip_gre.c index cb4a0f4bd5e..82c11dd10a6 100644 --- a/net/ipv4/ip_gre.c +++ b/net/ipv4/ip_gre.c | |||
@@ -951,7 +951,7 @@ static int ipgre_tunnel_bind_dev(struct net_device *dev) | |||
951 | addend += 4; | 951 | addend += 4; |
952 | } | 952 | } |
953 | dev->needed_headroom = addend + hlen; | 953 | dev->needed_headroom = addend + hlen; |
954 | mtu -= dev->hard_header_len - addend; | 954 | mtu -= dev->hard_header_len + addend; |
955 | 955 | ||
956 | if (mtu < 68) | 956 | if (mtu < 68) |
957 | mtu = 68; | 957 | mtu = 68; |
diff --git a/net/irda/af_irda.c b/net/irda/af_irda.c index 80cf29aae09..50b43c57d5d 100644 --- a/net/irda/af_irda.c +++ b/net/irda/af_irda.c | |||
@@ -715,6 +715,7 @@ static int irda_getname(struct socket *sock, struct sockaddr *uaddr, | |||
715 | struct sock *sk = sock->sk; | 715 | struct sock *sk = sock->sk; |
716 | struct irda_sock *self = irda_sk(sk); | 716 | struct irda_sock *self = irda_sk(sk); |
717 | 717 | ||
718 | memset(&saddr, 0, sizeof(saddr)); | ||
718 | if (peer) { | 719 | if (peer) { |
719 | if (sk->sk_state != TCP_ESTABLISHED) | 720 | if (sk->sk_state != TCP_ESTABLISHED) |
720 | return -ENOTCONN; | 721 | return -ENOTCONN; |
diff --git a/net/mac80211/agg-tx.c b/net/mac80211/agg-tx.c index 9e5762ad307..a24e59816b9 100644 --- a/net/mac80211/agg-tx.c +++ b/net/mac80211/agg-tx.c | |||
@@ -381,6 +381,14 @@ static void ieee80211_agg_splice_packets(struct ieee80211_local *local, | |||
381 | &local->hw, queue, | 381 | &local->hw, queue, |
382 | IEEE80211_QUEUE_STOP_REASON_AGGREGATION); | 382 | IEEE80211_QUEUE_STOP_REASON_AGGREGATION); |
383 | 383 | ||
384 | if (!(sta->ampdu_mlme.tid_state_tx[tid] & HT_ADDBA_REQUESTED_MSK)) | ||
385 | return; | ||
386 | |||
387 | if (WARN(!sta->ampdu_mlme.tid_tx[tid], | ||
388 | "TID %d gone but expected when splicing aggregates from" | ||
389 | "the pending queue\n", tid)) | ||
390 | return; | ||
391 | |||
384 | if (!skb_queue_empty(&sta->ampdu_mlme.tid_tx[tid]->pending)) { | 392 | if (!skb_queue_empty(&sta->ampdu_mlme.tid_tx[tid]->pending)) { |
385 | spin_lock_irqsave(&local->queue_stop_reason_lock, flags); | 393 | spin_lock_irqsave(&local->queue_stop_reason_lock, flags); |
386 | /* mark queue as pending, it is stopped already */ | 394 | /* mark queue as pending, it is stopped already */ |
diff --git a/net/netfilter/xt_RATEEST.c b/net/netfilter/xt_RATEEST.c index 43f5676b1af..d80b8192e0d 100644 --- a/net/netfilter/xt_RATEEST.c +++ b/net/netfilter/xt_RATEEST.c | |||
@@ -74,7 +74,7 @@ static unsigned int | |||
74 | xt_rateest_tg(struct sk_buff *skb, const struct xt_target_param *par) | 74 | xt_rateest_tg(struct sk_buff *skb, const struct xt_target_param *par) |
75 | { | 75 | { |
76 | const struct xt_rateest_target_info *info = par->targinfo; | 76 | const struct xt_rateest_target_info *info = par->targinfo; |
77 | struct gnet_stats_basic *stats = &info->est->bstats; | 77 | struct gnet_stats_basic_packed *stats = &info->est->bstats; |
78 | 78 | ||
79 | spin_lock_bh(&info->est->lock); | 79 | spin_lock_bh(&info->est->lock); |
80 | stats->bytes += skb->len; | 80 | stats->bytes += skb->len; |
diff --git a/net/netrom/af_netrom.c b/net/netrom/af_netrom.c index ce51ce012cd..ce1a34b99c2 100644 --- a/net/netrom/af_netrom.c +++ b/net/netrom/af_netrom.c | |||
@@ -847,6 +847,7 @@ static int nr_getname(struct socket *sock, struct sockaddr *uaddr, | |||
847 | sax->fsa_ax25.sax25_family = AF_NETROM; | 847 | sax->fsa_ax25.sax25_family = AF_NETROM; |
848 | sax->fsa_ax25.sax25_ndigis = 1; | 848 | sax->fsa_ax25.sax25_ndigis = 1; |
849 | sax->fsa_ax25.sax25_call = nr->user_addr; | 849 | sax->fsa_ax25.sax25_call = nr->user_addr; |
850 | memset(sax->fsa_digipeater, 0, sizeof(sax->fsa_digipeater)); | ||
850 | sax->fsa_digipeater[0] = nr->dest_addr; | 851 | sax->fsa_digipeater[0] = nr->dest_addr; |
851 | *uaddr_len = sizeof(struct full_sockaddr_ax25); | 852 | *uaddr_len = sizeof(struct full_sockaddr_ax25); |
852 | } else { | 853 | } else { |
diff --git a/net/netrom/nr_route.c b/net/netrom/nr_route.c index e943c16552a..4eb1ac9a767 100644 --- a/net/netrom/nr_route.c +++ b/net/netrom/nr_route.c | |||
@@ -630,23 +630,23 @@ out: | |||
630 | return dev; | 630 | return dev; |
631 | } | 631 | } |
632 | 632 | ||
633 | static ax25_digi *nr_call_to_digi(int ndigis, ax25_address *digipeaters) | 633 | static ax25_digi *nr_call_to_digi(ax25_digi *digi, int ndigis, |
634 | ax25_address *digipeaters) | ||
634 | { | 635 | { |
635 | static ax25_digi ax25_digi; | ||
636 | int i; | 636 | int i; |
637 | 637 | ||
638 | if (ndigis == 0) | 638 | if (ndigis == 0) |
639 | return NULL; | 639 | return NULL; |
640 | 640 | ||
641 | for (i = 0; i < ndigis; i++) { | 641 | for (i = 0; i < ndigis; i++) { |
642 | ax25_digi.calls[i] = digipeaters[i]; | 642 | digi->calls[i] = digipeaters[i]; |
643 | ax25_digi.repeated[i] = 0; | 643 | digi->repeated[i] = 0; |
644 | } | 644 | } |
645 | 645 | ||
646 | ax25_digi.ndigi = ndigis; | 646 | digi->ndigi = ndigis; |
647 | ax25_digi.lastrepeat = -1; | 647 | digi->lastrepeat = -1; |
648 | 648 | ||
649 | return &ax25_digi; | 649 | return digi; |
650 | } | 650 | } |
651 | 651 | ||
652 | /* | 652 | /* |
@@ -656,6 +656,7 @@ int nr_rt_ioctl(unsigned int cmd, void __user *arg) | |||
656 | { | 656 | { |
657 | struct nr_route_struct nr_route; | 657 | struct nr_route_struct nr_route; |
658 | struct net_device *dev; | 658 | struct net_device *dev; |
659 | ax25_digi digi; | ||
659 | int ret; | 660 | int ret; |
660 | 661 | ||
661 | switch (cmd) { | 662 | switch (cmd) { |
@@ -673,13 +674,15 @@ int nr_rt_ioctl(unsigned int cmd, void __user *arg) | |||
673 | ret = nr_add_node(&nr_route.callsign, | 674 | ret = nr_add_node(&nr_route.callsign, |
674 | nr_route.mnemonic, | 675 | nr_route.mnemonic, |
675 | &nr_route.neighbour, | 676 | &nr_route.neighbour, |
676 | nr_call_to_digi(nr_route.ndigis, nr_route.digipeaters), | 677 | nr_call_to_digi(&digi, nr_route.ndigis, |
678 | nr_route.digipeaters), | ||
677 | dev, nr_route.quality, | 679 | dev, nr_route.quality, |
678 | nr_route.obs_count); | 680 | nr_route.obs_count); |
679 | break; | 681 | break; |
680 | case NETROM_NEIGH: | 682 | case NETROM_NEIGH: |
681 | ret = nr_add_neigh(&nr_route.callsign, | 683 | ret = nr_add_neigh(&nr_route.callsign, |
682 | nr_call_to_digi(nr_route.ndigis, nr_route.digipeaters), | 684 | nr_call_to_digi(&digi, nr_route.ndigis, |
685 | nr_route.digipeaters), | ||
683 | dev, nr_route.quality); | 686 | dev, nr_route.quality); |
684 | break; | 687 | break; |
685 | default: | 688 | default: |
diff --git a/net/phonet/pn_dev.c b/net/phonet/pn_dev.c index b0d6ddd82a9..c2b77a69869 100644 --- a/net/phonet/pn_dev.c +++ b/net/phonet/pn_dev.c | |||
@@ -96,7 +96,7 @@ struct net_device *phonet_device_get(struct net *net) | |||
96 | { | 96 | { |
97 | struct phonet_device_list *pndevs = phonet_device_list(net); | 97 | struct phonet_device_list *pndevs = phonet_device_list(net); |
98 | struct phonet_device *pnd; | 98 | struct phonet_device *pnd; |
99 | struct net_device *dev; | 99 | struct net_device *dev = NULL; |
100 | 100 | ||
101 | spin_lock_bh(&pndevs->lock); | 101 | spin_lock_bh(&pndevs->lock); |
102 | list_for_each_entry(pnd, &pndevs->list, list) { | 102 | list_for_each_entry(pnd, &pndevs->list, list) { |
diff --git a/net/rose/af_rose.c b/net/rose/af_rose.c index f0a76f6bca7..e5f478ca3d6 100644 --- a/net/rose/af_rose.c +++ b/net/rose/af_rose.c | |||
@@ -954,6 +954,7 @@ static int rose_getname(struct socket *sock, struct sockaddr *uaddr, | |||
954 | struct rose_sock *rose = rose_sk(sk); | 954 | struct rose_sock *rose = rose_sk(sk); |
955 | int n; | 955 | int n; |
956 | 956 | ||
957 | memset(srose, 0, sizeof(*srose)); | ||
957 | if (peer != 0) { | 958 | if (peer != 0) { |
958 | if (sk->sk_state != TCP_ESTABLISHED) | 959 | if (sk->sk_state != TCP_ESTABLISHED) |
959 | return -ENOTCONN; | 960 | return -ENOTCONN; |
diff --git a/net/sched/sch_atm.c b/net/sched/sch_atm.c index 2a8b83af7c4..ab82f145f68 100644 --- a/net/sched/sch_atm.c +++ b/net/sched/sch_atm.c | |||
@@ -49,7 +49,7 @@ struct atm_flow_data { | |||
49 | struct socket *sock; /* for closing */ | 49 | struct socket *sock; /* for closing */ |
50 | u32 classid; /* x:y type ID */ | 50 | u32 classid; /* x:y type ID */ |
51 | int ref; /* reference count */ | 51 | int ref; /* reference count */ |
52 | struct gnet_stats_basic bstats; | 52 | struct gnet_stats_basic_packed bstats; |
53 | struct gnet_stats_queue qstats; | 53 | struct gnet_stats_queue qstats; |
54 | struct atm_flow_data *next; | 54 | struct atm_flow_data *next; |
55 | struct atm_flow_data *excess; /* flow for excess traffic; | 55 | struct atm_flow_data *excess; /* flow for excess traffic; |
diff --git a/net/sched/sch_cbq.c b/net/sched/sch_cbq.c index 23a167670fd..d5798e17a83 100644 --- a/net/sched/sch_cbq.c +++ b/net/sched/sch_cbq.c | |||
@@ -128,7 +128,7 @@ struct cbq_class | |||
128 | long avgidle; | 128 | long avgidle; |
129 | long deficit; /* Saved deficit for WRR */ | 129 | long deficit; /* Saved deficit for WRR */ |
130 | psched_time_t penalized; | 130 | psched_time_t penalized; |
131 | struct gnet_stats_basic bstats; | 131 | struct gnet_stats_basic_packed bstats; |
132 | struct gnet_stats_queue qstats; | 132 | struct gnet_stats_queue qstats; |
133 | struct gnet_stats_rate_est rate_est; | 133 | struct gnet_stats_rate_est rate_est; |
134 | struct tc_cbq_xstats xstats; | 134 | struct tc_cbq_xstats xstats; |
diff --git a/net/sched/sch_drr.c b/net/sched/sch_drr.c index 7597fe14686..12b2fb04b29 100644 --- a/net/sched/sch_drr.c +++ b/net/sched/sch_drr.c | |||
@@ -22,7 +22,7 @@ struct drr_class { | |||
22 | unsigned int refcnt; | 22 | unsigned int refcnt; |
23 | unsigned int filter_cnt; | 23 | unsigned int filter_cnt; |
24 | 24 | ||
25 | struct gnet_stats_basic bstats; | 25 | struct gnet_stats_basic_packed bstats; |
26 | struct gnet_stats_queue qstats; | 26 | struct gnet_stats_queue qstats; |
27 | struct gnet_stats_rate_est rate_est; | 27 | struct gnet_stats_rate_est rate_est; |
28 | struct list_head alist; | 28 | struct list_head alist; |
diff --git a/net/sched/sch_hfsc.c b/net/sched/sch_hfsc.c index 362c2811b2d..dad0144423d 100644 --- a/net/sched/sch_hfsc.c +++ b/net/sched/sch_hfsc.c | |||
@@ -116,7 +116,7 @@ struct hfsc_class | |||
116 | struct Qdisc_class_common cl_common; | 116 | struct Qdisc_class_common cl_common; |
117 | unsigned int refcnt; /* usage count */ | 117 | unsigned int refcnt; /* usage count */ |
118 | 118 | ||
119 | struct gnet_stats_basic bstats; | 119 | struct gnet_stats_basic_packed bstats; |
120 | struct gnet_stats_queue qstats; | 120 | struct gnet_stats_queue qstats; |
121 | struct gnet_stats_rate_est rate_est; | 121 | struct gnet_stats_rate_est rate_est; |
122 | unsigned int level; /* class level in hierarchy */ | 122 | unsigned int level; /* class level in hierarchy */ |
diff --git a/net/sched/sch_htb.c b/net/sched/sch_htb.c index 88cd0262662..ec4d46399d5 100644 --- a/net/sched/sch_htb.c +++ b/net/sched/sch_htb.c | |||
@@ -74,7 +74,7 @@ enum htb_cmode { | |||
74 | struct htb_class { | 74 | struct htb_class { |
75 | struct Qdisc_class_common common; | 75 | struct Qdisc_class_common common; |
76 | /* general class parameters */ | 76 | /* general class parameters */ |
77 | struct gnet_stats_basic bstats; | 77 | struct gnet_stats_basic_packed bstats; |
78 | struct gnet_stats_queue qstats; | 78 | struct gnet_stats_queue qstats; |
79 | struct gnet_stats_rate_est rate_est; | 79 | struct gnet_stats_rate_est rate_est; |
80 | struct tc_htb_xstats xstats; /* our special stats */ | 80 | struct tc_htb_xstats xstats; /* our special stats */ |
diff --git a/net/sctp/protocol.c b/net/sctp/protocol.c index 79cbd47f4df..a76da657244 100644 --- a/net/sctp/protocol.c +++ b/net/sctp/protocol.c | |||
@@ -160,6 +160,7 @@ static void sctp_proc_exit(void) | |||
160 | remove_proc_entry("sctp", init_net.proc_net); | 160 | remove_proc_entry("sctp", init_net.proc_net); |
161 | } | 161 | } |
162 | #endif | 162 | #endif |
163 | percpu_counter_destroy(&sctp_sockets_allocated); | ||
163 | } | 164 | } |
164 | 165 | ||
165 | /* Private helper to extract ipv4 address and stash them in | 166 | /* Private helper to extract ipv4 address and stash them in |
diff --git a/net/xfrm/xfrm_hash.h b/net/xfrm/xfrm_hash.h index d401dc8f05e..e5195c99f71 100644 --- a/net/xfrm/xfrm_hash.h +++ b/net/xfrm/xfrm_hash.h | |||
@@ -16,7 +16,7 @@ static inline unsigned int __xfrm6_addr_hash(xfrm_address_t *addr) | |||
16 | 16 | ||
17 | static inline unsigned int __xfrm4_daddr_saddr_hash(xfrm_address_t *daddr, xfrm_address_t *saddr) | 17 | static inline unsigned int __xfrm4_daddr_saddr_hash(xfrm_address_t *daddr, xfrm_address_t *saddr) |
18 | { | 18 | { |
19 | return ntohl(daddr->a4 ^ saddr->a4); | 19 | return ntohl(daddr->a4 + saddr->a4); |
20 | } | 20 | } |
21 | 21 | ||
22 | static inline unsigned int __xfrm6_daddr_saddr_hash(xfrm_address_t *daddr, xfrm_address_t *saddr) | 22 | static inline unsigned int __xfrm6_daddr_saddr_hash(xfrm_address_t *daddr, xfrm_address_t *saddr) |
diff --git a/security/Kconfig b/security/Kconfig index 9c60c346a91..4c865345caa 100644 --- a/security/Kconfig +++ b/security/Kconfig | |||
@@ -114,9 +114,9 @@ config SECURITY_ROOTPLUG | |||
114 | If you are unsure how to answer this question, answer N. | 114 | If you are unsure how to answer this question, answer N. |
115 | 115 | ||
116 | config LSM_MMAP_MIN_ADDR | 116 | config LSM_MMAP_MIN_ADDR |
117 | int "Low address space for LSM to from user allocation" | 117 | int "Low address space for LSM to protect from user allocation" |
118 | depends on SECURITY && SECURITY_SELINUX | 118 | depends on SECURITY && SECURITY_SELINUX |
119 | default 65535 | 119 | default 65536 |
120 | help | 120 | help |
121 | This is the portion of low virtual memory which should be protected | 121 | This is the portion of low virtual memory which should be protected |
122 | from userspace allocation. Keeping a user from writing to low pages | 122 | from userspace allocation. Keeping a user from writing to low pages |
diff --git a/tools/perf/Documentation/Makefile b/tools/perf/Documentation/Makefile index 5457192e1b4..bdd3b7ecad0 100644 --- a/tools/perf/Documentation/Makefile +++ b/tools/perf/Documentation/Makefile | |||
@@ -35,7 +35,7 @@ man7dir=$(mandir)/man7 | |||
35 | # DESTDIR= | 35 | # DESTDIR= |
36 | 36 | ||
37 | ASCIIDOC=asciidoc | 37 | ASCIIDOC=asciidoc |
38 | ASCIIDOC_EXTRA = | 38 | ASCIIDOC_EXTRA = --unsafe |
39 | MANPAGE_XSL = manpage-normal.xsl | 39 | MANPAGE_XSL = manpage-normal.xsl |
40 | XMLTO_EXTRA = | 40 | XMLTO_EXTRA = |
41 | INSTALL?=install | 41 | INSTALL?=install |
diff --git a/tools/perf/Documentation/perf-examples.txt b/tools/perf/Documentation/examples.txt index 8eb6c489fb1..8eb6c489fb1 100644 --- a/tools/perf/Documentation/perf-examples.txt +++ b/tools/perf/Documentation/examples.txt | |||
diff --git a/tools/perf/builtin-annotate.c b/tools/perf/builtin-annotate.c index 1dba568e194..343e7b14bf0 100644 --- a/tools/perf/builtin-annotate.c +++ b/tools/perf/builtin-annotate.c | |||
@@ -980,6 +980,13 @@ process_fork_event(event_t *event, unsigned long offset, unsigned long head) | |||
980 | (void *)(long)(event->header.size), | 980 | (void *)(long)(event->header.size), |
981 | event->fork.pid, event->fork.ppid); | 981 | event->fork.pid, event->fork.ppid); |
982 | 982 | ||
983 | /* | ||
984 | * A thread clone will have the same PID for both | ||
985 | * parent and child. | ||
986 | */ | ||
987 | if (thread == parent) | ||
988 | return 0; | ||
989 | |||
983 | if (!thread || !parent || thread__fork(thread, parent)) { | 990 | if (!thread || !parent || thread__fork(thread, parent)) { |
984 | dprintf("problem processing PERF_EVENT_FORK, skipping event.\n"); | 991 | dprintf("problem processing PERF_EVENT_FORK, skipping event.\n"); |
985 | return -1; | 992 | return -1; |
diff --git a/tools/perf/builtin-record.c b/tools/perf/builtin-record.c index 3d051b9cf25..89a5ddcd1de 100644 --- a/tools/perf/builtin-record.c +++ b/tools/perf/builtin-record.c | |||
@@ -219,7 +219,7 @@ static pid_t pid_synthesize_comm_event(pid_t pid, int full) | |||
219 | snprintf(filename, sizeof(filename), "/proc/%d/status", pid); | 219 | snprintf(filename, sizeof(filename), "/proc/%d/status", pid); |
220 | 220 | ||
221 | fp = fopen(filename, "r"); | 221 | fp = fopen(filename, "r"); |
222 | if (fd == NULL) { | 222 | if (fp == NULL) { |
223 | /* | 223 | /* |
224 | * We raced with a task exiting - just return: | 224 | * We raced with a task exiting - just return: |
225 | */ | 225 | */ |