1 |
commit: 43d60aa903f572b62636daf590b98f65206078ed |
2 |
Author: Mike Pagano <mpagano <AT> gentoo <DOT> org> |
3 |
AuthorDate: Mon May 11 22:52:41 2020 +0000 |
4 |
Commit: Mike Pagano <mpagano <AT> gentoo <DOT> org> |
5 |
CommitDate: Mon May 11 22:52:41 2020 +0000 |
6 |
URL: https://gitweb.gentoo.org/proj/linux-patches.git/commit/?id=43d60aa9 |
7 |
|
8 |
Linux patch 4.4.223 |
9 |
|
10 |
Signed-off-by: Mike Pagano <mpagano <AT> gentoo.org> |
11 |
|
12 |
0000_README | 4 + |
13 |
1222_linux-4.4.223.patch | 9587 ++++++++++++++++++++++++++++++++++++++++++++++ |
14 |
2 files changed, 9591 insertions(+) |
15 |
|
16 |
diff --git a/0000_README b/0000_README |
17 |
index 80253f1..ea662bf 100644 |
18 |
--- a/0000_README |
19 |
+++ b/0000_README |
20 |
@@ -931,6 +931,10 @@ Patch: 1221_linux-4.4.222.patch |
21 |
From: http://www.kernel.org |
22 |
Desc: Linux 4.4.222 |
23 |
|
24 |
+Patch: 1222_linux-4.4.223.patch |
25 |
+From: http://www.kernel.org |
26 |
+Desc: Linux 4.4.223 |
27 |
+ |
28 |
Patch: 1500_XATTR_USER_PREFIX.patch |
29 |
From: https://bugs.gentoo.org/show_bug.cgi?id=470644 |
30 |
Desc: Support for namespace user.pax.* on tmpfs. |
31 |
|
32 |
diff --git a/1222_linux-4.4.223.patch b/1222_linux-4.4.223.patch |
33 |
new file mode 100644 |
34 |
index 0000000..dca4367 |
35 |
--- /dev/null |
36 |
+++ b/1222_linux-4.4.223.patch |
37 |
@@ -0,0 +1,9587 @@ |
38 |
+diff --git a/Makefile b/Makefile |
39 |
+index 03f34df673d9..6b88acb0b9b1 100644 |
40 |
+--- a/Makefile |
41 |
++++ b/Makefile |
42 |
+@@ -1,6 +1,6 @@ |
43 |
+ VERSION = 4 |
44 |
+ PATCHLEVEL = 4 |
45 |
+-SUBLEVEL = 222 |
46 |
++SUBLEVEL = 223 |
47 |
+ EXTRAVERSION = |
48 |
+ NAME = Blurry Fish Butt |
49 |
+ |
50 |
+diff --git a/arch/alpha/kernel/pci-sysfs.c b/arch/alpha/kernel/pci-sysfs.c |
51 |
+index 99e8d4796c96..92c0d460815b 100644 |
52 |
+--- a/arch/alpha/kernel/pci-sysfs.c |
53 |
++++ b/arch/alpha/kernel/pci-sysfs.c |
54 |
+@@ -77,10 +77,10 @@ static int pci_mmap_resource(struct kobject *kobj, |
55 |
+ if (i >= PCI_ROM_RESOURCE) |
56 |
+ return -ENODEV; |
57 |
+ |
58 |
+- if (!__pci_mmap_fits(pdev, i, vma, sparse)) |
59 |
++ if (res->flags & IORESOURCE_MEM && iomem_is_exclusive(res->start)) |
60 |
+ return -EINVAL; |
61 |
+ |
62 |
+- if (iomem_is_exclusive(res->start)) |
63 |
++ if (!__pci_mmap_fits(pdev, i, vma, sparse)) |
64 |
+ return -EINVAL; |
65 |
+ |
66 |
+ pcibios_resource_to_bus(pdev->bus, &bar, res); |
67 |
+diff --git a/arch/arm/boot/dts/Makefile b/arch/arm/boot/dts/Makefile |
68 |
+index 30bbc3746130..25b80021a1a3 100644 |
69 |
+--- a/arch/arm/boot/dts/Makefile |
70 |
++++ b/arch/arm/boot/dts/Makefile |
71 |
+@@ -166,6 +166,7 @@ dtb-$(CONFIG_MACH_KIRKWOOD) += \ |
72 |
+ kirkwood-ds109.dtb \ |
73 |
+ kirkwood-ds110jv10.dtb \ |
74 |
+ kirkwood-ds111.dtb \ |
75 |
++ kirkwood-ds112.dtb \ |
76 |
+ kirkwood-ds209.dtb \ |
77 |
+ kirkwood-ds210.dtb \ |
78 |
+ kirkwood-ds212.dtb \ |
79 |
+diff --git a/arch/arm/boot/dts/kirkwood-ds112.dts b/arch/arm/boot/dts/kirkwood-ds112.dts |
80 |
+index bf4143c6cb8f..b84af3da8c84 100644 |
81 |
+--- a/arch/arm/boot/dts/kirkwood-ds112.dts |
82 |
++++ b/arch/arm/boot/dts/kirkwood-ds112.dts |
83 |
+@@ -14,7 +14,7 @@ |
84 |
+ #include "kirkwood-synology.dtsi" |
85 |
+ |
86 |
+ / { |
87 |
+- model = "Synology DS111"; |
88 |
++ model = "Synology DS112"; |
89 |
+ compatible = "synology,ds111", "marvell,kirkwood"; |
90 |
+ |
91 |
+ memory { |
92 |
+diff --git a/arch/arm/boot/dts/kirkwood-lswvl.dts b/arch/arm/boot/dts/kirkwood-lswvl.dts |
93 |
+index 09eed3cea0af..36eec7392ab4 100644 |
94 |
+--- a/arch/arm/boot/dts/kirkwood-lswvl.dts |
95 |
++++ b/arch/arm/boot/dts/kirkwood-lswvl.dts |
96 |
+@@ -1,7 +1,8 @@ |
97 |
+ /* |
98 |
+ * Device Tree file for Buffalo Linkstation LS-WVL/VL |
99 |
+ * |
100 |
+- * Copyright (C) 2015, rogershimizu@×××××.com |
101 |
++ * Copyright (C) 2015, 2016 |
102 |
++ * Roger Shimizu <rogershimizu@×××××.com> |
103 |
+ * |
104 |
+ * This program is free software; you can redistribute it and/or |
105 |
+ * modify it under the terms of the GNU General Public License |
106 |
+@@ -156,21 +157,21 @@ |
107 |
+ button@1 { |
108 |
+ label = "Function Button"; |
109 |
+ linux,code = <KEY_OPTION>; |
110 |
+- gpios = <&gpio0 45 GPIO_ACTIVE_LOW>; |
111 |
++ gpios = <&gpio1 13 GPIO_ACTIVE_LOW>; |
112 |
+ }; |
113 |
+ |
114 |
+ button@2 { |
115 |
+ label = "Power-on Switch"; |
116 |
+ linux,code = <KEY_RESERVED>; |
117 |
+ linux,input-type = <5>; |
118 |
+- gpios = <&gpio0 46 GPIO_ACTIVE_LOW>; |
119 |
++ gpios = <&gpio1 14 GPIO_ACTIVE_LOW>; |
120 |
+ }; |
121 |
+ |
122 |
+ button@3 { |
123 |
+ label = "Power-auto Switch"; |
124 |
+ linux,code = <KEY_ESC>; |
125 |
+ linux,input-type = <5>; |
126 |
+- gpios = <&gpio0 47 GPIO_ACTIVE_LOW>; |
127 |
++ gpios = <&gpio1 15 GPIO_ACTIVE_LOW>; |
128 |
+ }; |
129 |
+ }; |
130 |
+ |
131 |
+@@ -185,38 +186,38 @@ |
132 |
+ |
133 |
+ led@1 { |
134 |
+ label = "lswvl:red:alarm"; |
135 |
+- gpios = <&gpio0 36 GPIO_ACTIVE_LOW>; |
136 |
++ gpios = <&gpio1 4 GPIO_ACTIVE_HIGH>; |
137 |
+ }; |
138 |
+ |
139 |
+ led@2 { |
140 |
+ label = "lswvl:red:func"; |
141 |
+- gpios = <&gpio0 37 GPIO_ACTIVE_LOW>; |
142 |
++ gpios = <&gpio1 5 GPIO_ACTIVE_HIGH>; |
143 |
+ }; |
144 |
+ |
145 |
+ led@3 { |
146 |
+ label = "lswvl:amber:info"; |
147 |
+- gpios = <&gpio0 38 GPIO_ACTIVE_LOW>; |
148 |
++ gpios = <&gpio1 6 GPIO_ACTIVE_HIGH>; |
149 |
+ }; |
150 |
+ |
151 |
+ led@4 { |
152 |
+ label = "lswvl:blue:func"; |
153 |
+- gpios = <&gpio0 39 GPIO_ACTIVE_LOW>; |
154 |
++ gpios = <&gpio1 7 GPIO_ACTIVE_HIGH>; |
155 |
+ }; |
156 |
+ |
157 |
+ led@5 { |
158 |
+ label = "lswvl:blue:power"; |
159 |
+- gpios = <&gpio0 40 GPIO_ACTIVE_LOW>; |
160 |
++ gpios = <&gpio1 8 GPIO_ACTIVE_LOW>; |
161 |
+ default-state = "keep"; |
162 |
+ }; |
163 |
+ |
164 |
+ led@6 { |
165 |
+ label = "lswvl:red:hdderr0"; |
166 |
+- gpios = <&gpio0 34 GPIO_ACTIVE_LOW>; |
167 |
++ gpios = <&gpio1 2 GPIO_ACTIVE_HIGH>; |
168 |
+ }; |
169 |
+ |
170 |
+ led@7 { |
171 |
+ label = "lswvl:red:hdderr1"; |
172 |
+- gpios = <&gpio0 35 GPIO_ACTIVE_LOW>; |
173 |
++ gpios = <&gpio1 3 GPIO_ACTIVE_HIGH>; |
174 |
+ }; |
175 |
+ }; |
176 |
+ |
177 |
+@@ -233,7 +234,7 @@ |
178 |
+ 3250 1 |
179 |
+ 5000 0>; |
180 |
+ |
181 |
+- alarm-gpios = <&gpio0 43 GPIO_ACTIVE_HIGH>; |
182 |
++ alarm-gpios = <&gpio1 11 GPIO_ACTIVE_HIGH>; |
183 |
+ }; |
184 |
+ |
185 |
+ restart_poweroff { |
186 |
+diff --git a/arch/arm/boot/dts/kirkwood-lswxl.dts b/arch/arm/boot/dts/kirkwood-lswxl.dts |
187 |
+index f5db16a08597..b13ec20a7088 100644 |
188 |
+--- a/arch/arm/boot/dts/kirkwood-lswxl.dts |
189 |
++++ b/arch/arm/boot/dts/kirkwood-lswxl.dts |
190 |
+@@ -1,7 +1,8 @@ |
191 |
+ /* |
192 |
+ * Device Tree file for Buffalo Linkstation LS-WXL/WSXL |
193 |
+ * |
194 |
+- * Copyright (C) 2015, rogershimizu@×××××.com |
195 |
++ * Copyright (C) 2015, 2016 |
196 |
++ * Roger Shimizu <rogershimizu@×××××.com> |
197 |
+ * |
198 |
+ * This program is free software; you can redistribute it and/or |
199 |
+ * modify it under the terms of the GNU General Public License |
200 |
+@@ -156,21 +157,21 @@ |
201 |
+ button@1 { |
202 |
+ label = "Function Button"; |
203 |
+ linux,code = <KEY_OPTION>; |
204 |
+- gpios = <&gpio1 41 GPIO_ACTIVE_LOW>; |
205 |
++ gpios = <&gpio1 9 GPIO_ACTIVE_LOW>; |
206 |
+ }; |
207 |
+ |
208 |
+ button@2 { |
209 |
+ label = "Power-on Switch"; |
210 |
+ linux,code = <KEY_RESERVED>; |
211 |
+ linux,input-type = <5>; |
212 |
+- gpios = <&gpio1 42 GPIO_ACTIVE_LOW>; |
213 |
++ gpios = <&gpio1 10 GPIO_ACTIVE_LOW>; |
214 |
+ }; |
215 |
+ |
216 |
+ button@3 { |
217 |
+ label = "Power-auto Switch"; |
218 |
+ linux,code = <KEY_ESC>; |
219 |
+ linux,input-type = <5>; |
220 |
+- gpios = <&gpio1 43 GPIO_ACTIVE_LOW>; |
221 |
++ gpios = <&gpio1 11 GPIO_ACTIVE_LOW>; |
222 |
+ }; |
223 |
+ }; |
224 |
+ |
225 |
+@@ -185,12 +186,12 @@ |
226 |
+ |
227 |
+ led@1 { |
228 |
+ label = "lswxl:blue:func"; |
229 |
+- gpios = <&gpio1 36 GPIO_ACTIVE_LOW>; |
230 |
++ gpios = <&gpio1 4 GPIO_ACTIVE_LOW>; |
231 |
+ }; |
232 |
+ |
233 |
+ led@2 { |
234 |
+ label = "lswxl:red:alarm"; |
235 |
+- gpios = <&gpio1 49 GPIO_ACTIVE_LOW>; |
236 |
++ gpios = <&gpio1 17 GPIO_ACTIVE_LOW>; |
237 |
+ }; |
238 |
+ |
239 |
+ led@3 { |
240 |
+@@ -200,23 +201,23 @@ |
241 |
+ |
242 |
+ led@4 { |
243 |
+ label = "lswxl:blue:power"; |
244 |
+- gpios = <&gpio1 8 GPIO_ACTIVE_LOW>; |
245 |
++ gpios = <&gpio1 7 GPIO_ACTIVE_HIGH>; |
246 |
++ default-state = "keep"; |
247 |
+ }; |
248 |
+ |
249 |
+ led@5 { |
250 |
+ label = "lswxl:red:func"; |
251 |
+- gpios = <&gpio1 5 GPIO_ACTIVE_LOW>; |
252 |
+- default-state = "keep"; |
253 |
++ gpios = <&gpio1 2 GPIO_ACTIVE_HIGH>; |
254 |
+ }; |
255 |
+ |
256 |
+ led@6 { |
257 |
+ label = "lswxl:red:hdderr0"; |
258 |
+- gpios = <&gpio1 2 GPIO_ACTIVE_LOW>; |
259 |
++ gpios = <&gpio0 8 GPIO_ACTIVE_HIGH>; |
260 |
+ }; |
261 |
+ |
262 |
+ led@7 { |
263 |
+ label = "lswxl:red:hdderr1"; |
264 |
+- gpios = <&gpio1 3 GPIO_ACTIVE_LOW>; |
265 |
++ gpios = <&gpio1 14 GPIO_ACTIVE_HIGH>; |
266 |
+ }; |
267 |
+ }; |
268 |
+ |
269 |
+@@ -225,15 +226,15 @@ |
270 |
+ pinctrl-0 = <&pmx_fan_low &pmx_fan_high &pmx_fan_lock>; |
271 |
+ pinctrl-names = "default"; |
272 |
+ |
273 |
+- gpios = <&gpio0 47 GPIO_ACTIVE_LOW |
274 |
+- &gpio0 48 GPIO_ACTIVE_LOW>; |
275 |
++ gpios = <&gpio1 16 GPIO_ACTIVE_LOW |
276 |
++ &gpio1 15 GPIO_ACTIVE_LOW>; |
277 |
+ |
278 |
+ gpio-fan,speed-map = <0 3 |
279 |
+ 1500 2 |
280 |
+ 3250 1 |
281 |
+ 5000 0>; |
282 |
+ |
283 |
+- alarm-gpios = <&gpio1 49 GPIO_ACTIVE_HIGH>; |
284 |
++ alarm-gpios = <&gpio1 8 GPIO_ACTIVE_HIGH>; |
285 |
+ }; |
286 |
+ |
287 |
+ restart_poweroff { |
288 |
+@@ -256,7 +257,7 @@ |
289 |
+ enable-active-high; |
290 |
+ regulator-always-on; |
291 |
+ regulator-boot-on; |
292 |
+- gpio = <&gpio0 37 GPIO_ACTIVE_HIGH>; |
293 |
++ gpio = <&gpio1 5 GPIO_ACTIVE_HIGH>; |
294 |
+ }; |
295 |
+ hdd_power0: regulator@2 { |
296 |
+ compatible = "regulator-fixed"; |
297 |
+diff --git a/arch/arm/boot/dts/orion5x-linkstation-lswtgl.dts b/arch/arm/boot/dts/orion5x-linkstation-lswtgl.dts |
298 |
+index 3daec912b4bf..aae8a7aceab7 100644 |
299 |
+--- a/arch/arm/boot/dts/orion5x-linkstation-lswtgl.dts |
300 |
++++ b/arch/arm/boot/dts/orion5x-linkstation-lswtgl.dts |
301 |
+@@ -1,7 +1,8 @@ |
302 |
+ /* |
303 |
+ * Device Tree file for Buffalo Linkstation LS-WTGL |
304 |
+ * |
305 |
+- * Copyright (C) 2015, Roger Shimizu <rogershimizu@×××××.com> |
306 |
++ * Copyright (C) 2015, 2016 |
307 |
++ * Roger Shimizu <rogershimizu@×××××.com> |
308 |
+ * |
309 |
+ * This file is dual-licensed: you can use it either under the terms |
310 |
+ * of the GPL or the X11 license, at your option. Note that this dual |
311 |
+@@ -69,8 +70,6 @@ |
312 |
+ |
313 |
+ internal-regs { |
314 |
+ pinctrl: pinctrl@10000 { |
315 |
+- pinctrl-0 = <&pmx_usb_power &pmx_power_hdd |
316 |
+- &pmx_fan_low &pmx_fan_high &pmx_fan_lock>; |
317 |
+ pinctrl-names = "default"; |
318 |
+ |
319 |
+ pmx_led_power: pmx-leds { |
320 |
+@@ -162,6 +161,7 @@ |
321 |
+ led@1 { |
322 |
+ label = "lswtgl:blue:power"; |
323 |
+ gpios = <&gpio0 0 GPIO_ACTIVE_LOW>; |
324 |
++ default-state = "keep"; |
325 |
+ }; |
326 |
+ |
327 |
+ led@2 { |
328 |
+@@ -188,7 +188,7 @@ |
329 |
+ 3250 1 |
330 |
+ 5000 0>; |
331 |
+ |
332 |
+- alarm-gpios = <&gpio0 2 GPIO_ACTIVE_HIGH>; |
333 |
++ alarm-gpios = <&gpio0 6 GPIO_ACTIVE_HIGH>; |
334 |
+ }; |
335 |
+ |
336 |
+ restart_poweroff { |
337 |
+@@ -228,6 +228,37 @@ |
338 |
+ }; |
339 |
+ }; |
340 |
+ |
341 |
++&devbus_bootcs { |
342 |
++ status = "okay"; |
343 |
++ devbus,keep-config; |
344 |
++ |
345 |
++ flash@0 { |
346 |
++ compatible = "jedec-flash"; |
347 |
++ reg = <0 0x40000>; |
348 |
++ bank-width = <1>; |
349 |
++ |
350 |
++ partitions { |
351 |
++ compatible = "fixed-partitions"; |
352 |
++ #address-cells = <1>; |
353 |
++ #size-cells = <1>; |
354 |
++ |
355 |
++ header@0 { |
356 |
++ reg = <0 0x30000>; |
357 |
++ read-only; |
358 |
++ }; |
359 |
++ |
360 |
++ uboot@30000 { |
361 |
++ reg = <0x30000 0xF000>; |
362 |
++ read-only; |
363 |
++ }; |
364 |
++ |
365 |
++ uboot_env@3F000 { |
366 |
++ reg = <0x3F000 0x1000>; |
367 |
++ }; |
368 |
++ }; |
369 |
++ }; |
370 |
++}; |
371 |
++ |
372 |
+ &mdio { |
373 |
+ status = "okay"; |
374 |
+ |
375 |
+diff --git a/arch/arm/boot/dts/r8a7740-armadillo800eva.dts b/arch/arm/boot/dts/r8a7740-armadillo800eva.dts |
376 |
+index 105d9c95de4a..5c76dcc89df5 100644 |
377 |
+--- a/arch/arm/boot/dts/r8a7740-armadillo800eva.dts |
378 |
++++ b/arch/arm/boot/dts/r8a7740-armadillo800eva.dts |
379 |
+@@ -180,7 +180,7 @@ |
380 |
+ }; |
381 |
+ |
382 |
+ &extal1_clk { |
383 |
+- clock-frequency = <25000000>; |
384 |
++ clock-frequency = <24000000>; |
385 |
+ }; |
386 |
+ &extal2_clk { |
387 |
+ clock-frequency = <48000000>; |
388 |
+diff --git a/arch/arm/mach-imx/Kconfig b/arch/arm/mach-imx/Kconfig |
389 |
+index 8ceda2844c4f..9aa659e4c46e 100644 |
390 |
+--- a/arch/arm/mach-imx/Kconfig |
391 |
++++ b/arch/arm/mach-imx/Kconfig |
392 |
+@@ -562,6 +562,7 @@ config SOC_IMX7D |
393 |
+ select ARM_GIC |
394 |
+ select HAVE_IMX_ANATOP |
395 |
+ select HAVE_IMX_MMDC |
396 |
++ select HAVE_IMX_SRC |
397 |
+ help |
398 |
+ This enables support for Freescale i.MX7 Dual processor. |
399 |
+ |
400 |
+diff --git a/arch/arm/mach-omap2/omap_hwmod.c b/arch/arm/mach-omap2/omap_hwmod.c |
401 |
+index 1bc87c29467b..fcb48eb3ecdd 100644 |
402 |
+--- a/arch/arm/mach-omap2/omap_hwmod.c |
403 |
++++ b/arch/arm/mach-omap2/omap_hwmod.c |
404 |
+@@ -2207,15 +2207,15 @@ static int _idle(struct omap_hwmod *oh) |
405 |
+ |
406 |
+ pr_debug("omap_hwmod: %s: idling\n", oh->name); |
407 |
+ |
408 |
++ if (_are_all_hardreset_lines_asserted(oh)) |
409 |
++ return 0; |
410 |
++ |
411 |
+ if (oh->_state != _HWMOD_STATE_ENABLED) { |
412 |
+ WARN(1, "omap_hwmod: %s: idle state can only be entered from enabled state\n", |
413 |
+ oh->name); |
414 |
+ return -EINVAL; |
415 |
+ } |
416 |
+ |
417 |
+- if (_are_all_hardreset_lines_asserted(oh)) |
418 |
+- return 0; |
419 |
+- |
420 |
+ if (oh->class->sysc) |
421 |
+ _idle_sysc(oh); |
422 |
+ _del_initiator_dep(oh, mpu_oh); |
423 |
+@@ -2262,6 +2262,9 @@ static int _shutdown(struct omap_hwmod *oh) |
424 |
+ int ret, i; |
425 |
+ u8 prev_state; |
426 |
+ |
427 |
++ if (_are_all_hardreset_lines_asserted(oh)) |
428 |
++ return 0; |
429 |
++ |
430 |
+ if (oh->_state != _HWMOD_STATE_IDLE && |
431 |
+ oh->_state != _HWMOD_STATE_ENABLED) { |
432 |
+ WARN(1, "omap_hwmod: %s: disabled state can only be entered from idle, or enabled state\n", |
433 |
+@@ -2269,9 +2272,6 @@ static int _shutdown(struct omap_hwmod *oh) |
434 |
+ return -EINVAL; |
435 |
+ } |
436 |
+ |
437 |
+- if (_are_all_hardreset_lines_asserted(oh)) |
438 |
+- return 0; |
439 |
+- |
440 |
+ pr_debug("omap_hwmod: %s: disabling\n", oh->name); |
441 |
+ |
442 |
+ if (oh->class->pre_shutdown) { |
443 |
+diff --git a/arch/arm64/net/bpf_jit_comp.c b/arch/arm64/net/bpf_jit_comp.c |
444 |
+index 6297140dd84f..fb413052e10a 100644 |
445 |
+--- a/arch/arm64/net/bpf_jit_comp.c |
446 |
++++ b/arch/arm64/net/bpf_jit_comp.c |
447 |
+@@ -482,6 +482,7 @@ emit_cond_jmp: |
448 |
+ case BPF_JGE: |
449 |
+ jmp_cond = A64_COND_CS; |
450 |
+ break; |
451 |
++ case BPF_JSET: |
452 |
+ case BPF_JNE: |
453 |
+ jmp_cond = A64_COND_NE; |
454 |
+ break; |
455 |
+diff --git a/arch/mips/boot/dts/brcm/bcm7435.dtsi b/arch/mips/boot/dts/brcm/bcm7435.dtsi |
456 |
+index 8b9432cc062b..27b2b8e08503 100644 |
457 |
+--- a/arch/mips/boot/dts/brcm/bcm7435.dtsi |
458 |
++++ b/arch/mips/boot/dts/brcm/bcm7435.dtsi |
459 |
+@@ -7,7 +7,7 @@ |
460 |
+ #address-cells = <1>; |
461 |
+ #size-cells = <0>; |
462 |
+ |
463 |
+- mips-hpt-frequency = <163125000>; |
464 |
++ mips-hpt-frequency = <175625000>; |
465 |
+ |
466 |
+ cpu@0 { |
467 |
+ compatible = "brcm,bmips5200"; |
468 |
+diff --git a/arch/mips/cavium-octeon/octeon-irq.c b/arch/mips/cavium-octeon/octeon-irq.c |
469 |
+index ed7c4f1fc6a0..9189730bd517 100644 |
470 |
+--- a/arch/mips/cavium-octeon/octeon-irq.c |
471 |
++++ b/arch/mips/cavium-octeon/octeon-irq.c |
472 |
+@@ -1220,7 +1220,7 @@ static int octeon_irq_gpio_map(struct irq_domain *d, |
473 |
+ |
474 |
+ line = (hw + gpiod->base_hwirq) >> 6; |
475 |
+ bit = (hw + gpiod->base_hwirq) & 63; |
476 |
+- if (line > ARRAY_SIZE(octeon_irq_ciu_to_irq) || |
477 |
++ if (line >= ARRAY_SIZE(octeon_irq_ciu_to_irq) || |
478 |
+ octeon_irq_ciu_to_irq[line][bit] != 0) |
479 |
+ return -EINVAL; |
480 |
+ |
481 |
+diff --git a/arch/mips/cavium-octeon/setup.c b/arch/mips/cavium-octeon/setup.c |
482 |
+index cd7101fb6227..6b9c608cdff1 100644 |
483 |
+--- a/arch/mips/cavium-octeon/setup.c |
484 |
++++ b/arch/mips/cavium-octeon/setup.c |
485 |
+@@ -251,6 +251,17 @@ static void octeon_crash_shutdown(struct pt_regs *regs) |
486 |
+ default_machine_crash_shutdown(regs); |
487 |
+ } |
488 |
+ |
489 |
++#ifdef CONFIG_SMP |
490 |
++void octeon_crash_smp_send_stop(void) |
491 |
++{ |
492 |
++ int cpu; |
493 |
++ |
494 |
++ /* disable watchdogs */ |
495 |
++ for_each_online_cpu(cpu) |
496 |
++ cvmx_write_csr(CVMX_CIU_WDOGX(cpu_logical_map(cpu)), 0); |
497 |
++} |
498 |
++#endif |
499 |
++ |
500 |
+ #endif /* CONFIG_KEXEC */ |
501 |
+ |
502 |
+ #ifdef CONFIG_CAVIUM_RESERVE32 |
503 |
+@@ -864,6 +875,9 @@ void __init prom_init(void) |
504 |
+ _machine_kexec_shutdown = octeon_shutdown; |
505 |
+ _machine_crash_shutdown = octeon_crash_shutdown; |
506 |
+ _machine_kexec_prepare = octeon_kexec_prepare; |
507 |
++#ifdef CONFIG_SMP |
508 |
++ _crash_smp_send_stop = octeon_crash_smp_send_stop; |
509 |
++#endif |
510 |
+ #endif |
511 |
+ |
512 |
+ octeon_user_io_init(); |
513 |
+diff --git a/arch/mips/cavium-octeon/smp.c b/arch/mips/cavium-octeon/smp.c |
514 |
+index b7fa9ae28c36..bbd34b0f8d84 100644 |
515 |
+--- a/arch/mips/cavium-octeon/smp.c |
516 |
++++ b/arch/mips/cavium-octeon/smp.c |
517 |
+@@ -239,6 +239,7 @@ static int octeon_cpu_disable(void) |
518 |
+ return -ENOTSUPP; |
519 |
+ |
520 |
+ set_cpu_online(cpu, false); |
521 |
++ calculate_cpu_foreign_map(); |
522 |
+ cpumask_clear_cpu(cpu, &cpu_callin_map); |
523 |
+ octeon_fixup_irqs(); |
524 |
+ |
525 |
+diff --git a/arch/mips/include/asm/elf.h b/arch/mips/include/asm/elf.h |
526 |
+index b01a6ff468e0..ce985cefe11c 100644 |
527 |
+--- a/arch/mips/include/asm/elf.h |
528 |
++++ b/arch/mips/include/asm/elf.h |
529 |
+@@ -420,6 +420,7 @@ extern const char *__elf_platform; |
530 |
+ #define ELF_ET_DYN_BASE (TASK_SIZE / 3 * 2) |
531 |
+ #endif |
532 |
+ |
533 |
++/* update AT_VECTOR_SIZE_ARCH if the number of NEW_AUX_ENT entries changes */ |
534 |
+ #define ARCH_DLINFO \ |
535 |
+ do { \ |
536 |
+ NEW_AUX_ENT(AT_SYSINFO_EHDR, \ |
537 |
+diff --git a/arch/mips/include/asm/kexec.h b/arch/mips/include/asm/kexec.h |
538 |
+index b6a4d4aa548f..cfdbe66575f4 100644 |
539 |
+--- a/arch/mips/include/asm/kexec.h |
540 |
++++ b/arch/mips/include/asm/kexec.h |
541 |
+@@ -45,6 +45,7 @@ extern const unsigned char kexec_smp_wait[]; |
542 |
+ extern unsigned long secondary_kexec_args[4]; |
543 |
+ extern void (*relocated_kexec_smp_wait) (void *); |
544 |
+ extern atomic_t kexec_ready_to_reboot; |
545 |
++extern void (*_crash_smp_send_stop)(void); |
546 |
+ #endif |
547 |
+ #endif |
548 |
+ |
549 |
+diff --git a/arch/mips/include/asm/r4kcache.h b/arch/mips/include/asm/r4kcache.h |
550 |
+index 38902bf97adc..667ca3c467b7 100644 |
551 |
+--- a/arch/mips/include/asm/r4kcache.h |
552 |
++++ b/arch/mips/include/asm/r4kcache.h |
553 |
+@@ -210,7 +210,11 @@ static inline void protected_writeback_dcache_line(unsigned long addr) |
554 |
+ |
555 |
+ static inline void protected_writeback_scache_line(unsigned long addr) |
556 |
+ { |
557 |
++#ifdef CONFIG_EVA |
558 |
++ protected_cachee_op(Hit_Writeback_Inv_SD, addr); |
559 |
++#else |
560 |
+ protected_cache_op(Hit_Writeback_Inv_SD, addr); |
561 |
++#endif |
562 |
+ } |
563 |
+ |
564 |
+ /* |
565 |
+diff --git a/arch/mips/include/asm/smp.h b/arch/mips/include/asm/smp.h |
566 |
+index 82852dfd8dab..5ce0fcc81e87 100644 |
567 |
+--- a/arch/mips/include/asm/smp.h |
568 |
++++ b/arch/mips/include/asm/smp.h |
569 |
+@@ -63,6 +63,8 @@ extern cpumask_t cpu_coherent_mask; |
570 |
+ |
571 |
+ extern void asmlinkage smp_bootstrap(void); |
572 |
+ |
573 |
++extern void calculate_cpu_foreign_map(void); |
574 |
++ |
575 |
+ /* |
576 |
+ * this function sends a 'reschedule' IPI to another CPU. |
577 |
+ * it goes straight through and wastes no time serializing |
578 |
+diff --git a/arch/mips/include/uapi/asm/auxvec.h b/arch/mips/include/uapi/asm/auxvec.h |
579 |
+index c9c7195272c4..45ba259a3618 100644 |
580 |
+--- a/arch/mips/include/uapi/asm/auxvec.h |
581 |
++++ b/arch/mips/include/uapi/asm/auxvec.h |
582 |
+@@ -14,4 +14,6 @@ |
583 |
+ /* Location of VDSO image. */ |
584 |
+ #define AT_SYSINFO_EHDR 33 |
585 |
+ |
586 |
++#define AT_VECTOR_SIZE_ARCH 1 /* entries in ARCH_DLINFO */ |
587 |
++ |
588 |
+ #endif /* __ASM_AUXVEC_H */ |
589 |
+diff --git a/arch/mips/kernel/bmips_vec.S b/arch/mips/kernel/bmips_vec.S |
590 |
+index 86495072a922..d9495f3f3fad 100644 |
591 |
+--- a/arch/mips/kernel/bmips_vec.S |
592 |
++++ b/arch/mips/kernel/bmips_vec.S |
593 |
+@@ -93,7 +93,8 @@ NESTED(bmips_reset_nmi_vec, PT_SIZE, sp) |
594 |
+ #if defined(CONFIG_CPU_BMIPS5000) |
595 |
+ mfc0 k0, CP0_PRID |
596 |
+ li k1, PRID_IMP_BMIPS5000 |
597 |
+- andi k0, 0xff00 |
598 |
++ /* mask with PRID_IMP_BMIPS5000 to cover both variants */ |
599 |
++ andi k0, PRID_IMP_BMIPS5000 |
600 |
+ bne k0, k1, 1f |
601 |
+ |
602 |
+ /* if we're not on core 0, this must be the SMP boot signal */ |
603 |
+@@ -166,10 +167,12 @@ bmips_smp_entry: |
604 |
+ 2: |
605 |
+ #endif /* CONFIG_CPU_BMIPS4350 || CONFIG_CPU_BMIPS4380 */ |
606 |
+ #if defined(CONFIG_CPU_BMIPS5000) |
607 |
+- /* set exception vector base */ |
608 |
++ /* mask with PRID_IMP_BMIPS5000 to cover both variants */ |
609 |
+ li k1, PRID_IMP_BMIPS5000 |
610 |
++ andi k0, PRID_IMP_BMIPS5000 |
611 |
+ bne k0, k1, 3f |
612 |
+ |
613 |
++ /* set exception vector base */ |
614 |
+ la k0, ebase |
615 |
+ lw k0, 0(k0) |
616 |
+ mtc0 k0, $15, 1 |
617 |
+@@ -263,6 +266,8 @@ LEAF(bmips_enable_xks01) |
618 |
+ #endif /* CONFIG_CPU_BMIPS4380 */ |
619 |
+ #if defined(CONFIG_CPU_BMIPS5000) |
620 |
+ li t1, PRID_IMP_BMIPS5000 |
621 |
++ /* mask with PRID_IMP_BMIPS5000 to cover both variants */ |
622 |
++ andi t2, PRID_IMP_BMIPS5000 |
623 |
+ bne t2, t1, 2f |
624 |
+ |
625 |
+ mfc0 t0, $22, 5 |
626 |
+diff --git a/arch/mips/kernel/branch.c b/arch/mips/kernel/branch.c |
627 |
+index 71e8f4c0b8da..a2e9ad37ea20 100644 |
628 |
+--- a/arch/mips/kernel/branch.c |
629 |
++++ b/arch/mips/kernel/branch.c |
630 |
+@@ -685,21 +685,9 @@ int __compute_return_epc_for_insn(struct pt_regs *regs, |
631 |
+ } |
632 |
+ lose_fpu(1); /* Save FPU state for the emulator. */ |
633 |
+ reg = insn.i_format.rt; |
634 |
+- bit = 0; |
635 |
+- switch (insn.i_format.rs) { |
636 |
+- case bc1eqz_op: |
637 |
+- /* Test bit 0 */ |
638 |
+- if (get_fpr32(¤t->thread.fpu.fpr[reg], 0) |
639 |
+- & 0x1) |
640 |
+- bit = 1; |
641 |
+- break; |
642 |
+- case bc1nez_op: |
643 |
+- /* Test bit 0 */ |
644 |
+- if (!(get_fpr32(¤t->thread.fpu.fpr[reg], 0) |
645 |
+- & 0x1)) |
646 |
+- bit = 1; |
647 |
+- break; |
648 |
+- } |
649 |
++ bit = get_fpr32(¤t->thread.fpu.fpr[reg], 0) & 0x1; |
650 |
++ if (insn.i_format.rs == bc1eqz_op) |
651 |
++ bit = !bit; |
652 |
+ own_fpu(1); |
653 |
+ if (bit) |
654 |
+ epc = epc + 4 + |
655 |
+diff --git a/arch/mips/kernel/cps-vec.S b/arch/mips/kernel/cps-vec.S |
656 |
+index ac81edd44563..6b724436ac04 100644 |
657 |
+--- a/arch/mips/kernel/cps-vec.S |
658 |
++++ b/arch/mips/kernel/cps-vec.S |
659 |
+@@ -245,7 +245,6 @@ LEAF(excep_intex) |
660 |
+ |
661 |
+ .org 0x480 |
662 |
+ LEAF(excep_ejtag) |
663 |
+- DUMP_EXCEP("EJTAG") |
664 |
+ PTR_LA k0, ejtag_debug_handler |
665 |
+ jr k0 |
666 |
+ nop |
667 |
+diff --git a/arch/mips/kernel/cpu-probe.c b/arch/mips/kernel/cpu-probe.c |
668 |
+index 6b9064499bd3..157c08c37e68 100644 |
669 |
+--- a/arch/mips/kernel/cpu-probe.c |
670 |
++++ b/arch/mips/kernel/cpu-probe.c |
671 |
+@@ -1284,7 +1284,10 @@ static inline void cpu_probe_broadcom(struct cpuinfo_mips *c, unsigned int cpu) |
672 |
+ case PRID_IMP_BMIPS5000: |
673 |
+ case PRID_IMP_BMIPS5200: |
674 |
+ c->cputype = CPU_BMIPS5000; |
675 |
+- __cpu_name[cpu] = "Broadcom BMIPS5000"; |
676 |
++ if ((c->processor_id & PRID_IMP_MASK) == PRID_IMP_BMIPS5200) |
677 |
++ __cpu_name[cpu] = "Broadcom BMIPS5200"; |
678 |
++ else |
679 |
++ __cpu_name[cpu] = "Broadcom BMIPS5000"; |
680 |
+ set_elf_platform(cpu, "bmips5000"); |
681 |
+ c->options |= MIPS_CPU_ULRI; |
682 |
+ break; |
683 |
+diff --git a/arch/mips/kernel/crash.c b/arch/mips/kernel/crash.c |
684 |
+index 93c46c9cebb7..e757f36cea6f 100644 |
685 |
+--- a/arch/mips/kernel/crash.c |
686 |
++++ b/arch/mips/kernel/crash.c |
687 |
+@@ -50,9 +50,14 @@ static void crash_shutdown_secondary(void *passed_regs) |
688 |
+ |
689 |
+ static void crash_kexec_prepare_cpus(void) |
690 |
+ { |
691 |
++ static int cpus_stopped; |
692 |
+ unsigned int msecs; |
693 |
++ unsigned int ncpus; |
694 |
+ |
695 |
+- unsigned int ncpus = num_online_cpus() - 1;/* Excluding the panic cpu */ |
696 |
++ if (cpus_stopped) |
697 |
++ return; |
698 |
++ |
699 |
++ ncpus = num_online_cpus() - 1;/* Excluding the panic cpu */ |
700 |
+ |
701 |
+ dump_send_ipi(crash_shutdown_secondary); |
702 |
+ smp_wmb(); |
703 |
+@@ -67,6 +72,17 @@ static void crash_kexec_prepare_cpus(void) |
704 |
+ cpu_relax(); |
705 |
+ mdelay(1); |
706 |
+ } |
707 |
++ |
708 |
++ cpus_stopped = 1; |
709 |
++} |
710 |
++ |
711 |
++/* Override the weak function in kernel/panic.c */ |
712 |
++void crash_smp_send_stop(void) |
713 |
++{ |
714 |
++ if (_crash_smp_send_stop) |
715 |
++ _crash_smp_send_stop(); |
716 |
++ |
717 |
++ crash_kexec_prepare_cpus(); |
718 |
+ } |
719 |
+ |
720 |
+ #else /* !defined(CONFIG_SMP) */ |
721 |
+diff --git a/arch/mips/kernel/machine_kexec.c b/arch/mips/kernel/machine_kexec.c |
722 |
+index 92bc066e47a3..32b567e88b02 100644 |
723 |
+--- a/arch/mips/kernel/machine_kexec.c |
724 |
++++ b/arch/mips/kernel/machine_kexec.c |
725 |
+@@ -25,6 +25,7 @@ void (*_machine_crash_shutdown)(struct pt_regs *regs) = NULL; |
726 |
+ #ifdef CONFIG_SMP |
727 |
+ void (*relocated_kexec_smp_wait) (void *); |
728 |
+ atomic_t kexec_ready_to_reboot = ATOMIC_INIT(0); |
729 |
++void (*_crash_smp_send_stop)(void) = NULL; |
730 |
+ #endif |
731 |
+ |
732 |
+ int |
733 |
+diff --git a/arch/mips/kernel/perf_event_mipsxx.c b/arch/mips/kernel/perf_event_mipsxx.c |
734 |
+index d7b8dd43147a..fcc1117a73e0 100644 |
735 |
+--- a/arch/mips/kernel/perf_event_mipsxx.c |
736 |
++++ b/arch/mips/kernel/perf_event_mipsxx.c |
737 |
+@@ -825,6 +825,16 @@ static const struct mips_perf_event mipsxxcore_event_map2 |
738 |
+ [PERF_COUNT_HW_BRANCH_MISSES] = { 0x27, CNTR_ODD, T }, |
739 |
+ }; |
740 |
+ |
741 |
++static const struct mips_perf_event i6400_event_map[PERF_COUNT_HW_MAX] = { |
742 |
++ [PERF_COUNT_HW_CPU_CYCLES] = { 0x00, CNTR_EVEN | CNTR_ODD }, |
743 |
++ [PERF_COUNT_HW_INSTRUCTIONS] = { 0x01, CNTR_EVEN | CNTR_ODD }, |
744 |
++ /* These only count dcache, not icache */ |
745 |
++ [PERF_COUNT_HW_CACHE_REFERENCES] = { 0x45, CNTR_EVEN | CNTR_ODD }, |
746 |
++ [PERF_COUNT_HW_CACHE_MISSES] = { 0x48, CNTR_EVEN | CNTR_ODD }, |
747 |
++ [PERF_COUNT_HW_BRANCH_INSTRUCTIONS] = { 0x15, CNTR_EVEN | CNTR_ODD }, |
748 |
++ [PERF_COUNT_HW_BRANCH_MISSES] = { 0x16, CNTR_EVEN | CNTR_ODD }, |
749 |
++}; |
750 |
++ |
751 |
+ static const struct mips_perf_event loongson3_event_map[PERF_COUNT_HW_MAX] = { |
752 |
+ [PERF_COUNT_HW_CPU_CYCLES] = { 0x00, CNTR_EVEN }, |
753 |
+ [PERF_COUNT_HW_INSTRUCTIONS] = { 0x00, CNTR_ODD }, |
754 |
+@@ -1015,6 +1025,46 @@ static const struct mips_perf_event mipsxxcore_cache_map2 |
755 |
+ }, |
756 |
+ }; |
757 |
+ |
758 |
++static const struct mips_perf_event i6400_cache_map |
759 |
++ [PERF_COUNT_HW_CACHE_MAX] |
760 |
++ [PERF_COUNT_HW_CACHE_OP_MAX] |
761 |
++ [PERF_COUNT_HW_CACHE_RESULT_MAX] = { |
762 |
++[C(L1D)] = { |
763 |
++ [C(OP_READ)] = { |
764 |
++ [C(RESULT_ACCESS)] = { 0x46, CNTR_EVEN | CNTR_ODD }, |
765 |
++ [C(RESULT_MISS)] = { 0x49, CNTR_EVEN | CNTR_ODD }, |
766 |
++ }, |
767 |
++ [C(OP_WRITE)] = { |
768 |
++ [C(RESULT_ACCESS)] = { 0x47, CNTR_EVEN | CNTR_ODD }, |
769 |
++ [C(RESULT_MISS)] = { 0x4a, CNTR_EVEN | CNTR_ODD }, |
770 |
++ }, |
771 |
++}, |
772 |
++[C(L1I)] = { |
773 |
++ [C(OP_READ)] = { |
774 |
++ [C(RESULT_ACCESS)] = { 0x84, CNTR_EVEN | CNTR_ODD }, |
775 |
++ [C(RESULT_MISS)] = { 0x85, CNTR_EVEN | CNTR_ODD }, |
776 |
++ }, |
777 |
++}, |
778 |
++[C(DTLB)] = { |
779 |
++ /* Can't distinguish read & write */ |
780 |
++ [C(OP_READ)] = { |
781 |
++ [C(RESULT_ACCESS)] = { 0x40, CNTR_EVEN | CNTR_ODD }, |
782 |
++ [C(RESULT_MISS)] = { 0x41, CNTR_EVEN | CNTR_ODD }, |
783 |
++ }, |
784 |
++ [C(OP_WRITE)] = { |
785 |
++ [C(RESULT_ACCESS)] = { 0x40, CNTR_EVEN | CNTR_ODD }, |
786 |
++ [C(RESULT_MISS)] = { 0x41, CNTR_EVEN | CNTR_ODD }, |
787 |
++ }, |
788 |
++}, |
789 |
++[C(BPU)] = { |
790 |
++ /* Conditional branches / mispredicted */ |
791 |
++ [C(OP_READ)] = { |
792 |
++ [C(RESULT_ACCESS)] = { 0x15, CNTR_EVEN | CNTR_ODD }, |
793 |
++ [C(RESULT_MISS)] = { 0x16, CNTR_EVEN | CNTR_ODD }, |
794 |
++ }, |
795 |
++}, |
796 |
++}; |
797 |
++ |
798 |
+ static const struct mips_perf_event loongson3_cache_map |
799 |
+ [PERF_COUNT_HW_CACHE_MAX] |
800 |
+ [PERF_COUNT_HW_CACHE_OP_MAX] |
801 |
+@@ -1556,7 +1606,6 @@ static const struct mips_perf_event *mipsxx_pmu_map_raw_event(u64 config) |
802 |
+ #endif |
803 |
+ break; |
804 |
+ case CPU_P5600: |
805 |
+- case CPU_I6400: |
806 |
+ /* 8-bit event numbers */ |
807 |
+ raw_id = config & 0x1ff; |
808 |
+ base_id = raw_id & 0xff; |
809 |
+@@ -1569,6 +1618,11 @@ static const struct mips_perf_event *mipsxx_pmu_map_raw_event(u64 config) |
810 |
+ raw_event.range = P; |
811 |
+ #endif |
812 |
+ break; |
813 |
++ case CPU_I6400: |
814 |
++ /* 8-bit event numbers */ |
815 |
++ base_id = config & 0xff; |
816 |
++ raw_event.cntr_mask = CNTR_EVEN | CNTR_ODD; |
817 |
++ break; |
818 |
+ case CPU_1004K: |
819 |
+ if (IS_BOTH_COUNTERS_1004K_EVENT(base_id)) |
820 |
+ raw_event.cntr_mask = CNTR_EVEN | CNTR_ODD; |
821 |
+@@ -1720,8 +1774,8 @@ init_hw_perf_events(void) |
822 |
+ break; |
823 |
+ case CPU_I6400: |
824 |
+ mipspmu.name = "mips/I6400"; |
825 |
+- mipspmu.general_event_map = &mipsxxcore_event_map2; |
826 |
+- mipspmu.cache_event_map = &mipsxxcore_cache_map2; |
827 |
++ mipspmu.general_event_map = &i6400_event_map; |
828 |
++ mipspmu.cache_event_map = &i6400_cache_map; |
829 |
+ break; |
830 |
+ case CPU_1004K: |
831 |
+ mipspmu.name = "mips/1004K"; |
832 |
+diff --git a/arch/mips/kernel/ptrace.c b/arch/mips/kernel/ptrace.c |
833 |
+index 9d04392f7ef0..135e22611820 100644 |
834 |
+--- a/arch/mips/kernel/ptrace.c |
835 |
++++ b/arch/mips/kernel/ptrace.c |
836 |
+@@ -670,9 +670,6 @@ static const struct pt_regs_offset regoffset_table[] = { |
837 |
+ REG_OFFSET_NAME(c0_badvaddr, cp0_badvaddr), |
838 |
+ REG_OFFSET_NAME(c0_cause, cp0_cause), |
839 |
+ REG_OFFSET_NAME(c0_epc, cp0_epc), |
840 |
+-#ifdef CONFIG_MIPS_MT_SMTC |
841 |
+- REG_OFFSET_NAME(c0_tcstatus, cp0_tcstatus), |
842 |
+-#endif |
843 |
+ #ifdef CONFIG_CPU_CAVIUM_OCTEON |
844 |
+ REG_OFFSET_NAME(mpl0, mpl[0]), |
845 |
+ REG_OFFSET_NAME(mpl1, mpl[1]), |
846 |
+diff --git a/arch/mips/kernel/scall32-o32.S b/arch/mips/kernel/scall32-o32.S |
847 |
+index 29b0c5f978e4..7ee8c6269b22 100644 |
848 |
+--- a/arch/mips/kernel/scall32-o32.S |
849 |
++++ b/arch/mips/kernel/scall32-o32.S |
850 |
+@@ -35,7 +35,6 @@ NESTED(handle_sys, PT_SIZE, sp) |
851 |
+ |
852 |
+ lw t1, PT_EPC(sp) # skip syscall on return |
853 |
+ |
854 |
+- subu v0, v0, __NR_O32_Linux # check syscall number |
855 |
+ addiu t1, 4 # skip to next instruction |
856 |
+ sw t1, PT_EPC(sp) |
857 |
+ |
858 |
+@@ -89,6 +88,7 @@ loads_done: |
859 |
+ and t0, t1 |
860 |
+ bnez t0, syscall_trace_entry # -> yes |
861 |
+ syscall_common: |
862 |
++ subu v0, v0, __NR_O32_Linux # check syscall number |
863 |
+ sltiu t0, v0, __NR_O32_Linux_syscalls + 1 |
864 |
+ beqz t0, illegal_syscall |
865 |
+ |
866 |
+@@ -118,24 +118,23 @@ o32_syscall_exit: |
867 |
+ |
868 |
+ syscall_trace_entry: |
869 |
+ SAVE_STATIC |
870 |
+- move s0, v0 |
871 |
+ move a0, sp |
872 |
+ |
873 |
+ /* |
874 |
+ * syscall number is in v0 unless we called syscall(__NR_###) |
875 |
+ * where the real syscall number is in a0 |
876 |
+ */ |
877 |
+- addiu a1, v0, __NR_O32_Linux |
878 |
+- bnez v0, 1f /* __NR_syscall at offset 0 */ |
879 |
++ move a1, v0 |
880 |
++ subu t2, v0, __NR_O32_Linux |
881 |
++ bnez t2, 1f /* __NR_syscall at offset 0 */ |
882 |
+ lw a1, PT_R4(sp) |
883 |
+ |
884 |
+ 1: jal syscall_trace_enter |
885 |
+ |
886 |
+ bltz v0, 1f # seccomp failed? Skip syscall |
887 |
+ |
888 |
+- move v0, s0 # restore syscall |
889 |
+- |
890 |
+ RESTORE_STATIC |
891 |
++ lw v0, PT_R2(sp) # Restore syscall (maybe modified) |
892 |
+ lw a0, PT_R4(sp) # Restore argument registers |
893 |
+ lw a1, PT_R5(sp) |
894 |
+ lw a2, PT_R6(sp) |
895 |
+diff --git a/arch/mips/kernel/scall64-64.S b/arch/mips/kernel/scall64-64.S |
896 |
+index a6323a969919..01779c315bc6 100644 |
897 |
+--- a/arch/mips/kernel/scall64-64.S |
898 |
++++ b/arch/mips/kernel/scall64-64.S |
899 |
+@@ -82,15 +82,14 @@ n64_syscall_exit: |
900 |
+ |
901 |
+ syscall_trace_entry: |
902 |
+ SAVE_STATIC |
903 |
+- move s0, v0 |
904 |
+ move a0, sp |
905 |
+ move a1, v0 |
906 |
+ jal syscall_trace_enter |
907 |
+ |
908 |
+ bltz v0, 1f # seccomp failed? Skip syscall |
909 |
+ |
910 |
+- move v0, s0 |
911 |
+ RESTORE_STATIC |
912 |
++ ld v0, PT_R2(sp) # Restore syscall (maybe modified) |
913 |
+ ld a0, PT_R4(sp) # Restore argument registers |
914 |
+ ld a1, PT_R5(sp) |
915 |
+ ld a2, PT_R6(sp) |
916 |
+diff --git a/arch/mips/kernel/scall64-n32.S b/arch/mips/kernel/scall64-n32.S |
917 |
+index e0fdca8d3abe..0d22a5cc0b8b 100644 |
918 |
+--- a/arch/mips/kernel/scall64-n32.S |
919 |
++++ b/arch/mips/kernel/scall64-n32.S |
920 |
+@@ -42,9 +42,6 @@ NESTED(handle_sysn32, PT_SIZE, sp) |
921 |
+ #endif |
922 |
+ beqz t0, not_n32_scall |
923 |
+ |
924 |
+- dsll t0, v0, 3 # offset into table |
925 |
+- ld t2, (sysn32_call_table - (__NR_N32_Linux * 8))(t0) |
926 |
+- |
927 |
+ sd a3, PT_R26(sp) # save a3 for syscall restarting |
928 |
+ |
929 |
+ li t1, _TIF_WORK_SYSCALL_ENTRY |
930 |
+@@ -53,6 +50,9 @@ NESTED(handle_sysn32, PT_SIZE, sp) |
931 |
+ bnez t0, n32_syscall_trace_entry |
932 |
+ |
933 |
+ syscall_common: |
934 |
++ dsll t0, v0, 3 # offset into table |
935 |
++ ld t2, (sysn32_call_table - (__NR_N32_Linux * 8))(t0) |
936 |
++ |
937 |
+ jalr t2 # Do The Real Thing (TM) |
938 |
+ |
939 |
+ li t0, -EMAXERRNO - 1 # error? |
940 |
+@@ -71,21 +71,25 @@ syscall_common: |
941 |
+ |
942 |
+ n32_syscall_trace_entry: |
943 |
+ SAVE_STATIC |
944 |
+- move s0, t2 |
945 |
+ move a0, sp |
946 |
+ move a1, v0 |
947 |
+ jal syscall_trace_enter |
948 |
+ |
949 |
+ bltz v0, 1f # seccomp failed? Skip syscall |
950 |
+ |
951 |
+- move t2, s0 |
952 |
+ RESTORE_STATIC |
953 |
++ ld v0, PT_R2(sp) # Restore syscall (maybe modified) |
954 |
+ ld a0, PT_R4(sp) # Restore argument registers |
955 |
+ ld a1, PT_R5(sp) |
956 |
+ ld a2, PT_R6(sp) |
957 |
+ ld a3, PT_R7(sp) |
958 |
+ ld a4, PT_R8(sp) |
959 |
+ ld a5, PT_R9(sp) |
960 |
++ |
961 |
++ dsubu t2, v0, __NR_N32_Linux # check (new) syscall number |
962 |
++ sltiu t0, t2, __NR_N32_Linux_syscalls + 1 |
963 |
++ beqz t0, not_n32_scall |
964 |
++ |
965 |
+ j syscall_common |
966 |
+ |
967 |
+ 1: j syscall_exit |
968 |
+diff --git a/arch/mips/kernel/scall64-o32.S b/arch/mips/kernel/scall64-o32.S |
969 |
+index 4faff3e77b25..a5cc2b2823d2 100644 |
970 |
+--- a/arch/mips/kernel/scall64-o32.S |
971 |
++++ b/arch/mips/kernel/scall64-o32.S |
972 |
+@@ -52,9 +52,6 @@ NESTED(handle_sys, PT_SIZE, sp) |
973 |
+ sll a2, a2, 0 |
974 |
+ sll a3, a3, 0 |
975 |
+ |
976 |
+- dsll t0, v0, 3 # offset into table |
977 |
+- ld t2, (sys32_call_table - (__NR_O32_Linux * 8))(t0) |
978 |
+- |
979 |
+ sd a3, PT_R26(sp) # save a3 for syscall restarting |
980 |
+ |
981 |
+ /* |
982 |
+@@ -88,6 +85,9 @@ loads_done: |
983 |
+ bnez t0, trace_a_syscall |
984 |
+ |
985 |
+ syscall_common: |
986 |
++ dsll t0, v0, 3 # offset into table |
987 |
++ ld t2, (sys32_call_table - (__NR_O32_Linux * 8))(t0) |
988 |
++ |
989 |
+ jalr t2 # Do The Real Thing (TM) |
990 |
+ |
991 |
+ li t0, -EMAXERRNO - 1 # error? |
992 |
+@@ -112,7 +112,6 @@ trace_a_syscall: |
993 |
+ sd a6, PT_R10(sp) |
994 |
+ sd a7, PT_R11(sp) # For indirect syscalls |
995 |
+ |
996 |
+- move s0, t2 # Save syscall pointer |
997 |
+ move a0, sp |
998 |
+ /* |
999 |
+ * absolute syscall number is in v0 unless we called syscall(__NR_###) |
1000 |
+@@ -133,8 +132,8 @@ trace_a_syscall: |
1001 |
+ |
1002 |
+ bltz v0, 1f # seccomp failed? Skip syscall |
1003 |
+ |
1004 |
+- move t2, s0 |
1005 |
+ RESTORE_STATIC |
1006 |
++ ld v0, PT_R2(sp) # Restore syscall (maybe modified) |
1007 |
+ ld a0, PT_R4(sp) # Restore argument registers |
1008 |
+ ld a1, PT_R5(sp) |
1009 |
+ ld a2, PT_R6(sp) |
1010 |
+@@ -143,6 +142,11 @@ trace_a_syscall: |
1011 |
+ ld a5, PT_R9(sp) |
1012 |
+ ld a6, PT_R10(sp) |
1013 |
+ ld a7, PT_R11(sp) # For indirect syscalls |
1014 |
++ |
1015 |
++ dsubu t0, v0, __NR_O32_Linux # check (new) syscall number |
1016 |
++ sltiu t0, t0, __NR_O32_Linux_syscalls + 1 |
1017 |
++ beqz t0, not_o32_scall |
1018 |
++ |
1019 |
+ j syscall_common |
1020 |
+ |
1021 |
+ 1: j syscall_exit |
1022 |
+diff --git a/arch/mips/kernel/setup.c b/arch/mips/kernel/setup.c |
1023 |
+index fadc946b306d..8fa30516f39d 100644 |
1024 |
+--- a/arch/mips/kernel/setup.c |
1025 |
++++ b/arch/mips/kernel/setup.c |
1026 |
+@@ -695,7 +695,7 @@ static void __init request_crashkernel(struct resource *res) |
1027 |
+ |
1028 |
+ #define USE_PROM_CMDLINE IS_ENABLED(CONFIG_MIPS_CMDLINE_FROM_BOOTLOADER) |
1029 |
+ #define USE_DTB_CMDLINE IS_ENABLED(CONFIG_MIPS_CMDLINE_FROM_DTB) |
1030 |
+-#define EXTEND_WITH_PROM IS_ENABLED(CONFIG_MIPS_CMDLINE_EXTEND) |
1031 |
++#define EXTEND_WITH_PROM IS_ENABLED(CONFIG_MIPS_CMDLINE_DTB_EXTEND) |
1032 |
+ |
1033 |
+ static void __init arch_mem_init(char **cmdline_p) |
1034 |
+ { |
1035 |
+diff --git a/arch/mips/kernel/smp-bmips.c b/arch/mips/kernel/smp-bmips.c |
1036 |
+index a62d24169d75..a00c4699ca10 100644 |
1037 |
+--- a/arch/mips/kernel/smp-bmips.c |
1038 |
++++ b/arch/mips/kernel/smp-bmips.c |
1039 |
+@@ -362,6 +362,7 @@ static int bmips_cpu_disable(void) |
1040 |
+ pr_info("SMP: CPU%d is offline\n", cpu); |
1041 |
+ |
1042 |
+ set_cpu_online(cpu, false); |
1043 |
++ calculate_cpu_foreign_map(); |
1044 |
+ cpumask_clear_cpu(cpu, &cpu_callin_map); |
1045 |
+ clear_c0_status(IE_IRQ5); |
1046 |
+ |
1047 |
+diff --git a/arch/mips/kernel/smp-cps.c b/arch/mips/kernel/smp-cps.c |
1048 |
+index e04c8057b882..de0b7eaca9e2 100644 |
1049 |
+--- a/arch/mips/kernel/smp-cps.c |
1050 |
++++ b/arch/mips/kernel/smp-cps.c |
1051 |
+@@ -338,6 +338,7 @@ static int cps_cpu_disable(void) |
1052 |
+ atomic_sub(1 << cpu_vpe_id(¤t_cpu_data), &core_cfg->vpe_mask); |
1053 |
+ smp_mb__after_atomic(); |
1054 |
+ set_cpu_online(cpu, false); |
1055 |
++ calculate_cpu_foreign_map(); |
1056 |
+ cpumask_clear_cpu(cpu, &cpu_callin_map); |
1057 |
+ |
1058 |
+ return 0; |
1059 |
+diff --git a/arch/mips/kernel/smp.c b/arch/mips/kernel/smp.c |
1060 |
+index 4af08c197177..8eff08d548fa 100644 |
1061 |
+--- a/arch/mips/kernel/smp.c |
1062 |
++++ b/arch/mips/kernel/smp.c |
1063 |
+@@ -118,7 +118,7 @@ static inline void set_cpu_core_map(int cpu) |
1064 |
+ * Calculate a new cpu_foreign_map mask whenever a |
1065 |
+ * new cpu appears or disappears. |
1066 |
+ */ |
1067 |
+-static inline void calculate_cpu_foreign_map(void) |
1068 |
++void calculate_cpu_foreign_map(void) |
1069 |
+ { |
1070 |
+ int i, k, core_present; |
1071 |
+ cpumask_t temp_foreign_map; |
1072 |
+diff --git a/arch/mips/kvm/dyntrans.c b/arch/mips/kvm/dyntrans.c |
1073 |
+index 521121bdebff..4974bfc2c5c8 100644 |
1074 |
+--- a/arch/mips/kvm/dyntrans.c |
1075 |
++++ b/arch/mips/kvm/dyntrans.c |
1076 |
+@@ -82,7 +82,7 @@ int kvm_mips_trans_mfc0(uint32_t inst, uint32_t *opc, struct kvm_vcpu *vcpu) |
1077 |
+ |
1078 |
+ if ((rd == MIPS_CP0_ERRCTL) && (sel == 0)) { |
1079 |
+ mfc0_inst = CLEAR_TEMPLATE; |
1080 |
+- mfc0_inst |= ((rt & 0x1f) << 16); |
1081 |
++ mfc0_inst |= ((rt & 0x1f) << 11); |
1082 |
+ } else { |
1083 |
+ mfc0_inst = LW_TEMPLATE; |
1084 |
+ mfc0_inst |= ((rt & 0x1f) << 16); |
1085 |
+diff --git a/arch/mips/loongson64/loongson-3/smp.c b/arch/mips/loongson64/loongson-3/smp.c |
1086 |
+index 509832a9836c..2525b6d38f58 100644 |
1087 |
+--- a/arch/mips/loongson64/loongson-3/smp.c |
1088 |
++++ b/arch/mips/loongson64/loongson-3/smp.c |
1089 |
+@@ -417,6 +417,7 @@ static int loongson3_cpu_disable(void) |
1090 |
+ return -EBUSY; |
1091 |
+ |
1092 |
+ set_cpu_online(cpu, false); |
1093 |
++ calculate_cpu_foreign_map(); |
1094 |
+ cpumask_clear_cpu(cpu, &cpu_callin_map); |
1095 |
+ local_irq_save(flags); |
1096 |
+ fixup_irqs(); |
1097 |
+diff --git a/arch/mips/math-emu/cp1emu.c b/arch/mips/math-emu/cp1emu.c |
1098 |
+index 011b9b9574f1..e31fde4bc25b 100644 |
1099 |
+--- a/arch/mips/math-emu/cp1emu.c |
1100 |
++++ b/arch/mips/math-emu/cp1emu.c |
1101 |
+@@ -975,9 +975,10 @@ static int cop1Emulate(struct pt_regs *xcp, struct mips_fpu_struct *ctx, |
1102 |
+ struct mm_decoded_insn dec_insn, void *__user *fault_addr) |
1103 |
+ { |
1104 |
+ unsigned long contpc = xcp->cp0_epc + dec_insn.pc_inc; |
1105 |
+- unsigned int cond, cbit; |
1106 |
++ unsigned int cond, cbit, bit0; |
1107 |
+ mips_instruction ir; |
1108 |
+ int likely, pc_inc; |
1109 |
++ union fpureg *fpr; |
1110 |
+ u32 __user *wva; |
1111 |
+ u64 __user *dva; |
1112 |
+ u32 wval; |
1113 |
+@@ -1189,14 +1190,14 @@ emul: |
1114 |
+ return SIGILL; |
1115 |
+ |
1116 |
+ cond = likely = 0; |
1117 |
++ fpr = ¤t->thread.fpu.fpr[MIPSInst_RT(ir)]; |
1118 |
++ bit0 = get_fpr32(fpr, 0) & 0x1; |
1119 |
+ switch (MIPSInst_RS(ir)) { |
1120 |
+ case bc1eqz_op: |
1121 |
+- if (get_fpr32(¤t->thread.fpu.fpr[MIPSInst_RT(ir)], 0) & 0x1) |
1122 |
+- cond = 1; |
1123 |
++ cond = bit0 == 0; |
1124 |
+ break; |
1125 |
+ case bc1nez_op: |
1126 |
+- if (!(get_fpr32(¤t->thread.fpu.fpr[MIPSInst_RT(ir)], 0) & 0x1)) |
1127 |
+- cond = 1; |
1128 |
++ cond = bit0 != 0; |
1129 |
+ break; |
1130 |
+ } |
1131 |
+ goto branch_common; |
1132 |
+diff --git a/arch/mips/mm/c-r4k.c b/arch/mips/mm/c-r4k.c |
1133 |
+index 52e8c2026853..6c0147bd8e80 100644 |
1134 |
+--- a/arch/mips/mm/c-r4k.c |
1135 |
++++ b/arch/mips/mm/c-r4k.c |
1136 |
+@@ -447,6 +447,11 @@ static inline void local_r4k___flush_cache_all(void * args) |
1137 |
+ r4k_blast_scache(); |
1138 |
+ break; |
1139 |
+ |
1140 |
++ case CPU_BMIPS5000: |
1141 |
++ r4k_blast_scache(); |
1142 |
++ __sync(); |
1143 |
++ break; |
1144 |
++ |
1145 |
+ default: |
1146 |
+ r4k_blast_dcache(); |
1147 |
+ r4k_blast_icache(); |
1148 |
+@@ -1308,6 +1313,12 @@ static void probe_pcache(void) |
1149 |
+ c->icache.flags |= MIPS_CACHE_IC_F_DC; |
1150 |
+ break; |
1151 |
+ |
1152 |
++ case CPU_BMIPS5000: |
1153 |
++ c->icache.flags |= MIPS_CACHE_IC_F_DC; |
1154 |
++ /* Cache aliases are handled in hardware; allow HIGHMEM */ |
1155 |
++ c->dcache.flags &= ~MIPS_CACHE_ALIASES; |
1156 |
++ break; |
1157 |
++ |
1158 |
+ case CPU_LOONGSON2: |
1159 |
+ /* |
1160 |
+ * LOONGSON2 has 4 way icache, but when using indexed cache op, |
1161 |
+@@ -1745,8 +1756,6 @@ void r4k_cache_init(void) |
1162 |
+ flush_icache_range = (void *)b5k_instruction_hazard; |
1163 |
+ local_flush_icache_range = (void *)b5k_instruction_hazard; |
1164 |
+ |
1165 |
+- /* Cache aliases are handled in hardware; allow HIGHMEM */ |
1166 |
+- current_cpu_data.dcache.flags &= ~MIPS_CACHE_ALIASES; |
1167 |
+ |
1168 |
+ /* Optimization: an L2 flush implicitly flushes the L1 */ |
1169 |
+ current_cpu_data.options |= MIPS_CPU_INCLUSIVE_CACHES; |
1170 |
+diff --git a/arch/mips/mm/sc-rm7k.c b/arch/mips/mm/sc-rm7k.c |
1171 |
+index 9ac1efcfbcc7..78f900c59276 100644 |
1172 |
+--- a/arch/mips/mm/sc-rm7k.c |
1173 |
++++ b/arch/mips/mm/sc-rm7k.c |
1174 |
+@@ -161,7 +161,7 @@ static void rm7k_tc_disable(void) |
1175 |
+ local_irq_save(flags); |
1176 |
+ blast_rm7k_tcache(); |
1177 |
+ clear_c0_config(RM7K_CONF_TE); |
1178 |
+- local_irq_save(flags); |
1179 |
++ local_irq_restore(flags); |
1180 |
+ } |
1181 |
+ |
1182 |
+ static void rm7k_sc_disable(void) |
1183 |
+diff --git a/arch/mips/mm/tlbex.c b/arch/mips/mm/tlbex.c |
1184 |
+index 63b7d6f82d24..448b4aab3a1f 100644 |
1185 |
+--- a/arch/mips/mm/tlbex.c |
1186 |
++++ b/arch/mips/mm/tlbex.c |
1187 |
+@@ -2329,9 +2329,7 @@ static void config_htw_params(void) |
1188 |
+ if (CONFIG_PGTABLE_LEVELS >= 3) |
1189 |
+ pwsize |= ilog2(PTRS_PER_PMD) << MIPS_PWSIZE_MDW_SHIFT; |
1190 |
+ |
1191 |
+- /* If XPA has been enabled, PTEs are 64-bit in size. */ |
1192 |
+- if (config_enabled(CONFIG_64BITS) || (read_c0_pagegrain() & PG_ELPA)) |
1193 |
+- pwsize |= 1; |
1194 |
++ pwsize |= ilog2(sizeof(pte_t)/4) << MIPS_PWSIZE_PTEW_SHIFT; |
1195 |
+ |
1196 |
+ write_c0_pwsize(pwsize); |
1197 |
+ |
1198 |
+diff --git a/arch/mips/net/bpf_jit.c b/arch/mips/net/bpf_jit.c |
1199 |
+index c0c1e9529dbd..742daf8351b9 100644 |
1200 |
+--- a/arch/mips/net/bpf_jit.c |
1201 |
++++ b/arch/mips/net/bpf_jit.c |
1202 |
+@@ -1207,7 +1207,7 @@ void bpf_jit_compile(struct bpf_prog *fp) |
1203 |
+ |
1204 |
+ memset(&ctx, 0, sizeof(ctx)); |
1205 |
+ |
1206 |
+- ctx.offsets = kcalloc(fp->len, sizeof(*ctx.offsets), GFP_KERNEL); |
1207 |
++ ctx.offsets = kcalloc(fp->len + 1, sizeof(*ctx.offsets), GFP_KERNEL); |
1208 |
+ if (ctx.offsets == NULL) |
1209 |
+ return; |
1210 |
+ |
1211 |
+diff --git a/arch/powerpc/kernel/mce.c b/arch/powerpc/kernel/mce.c |
1212 |
+index da3c4c3f4ec8..d4936615a756 100644 |
1213 |
+--- a/arch/powerpc/kernel/mce.c |
1214 |
++++ b/arch/powerpc/kernel/mce.c |
1215 |
+@@ -92,7 +92,8 @@ void save_mce_event(struct pt_regs *regs, long handled, |
1216 |
+ mce->in_use = 1; |
1217 |
+ |
1218 |
+ mce->initiator = MCE_INITIATOR_CPU; |
1219 |
+- if (handled) |
1220 |
++ /* Mark it recovered if we have handled it and MSR(RI=1). */ |
1221 |
++ if (handled && (regs->msr & MSR_RI)) |
1222 |
+ mce->disposition = MCE_DISPOSITION_RECOVERED; |
1223 |
+ else |
1224 |
+ mce->disposition = MCE_DISPOSITION_NOT_RECOVERED; |
1225 |
+diff --git a/arch/powerpc/kernel/pci_of_scan.c b/arch/powerpc/kernel/pci_of_scan.c |
1226 |
+index a38d7293460d..985b5be3bcf6 100644 |
1227 |
+--- a/arch/powerpc/kernel/pci_of_scan.c |
1228 |
++++ b/arch/powerpc/kernel/pci_of_scan.c |
1229 |
+@@ -82,10 +82,16 @@ static void of_pci_parse_addrs(struct device_node *node, struct pci_dev *dev) |
1230 |
+ const __be32 *addrs; |
1231 |
+ u32 i; |
1232 |
+ int proplen; |
1233 |
++ bool mark_unset = false; |
1234 |
+ |
1235 |
+ addrs = of_get_property(node, "assigned-addresses", &proplen); |
1236 |
+- if (!addrs) |
1237 |
+- return; |
1238 |
++ if (!addrs || !proplen) { |
1239 |
++ addrs = of_get_property(node, "reg", &proplen); |
1240 |
++ if (!addrs || !proplen) |
1241 |
++ return; |
1242 |
++ mark_unset = true; |
1243 |
++ } |
1244 |
++ |
1245 |
+ pr_debug(" parse addresses (%d bytes) @ %p\n", proplen, addrs); |
1246 |
+ for (; proplen >= 20; proplen -= 20, addrs += 5) { |
1247 |
+ flags = pci_parse_of_flags(of_read_number(addrs, 1), 0); |
1248 |
+@@ -110,6 +116,8 @@ static void of_pci_parse_addrs(struct device_node *node, struct pci_dev *dev) |
1249 |
+ continue; |
1250 |
+ } |
1251 |
+ res->flags = flags; |
1252 |
++ if (mark_unset) |
1253 |
++ res->flags |= IORESOURCE_UNSET; |
1254 |
+ res->name = pci_name(dev); |
1255 |
+ region.start = base; |
1256 |
+ region.end = base + size - 1; |
1257 |
+diff --git a/arch/powerpc/kernel/tm.S b/arch/powerpc/kernel/tm.S |
1258 |
+index 2d2860711e07..55e831238485 100644 |
1259 |
+--- a/arch/powerpc/kernel/tm.S |
1260 |
++++ b/arch/powerpc/kernel/tm.S |
1261 |
+@@ -352,8 +352,6 @@ _GLOBAL(__tm_recheckpoint) |
1262 |
+ */ |
1263 |
+ subi r7, r7, STACK_FRAME_OVERHEAD |
1264 |
+ |
1265 |
+- SET_SCRATCH0(r1) |
1266 |
+- |
1267 |
+ mfmsr r6 |
1268 |
+ /* R4 = original MSR to indicate whether thread used FP/Vector etc. */ |
1269 |
+ |
1270 |
+@@ -482,6 +480,7 @@ restore_gprs: |
1271 |
+ * until we turn MSR RI back on. |
1272 |
+ */ |
1273 |
+ |
1274 |
++ SET_SCRATCH0(r1) |
1275 |
+ ld r5, -8(r1) |
1276 |
+ ld r1, -16(r1) |
1277 |
+ |
1278 |
+diff --git a/arch/powerpc/platforms/powernv/opal.c b/arch/powerpc/platforms/powernv/opal.c |
1279 |
+index d3787618315f..56125dbdb1e2 100644 |
1280 |
+--- a/arch/powerpc/platforms/powernv/opal.c |
1281 |
++++ b/arch/powerpc/platforms/powernv/opal.c |
1282 |
+@@ -401,6 +401,7 @@ static int opal_recover_mce(struct pt_regs *regs, |
1283 |
+ |
1284 |
+ if (!(regs->msr & MSR_RI)) { |
1285 |
+ /* If MSR_RI isn't set, we cannot recover */ |
1286 |
++ pr_err("Machine check interrupt unrecoverable: MSR(RI=0)\n"); |
1287 |
+ recovered = 0; |
1288 |
+ } else if (evt->disposition == MCE_DISPOSITION_RECOVERED) { |
1289 |
+ /* Platform corrected itself */ |
1290 |
+diff --git a/arch/x86/kernel/apic/x2apic_uv_x.c b/arch/x86/kernel/apic/x2apic_uv_x.c |
1291 |
+index 4a139465f1d4..7554075414d4 100644 |
1292 |
+--- a/arch/x86/kernel/apic/x2apic_uv_x.c |
1293 |
++++ b/arch/x86/kernel/apic/x2apic_uv_x.c |
1294 |
+@@ -648,9 +648,9 @@ static __init void map_mmioh_high_uv3(int index, int min_pnode, int max_pnode) |
1295 |
+ l = li; |
1296 |
+ } |
1297 |
+ addr1 = (base << shift) + |
1298 |
+- f * (unsigned long)(1 << m_io); |
1299 |
++ f * (1ULL << m_io); |
1300 |
+ addr2 = (base << shift) + |
1301 |
+- (l + 1) * (unsigned long)(1 << m_io); |
1302 |
++ (l + 1) * (1ULL << m_io); |
1303 |
+ pr_info("UV: %s[%03d..%03d] NASID 0x%04x ADDR 0x%016lx - 0x%016lx\n", |
1304 |
+ id, fi, li, lnasid, addr1, addr2); |
1305 |
+ if (max_io < l) |
1306 |
+diff --git a/arch/x86/kernel/cpu/perf_event.c b/arch/x86/kernel/cpu/perf_event.c |
1307 |
+index fbf2edc3eb35..b983d3dc4e6c 100644 |
1308 |
+--- a/arch/x86/kernel/cpu/perf_event.c |
1309 |
++++ b/arch/x86/kernel/cpu/perf_event.c |
1310 |
+@@ -1550,6 +1550,7 @@ static void __init filter_events(struct attribute **attrs) |
1311 |
+ { |
1312 |
+ struct device_attribute *d; |
1313 |
+ struct perf_pmu_events_attr *pmu_attr; |
1314 |
++ int offset = 0; |
1315 |
+ int i, j; |
1316 |
+ |
1317 |
+ for (i = 0; attrs[i]; i++) { |
1318 |
+@@ -1558,7 +1559,7 @@ static void __init filter_events(struct attribute **attrs) |
1319 |
+ /* str trumps id */ |
1320 |
+ if (pmu_attr->event_str) |
1321 |
+ continue; |
1322 |
+- if (x86_pmu.event_map(i)) |
1323 |
++ if (x86_pmu.event_map(i + offset)) |
1324 |
+ continue; |
1325 |
+ |
1326 |
+ for (j = i; attrs[j]; j++) |
1327 |
+@@ -1566,6 +1567,14 @@ static void __init filter_events(struct attribute **attrs) |
1328 |
+ |
1329 |
+ /* Check the shifted attr. */ |
1330 |
+ i--; |
1331 |
++ |
1332 |
++ /* |
1333 |
++ * event_map() is index based, the attrs array is organized |
1334 |
++ * by increasing event index. If we shift the events, then |
1335 |
++ * we need to compensate for the event_map(), otherwise |
1336 |
++ * we are looking up the wrong event in the map |
1337 |
++ */ |
1338 |
++ offset++; |
1339 |
+ } |
1340 |
+ } |
1341 |
+ |
1342 |
+diff --git a/arch/x86/kernel/process_64.c b/arch/x86/kernel/process_64.c |
1343 |
+index 618565fecb1c..1a79d451cd34 100644 |
1344 |
+--- a/arch/x86/kernel/process_64.c |
1345 |
++++ b/arch/x86/kernel/process_64.c |
1346 |
+@@ -128,7 +128,7 @@ void release_thread(struct task_struct *dead_task) |
1347 |
+ if (dead_task->mm->context.ldt) { |
1348 |
+ pr_warn("WARNING: dead process %s still has LDT? <%p/%d>\n", |
1349 |
+ dead_task->comm, |
1350 |
+- dead_task->mm->context.ldt, |
1351 |
++ dead_task->mm->context.ldt->entries, |
1352 |
+ dead_task->mm->context.ldt->size); |
1353 |
+ BUG(); |
1354 |
+ } |
1355 |
+diff --git a/block/blk-mq.c b/block/blk-mq.c |
1356 |
+index 8649dbf06ce4..b5633501f181 100644 |
1357 |
+--- a/block/blk-mq.c |
1358 |
++++ b/block/blk-mq.c |
1359 |
+@@ -1491,7 +1491,7 @@ static struct blk_mq_tags *blk_mq_init_rq_map(struct blk_mq_tag_set *set, |
1360 |
+ int to_do; |
1361 |
+ void *p; |
1362 |
+ |
1363 |
+- while (left < order_to_size(this_order - 1) && this_order) |
1364 |
++ while (this_order && left < order_to_size(this_order - 1)) |
1365 |
+ this_order--; |
1366 |
+ |
1367 |
+ do { |
1368 |
+diff --git a/drivers/acpi/acpi_lpss.c b/drivers/acpi/acpi_lpss.c |
1369 |
+index e54e6170981b..a17337fd8f37 100644 |
1370 |
+--- a/drivers/acpi/acpi_lpss.c |
1371 |
++++ b/drivers/acpi/acpi_lpss.c |
1372 |
+@@ -704,8 +704,13 @@ static int acpi_lpss_platform_notify(struct notifier_block *nb, |
1373 |
+ } |
1374 |
+ |
1375 |
+ switch (action) { |
1376 |
+- case BUS_NOTIFY_ADD_DEVICE: |
1377 |
++ case BUS_NOTIFY_BOUND_DRIVER: |
1378 |
+ pdev->dev.pm_domain = &acpi_lpss_pm_domain; |
1379 |
++ break; |
1380 |
++ case BUS_NOTIFY_UNBOUND_DRIVER: |
1381 |
++ pdev->dev.pm_domain = NULL; |
1382 |
++ break; |
1383 |
++ case BUS_NOTIFY_ADD_DEVICE: |
1384 |
+ if (pdata->dev_desc->flags & LPSS_LTR) |
1385 |
+ return sysfs_create_group(&pdev->dev.kobj, |
1386 |
+ &lpss_attr_group); |
1387 |
+@@ -713,7 +718,6 @@ static int acpi_lpss_platform_notify(struct notifier_block *nb, |
1388 |
+ case BUS_NOTIFY_DEL_DEVICE: |
1389 |
+ if (pdata->dev_desc->flags & LPSS_LTR) |
1390 |
+ sysfs_remove_group(&pdev->dev.kobj, &lpss_attr_group); |
1391 |
+- pdev->dev.pm_domain = NULL; |
1392 |
+ break; |
1393 |
+ default: |
1394 |
+ break; |
1395 |
+diff --git a/drivers/ata/sata_dwc_460ex.c b/drivers/ata/sata_dwc_460ex.c |
1396 |
+index 902034991517..7a7faca0ddcd 100644 |
1397 |
+--- a/drivers/ata/sata_dwc_460ex.c |
1398 |
++++ b/drivers/ata/sata_dwc_460ex.c |
1399 |
+@@ -924,15 +924,13 @@ static void sata_dwc_exec_command_by_tag(struct ata_port *ap, |
1400 |
+ struct ata_taskfile *tf, |
1401 |
+ u8 tag, u32 cmd_issued) |
1402 |
+ { |
1403 |
+- unsigned long flags; |
1404 |
+ struct sata_dwc_device_port *hsdevp = HSDEVP_FROM_AP(ap); |
1405 |
+ |
1406 |
+ dev_dbg(ap->dev, "%s cmd(0x%02x): %s tag=%d\n", __func__, tf->command, |
1407 |
+ ata_get_cmd_descript(tf->command), tag); |
1408 |
+ |
1409 |
+- spin_lock_irqsave(&ap->host->lock, flags); |
1410 |
+ hsdevp->cmd_issued[tag] = cmd_issued; |
1411 |
+- spin_unlock_irqrestore(&ap->host->lock, flags); |
1412 |
++ |
1413 |
+ /* |
1414 |
+ * Clear SError before executing a new command. |
1415 |
+ * sata_dwc_scr_write and read can not be used here. Clearing the PM |
1416 |
+diff --git a/drivers/base/firmware_class.c b/drivers/base/firmware_class.c |
1417 |
+index ccfd268148a8..3bf1cdee8f49 100644 |
1418 |
+--- a/drivers/base/firmware_class.c |
1419 |
++++ b/drivers/base/firmware_class.c |
1420 |
+@@ -1119,15 +1119,17 @@ static int |
1421 |
+ _request_firmware(const struct firmware **firmware_p, const char *name, |
1422 |
+ struct device *device, unsigned int opt_flags) |
1423 |
+ { |
1424 |
+- struct firmware *fw; |
1425 |
++ struct firmware *fw = NULL; |
1426 |
+ long timeout; |
1427 |
+ int ret; |
1428 |
+ |
1429 |
+ if (!firmware_p) |
1430 |
+ return -EINVAL; |
1431 |
+ |
1432 |
+- if (!name || name[0] == '\0') |
1433 |
+- return -EINVAL; |
1434 |
++ if (!name || name[0] == '\0') { |
1435 |
++ ret = -EINVAL; |
1436 |
++ goto out; |
1437 |
++ } |
1438 |
+ |
1439 |
+ ret = _request_firmware_prepare(&fw, name, device); |
1440 |
+ if (ret <= 0) /* error or already assigned */ |
1441 |
+diff --git a/drivers/base/isa.c b/drivers/base/isa.c |
1442 |
+index 901d8185309e..372d10af2600 100644 |
1443 |
+--- a/drivers/base/isa.c |
1444 |
++++ b/drivers/base/isa.c |
1445 |
+@@ -180,4 +180,4 @@ static int __init isa_bus_init(void) |
1446 |
+ return error; |
1447 |
+ } |
1448 |
+ |
1449 |
+-device_initcall(isa_bus_init); |
1450 |
++postcore_initcall(isa_bus_init); |
1451 |
+diff --git a/drivers/bluetooth/btmrvl_sdio.c b/drivers/bluetooth/btmrvl_sdio.c |
1452 |
+index 71ea2a3af293..9c6843af1c6b 100644 |
1453 |
+--- a/drivers/bluetooth/btmrvl_sdio.c |
1454 |
++++ b/drivers/bluetooth/btmrvl_sdio.c |
1455 |
+@@ -1112,7 +1112,8 @@ static int btmrvl_sdio_download_fw(struct btmrvl_sdio_card *card) |
1456 |
+ */ |
1457 |
+ if (btmrvl_sdio_verify_fw_download(card, pollnum)) { |
1458 |
+ BT_ERR("FW failed to be active in time!"); |
1459 |
+- return -ETIMEDOUT; |
1460 |
++ ret = -ETIMEDOUT; |
1461 |
++ goto done; |
1462 |
+ } |
1463 |
+ |
1464 |
+ sdio_release_host(card->func); |
1465 |
+diff --git a/drivers/char/hw_random/exynos-rng.c b/drivers/char/hw_random/exynos-rng.c |
1466 |
+index 7ba0ae060d61..66115ef979b1 100644 |
1467 |
+--- a/drivers/char/hw_random/exynos-rng.c |
1468 |
++++ b/drivers/char/hw_random/exynos-rng.c |
1469 |
+@@ -155,6 +155,14 @@ static int exynos_rng_probe(struct platform_device *pdev) |
1470 |
+ return ret; |
1471 |
+ } |
1472 |
+ |
1473 |
++static int exynos_rng_remove(struct platform_device *pdev) |
1474 |
++{ |
1475 |
++ pm_runtime_dont_use_autosuspend(&pdev->dev); |
1476 |
++ pm_runtime_disable(&pdev->dev); |
1477 |
++ |
1478 |
++ return 0; |
1479 |
++} |
1480 |
++ |
1481 |
+ static int __maybe_unused exynos_rng_runtime_suspend(struct device *dev) |
1482 |
+ { |
1483 |
+ struct platform_device *pdev = to_platform_device(dev); |
1484 |
+@@ -212,6 +220,7 @@ static struct platform_driver exynos_rng_driver = { |
1485 |
+ .of_match_table = exynos_rng_dt_match, |
1486 |
+ }, |
1487 |
+ .probe = exynos_rng_probe, |
1488 |
++ .remove = exynos_rng_remove, |
1489 |
+ }; |
1490 |
+ |
1491 |
+ module_platform_driver(exynos_rng_driver); |
1492 |
+diff --git a/drivers/clk/clk-gpio.c b/drivers/clk/clk-gpio.c |
1493 |
+index 335322dc403f..9bc801f3a7ba 100644 |
1494 |
+--- a/drivers/clk/clk-gpio.c |
1495 |
++++ b/drivers/clk/clk-gpio.c |
1496 |
+@@ -287,12 +287,14 @@ static void __init of_gpio_clk_setup(struct device_node *node, |
1497 |
+ const char **parent_names; |
1498 |
+ int i, num_parents; |
1499 |
+ |
1500 |
++ num_parents = of_clk_get_parent_count(node); |
1501 |
++ if (num_parents < 0) |
1502 |
++ return; |
1503 |
++ |
1504 |
+ data = kzalloc(sizeof(*data), GFP_KERNEL); |
1505 |
+ if (!data) |
1506 |
+ return; |
1507 |
+ |
1508 |
+- num_parents = of_clk_get_parent_count(node); |
1509 |
+- |
1510 |
+ parent_names = kcalloc(num_parents, sizeof(char *), GFP_KERNEL); |
1511 |
+ if (!parent_names) |
1512 |
+ return; |
1513 |
+diff --git a/drivers/clk/clk-multiplier.c b/drivers/clk/clk-multiplier.c |
1514 |
+index fe7806506bf3..e9fb8a111f71 100644 |
1515 |
+--- a/drivers/clk/clk-multiplier.c |
1516 |
++++ b/drivers/clk/clk-multiplier.c |
1517 |
+@@ -54,14 +54,28 @@ static unsigned long __bestmult(struct clk_hw *hw, unsigned long rate, |
1518 |
+ unsigned long *best_parent_rate, |
1519 |
+ u8 width, unsigned long flags) |
1520 |
+ { |
1521 |
++ struct clk_multiplier *mult = to_clk_multiplier(hw); |
1522 |
+ unsigned long orig_parent_rate = *best_parent_rate; |
1523 |
+ unsigned long parent_rate, current_rate, best_rate = ~0; |
1524 |
+ unsigned int i, bestmult = 0; |
1525 |
++ unsigned int maxmult = (1 << width) - 1; |
1526 |
++ |
1527 |
++ if (!(clk_hw_get_flags(hw) & CLK_SET_RATE_PARENT)) { |
1528 |
++ bestmult = rate / orig_parent_rate; |
1529 |
++ |
1530 |
++ /* Make sure we don't end up with a 0 multiplier */ |
1531 |
++ if ((bestmult == 0) && |
1532 |
++ !(mult->flags & CLK_MULTIPLIER_ZERO_BYPASS)) |
1533 |
++ bestmult = 1; |
1534 |
+ |
1535 |
+- if (!(clk_hw_get_flags(hw) & CLK_SET_RATE_PARENT)) |
1536 |
+- return rate / *best_parent_rate; |
1537 |
++ /* Make sure we don't overflow the multiplier */ |
1538 |
++ if (bestmult > maxmult) |
1539 |
++ bestmult = maxmult; |
1540 |
++ |
1541 |
++ return bestmult; |
1542 |
++ } |
1543 |
+ |
1544 |
+- for (i = 1; i < ((1 << width) - 1); i++) { |
1545 |
++ for (i = 1; i < maxmult; i++) { |
1546 |
+ if (rate == orig_parent_rate * i) { |
1547 |
+ /* |
1548 |
+ * This is the best case for us if we have a |
1549 |
+diff --git a/drivers/clk/clk-xgene.c b/drivers/clk/clk-xgene.c |
1550 |
+index b134a8b15e2c..5fea58713293 100644 |
1551 |
+--- a/drivers/clk/clk-xgene.c |
1552 |
++++ b/drivers/clk/clk-xgene.c |
1553 |
+@@ -218,22 +218,20 @@ static int xgene_clk_enable(struct clk_hw *hw) |
1554 |
+ struct xgene_clk *pclk = to_xgene_clk(hw); |
1555 |
+ unsigned long flags = 0; |
1556 |
+ u32 data; |
1557 |
+- phys_addr_t reg; |
1558 |
+ |
1559 |
+ if (pclk->lock) |
1560 |
+ spin_lock_irqsave(pclk->lock, flags); |
1561 |
+ |
1562 |
+ if (pclk->param.csr_reg != NULL) { |
1563 |
+ pr_debug("%s clock enabled\n", clk_hw_get_name(hw)); |
1564 |
+- reg = __pa(pclk->param.csr_reg); |
1565 |
+ /* First enable the clock */ |
1566 |
+ data = xgene_clk_read(pclk->param.csr_reg + |
1567 |
+ pclk->param.reg_clk_offset); |
1568 |
+ data |= pclk->param.reg_clk_mask; |
1569 |
+ xgene_clk_write(data, pclk->param.csr_reg + |
1570 |
+ pclk->param.reg_clk_offset); |
1571 |
+- pr_debug("%s clock PADDR base %pa clk offset 0x%08X mask 0x%08X value 0x%08X\n", |
1572 |
+- clk_hw_get_name(hw), ®, |
1573 |
++ pr_debug("%s clk offset 0x%08X mask 0x%08X value 0x%08X\n", |
1574 |
++ clk_hw_get_name(hw), |
1575 |
+ pclk->param.reg_clk_offset, pclk->param.reg_clk_mask, |
1576 |
+ data); |
1577 |
+ |
1578 |
+@@ -243,8 +241,8 @@ static int xgene_clk_enable(struct clk_hw *hw) |
1579 |
+ data &= ~pclk->param.reg_csr_mask; |
1580 |
+ xgene_clk_write(data, pclk->param.csr_reg + |
1581 |
+ pclk->param.reg_csr_offset); |
1582 |
+- pr_debug("%s CSR RESET PADDR base %pa csr offset 0x%08X mask 0x%08X value 0x%08X\n", |
1583 |
+- clk_hw_get_name(hw), ®, |
1584 |
++ pr_debug("%s csr offset 0x%08X mask 0x%08X value 0x%08X\n", |
1585 |
++ clk_hw_get_name(hw), |
1586 |
+ pclk->param.reg_csr_offset, pclk->param.reg_csr_mask, |
1587 |
+ data); |
1588 |
+ } |
1589 |
+diff --git a/drivers/clk/imx/clk-pllv3.c b/drivers/clk/imx/clk-pllv3.c |
1590 |
+index 6addf8f58b97..cbecbd584624 100644 |
1591 |
+--- a/drivers/clk/imx/clk-pllv3.c |
1592 |
++++ b/drivers/clk/imx/clk-pllv3.c |
1593 |
+@@ -76,9 +76,9 @@ static int clk_pllv3_prepare(struct clk_hw *hw) |
1594 |
+ |
1595 |
+ val = readl_relaxed(pll->base); |
1596 |
+ if (pll->powerup_set) |
1597 |
+- val |= BM_PLL_POWER; |
1598 |
++ val |= pll->powerdown; |
1599 |
+ else |
1600 |
+- val &= ~BM_PLL_POWER; |
1601 |
++ val &= ~pll->powerdown; |
1602 |
+ writel_relaxed(val, pll->base); |
1603 |
+ |
1604 |
+ return clk_pllv3_wait_lock(pll); |
1605 |
+@@ -91,9 +91,9 @@ static void clk_pllv3_unprepare(struct clk_hw *hw) |
1606 |
+ |
1607 |
+ val = readl_relaxed(pll->base); |
1608 |
+ if (pll->powerup_set) |
1609 |
+- val &= ~BM_PLL_POWER; |
1610 |
++ val &= ~pll->powerdown; |
1611 |
+ else |
1612 |
+- val |= BM_PLL_POWER; |
1613 |
++ val |= pll->powerdown; |
1614 |
+ writel_relaxed(val, pll->base); |
1615 |
+ } |
1616 |
+ |
1617 |
+diff --git a/drivers/clk/rockchip/clk-mmc-phase.c b/drivers/clk/rockchip/clk-mmc-phase.c |
1618 |
+index 2b289581d570..b513a2bbfcc5 100644 |
1619 |
+--- a/drivers/clk/rockchip/clk-mmc-phase.c |
1620 |
++++ b/drivers/clk/rockchip/clk-mmc-phase.c |
1621 |
+@@ -41,8 +41,6 @@ static unsigned long rockchip_mmc_recalc(struct clk_hw *hw, |
1622 |
+ #define ROCKCHIP_MMC_DEGREE_MASK 0x3 |
1623 |
+ #define ROCKCHIP_MMC_DELAYNUM_OFFSET 2 |
1624 |
+ #define ROCKCHIP_MMC_DELAYNUM_MASK (0xff << ROCKCHIP_MMC_DELAYNUM_OFFSET) |
1625 |
+-#define ROCKCHIP_MMC_INIT_STATE_RESET 0x1 |
1626 |
+-#define ROCKCHIP_MMC_INIT_STATE_SHIFT 1 |
1627 |
+ |
1628 |
+ #define PSECS_PER_SEC 1000000000000LL |
1629 |
+ |
1630 |
+@@ -183,15 +181,6 @@ struct clk *rockchip_clk_register_mmc(const char *name, |
1631 |
+ mmc_clock->reg = reg; |
1632 |
+ mmc_clock->shift = shift; |
1633 |
+ |
1634 |
+- /* |
1635 |
+- * Assert init_state to soft reset the CLKGEN |
1636 |
+- * for mmc tuning phase and degree |
1637 |
+- */ |
1638 |
+- if (mmc_clock->shift == ROCKCHIP_MMC_INIT_STATE_SHIFT) |
1639 |
+- writel(HIWORD_UPDATE(ROCKCHIP_MMC_INIT_STATE_RESET, |
1640 |
+- ROCKCHIP_MMC_INIT_STATE_RESET, |
1641 |
+- mmc_clock->shift), mmc_clock->reg); |
1642 |
+- |
1643 |
+ clk = clk_register(NULL, &mmc_clock->hw); |
1644 |
+ if (IS_ERR(clk)) |
1645 |
+ goto err_free; |
1646 |
+diff --git a/drivers/clk/st/clkgen-fsyn.c b/drivers/clk/st/clkgen-fsyn.c |
1647 |
+index 576cd0354d48..ccb324d97160 100644 |
1648 |
+--- a/drivers/clk/st/clkgen-fsyn.c |
1649 |
++++ b/drivers/clk/st/clkgen-fsyn.c |
1650 |
+@@ -549,19 +549,20 @@ static int clk_fs660c32_vco_get_params(unsigned long input, |
1651 |
+ return 0; |
1652 |
+ } |
1653 |
+ |
1654 |
+-static long quadfs_pll_fs660c32_round_rate(struct clk_hw *hw, unsigned long rate |
1655 |
+- , unsigned long *prate) |
1656 |
++static long quadfs_pll_fs660c32_round_rate(struct clk_hw *hw, |
1657 |
++ unsigned long rate, |
1658 |
++ unsigned long *prate) |
1659 |
+ { |
1660 |
+ struct stm_fs params; |
1661 |
+ |
1662 |
+- if (!clk_fs660c32_vco_get_params(*prate, rate, ¶ms)) |
1663 |
+- clk_fs660c32_vco_get_rate(*prate, ¶ms, &rate); |
1664 |
++ if (clk_fs660c32_vco_get_params(*prate, rate, ¶ms)) |
1665 |
++ return rate; |
1666 |
+ |
1667 |
+- pr_debug("%s: %s new rate %ld [sdiv=0x%x,md=0x%x,pe=0x%x,nsdiv3=%u]\n", |
1668 |
++ clk_fs660c32_vco_get_rate(*prate, ¶ms, &rate); |
1669 |
++ |
1670 |
++ pr_debug("%s: %s new rate %ld [ndiv=%u]\n", |
1671 |
+ __func__, clk_hw_get_name(hw), |
1672 |
+- rate, (unsigned int)params.sdiv, |
1673 |
+- (unsigned int)params.mdiv, |
1674 |
+- (unsigned int)params.pe, (unsigned int)params.nsdiv); |
1675 |
++ rate, (unsigned int)params.ndiv); |
1676 |
+ |
1677 |
+ return rate; |
1678 |
+ } |
1679 |
+diff --git a/drivers/clk/ti/dpll3xxx.c b/drivers/clk/ti/dpll3xxx.c |
1680 |
+index 0e9119fae760..fa53bf6bd041 100644 |
1681 |
+--- a/drivers/clk/ti/dpll3xxx.c |
1682 |
++++ b/drivers/clk/ti/dpll3xxx.c |
1683 |
+@@ -437,7 +437,8 @@ int omap3_noncore_dpll_enable(struct clk_hw *hw) |
1684 |
+ |
1685 |
+ parent = clk_hw_get_parent(hw); |
1686 |
+ |
1687 |
+- if (clk_hw_get_rate(hw) == clk_get_rate(dd->clk_bypass)) { |
1688 |
++ if (clk_hw_get_rate(hw) == |
1689 |
++ clk_hw_get_rate(__clk_get_hw(dd->clk_bypass))) { |
1690 |
+ WARN_ON(parent != __clk_get_hw(dd->clk_bypass)); |
1691 |
+ r = _omap3_noncore_dpll_bypass(clk); |
1692 |
+ } else { |
1693 |
+diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c |
1694 |
+index 49aa58e617db..df651b1a7669 100644 |
1695 |
+--- a/drivers/cpufreq/cpufreq.c |
1696 |
++++ b/drivers/cpufreq/cpufreq.c |
1697 |
+@@ -2171,10 +2171,7 @@ static int cpufreq_set_policy(struct cpufreq_policy *policy, |
1698 |
+ return ret; |
1699 |
+ } |
1700 |
+ |
1701 |
+- up_write(&policy->rwsem); |
1702 |
+ ret = __cpufreq_governor(policy, CPUFREQ_GOV_POLICY_EXIT); |
1703 |
+- down_write(&policy->rwsem); |
1704 |
+- |
1705 |
+ if (ret) { |
1706 |
+ pr_err("%s: Failed to Exit Governor: %s (%d)\n", |
1707 |
+ __func__, old_gov->name, ret); |
1708 |
+@@ -2190,9 +2187,7 @@ static int cpufreq_set_policy(struct cpufreq_policy *policy, |
1709 |
+ if (!ret) |
1710 |
+ goto out; |
1711 |
+ |
1712 |
+- up_write(&policy->rwsem); |
1713 |
+ __cpufreq_governor(policy, CPUFREQ_GOV_POLICY_EXIT); |
1714 |
+- down_write(&policy->rwsem); |
1715 |
+ } |
1716 |
+ |
1717 |
+ /* new governor failed, so re-start old one */ |
1718 |
+diff --git a/drivers/dma/edma.c b/drivers/dma/edma.c |
1719 |
+index 17521fcf226f..3cca3055ebd4 100644 |
1720 |
+--- a/drivers/dma/edma.c |
1721 |
++++ b/drivers/dma/edma.c |
1722 |
+@@ -2439,7 +2439,13 @@ static struct platform_driver edma_driver = { |
1723 |
+ }, |
1724 |
+ }; |
1725 |
+ |
1726 |
++static int edma_tptc_probe(struct platform_device *pdev) |
1727 |
++{ |
1728 |
++ return 0; |
1729 |
++} |
1730 |
++ |
1731 |
+ static struct platform_driver edma_tptc_driver = { |
1732 |
++ .probe = edma_tptc_probe, |
1733 |
+ .driver = { |
1734 |
+ .name = "edma3-tptc", |
1735 |
+ .of_match_table = edma_tptc_of_ids, |
1736 |
+diff --git a/drivers/gpu/drm/qxl/qxl_cmd.c b/drivers/gpu/drm/qxl/qxl_cmd.c |
1737 |
+index d8066ac1e764..ae09f004a33f 100644 |
1738 |
+--- a/drivers/gpu/drm/qxl/qxl_cmd.c |
1739 |
++++ b/drivers/gpu/drm/qxl/qxl_cmd.c |
1740 |
+@@ -529,8 +529,8 @@ int qxl_hw_surface_alloc(struct qxl_device *qdev, |
1741 |
+ /* no need to add a release to the fence for this surface bo, |
1742 |
+ since it is only released when we ask to destroy the surface |
1743 |
+ and it would never signal otherwise */ |
1744 |
+- qxl_push_command_ring_release(qdev, release, QXL_CMD_SURFACE, false); |
1745 |
+ qxl_release_fence_buffer_objects(release); |
1746 |
++ qxl_push_command_ring_release(qdev, release, QXL_CMD_SURFACE, false); |
1747 |
+ |
1748 |
+ surf->hw_surf_alloc = true; |
1749 |
+ spin_lock(&qdev->surf_id_idr_lock); |
1750 |
+@@ -572,9 +572,8 @@ int qxl_hw_surface_dealloc(struct qxl_device *qdev, |
1751 |
+ cmd->surface_id = id; |
1752 |
+ qxl_release_unmap(qdev, release, &cmd->release_info); |
1753 |
+ |
1754 |
+- qxl_push_command_ring_release(qdev, release, QXL_CMD_SURFACE, false); |
1755 |
+- |
1756 |
+ qxl_release_fence_buffer_objects(release); |
1757 |
++ qxl_push_command_ring_release(qdev, release, QXL_CMD_SURFACE, false); |
1758 |
+ |
1759 |
+ return 0; |
1760 |
+ } |
1761 |
+diff --git a/drivers/gpu/drm/qxl/qxl_display.c b/drivers/gpu/drm/qxl/qxl_display.c |
1762 |
+index 5edebf495c07..0d6cc396cc16 100644 |
1763 |
+--- a/drivers/gpu/drm/qxl/qxl_display.c |
1764 |
++++ b/drivers/gpu/drm/qxl/qxl_display.c |
1765 |
+@@ -292,8 +292,8 @@ qxl_hide_cursor(struct qxl_device *qdev) |
1766 |
+ cmd->type = QXL_CURSOR_HIDE; |
1767 |
+ qxl_release_unmap(qdev, release, &cmd->release_info); |
1768 |
+ |
1769 |
+- qxl_push_cursor_ring_release(qdev, release, QXL_CMD_CURSOR, false); |
1770 |
+ qxl_release_fence_buffer_objects(release); |
1771 |
++ qxl_push_cursor_ring_release(qdev, release, QXL_CMD_CURSOR, false); |
1772 |
+ return 0; |
1773 |
+ } |
1774 |
+ |
1775 |
+@@ -390,8 +390,8 @@ static int qxl_crtc_cursor_set2(struct drm_crtc *crtc, |
1776 |
+ cmd->u.set.visible = 1; |
1777 |
+ qxl_release_unmap(qdev, release, &cmd->release_info); |
1778 |
+ |
1779 |
+- qxl_push_cursor_ring_release(qdev, release, QXL_CMD_CURSOR, false); |
1780 |
+ qxl_release_fence_buffer_objects(release); |
1781 |
++ qxl_push_cursor_ring_release(qdev, release, QXL_CMD_CURSOR, false); |
1782 |
+ |
1783 |
+ /* finish with the userspace bo */ |
1784 |
+ ret = qxl_bo_reserve(user_bo, false); |
1785 |
+@@ -450,8 +450,8 @@ static int qxl_crtc_cursor_move(struct drm_crtc *crtc, |
1786 |
+ cmd->u.position.y = qcrtc->cur_y + qcrtc->hot_spot_y; |
1787 |
+ qxl_release_unmap(qdev, release, &cmd->release_info); |
1788 |
+ |
1789 |
+- qxl_push_cursor_ring_release(qdev, release, QXL_CMD_CURSOR, false); |
1790 |
+ qxl_release_fence_buffer_objects(release); |
1791 |
++ qxl_push_cursor_ring_release(qdev, release, QXL_CMD_CURSOR, false); |
1792 |
+ |
1793 |
+ return 0; |
1794 |
+ } |
1795 |
+diff --git a/drivers/gpu/drm/qxl/qxl_draw.c b/drivers/gpu/drm/qxl/qxl_draw.c |
1796 |
+index 6e6c76080d6a..47da124b7ebf 100644 |
1797 |
+--- a/drivers/gpu/drm/qxl/qxl_draw.c |
1798 |
++++ b/drivers/gpu/drm/qxl/qxl_draw.c |
1799 |
+@@ -245,8 +245,8 @@ void qxl_draw_opaque_fb(const struct qxl_fb_image *qxl_fb_image, |
1800 |
+ qxl_bo_physical_address(qdev, dimage->bo, 0); |
1801 |
+ qxl_release_unmap(qdev, release, &drawable->release_info); |
1802 |
+ |
1803 |
+- qxl_push_command_ring_release(qdev, release, QXL_CMD_DRAW, false); |
1804 |
+ qxl_release_fence_buffer_objects(release); |
1805 |
++ qxl_push_command_ring_release(qdev, release, QXL_CMD_DRAW, false); |
1806 |
+ |
1807 |
+ out_free_palette: |
1808 |
+ if (palette_bo) |
1809 |
+@@ -352,9 +352,10 @@ void qxl_draw_dirty_fb(struct qxl_device *qdev, |
1810 |
+ goto out_release_backoff; |
1811 |
+ |
1812 |
+ rects = drawable_set_clipping(qdev, drawable, num_clips, clips_bo); |
1813 |
+- if (!rects) |
1814 |
++ if (!rects) { |
1815 |
++ ret = -EINVAL; |
1816 |
+ goto out_release_backoff; |
1817 |
+- |
1818 |
++ } |
1819 |
+ drawable = (struct qxl_drawable *)qxl_release_map(qdev, release); |
1820 |
+ |
1821 |
+ drawable->clip.type = SPICE_CLIP_TYPE_RECTS; |
1822 |
+@@ -385,8 +386,8 @@ void qxl_draw_dirty_fb(struct qxl_device *qdev, |
1823 |
+ } |
1824 |
+ qxl_bo_kunmap(clips_bo); |
1825 |
+ |
1826 |
+- qxl_push_command_ring_release(qdev, release, QXL_CMD_DRAW, false); |
1827 |
+ qxl_release_fence_buffer_objects(release); |
1828 |
++ qxl_push_command_ring_release(qdev, release, QXL_CMD_DRAW, false); |
1829 |
+ |
1830 |
+ out_release_backoff: |
1831 |
+ if (ret) |
1832 |
+@@ -436,8 +437,8 @@ void qxl_draw_copyarea(struct qxl_device *qdev, |
1833 |
+ drawable->u.copy_bits.src_pos.y = sy; |
1834 |
+ qxl_release_unmap(qdev, release, &drawable->release_info); |
1835 |
+ |
1836 |
+- qxl_push_command_ring_release(qdev, release, QXL_CMD_DRAW, false); |
1837 |
+ qxl_release_fence_buffer_objects(release); |
1838 |
++ qxl_push_command_ring_release(qdev, release, QXL_CMD_DRAW, false); |
1839 |
+ |
1840 |
+ out_free_release: |
1841 |
+ if (ret) |
1842 |
+@@ -480,8 +481,8 @@ void qxl_draw_fill(struct qxl_draw_fill *qxl_draw_fill_rec) |
1843 |
+ |
1844 |
+ qxl_release_unmap(qdev, release, &drawable->release_info); |
1845 |
+ |
1846 |
+- qxl_push_command_ring_release(qdev, release, QXL_CMD_DRAW, false); |
1847 |
+ qxl_release_fence_buffer_objects(release); |
1848 |
++ qxl_push_command_ring_release(qdev, release, QXL_CMD_DRAW, false); |
1849 |
+ |
1850 |
+ out_free_release: |
1851 |
+ if (ret) |
1852 |
+diff --git a/drivers/gpu/drm/qxl/qxl_ioctl.c b/drivers/gpu/drm/qxl/qxl_ioctl.c |
1853 |
+index 7c2e78201ead..4d852449a7d1 100644 |
1854 |
+--- a/drivers/gpu/drm/qxl/qxl_ioctl.c |
1855 |
++++ b/drivers/gpu/drm/qxl/qxl_ioctl.c |
1856 |
+@@ -257,11 +257,8 @@ static int qxl_process_single_command(struct qxl_device *qdev, |
1857 |
+ apply_surf_reloc(qdev, &reloc_info[i]); |
1858 |
+ } |
1859 |
+ |
1860 |
++ qxl_release_fence_buffer_objects(release); |
1861 |
+ ret = qxl_push_command_ring_release(qdev, release, cmd->type, true); |
1862 |
+- if (ret) |
1863 |
+- qxl_release_backoff_reserve_list(release); |
1864 |
+- else |
1865 |
+- qxl_release_fence_buffer_objects(release); |
1866 |
+ |
1867 |
+ out_free_bos: |
1868 |
+ out_free_release: |
1869 |
+diff --git a/drivers/hv/hv_utils_transport.c b/drivers/hv/hv_utils_transport.c |
1870 |
+index 1505ee6e6605..24b2766a6d34 100644 |
1871 |
+--- a/drivers/hv/hv_utils_transport.c |
1872 |
++++ b/drivers/hv/hv_utils_transport.c |
1873 |
+@@ -80,11 +80,10 @@ static ssize_t hvt_op_write(struct file *file, const char __user *buf, |
1874 |
+ |
1875 |
+ hvt = container_of(file->f_op, struct hvutil_transport, fops); |
1876 |
+ |
1877 |
+- inmsg = kzalloc(count, GFP_KERNEL); |
1878 |
+- if (copy_from_user(inmsg, buf, count)) { |
1879 |
+- kfree(inmsg); |
1880 |
+- return -EFAULT; |
1881 |
+- } |
1882 |
++ inmsg = memdup_user(buf, count); |
1883 |
++ if (IS_ERR(inmsg)) |
1884 |
++ return PTR_ERR(inmsg); |
1885 |
++ |
1886 |
+ if (hvt->on_msg(inmsg, count)) |
1887 |
+ return -EFAULT; |
1888 |
+ kfree(inmsg); |
1889 |
+diff --git a/drivers/iio/adc/ad7793.c b/drivers/iio/adc/ad7793.c |
1890 |
+index 91d34ed756ea..fe0c5a155e21 100644 |
1891 |
+--- a/drivers/iio/adc/ad7793.c |
1892 |
++++ b/drivers/iio/adc/ad7793.c |
1893 |
+@@ -579,7 +579,7 @@ static const struct iio_info ad7797_info = { |
1894 |
+ .read_raw = &ad7793_read_raw, |
1895 |
+ .write_raw = &ad7793_write_raw, |
1896 |
+ .write_raw_get_fmt = &ad7793_write_raw_get_fmt, |
1897 |
+- .attrs = &ad7793_attribute_group, |
1898 |
++ .attrs = &ad7797_attribute_group, |
1899 |
+ .validate_trigger = ad_sd_validate_trigger, |
1900 |
+ .driver_module = THIS_MODULE, |
1901 |
+ }; |
1902 |
+diff --git a/drivers/infiniband/hw/cxgb3/cxio_hal.c b/drivers/infiniband/hw/cxgb3/cxio_hal.c |
1903 |
+index de1c61b417d6..ada2e5009c86 100644 |
1904 |
+--- a/drivers/infiniband/hw/cxgb3/cxio_hal.c |
1905 |
++++ b/drivers/infiniband/hw/cxgb3/cxio_hal.c |
1906 |
+@@ -327,7 +327,7 @@ int cxio_destroy_cq(struct cxio_rdev *rdev_p, struct t3_cq *cq) |
1907 |
+ kfree(cq->sw_queue); |
1908 |
+ dma_free_coherent(&(rdev_p->rnic_info.pdev->dev), |
1909 |
+ (1UL << (cq->size_log2)) |
1910 |
+- * sizeof(struct t3_cqe), cq->queue, |
1911 |
++ * sizeof(struct t3_cqe) + 1, cq->queue, |
1912 |
+ dma_unmap_addr(cq, mapping)); |
1913 |
+ cxio_hal_put_cqid(rdev_p->rscp, cq->cqid); |
1914 |
+ return err; |
1915 |
+diff --git a/drivers/infiniband/hw/mlx4/ah.c b/drivers/infiniband/hw/mlx4/ah.c |
1916 |
+index fc21bdbb8b32..005ea5524e09 100644 |
1917 |
+--- a/drivers/infiniband/hw/mlx4/ah.c |
1918 |
++++ b/drivers/infiniband/hw/mlx4/ah.c |
1919 |
+@@ -107,6 +107,7 @@ static struct ib_ah *create_iboe_ah(struct ib_pd *pd, struct ib_ah_attr *ah_attr |
1920 |
+ return ERR_PTR(ret); |
1921 |
+ ah->av.eth.gid_index = ret; |
1922 |
+ ah->av.eth.vlan = cpu_to_be16(vlan_tag); |
1923 |
++ ah->av.eth.hop_limit = ah_attr->grh.hop_limit; |
1924 |
+ if (ah_attr->static_rate) { |
1925 |
+ ah->av.eth.stat_rate = ah_attr->static_rate + MLX4_STAT_RATE_OFFSET; |
1926 |
+ while (ah->av.eth.stat_rate > IB_RATE_2_5_GBPS + MLX4_STAT_RATE_OFFSET && |
1927 |
+diff --git a/drivers/infiniband/hw/mlx5/main.c b/drivers/infiniband/hw/mlx5/main.c |
1928 |
+index dbd5adc62c3f..1b731ab63ede 100644 |
1929 |
+--- a/drivers/infiniband/hw/mlx5/main.c |
1930 |
++++ b/drivers/infiniband/hw/mlx5/main.c |
1931 |
+@@ -905,7 +905,7 @@ static ssize_t show_fw_ver(struct device *device, struct device_attribute *attr, |
1932 |
+ { |
1933 |
+ struct mlx5_ib_dev *dev = |
1934 |
+ container_of(device, struct mlx5_ib_dev, ib_dev.dev); |
1935 |
+- return sprintf(buf, "%d.%d.%d\n", fw_rev_maj(dev->mdev), |
1936 |
++ return sprintf(buf, "%d.%d.%04d\n", fw_rev_maj(dev->mdev), |
1937 |
+ fw_rev_min(dev->mdev), fw_rev_sub(dev->mdev)); |
1938 |
+ } |
1939 |
+ |
1940 |
+diff --git a/drivers/infiniband/hw/mlx5/qp.c b/drivers/infiniband/hw/mlx5/qp.c |
1941 |
+index eac5f5eff8d2..b8e71187c700 100644 |
1942 |
+--- a/drivers/infiniband/hw/mlx5/qp.c |
1943 |
++++ b/drivers/infiniband/hw/mlx5/qp.c |
1944 |
+@@ -271,8 +271,10 @@ static int sq_overhead(enum ib_qp_type qp_type) |
1945 |
+ /* fall through */ |
1946 |
+ case IB_QPT_RC: |
1947 |
+ size += sizeof(struct mlx5_wqe_ctrl_seg) + |
1948 |
+- sizeof(struct mlx5_wqe_atomic_seg) + |
1949 |
+- sizeof(struct mlx5_wqe_raddr_seg); |
1950 |
++ max(sizeof(struct mlx5_wqe_atomic_seg) + |
1951 |
++ sizeof(struct mlx5_wqe_raddr_seg), |
1952 |
++ sizeof(struct mlx5_wqe_umr_ctrl_seg) + |
1953 |
++ sizeof(struct mlx5_mkey_seg)); |
1954 |
+ break; |
1955 |
+ |
1956 |
+ case IB_QPT_XRC_TGT: |
1957 |
+@@ -280,9 +282,9 @@ static int sq_overhead(enum ib_qp_type qp_type) |
1958 |
+ |
1959 |
+ case IB_QPT_UC: |
1960 |
+ size += sizeof(struct mlx5_wqe_ctrl_seg) + |
1961 |
+- sizeof(struct mlx5_wqe_raddr_seg) + |
1962 |
+- sizeof(struct mlx5_wqe_umr_ctrl_seg) + |
1963 |
+- sizeof(struct mlx5_mkey_seg); |
1964 |
++ max(sizeof(struct mlx5_wqe_raddr_seg), |
1965 |
++ sizeof(struct mlx5_wqe_umr_ctrl_seg) + |
1966 |
++ sizeof(struct mlx5_mkey_seg)); |
1967 |
+ break; |
1968 |
+ |
1969 |
+ case IB_QPT_UD: |
1970 |
+diff --git a/drivers/input/keyboard/gpio_keys.c b/drivers/input/keyboard/gpio_keys.c |
1971 |
+index bef317ff7352..b9f01bd1b7ef 100644 |
1972 |
+--- a/drivers/input/keyboard/gpio_keys.c |
1973 |
++++ b/drivers/input/keyboard/gpio_keys.c |
1974 |
+@@ -96,13 +96,29 @@ struct gpio_keys_drvdata { |
1975 |
+ * Return value of this function can be used to allocate bitmap |
1976 |
+ * large enough to hold all bits for given type. |
1977 |
+ */ |
1978 |
+-static inline int get_n_events_by_type(int type) |
1979 |
++static int get_n_events_by_type(int type) |
1980 |
+ { |
1981 |
+ BUG_ON(type != EV_SW && type != EV_KEY); |
1982 |
+ |
1983 |
+ return (type == EV_KEY) ? KEY_CNT : SW_CNT; |
1984 |
+ } |
1985 |
+ |
1986 |
++/** |
1987 |
++ * get_bm_events_by_type() - returns bitmap of supported events per @type |
1988 |
++ * @input: input device from which bitmap is retrieved |
1989 |
++ * @type: type of button (%EV_KEY, %EV_SW) |
1990 |
++ * |
1991 |
++ * Return value of this function can be used to allocate bitmap |
1992 |
++ * large enough to hold all bits for given type. |
1993 |
++ */ |
1994 |
++static const unsigned long *get_bm_events_by_type(struct input_dev *dev, |
1995 |
++ int type) |
1996 |
++{ |
1997 |
++ BUG_ON(type != EV_SW && type != EV_KEY); |
1998 |
++ |
1999 |
++ return (type == EV_KEY) ? dev->keybit : dev->swbit; |
2000 |
++} |
2001 |
++ |
2002 |
+ /** |
2003 |
+ * gpio_keys_disable_button() - disables given GPIO button |
2004 |
+ * @bdata: button data for button to be disabled |
2005 |
+@@ -213,6 +229,7 @@ static ssize_t gpio_keys_attr_store_helper(struct gpio_keys_drvdata *ddata, |
2006 |
+ const char *buf, unsigned int type) |
2007 |
+ { |
2008 |
+ int n_events = get_n_events_by_type(type); |
2009 |
++ const unsigned long *bitmap = get_bm_events_by_type(ddata->input, type); |
2010 |
+ unsigned long *bits; |
2011 |
+ ssize_t error; |
2012 |
+ int i; |
2013 |
+@@ -226,6 +243,11 @@ static ssize_t gpio_keys_attr_store_helper(struct gpio_keys_drvdata *ddata, |
2014 |
+ goto out; |
2015 |
+ |
2016 |
+ /* First validate */ |
2017 |
++ if (!bitmap_subset(bits, bitmap, n_events)) { |
2018 |
++ error = -EINVAL; |
2019 |
++ goto out; |
2020 |
++ } |
2021 |
++ |
2022 |
+ for (i = 0; i < ddata->pdata->nbuttons; i++) { |
2023 |
+ struct gpio_button_data *bdata = &ddata->data[i]; |
2024 |
+ |
2025 |
+@@ -239,11 +261,6 @@ static ssize_t gpio_keys_attr_store_helper(struct gpio_keys_drvdata *ddata, |
2026 |
+ } |
2027 |
+ } |
2028 |
+ |
2029 |
+- if (i == ddata->pdata->nbuttons) { |
2030 |
+- error = -EINVAL; |
2031 |
+- goto out; |
2032 |
+- } |
2033 |
+- |
2034 |
+ mutex_lock(&ddata->disable_lock); |
2035 |
+ |
2036 |
+ for (i = 0; i < ddata->pdata->nbuttons; i++) { |
2037 |
+diff --git a/drivers/input/touchscreen/edt-ft5x06.c b/drivers/input/touchscreen/edt-ft5x06.c |
2038 |
+index a9d97d577a7e..5e535d0bbe16 100644 |
2039 |
+--- a/drivers/input/touchscreen/edt-ft5x06.c |
2040 |
++++ b/drivers/input/touchscreen/edt-ft5x06.c |
2041 |
+@@ -822,16 +822,22 @@ static void edt_ft5x06_ts_get_defaults(struct device *dev, |
2042 |
+ int error; |
2043 |
+ |
2044 |
+ error = device_property_read_u32(dev, "threshold", &val); |
2045 |
+- if (!error) |
2046 |
+- reg_addr->reg_threshold = val; |
2047 |
++ if (!error) { |
2048 |
++ edt_ft5x06_register_write(tsdata, reg_addr->reg_threshold, val); |
2049 |
++ tsdata->threshold = val; |
2050 |
++ } |
2051 |
+ |
2052 |
+ error = device_property_read_u32(dev, "gain", &val); |
2053 |
+- if (!error) |
2054 |
+- reg_addr->reg_gain = val; |
2055 |
++ if (!error) { |
2056 |
++ edt_ft5x06_register_write(tsdata, reg_addr->reg_gain, val); |
2057 |
++ tsdata->gain = val; |
2058 |
++ } |
2059 |
+ |
2060 |
+ error = device_property_read_u32(dev, "offset", &val); |
2061 |
+- if (!error) |
2062 |
+- reg_addr->reg_offset = val; |
2063 |
++ if (!error) { |
2064 |
++ edt_ft5x06_register_write(tsdata, reg_addr->reg_offset, val); |
2065 |
++ tsdata->offset = val; |
2066 |
++ } |
2067 |
+ } |
2068 |
+ |
2069 |
+ static void |
2070 |
+diff --git a/drivers/iommu/dma-iommu.c b/drivers/iommu/dma-iommu.c |
2071 |
+index 347a3c17f73a..087a092a6e6e 100644 |
2072 |
+--- a/drivers/iommu/dma-iommu.c |
2073 |
++++ b/drivers/iommu/dma-iommu.c |
2074 |
+@@ -152,12 +152,15 @@ int dma_direction_to_prot(enum dma_data_direction dir, bool coherent) |
2075 |
+ } |
2076 |
+ } |
2077 |
+ |
2078 |
+-static struct iova *__alloc_iova(struct iova_domain *iovad, size_t size, |
2079 |
++static struct iova *__alloc_iova(struct iommu_domain *domain, size_t size, |
2080 |
+ dma_addr_t dma_limit) |
2081 |
+ { |
2082 |
++ struct iova_domain *iovad = domain->iova_cookie; |
2083 |
+ unsigned long shift = iova_shift(iovad); |
2084 |
+ unsigned long length = iova_align(iovad, size) >> shift; |
2085 |
+ |
2086 |
++ if (domain->geometry.force_aperture) |
2087 |
++ dma_limit = min(dma_limit, domain->geometry.aperture_end); |
2088 |
+ /* |
2089 |
+ * Enforce size-alignment to be safe - there could perhaps be an |
2090 |
+ * attribute to control this per-device, or at least per-domain... |
2091 |
+@@ -297,7 +300,7 @@ struct page **iommu_dma_alloc(struct device *dev, size_t size, |
2092 |
+ if (!pages) |
2093 |
+ return NULL; |
2094 |
+ |
2095 |
+- iova = __alloc_iova(iovad, size, dev->coherent_dma_mask); |
2096 |
++ iova = __alloc_iova(domain, size, dev->coherent_dma_mask); |
2097 |
+ if (!iova) |
2098 |
+ goto out_free_pages; |
2099 |
+ |
2100 |
+@@ -369,7 +372,7 @@ dma_addr_t iommu_dma_map_page(struct device *dev, struct page *page, |
2101 |
+ phys_addr_t phys = page_to_phys(page) + offset; |
2102 |
+ size_t iova_off = iova_offset(iovad, phys); |
2103 |
+ size_t len = iova_align(iovad, size + iova_off); |
2104 |
+- struct iova *iova = __alloc_iova(iovad, len, dma_get_mask(dev)); |
2105 |
++ struct iova *iova = __alloc_iova(domain, len, dma_get_mask(dev)); |
2106 |
+ |
2107 |
+ if (!iova) |
2108 |
+ return DMA_ERROR_CODE; |
2109 |
+@@ -483,7 +486,7 @@ int iommu_dma_map_sg(struct device *dev, struct scatterlist *sg, |
2110 |
+ prev = s; |
2111 |
+ } |
2112 |
+ |
2113 |
+- iova = __alloc_iova(iovad, iova_len, dma_get_mask(dev)); |
2114 |
++ iova = __alloc_iova(domain, iova_len, dma_get_mask(dev)); |
2115 |
+ if (!iova) |
2116 |
+ goto out_restore_sg; |
2117 |
+ |
2118 |
+diff --git a/drivers/md/dm.c b/drivers/md/dm.c |
2119 |
+index c4d4cd38a58f..ff017d148323 100644 |
2120 |
+--- a/drivers/md/dm.c |
2121 |
++++ b/drivers/md/dm.c |
2122 |
+@@ -2192,7 +2192,7 @@ static void dm_request_fn(struct request_queue *q) |
2123 |
+ goto out; |
2124 |
+ |
2125 |
+ delay_and_out: |
2126 |
+- blk_delay_queue(q, HZ / 100); |
2127 |
++ blk_delay_queue(q, 10); |
2128 |
+ out: |
2129 |
+ dm_put_live_table(md, srcu_idx); |
2130 |
+ } |
2131 |
+diff --git a/drivers/media/pci/cx23885/cx23885-av.c b/drivers/media/pci/cx23885/cx23885-av.c |
2132 |
+index 877dad89107e..e7d4406f9abd 100644 |
2133 |
+--- a/drivers/media/pci/cx23885/cx23885-av.c |
2134 |
++++ b/drivers/media/pci/cx23885/cx23885-av.c |
2135 |
+@@ -24,7 +24,7 @@ void cx23885_av_work_handler(struct work_struct *work) |
2136 |
+ { |
2137 |
+ struct cx23885_dev *dev = |
2138 |
+ container_of(work, struct cx23885_dev, cx25840_work); |
2139 |
+- bool handled; |
2140 |
++ bool handled = false; |
2141 |
+ |
2142 |
+ v4l2_subdev_call(dev->sd_cx25840, core, interrupt_service_routine, |
2143 |
+ PCI_MSK_AV_CORE, &handled); |
2144 |
+diff --git a/drivers/media/platform/am437x/am437x-vpfe.c b/drivers/media/platform/am437x/am437x-vpfe.c |
2145 |
+index 36add3c463f7..1256af0dde1d 100644 |
2146 |
+--- a/drivers/media/platform/am437x/am437x-vpfe.c |
2147 |
++++ b/drivers/media/platform/am437x/am437x-vpfe.c |
2148 |
+@@ -1047,7 +1047,7 @@ static int vpfe_get_ccdc_image_format(struct vpfe_device *vpfe, |
2149 |
+ static int vpfe_config_ccdc_image_format(struct vpfe_device *vpfe) |
2150 |
+ { |
2151 |
+ enum ccdc_frmfmt frm_fmt = CCDC_FRMFMT_INTERLACED; |
2152 |
+- int ret; |
2153 |
++ int ret = 0; |
2154 |
+ |
2155 |
+ vpfe_dbg(2, vpfe, "vpfe_config_ccdc_image_format\n"); |
2156 |
+ |
2157 |
+diff --git a/drivers/media/platform/sti/c8sectpfe/c8sectpfe-core.c b/drivers/media/platform/sti/c8sectpfe/c8sectpfe-core.c |
2158 |
+index a43404cad3e3..ed307488ccbd 100644 |
2159 |
+--- a/drivers/media/platform/sti/c8sectpfe/c8sectpfe-core.c |
2160 |
++++ b/drivers/media/platform/sti/c8sectpfe/c8sectpfe-core.c |
2161 |
+@@ -49,7 +49,7 @@ MODULE_FIRMWARE(FIRMWARE_MEMDMA); |
2162 |
+ #define PID_TABLE_SIZE 1024 |
2163 |
+ #define POLL_MSECS 50 |
2164 |
+ |
2165 |
+-static int load_c8sectpfe_fw_step1(struct c8sectpfei *fei); |
2166 |
++static int load_c8sectpfe_fw(struct c8sectpfei *fei); |
2167 |
+ |
2168 |
+ #define TS_PKT_SIZE 188 |
2169 |
+ #define HEADER_SIZE (4) |
2170 |
+@@ -143,6 +143,7 @@ static int c8sectpfe_start_feed(struct dvb_demux_feed *dvbdmxfeed) |
2171 |
+ struct channel_info *channel; |
2172 |
+ u32 tmp; |
2173 |
+ unsigned long *bitmap; |
2174 |
++ int ret; |
2175 |
+ |
2176 |
+ switch (dvbdmxfeed->type) { |
2177 |
+ case DMX_TYPE_TS: |
2178 |
+@@ -171,8 +172,9 @@ static int c8sectpfe_start_feed(struct dvb_demux_feed *dvbdmxfeed) |
2179 |
+ } |
2180 |
+ |
2181 |
+ if (!atomic_read(&fei->fw_loaded)) { |
2182 |
+- dev_err(fei->dev, "%s: c8sectpfe fw not loaded\n", __func__); |
2183 |
+- return -EINVAL; |
2184 |
++ ret = load_c8sectpfe_fw(fei); |
2185 |
++ if (ret) |
2186 |
++ return ret; |
2187 |
+ } |
2188 |
+ |
2189 |
+ mutex_lock(&fei->lock); |
2190 |
+@@ -267,8 +269,9 @@ static int c8sectpfe_stop_feed(struct dvb_demux_feed *dvbdmxfeed) |
2191 |
+ unsigned long *bitmap; |
2192 |
+ |
2193 |
+ if (!atomic_read(&fei->fw_loaded)) { |
2194 |
+- dev_err(fei->dev, "%s: c8sectpfe fw not loaded\n", __func__); |
2195 |
+- return -EINVAL; |
2196 |
++ ret = load_c8sectpfe_fw(fei); |
2197 |
++ if (ret) |
2198 |
++ return ret; |
2199 |
+ } |
2200 |
+ |
2201 |
+ mutex_lock(&fei->lock); |
2202 |
+@@ -882,13 +885,6 @@ static int c8sectpfe_probe(struct platform_device *pdev) |
2203 |
+ goto err_clk_disable; |
2204 |
+ } |
2205 |
+ |
2206 |
+- /* ensure all other init has been done before requesting firmware */ |
2207 |
+- ret = load_c8sectpfe_fw_step1(fei); |
2208 |
+- if (ret) { |
2209 |
+- dev_err(dev, "Couldn't load slim core firmware\n"); |
2210 |
+- goto err_clk_disable; |
2211 |
+- } |
2212 |
+- |
2213 |
+ c8sectpfe_debugfs_init(fei); |
2214 |
+ |
2215 |
+ return 0; |
2216 |
+@@ -1093,15 +1089,14 @@ static void load_dmem_segment(struct c8sectpfei *fei, Elf32_Phdr *phdr, |
2217 |
+ phdr->p_memsz - phdr->p_filesz); |
2218 |
+ } |
2219 |
+ |
2220 |
+-static int load_slim_core_fw(const struct firmware *fw, void *context) |
2221 |
++static int load_slim_core_fw(const struct firmware *fw, struct c8sectpfei *fei) |
2222 |
+ { |
2223 |
+- struct c8sectpfei *fei = context; |
2224 |
+ Elf32_Ehdr *ehdr; |
2225 |
+ Elf32_Phdr *phdr; |
2226 |
+ u8 __iomem *dst; |
2227 |
+ int err = 0, i; |
2228 |
+ |
2229 |
+- if (!fw || !context) |
2230 |
++ if (!fw || !fei) |
2231 |
+ return -EINVAL; |
2232 |
+ |
2233 |
+ ehdr = (Elf32_Ehdr *)fw->data; |
2234 |
+@@ -1153,29 +1148,35 @@ static int load_slim_core_fw(const struct firmware *fw, void *context) |
2235 |
+ return err; |
2236 |
+ } |
2237 |
+ |
2238 |
+-static void load_c8sectpfe_fw_cb(const struct firmware *fw, void *context) |
2239 |
++static int load_c8sectpfe_fw(struct c8sectpfei *fei) |
2240 |
+ { |
2241 |
+- struct c8sectpfei *fei = context; |
2242 |
++ const struct firmware *fw; |
2243 |
+ int err; |
2244 |
+ |
2245 |
++ dev_info(fei->dev, "Loading firmware: %s\n", FIRMWARE_MEMDMA); |
2246 |
++ |
2247 |
++ err = request_firmware(&fw, FIRMWARE_MEMDMA, fei->dev); |
2248 |
++ if (err) |
2249 |
++ return err; |
2250 |
++ |
2251 |
+ err = c8sectpfe_elf_sanity_check(fei, fw); |
2252 |
+ if (err) { |
2253 |
+ dev_err(fei->dev, "c8sectpfe_elf_sanity_check failed err=(%d)\n" |
2254 |
+ , err); |
2255 |
+- goto err; |
2256 |
++ return err; |
2257 |
+ } |
2258 |
+ |
2259 |
+- err = load_slim_core_fw(fw, context); |
2260 |
++ err = load_slim_core_fw(fw, fei); |
2261 |
+ if (err) { |
2262 |
+ dev_err(fei->dev, "load_slim_core_fw failed err=(%d)\n", err); |
2263 |
+- goto err; |
2264 |
++ return err; |
2265 |
+ } |
2266 |
+ |
2267 |
+ /* now the firmware is loaded configure the input blocks */ |
2268 |
+ err = configure_channels(fei); |
2269 |
+ if (err) { |
2270 |
+ dev_err(fei->dev, "configure_channels failed err=(%d)\n", err); |
2271 |
+- goto err; |
2272 |
++ return err; |
2273 |
+ } |
2274 |
+ |
2275 |
+ /* |
2276 |
+@@ -1188,28 +1189,6 @@ static void load_c8sectpfe_fw_cb(const struct firmware *fw, void *context) |
2277 |
+ writel(0x1, fei->io + DMA_CPU_RUN); |
2278 |
+ |
2279 |
+ atomic_set(&fei->fw_loaded, 1); |
2280 |
+-err: |
2281 |
+- complete_all(&fei->fw_ack); |
2282 |
+-} |
2283 |
+- |
2284 |
+-static int load_c8sectpfe_fw_step1(struct c8sectpfei *fei) |
2285 |
+-{ |
2286 |
+- int err; |
2287 |
+- |
2288 |
+- dev_info(fei->dev, "Loading firmware: %s\n", FIRMWARE_MEMDMA); |
2289 |
+- |
2290 |
+- init_completion(&fei->fw_ack); |
2291 |
+- atomic_set(&fei->fw_loaded, 0); |
2292 |
+- |
2293 |
+- err = request_firmware_nowait(THIS_MODULE, FW_ACTION_HOTPLUG, |
2294 |
+- FIRMWARE_MEMDMA, fei->dev, GFP_KERNEL, fei, |
2295 |
+- load_c8sectpfe_fw_cb); |
2296 |
+- |
2297 |
+- if (err) { |
2298 |
+- dev_err(fei->dev, "request_firmware_nowait err: %d.\n", err); |
2299 |
+- complete_all(&fei->fw_ack); |
2300 |
+- return err; |
2301 |
+- } |
2302 |
+ |
2303 |
+ return 0; |
2304 |
+ } |
2305 |
+diff --git a/drivers/media/rc/rc-main.c b/drivers/media/rc/rc-main.c |
2306 |
+index 3f0f71adabb4..ea1008cf14a3 100644 |
2307 |
+--- a/drivers/media/rc/rc-main.c |
2308 |
++++ b/drivers/media/rc/rc-main.c |
2309 |
+@@ -61,7 +61,7 @@ struct rc_map *rc_map_get(const char *name) |
2310 |
+ struct rc_map_list *map; |
2311 |
+ |
2312 |
+ map = seek_rc_map(name); |
2313 |
+-#ifdef MODULE |
2314 |
++#ifdef CONFIG_MODULES |
2315 |
+ if (!map) { |
2316 |
+ int rc = request_module("%s", name); |
2317 |
+ if (rc < 0) { |
2318 |
+diff --git a/drivers/memory/tegra/tegra124.c b/drivers/memory/tegra/tegra124.c |
2319 |
+index 234e74f97a4b..9f68a56f2727 100644 |
2320 |
+--- a/drivers/memory/tegra/tegra124.c |
2321 |
++++ b/drivers/memory/tegra/tegra124.c |
2322 |
+@@ -1007,6 +1007,7 @@ static const struct tegra_smmu_soc tegra124_smmu_soc = { |
2323 |
+ .num_swgroups = ARRAY_SIZE(tegra124_swgroups), |
2324 |
+ .supports_round_robin_arbitration = true, |
2325 |
+ .supports_request_limit = true, |
2326 |
++ .num_tlb_lines = 32, |
2327 |
+ .num_asids = 128, |
2328 |
+ }; |
2329 |
+ |
2330 |
+diff --git a/drivers/mfd/lp8788-irq.c b/drivers/mfd/lp8788-irq.c |
2331 |
+index c7a9825aa4ce..792d51bae20f 100644 |
2332 |
+--- a/drivers/mfd/lp8788-irq.c |
2333 |
++++ b/drivers/mfd/lp8788-irq.c |
2334 |
+@@ -112,7 +112,7 @@ static irqreturn_t lp8788_irq_handler(int irq, void *ptr) |
2335 |
+ struct lp8788_irq_data *irqd = ptr; |
2336 |
+ struct lp8788 *lp = irqd->lp; |
2337 |
+ u8 status[NUM_REGS], addr, mask; |
2338 |
+- bool handled; |
2339 |
++ bool handled = false; |
2340 |
+ int i; |
2341 |
+ |
2342 |
+ if (lp8788_read_multi_bytes(lp, LP8788_INT_1, status, NUM_REGS)) |
2343 |
+diff --git a/drivers/misc/cxl/fault.c b/drivers/misc/cxl/fault.c |
2344 |
+index 81c3f75b7330..8f9c26b77089 100644 |
2345 |
+--- a/drivers/misc/cxl/fault.c |
2346 |
++++ b/drivers/misc/cxl/fault.c |
2347 |
+@@ -152,7 +152,7 @@ static void cxl_handle_page_fault(struct cxl_context *ctx, |
2348 |
+ access = _PAGE_PRESENT; |
2349 |
+ if (dsisr & CXL_PSL_DSISR_An_S) |
2350 |
+ access |= _PAGE_RW; |
2351 |
+- if ((!ctx->kernel) || ~(dar & (1ULL << 63))) |
2352 |
++ if ((!ctx->kernel) || (REGION_ID(dar) == USER_REGION_ID)) |
2353 |
+ access |= _PAGE_USER; |
2354 |
+ |
2355 |
+ if (dsisr & DSISR_NOHPTE) |
2356 |
+diff --git a/drivers/mmc/card/block.c b/drivers/mmc/card/block.c |
2357 |
+index 07592e428755..c4c4dfbde0dc 100644 |
2358 |
+--- a/drivers/mmc/card/block.c |
2359 |
++++ b/drivers/mmc/card/block.c |
2360 |
+@@ -668,8 +668,10 @@ static int mmc_blk_ioctl_multi_cmd(struct block_device *bdev, |
2361 |
+ } |
2362 |
+ |
2363 |
+ md = mmc_blk_get(bdev->bd_disk); |
2364 |
+- if (!md) |
2365 |
++ if (!md) { |
2366 |
++ err = -EINVAL; |
2367 |
+ goto cmd_err; |
2368 |
++ } |
2369 |
+ |
2370 |
+ card = md->queue.card; |
2371 |
+ if (IS_ERR(card)) { |
2372 |
+diff --git a/drivers/mmc/core/debugfs.c b/drivers/mmc/core/debugfs.c |
2373 |
+index 705586dcd9fa..9382a57a5aa4 100644 |
2374 |
+--- a/drivers/mmc/core/debugfs.c |
2375 |
++++ b/drivers/mmc/core/debugfs.c |
2376 |
+@@ -170,7 +170,7 @@ static int mmc_ios_show(struct seq_file *s, void *data) |
2377 |
+ str = "invalid"; |
2378 |
+ break; |
2379 |
+ } |
2380 |
+- seq_printf(s, "signal voltage:\t%u (%s)\n", ios->chip_select, str); |
2381 |
++ seq_printf(s, "signal voltage:\t%u (%s)\n", ios->signal_voltage, str); |
2382 |
+ |
2383 |
+ switch (ios->drv_type) { |
2384 |
+ case MMC_SET_DRIVER_TYPE_A: |
2385 |
+diff --git a/drivers/mmc/core/sd.c b/drivers/mmc/core/sd.c |
2386 |
+index 54ba1abb5460..ed9af65e583e 100644 |
2387 |
+--- a/drivers/mmc/core/sd.c |
2388 |
++++ b/drivers/mmc/core/sd.c |
2389 |
+@@ -337,6 +337,7 @@ static int mmc_read_switch(struct mmc_card *card) |
2390 |
+ card->sw_caps.sd3_bus_mode = status[13]; |
2391 |
+ /* Driver Strengths supported by the card */ |
2392 |
+ card->sw_caps.sd3_drv_type = status[9]; |
2393 |
++ card->sw_caps.sd3_curr_limit = status[7] | status[6] << 8; |
2394 |
+ } |
2395 |
+ |
2396 |
+ out: |
2397 |
+@@ -553,14 +554,25 @@ static int sd_set_current_limit(struct mmc_card *card, u8 *status) |
2398 |
+ * when we set current limit to 200ma, the card will draw 200ma, and |
2399 |
+ * when we set current limit to 400/600/800ma, the card will draw its |
2400 |
+ * maximum 300ma from the host. |
2401 |
++ * |
2402 |
++ * The above is incorrect: if we try to set a current limit that is |
2403 |
++ * not supported by the card, the card can rightfully error out the |
2404 |
++ * attempt, and remain at the default current limit. This results |
2405 |
++ * in a 300mA card being limited to 200mA even though the host |
2406 |
++ * supports 800mA. Failures seen with SanDisk 8GB UHS cards with |
2407 |
++ * an iMX6 host. --rmk |
2408 |
+ */ |
2409 |
+- if (max_current >= 800) |
2410 |
++ if (max_current >= 800 && |
2411 |
++ card->sw_caps.sd3_curr_limit & SD_MAX_CURRENT_800) |
2412 |
+ current_limit = SD_SET_CURRENT_LIMIT_800; |
2413 |
+- else if (max_current >= 600) |
2414 |
++ else if (max_current >= 600 && |
2415 |
++ card->sw_caps.sd3_curr_limit & SD_MAX_CURRENT_600) |
2416 |
+ current_limit = SD_SET_CURRENT_LIMIT_600; |
2417 |
+- else if (max_current >= 400) |
2418 |
++ else if (max_current >= 400 && |
2419 |
++ card->sw_caps.sd3_curr_limit & SD_MAX_CURRENT_400) |
2420 |
+ current_limit = SD_SET_CURRENT_LIMIT_400; |
2421 |
+- else if (max_current >= 200) |
2422 |
++ else if (max_current >= 200 && |
2423 |
++ card->sw_caps.sd3_curr_limit & SD_MAX_CURRENT_200) |
2424 |
+ current_limit = SD_SET_CURRENT_LIMIT_200; |
2425 |
+ |
2426 |
+ if (current_limit != SD_SET_CURRENT_NO_CHANGE) { |
2427 |
+diff --git a/drivers/mmc/host/dw_mmc-rockchip.c b/drivers/mmc/host/dw_mmc-rockchip.c |
2428 |
+index 9becebeeccd1..b2c482da5dd7 100644 |
2429 |
+--- a/drivers/mmc/host/dw_mmc-rockchip.c |
2430 |
++++ b/drivers/mmc/host/dw_mmc-rockchip.c |
2431 |
+@@ -78,6 +78,70 @@ static void dw_mci_rk3288_set_ios(struct dw_mci *host, struct mmc_ios *ios) |
2432 |
+ /* Make sure we use phases which we can enumerate with */ |
2433 |
+ if (!IS_ERR(priv->sample_clk)) |
2434 |
+ clk_set_phase(priv->sample_clk, priv->default_sample_phase); |
2435 |
++ |
2436 |
++ /* |
2437 |
++ * Set the drive phase offset based on speed mode to achieve hold times. |
2438 |
++ * |
2439 |
++ * NOTE: this is _not_ a value that is dynamically tuned and is also |
2440 |
++ * _not_ a value that will vary from board to board. It is a value |
2441 |
++ * that could vary between different SoC models if they had massively |
2442 |
++ * different output clock delays inside their dw_mmc IP block (delay_o), |
2443 |
++ * but since it's OK to overshoot a little we don't need to do complex |
2444 |
++ * calculations and can pick values that will just work for everyone. |
2445 |
++ * |
2446 |
++ * When picking values we'll stick with picking 0/90/180/270 since |
2447 |
++ * those can be made very accurately on all known Rockchip SoCs. |
2448 |
++ * |
2449 |
++ * Note that these values match values from the DesignWare Databook |
2450 |
++ * tables for the most part except for SDR12 and "ID mode". For those |
2451 |
++ * two modes the databook calculations assume a clock in of 50MHz. As |
2452 |
++ * seen above, we always use a clock in rate that is exactly the |
2453 |
++ * card's input clock (times RK3288_CLKGEN_DIV, but that gets divided |
2454 |
++ * back out before the controller sees it). |
2455 |
++ * |
2456 |
++ * From measurement of a single device, it appears that delay_o is |
2457 |
++ * about .5 ns. Since we try to leave a bit of margin, it's expected |
2458 |
++ * that numbers here will be fine even with much larger delay_o |
2459 |
++ * (the 1.4 ns assumed by the DesignWare Databook would result in the |
2460 |
++ * same results, for instance). |
2461 |
++ */ |
2462 |
++ if (!IS_ERR(priv->drv_clk)) { |
2463 |
++ int phase; |
2464 |
++ |
2465 |
++ /* |
2466 |
++ * In almost all cases a 90 degree phase offset will provide |
2467 |
++ * sufficient hold times across all valid input clock rates |
2468 |
++ * assuming delay_o is not absurd for a given SoC. We'll use |
2469 |
++ * that as a default. |
2470 |
++ */ |
2471 |
++ phase = 90; |
2472 |
++ |
2473 |
++ switch (ios->timing) { |
2474 |
++ case MMC_TIMING_MMC_DDR52: |
2475 |
++ /* |
2476 |
++ * Since clock in rate with MMC_DDR52 is doubled when |
2477 |
++ * bus width is 8 we need to double the phase offset |
2478 |
++ * to get the same timings. |
2479 |
++ */ |
2480 |
++ if (ios->bus_width == MMC_BUS_WIDTH_8) |
2481 |
++ phase = 180; |
2482 |
++ break; |
2483 |
++ case MMC_TIMING_UHS_SDR104: |
2484 |
++ case MMC_TIMING_MMC_HS200: |
2485 |
++ /* |
2486 |
++ * In the case of 150 MHz clock (typical max for |
2487 |
++ * Rockchip SoCs), 90 degree offset will add a delay |
2488 |
++ * of 1.67 ns. That will meet min hold time of .8 ns |
2489 |
++ * as long as clock output delay is < .87 ns. On |
2490 |
++ * SoCs measured this seems to be OK, but it doesn't |
2491 |
++ * hurt to give margin here, so we use 180. |
2492 |
++ */ |
2493 |
++ phase = 180; |
2494 |
++ break; |
2495 |
++ } |
2496 |
++ |
2497 |
++ clk_set_phase(priv->drv_clk, phase); |
2498 |
++ } |
2499 |
+ } |
2500 |
+ |
2501 |
+ #define NUM_PHASES 360 |
2502 |
+diff --git a/drivers/mmc/host/moxart-mmc.c b/drivers/mmc/host/moxart-mmc.c |
2503 |
+index 79905ce895ad..bbad309679cf 100644 |
2504 |
+--- a/drivers/mmc/host/moxart-mmc.c |
2505 |
++++ b/drivers/mmc/host/moxart-mmc.c |
2506 |
+@@ -257,7 +257,7 @@ static void moxart_dma_complete(void *param) |
2507 |
+ static void moxart_transfer_dma(struct mmc_data *data, struct moxart_host *host) |
2508 |
+ { |
2509 |
+ u32 len, dir_data, dir_slave; |
2510 |
+- unsigned long dma_time; |
2511 |
++ long dma_time; |
2512 |
+ struct dma_async_tx_descriptor *desc = NULL; |
2513 |
+ struct dma_chan *dma_chan; |
2514 |
+ |
2515 |
+@@ -397,7 +397,8 @@ static void moxart_prepare_data(struct moxart_host *host) |
2516 |
+ static void moxart_request(struct mmc_host *mmc, struct mmc_request *mrq) |
2517 |
+ { |
2518 |
+ struct moxart_host *host = mmc_priv(mmc); |
2519 |
+- unsigned long pio_time, flags; |
2520 |
++ long pio_time; |
2521 |
++ unsigned long flags; |
2522 |
+ u32 status; |
2523 |
+ |
2524 |
+ spin_lock_irqsave(&host->lock, flags); |
2525 |
+diff --git a/drivers/mmc/host/sdhci-pxav3.c b/drivers/mmc/host/sdhci-pxav3.c |
2526 |
+index f5edf9d3a18a..0535827b02ee 100644 |
2527 |
+--- a/drivers/mmc/host/sdhci-pxav3.c |
2528 |
++++ b/drivers/mmc/host/sdhci-pxav3.c |
2529 |
+@@ -307,8 +307,30 @@ static void pxav3_set_uhs_signaling(struct sdhci_host *host, unsigned int uhs) |
2530 |
+ __func__, uhs, ctrl_2); |
2531 |
+ } |
2532 |
+ |
2533 |
++static void pxav3_set_power(struct sdhci_host *host, unsigned char mode, |
2534 |
++ unsigned short vdd) |
2535 |
++{ |
2536 |
++ struct mmc_host *mmc = host->mmc; |
2537 |
++ u8 pwr = host->pwr; |
2538 |
++ |
2539 |
++ sdhci_set_power(host, mode, vdd); |
2540 |
++ |
2541 |
++ if (host->pwr == pwr) |
2542 |
++ return; |
2543 |
++ |
2544 |
++ if (host->pwr == 0) |
2545 |
++ vdd = 0; |
2546 |
++ |
2547 |
++ if (!IS_ERR(mmc->supply.vmmc)) { |
2548 |
++ spin_unlock_irq(&host->lock); |
2549 |
++ mmc_regulator_set_ocr(mmc, mmc->supply.vmmc, vdd); |
2550 |
++ spin_lock_irq(&host->lock); |
2551 |
++ } |
2552 |
++} |
2553 |
++ |
2554 |
+ static const struct sdhci_ops pxav3_sdhci_ops = { |
2555 |
+ .set_clock = sdhci_set_clock, |
2556 |
++ .set_power = pxav3_set_power, |
2557 |
+ .platform_send_init_74_clocks = pxav3_gen_init_74_clocks, |
2558 |
+ .get_max_clock = sdhci_pltfm_clk_get_max_clock, |
2559 |
+ .set_bus_width = sdhci_set_bus_width, |
2560 |
+diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c |
2561 |
+index bf309a8a66a1..417cfaa85dd9 100644 |
2562 |
+--- a/drivers/mmc/host/sdhci.c |
2563 |
++++ b/drivers/mmc/host/sdhci.c |
2564 |
+@@ -1284,24 +1284,25 @@ clock_set: |
2565 |
+ } |
2566 |
+ EXPORT_SYMBOL_GPL(sdhci_set_clock); |
2567 |
+ |
2568 |
+-static void sdhci_set_power(struct sdhci_host *host, unsigned char mode, |
2569 |
+- unsigned short vdd) |
2570 |
++static void sdhci_set_power_reg(struct sdhci_host *host, unsigned char mode, |
2571 |
++ unsigned short vdd) |
2572 |
+ { |
2573 |
+ struct mmc_host *mmc = host->mmc; |
2574 |
+- u8 pwr = 0; |
2575 |
+ |
2576 |
+- if (!IS_ERR(mmc->supply.vmmc)) { |
2577 |
+- spin_unlock_irq(&host->lock); |
2578 |
+- mmc_regulator_set_ocr(mmc, mmc->supply.vmmc, vdd); |
2579 |
+- spin_lock_irq(&host->lock); |
2580 |
++ spin_unlock_irq(&host->lock); |
2581 |
++ mmc_regulator_set_ocr(mmc, mmc->supply.vmmc, vdd); |
2582 |
++ spin_lock_irq(&host->lock); |
2583 |
+ |
2584 |
+- if (mode != MMC_POWER_OFF) |
2585 |
+- sdhci_writeb(host, SDHCI_POWER_ON, SDHCI_POWER_CONTROL); |
2586 |
+- else |
2587 |
+- sdhci_writeb(host, 0, SDHCI_POWER_CONTROL); |
2588 |
++ if (mode != MMC_POWER_OFF) |
2589 |
++ sdhci_writeb(host, SDHCI_POWER_ON, SDHCI_POWER_CONTROL); |
2590 |
++ else |
2591 |
++ sdhci_writeb(host, 0, SDHCI_POWER_CONTROL); |
2592 |
++} |
2593 |
+ |
2594 |
+- return; |
2595 |
+- } |
2596 |
++void sdhci_set_power(struct sdhci_host *host, unsigned char mode, |
2597 |
++ unsigned short vdd) |
2598 |
++{ |
2599 |
++ u8 pwr = 0; |
2600 |
+ |
2601 |
+ if (mode != MMC_POWER_OFF) { |
2602 |
+ switch (1 << vdd) { |
2603 |
+@@ -1332,7 +1333,6 @@ static void sdhci_set_power(struct sdhci_host *host, unsigned char mode, |
2604 |
+ sdhci_writeb(host, 0, SDHCI_POWER_CONTROL); |
2605 |
+ if (host->quirks2 & SDHCI_QUIRK2_CARD_ON_NEEDS_BUS_ON) |
2606 |
+ sdhci_runtime_pm_bus_off(host); |
2607 |
+- vdd = 0; |
2608 |
+ } else { |
2609 |
+ /* |
2610 |
+ * Spec says that we should clear the power reg before setting |
2611 |
+@@ -1364,6 +1364,20 @@ static void sdhci_set_power(struct sdhci_host *host, unsigned char mode, |
2612 |
+ mdelay(10); |
2613 |
+ } |
2614 |
+ } |
2615 |
++EXPORT_SYMBOL_GPL(sdhci_set_power); |
2616 |
++ |
2617 |
++static void __sdhci_set_power(struct sdhci_host *host, unsigned char mode, |
2618 |
++ unsigned short vdd) |
2619 |
++{ |
2620 |
++ struct mmc_host *mmc = host->mmc; |
2621 |
++ |
2622 |
++ if (host->ops->set_power) |
2623 |
++ host->ops->set_power(host, mode, vdd); |
2624 |
++ else if (!IS_ERR(mmc->supply.vmmc)) |
2625 |
++ sdhci_set_power_reg(host, mode, vdd); |
2626 |
++ else |
2627 |
++ sdhci_set_power(host, mode, vdd); |
2628 |
++} |
2629 |
+ |
2630 |
+ /*****************************************************************************\ |
2631 |
+ * * |
2632 |
+@@ -1512,7 +1526,7 @@ static void sdhci_do_set_ios(struct sdhci_host *host, struct mmc_ios *ios) |
2633 |
+ } |
2634 |
+ } |
2635 |
+ |
2636 |
+- sdhci_set_power(host, ios->power_mode, ios->vdd); |
2637 |
++ __sdhci_set_power(host, ios->power_mode, ios->vdd); |
2638 |
+ |
2639 |
+ if (host->ops->platform_send_init_74_clocks) |
2640 |
+ host->ops->platform_send_init_74_clocks(host, ios->power_mode); |
2641 |
+diff --git a/drivers/mmc/host/sdhci.h b/drivers/mmc/host/sdhci.h |
2642 |
+index 0115e9907bf8..033d72b5bbd5 100644 |
2643 |
+--- a/drivers/mmc/host/sdhci.h |
2644 |
++++ b/drivers/mmc/host/sdhci.h |
2645 |
+@@ -529,6 +529,8 @@ struct sdhci_ops { |
2646 |
+ #endif |
2647 |
+ |
2648 |
+ void (*set_clock)(struct sdhci_host *host, unsigned int clock); |
2649 |
++ void (*set_power)(struct sdhci_host *host, unsigned char mode, |
2650 |
++ unsigned short vdd); |
2651 |
+ |
2652 |
+ int (*enable_dma)(struct sdhci_host *host); |
2653 |
+ unsigned int (*get_max_clock)(struct sdhci_host *host); |
2654 |
+@@ -660,6 +662,8 @@ static inline bool sdhci_sdio_irq_enabled(struct sdhci_host *host) |
2655 |
+ } |
2656 |
+ |
2657 |
+ void sdhci_set_clock(struct sdhci_host *host, unsigned int clock); |
2658 |
++void sdhci_set_power(struct sdhci_host *host, unsigned char mode, |
2659 |
++ unsigned short vdd); |
2660 |
+ void sdhci_set_bus_width(struct sdhci_host *host, int width); |
2661 |
+ void sdhci_reset(struct sdhci_host *host, u8 mask); |
2662 |
+ void sdhci_set_uhs_signaling(struct sdhci_host *host, unsigned timing); |
2663 |
+diff --git a/drivers/mtd/nand/denali.c b/drivers/mtd/nand/denali.c |
2664 |
+index 67eb2be0db87..9a5035cac129 100644 |
2665 |
+--- a/drivers/mtd/nand/denali.c |
2666 |
++++ b/drivers/mtd/nand/denali.c |
2667 |
+@@ -1622,9 +1622,16 @@ EXPORT_SYMBOL(denali_init); |
2668 |
+ /* driver exit point */ |
2669 |
+ void denali_remove(struct denali_nand_info *denali) |
2670 |
+ { |
2671 |
++ /* |
2672 |
++ * Pre-compute DMA buffer size to avoid any problems in case |
2673 |
++ * nand_release() ever changes in a way that mtd->writesize and |
2674 |
++ * mtd->oobsize are not reliable after this call. |
2675 |
++ */ |
2676 |
++ int bufsize = denali->mtd.writesize + denali->mtd.oobsize; |
2677 |
++ |
2678 |
++ nand_release(&denali->mtd); |
2679 |
+ denali_irq_cleanup(denali->irq, denali); |
2680 |
+- dma_unmap_single(denali->dev, denali->buf.dma_buf, |
2681 |
+- denali->mtd.writesize + denali->mtd.oobsize, |
2682 |
++ dma_unmap_single(denali->dev, denali->buf.dma_buf, bufsize, |
2683 |
+ DMA_BIDIRECTIONAL); |
2684 |
+ } |
2685 |
+ EXPORT_SYMBOL(denali_remove); |
2686 |
+diff --git a/drivers/net/bonding/bond_3ad.c b/drivers/net/bonding/bond_3ad.c |
2687 |
+index 399c627b15cc..22ebdf4d8cc4 100644 |
2688 |
+--- a/drivers/net/bonding/bond_3ad.c |
2689 |
++++ b/drivers/net/bonding/bond_3ad.c |
2690 |
+@@ -100,11 +100,14 @@ enum ad_link_speed_type { |
2691 |
+ #define MAC_ADDRESS_EQUAL(A, B) \ |
2692 |
+ ether_addr_equal_64bits((const u8 *)A, (const u8 *)B) |
2693 |
+ |
2694 |
+-static struct mac_addr null_mac_addr = { { 0, 0, 0, 0, 0, 0 } }; |
2695 |
++static const u8 null_mac_addr[ETH_ALEN + 2] __long_aligned = { |
2696 |
++ 0, 0, 0, 0, 0, 0 |
2697 |
++}; |
2698 |
+ static u16 ad_ticks_per_sec; |
2699 |
+ static const int ad_delta_in_ticks = (AD_TIMER_INTERVAL * HZ) / 1000; |
2700 |
+ |
2701 |
+-static const u8 lacpdu_mcast_addr[ETH_ALEN] = MULTICAST_LACPDU_ADDR; |
2702 |
++static const u8 lacpdu_mcast_addr[ETH_ALEN + 2] __long_aligned = |
2703 |
++ MULTICAST_LACPDU_ADDR; |
2704 |
+ |
2705 |
+ /* ================= main 802.3ad protocol functions ================== */ |
2706 |
+ static int ad_lacpdu_send(struct port *port); |
2707 |
+@@ -1701,7 +1704,7 @@ static void ad_clear_agg(struct aggregator *aggregator) |
2708 |
+ aggregator->is_individual = false; |
2709 |
+ aggregator->actor_admin_aggregator_key = 0; |
2710 |
+ aggregator->actor_oper_aggregator_key = 0; |
2711 |
+- aggregator->partner_system = null_mac_addr; |
2712 |
++ eth_zero_addr(aggregator->partner_system.mac_addr_value); |
2713 |
+ aggregator->partner_system_priority = 0; |
2714 |
+ aggregator->partner_oper_aggregator_key = 0; |
2715 |
+ aggregator->receive_state = 0; |
2716 |
+@@ -1723,7 +1726,7 @@ static void ad_initialize_agg(struct aggregator *aggregator) |
2717 |
+ if (aggregator) { |
2718 |
+ ad_clear_agg(aggregator); |
2719 |
+ |
2720 |
+- aggregator->aggregator_mac_address = null_mac_addr; |
2721 |
++ eth_zero_addr(aggregator->aggregator_mac_address.mac_addr_value); |
2722 |
+ aggregator->aggregator_identifier = 0; |
2723 |
+ aggregator->slave = NULL; |
2724 |
+ } |
2725 |
+diff --git a/drivers/net/bonding/bond_alb.c b/drivers/net/bonding/bond_alb.c |
2726 |
+index 41bd9186d383..295d86ba63d3 100644 |
2727 |
+--- a/drivers/net/bonding/bond_alb.c |
2728 |
++++ b/drivers/net/bonding/bond_alb.c |
2729 |
+@@ -42,13 +42,10 @@ |
2730 |
+ |
2731 |
+ |
2732 |
+ |
2733 |
+-#ifndef __long_aligned |
2734 |
+-#define __long_aligned __attribute__((aligned((sizeof(long))))) |
2735 |
+-#endif |
2736 |
+-static const u8 mac_bcast[ETH_ALEN] __long_aligned = { |
2737 |
++static const u8 mac_bcast[ETH_ALEN + 2] __long_aligned = { |
2738 |
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff |
2739 |
+ }; |
2740 |
+-static const u8 mac_v6_allmcast[ETH_ALEN] __long_aligned = { |
2741 |
++static const u8 mac_v6_allmcast[ETH_ALEN + 2] __long_aligned = { |
2742 |
+ 0x33, 0x33, 0x00, 0x00, 0x00, 0x01 |
2743 |
+ }; |
2744 |
+ static const int alb_delta_in_ticks = HZ / ALB_TIMER_TICKS_PER_SEC; |
2745 |
+diff --git a/drivers/net/bonding/bond_netlink.c b/drivers/net/bonding/bond_netlink.c |
2746 |
+index b8df0f5e8c25..3f320f470345 100644 |
2747 |
+--- a/drivers/net/bonding/bond_netlink.c |
2748 |
++++ b/drivers/net/bonding/bond_netlink.c |
2749 |
+@@ -628,8 +628,7 @@ static int bond_fill_info(struct sk_buff *skb, |
2750 |
+ goto nla_put_failure; |
2751 |
+ |
2752 |
+ if (nla_put(skb, IFLA_BOND_AD_ACTOR_SYSTEM, |
2753 |
+- sizeof(bond->params.ad_actor_system), |
2754 |
+- &bond->params.ad_actor_system)) |
2755 |
++ ETH_ALEN, &bond->params.ad_actor_system)) |
2756 |
+ goto nla_put_failure; |
2757 |
+ } |
2758 |
+ if (!bond_3ad_get_active_agg_info(bond, &info)) { |
2759 |
+diff --git a/drivers/net/dsa/mv88e6xxx.c b/drivers/net/dsa/mv88e6xxx.c |
2760 |
+index e2414f2d7ba9..68ef738a7689 100644 |
2761 |
+--- a/drivers/net/dsa/mv88e6xxx.c |
2762 |
++++ b/drivers/net/dsa/mv88e6xxx.c |
2763 |
+@@ -2064,9 +2064,9 @@ static int mv88e6xxx_setup_port(struct dsa_switch *ds, int port) |
2764 |
+ * the other bits clear. |
2765 |
+ */ |
2766 |
+ reg = 1 << port; |
2767 |
+- /* Disable learning for DSA and CPU ports */ |
2768 |
+- if (dsa_is_cpu_port(ds, port) || dsa_is_dsa_port(ds, port)) |
2769 |
+- reg = PORT_ASSOC_VECTOR_LOCKED_PORT; |
2770 |
++ /* Disable learning for CPU port */ |
2771 |
++ if (dsa_is_cpu_port(ds, port)) |
2772 |
++ reg = 0; |
2773 |
+ |
2774 |
+ ret = _mv88e6xxx_reg_write(ds, REG_PORT(port), PORT_ASSOC_VECTOR, reg); |
2775 |
+ if (ret) |
2776 |
+@@ -2150,7 +2150,8 @@ static int mv88e6xxx_setup_port(struct dsa_switch *ds, int port) |
2777 |
+ * database, and allow every port to egress frames on all other ports. |
2778 |
+ */ |
2779 |
+ reg = BIT(ps->num_ports) - 1; /* all ports */ |
2780 |
+- ret = _mv88e6xxx_port_vlan_map_set(ds, port, reg & ~port); |
2781 |
++ reg &= ~BIT(port); /* except itself */ |
2782 |
++ ret = _mv88e6xxx_port_vlan_map_set(ds, port, reg); |
2783 |
+ if (ret) |
2784 |
+ goto abort; |
2785 |
+ |
2786 |
+diff --git a/drivers/net/ethernet/agere/et131x.c b/drivers/net/ethernet/agere/et131x.c |
2787 |
+index e0f3d197e7f2..8ff10fd70b02 100644 |
2788 |
+--- a/drivers/net/ethernet/agere/et131x.c |
2789 |
++++ b/drivers/net/ethernet/agere/et131x.c |
2790 |
+@@ -3854,7 +3854,7 @@ static void et131x_tx_timeout(struct net_device *netdev) |
2791 |
+ unsigned long flags; |
2792 |
+ |
2793 |
+ /* If the device is closed, ignore the timeout */ |
2794 |
+- if (~(adapter->flags & FMP_ADAPTER_INTERRUPT_IN_USE)) |
2795 |
++ if (!(adapter->flags & FMP_ADAPTER_INTERRUPT_IN_USE)) |
2796 |
+ return; |
2797 |
+ |
2798 |
+ /* Any nonrecoverable hardware error? |
2799 |
+diff --git a/drivers/net/ethernet/broadcom/bcmsysport.c b/drivers/net/ethernet/broadcom/bcmsysport.c |
2800 |
+index 3cb99ce7325b..94f06c35ad9c 100644 |
2801 |
+--- a/drivers/net/ethernet/broadcom/bcmsysport.c |
2802 |
++++ b/drivers/net/ethernet/broadcom/bcmsysport.c |
2803 |
+@@ -396,7 +396,7 @@ static void bcm_sysport_get_stats(struct net_device *dev, |
2804 |
+ else |
2805 |
+ p = (char *)priv; |
2806 |
+ p += s->stat_offset; |
2807 |
+- data[i] = *(u32 *)p; |
2808 |
++ data[i] = *(unsigned long *)p; |
2809 |
+ } |
2810 |
+ } |
2811 |
+ |
2812 |
+@@ -526,7 +526,8 @@ static struct sk_buff *bcm_sysport_rx_refill(struct bcm_sysport_priv *priv, |
2813 |
+ dma_addr_t mapping; |
2814 |
+ |
2815 |
+ /* Allocate a new SKB for a new packet */ |
2816 |
+- skb = netdev_alloc_skb(priv->netdev, RX_BUF_LENGTH); |
2817 |
++ skb = __netdev_alloc_skb(priv->netdev, RX_BUF_LENGTH, |
2818 |
++ GFP_ATOMIC | __GFP_NOWARN); |
2819 |
+ if (!skb) { |
2820 |
+ priv->mib.alloc_rx_buff_failed++; |
2821 |
+ netif_err(priv, rx_err, ndev, "SKB alloc failed\n"); |
2822 |
+diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt.c b/drivers/net/ethernet/broadcom/bnxt/bnxt.c |
2823 |
+index d91953eabfeb..a3949c1a0c23 100644 |
2824 |
+--- a/drivers/net/ethernet/broadcom/bnxt/bnxt.c |
2825 |
++++ b/drivers/net/ethernet/broadcom/bnxt/bnxt.c |
2826 |
+@@ -4250,6 +4250,10 @@ static void bnxt_del_napi(struct bnxt *bp) |
2827 |
+ napi_hash_del(&bnapi->napi); |
2828 |
+ netif_napi_del(&bnapi->napi); |
2829 |
+ } |
2830 |
++ /* We called napi_hash_del() before netif_napi_del(), we need |
2831 |
++ * to respect an RCU grace period before freeing napi structures. |
2832 |
++ */ |
2833 |
++ synchronize_net(); |
2834 |
+ } |
2835 |
+ |
2836 |
+ static void bnxt_init_napi(struct bnxt *bp) |
2837 |
+@@ -4306,9 +4310,7 @@ static void bnxt_tx_disable(struct bnxt *bp) |
2838 |
+ bnapi = bp->bnapi[i]; |
2839 |
+ txr = &bnapi->tx_ring; |
2840 |
+ txq = netdev_get_tx_queue(bp->dev, i); |
2841 |
+- __netif_tx_lock(txq, smp_processor_id()); |
2842 |
+ txr->dev_state = BNXT_DEV_STATE_CLOSING; |
2843 |
+- __netif_tx_unlock(txq); |
2844 |
+ } |
2845 |
+ } |
2846 |
+ /* Stop all TX queues */ |
2847 |
+diff --git a/drivers/net/ethernet/broadcom/genet/bcmgenet.c b/drivers/net/ethernet/broadcom/genet/bcmgenet.c |
2848 |
+index 34fae5576b60..bae8df951780 100644 |
2849 |
+--- a/drivers/net/ethernet/broadcom/genet/bcmgenet.c |
2850 |
++++ b/drivers/net/ethernet/broadcom/genet/bcmgenet.c |
2851 |
+@@ -927,7 +927,11 @@ static void bcmgenet_get_ethtool_stats(struct net_device *dev, |
2852 |
+ else |
2853 |
+ p = (char *)priv; |
2854 |
+ p += s->stat_offset; |
2855 |
+- data[i] = *(u32 *)p; |
2856 |
++ if (sizeof(unsigned long) != sizeof(u32) && |
2857 |
++ s->stat_sizeof == sizeof(unsigned long)) |
2858 |
++ data[i] = *(unsigned long *)p; |
2859 |
++ else |
2860 |
++ data[i] = *(u32 *)p; |
2861 |
+ } |
2862 |
+ } |
2863 |
+ |
2864 |
+@@ -1346,7 +1350,7 @@ static int bcmgenet_xmit_single(struct net_device *dev, |
2865 |
+ |
2866 |
+ tx_cb_ptr->skb = skb; |
2867 |
+ |
2868 |
+- skb_len = skb_headlen(skb) < ETH_ZLEN ? ETH_ZLEN : skb_headlen(skb); |
2869 |
++ skb_len = skb_headlen(skb); |
2870 |
+ |
2871 |
+ mapping = dma_map_single(kdev, skb->data, skb_len, DMA_TO_DEVICE); |
2872 |
+ ret = dma_mapping_error(kdev, mapping); |
2873 |
+@@ -1575,7 +1579,8 @@ static struct sk_buff *bcmgenet_rx_refill(struct bcmgenet_priv *priv, |
2874 |
+ dma_addr_t mapping; |
2875 |
+ |
2876 |
+ /* Allocate a new Rx skb */ |
2877 |
+- skb = netdev_alloc_skb(priv->dev, priv->rx_buf_len + SKB_ALIGNMENT); |
2878 |
++ skb = __netdev_alloc_skb(priv->dev, priv->rx_buf_len + SKB_ALIGNMENT, |
2879 |
++ GFP_ATOMIC | __GFP_NOWARN); |
2880 |
+ if (!skb) { |
2881 |
+ priv->mib.alloc_rx_buff_failed++; |
2882 |
+ netif_err(priv, rx_err, priv->dev, |
2883 |
+diff --git a/drivers/net/ethernet/brocade/bna/bnad_ethtool.c b/drivers/net/ethernet/brocade/bna/bnad_ethtool.c |
2884 |
+index 18672ad773fb..856b7abe4b8a 100644 |
2885 |
+--- a/drivers/net/ethernet/brocade/bna/bnad_ethtool.c |
2886 |
++++ b/drivers/net/ethernet/brocade/bna/bnad_ethtool.c |
2887 |
+@@ -31,7 +31,7 @@ |
2888 |
+ #define BNAD_NUM_TXF_COUNTERS 12 |
2889 |
+ #define BNAD_NUM_RXF_COUNTERS 10 |
2890 |
+ #define BNAD_NUM_CQ_COUNTERS (3 + 5) |
2891 |
+-#define BNAD_NUM_RXQ_COUNTERS 6 |
2892 |
++#define BNAD_NUM_RXQ_COUNTERS 7 |
2893 |
+ #define BNAD_NUM_TXQ_COUNTERS 5 |
2894 |
+ |
2895 |
+ #define BNAD_ETHTOOL_STATS_NUM \ |
2896 |
+@@ -658,6 +658,8 @@ bnad_get_strings(struct net_device *netdev, u32 stringset, u8 *string) |
2897 |
+ string += ETH_GSTRING_LEN; |
2898 |
+ sprintf(string, "rxq%d_allocbuf_failed", q_num); |
2899 |
+ string += ETH_GSTRING_LEN; |
2900 |
++ sprintf(string, "rxq%d_mapbuf_failed", q_num); |
2901 |
++ string += ETH_GSTRING_LEN; |
2902 |
+ sprintf(string, "rxq%d_producer_index", q_num); |
2903 |
+ string += ETH_GSTRING_LEN; |
2904 |
+ sprintf(string, "rxq%d_consumer_index", q_num); |
2905 |
+@@ -678,6 +680,9 @@ bnad_get_strings(struct net_device *netdev, u32 stringset, u8 *string) |
2906 |
+ sprintf(string, "rxq%d_allocbuf_failed", |
2907 |
+ q_num); |
2908 |
+ string += ETH_GSTRING_LEN; |
2909 |
++ sprintf(string, "rxq%d_mapbuf_failed", |
2910 |
++ q_num); |
2911 |
++ string += ETH_GSTRING_LEN; |
2912 |
+ sprintf(string, "rxq%d_producer_index", |
2913 |
+ q_num); |
2914 |
+ string += ETH_GSTRING_LEN; |
2915 |
+diff --git a/drivers/net/ethernet/cadence/macb.c b/drivers/net/ethernet/cadence/macb.c |
2916 |
+index 75bdb6aad352..78803e7de360 100644 |
2917 |
+--- a/drivers/net/ethernet/cadence/macb.c |
2918 |
++++ b/drivers/net/ethernet/cadence/macb.c |
2919 |
+@@ -1104,7 +1104,7 @@ static irqreturn_t macb_interrupt(int irq, void *dev_id) |
2920 |
+ macb_writel(bp, NCR, ctrl | MACB_BIT(RE)); |
2921 |
+ |
2922 |
+ if (bp->caps & MACB_CAPS_ISR_CLEAR_ON_WRITE) |
2923 |
+- macb_writel(bp, ISR, MACB_BIT(RXUBR)); |
2924 |
++ queue_writel(queue, ISR, MACB_BIT(RXUBR)); |
2925 |
+ } |
2926 |
+ |
2927 |
+ if (status & MACB_BIT(ISR_ROVR)) { |
2928 |
+@@ -2904,7 +2904,7 @@ static int macb_probe(struct platform_device *pdev) |
2929 |
+ dev->irq = platform_get_irq(pdev, 0); |
2930 |
+ if (dev->irq < 0) { |
2931 |
+ err = dev->irq; |
2932 |
+- goto err_disable_clocks; |
2933 |
++ goto err_out_free_netdev; |
2934 |
+ } |
2935 |
+ |
2936 |
+ mac = of_get_mac_address(np); |
2937 |
+diff --git a/drivers/net/ethernet/chelsio/cxgb4/sge.c b/drivers/net/ethernet/chelsio/cxgb4/sge.c |
2938 |
+index b7b93e7a643d..d579f4770ee3 100644 |
2939 |
+--- a/drivers/net/ethernet/chelsio/cxgb4/sge.c |
2940 |
++++ b/drivers/net/ethernet/chelsio/cxgb4/sge.c |
2941 |
+@@ -1165,7 +1165,7 @@ out_free: dev_kfree_skb_any(skb); |
2942 |
+ |
2943 |
+ /* Discard the packet if the length is greater than mtu */ |
2944 |
+ max_pkt_len = ETH_HLEN + dev->mtu; |
2945 |
+- if (skb_vlan_tag_present(skb)) |
2946 |
++ if (skb_vlan_tagged(skb)) |
2947 |
+ max_pkt_len += VLAN_HLEN; |
2948 |
+ if (!skb_shinfo(skb)->gso_size && (unlikely(skb->len > max_pkt_len))) |
2949 |
+ goto out_free; |
2950 |
+diff --git a/drivers/net/ethernet/chelsio/cxgb4vf/sge.c b/drivers/net/ethernet/chelsio/cxgb4vf/sge.c |
2951 |
+index ec8ffd7eae33..735bcdeaa7de 100644 |
2952 |
+--- a/drivers/net/ethernet/chelsio/cxgb4vf/sge.c |
2953 |
++++ b/drivers/net/ethernet/chelsio/cxgb4vf/sge.c |
2954 |
+@@ -1188,7 +1188,7 @@ int t4vf_eth_xmit(struct sk_buff *skb, struct net_device *dev) |
2955 |
+ |
2956 |
+ /* Discard the packet if the length is greater than mtu */ |
2957 |
+ max_pkt_len = ETH_HLEN + dev->mtu; |
2958 |
+- if (skb_vlan_tag_present(skb)) |
2959 |
++ if (skb_vlan_tagged(skb)) |
2960 |
+ max_pkt_len += VLAN_HLEN; |
2961 |
+ if (!skb_shinfo(skb)->gso_size && (unlikely(skb->len > max_pkt_len))) |
2962 |
+ goto out_free; |
2963 |
+diff --git a/drivers/net/ethernet/cirrus/ep93xx_eth.c b/drivers/net/ethernet/cirrus/ep93xx_eth.c |
2964 |
+index 796ee362ad70..24f69034f52c 100644 |
2965 |
+--- a/drivers/net/ethernet/cirrus/ep93xx_eth.c |
2966 |
++++ b/drivers/net/ethernet/cirrus/ep93xx_eth.c |
2967 |
+@@ -468,6 +468,9 @@ static void ep93xx_free_buffers(struct ep93xx_priv *ep) |
2968 |
+ struct device *dev = ep->dev->dev.parent; |
2969 |
+ int i; |
2970 |
+ |
2971 |
++ if (!ep->descs) |
2972 |
++ return; |
2973 |
++ |
2974 |
+ for (i = 0; i < RX_QUEUE_ENTRIES; i++) { |
2975 |
+ dma_addr_t d; |
2976 |
+ |
2977 |
+@@ -490,6 +493,7 @@ static void ep93xx_free_buffers(struct ep93xx_priv *ep) |
2978 |
+ |
2979 |
+ dma_free_coherent(dev, sizeof(struct ep93xx_descs), ep->descs, |
2980 |
+ ep->descs_dma_addr); |
2981 |
++ ep->descs = NULL; |
2982 |
+ } |
2983 |
+ |
2984 |
+ static int ep93xx_alloc_buffers(struct ep93xx_priv *ep) |
2985 |
+diff --git a/drivers/net/ethernet/emulex/benet/be.h b/drivers/net/ethernet/emulex/benet/be.h |
2986 |
+index 6ee78c203eca..e5fb5cf5401b 100644 |
2987 |
+--- a/drivers/net/ethernet/emulex/benet/be.h |
2988 |
++++ b/drivers/net/ethernet/emulex/benet/be.h |
2989 |
+@@ -531,6 +531,7 @@ struct be_adapter { |
2990 |
+ |
2991 |
+ struct delayed_work be_err_detection_work; |
2992 |
+ u8 err_flags; |
2993 |
++ bool pcicfg_mapped; /* pcicfg obtained via pci_iomap() */ |
2994 |
+ u32 flags; |
2995 |
+ u32 cmd_privileges; |
2996 |
+ /* Ethtool knobs and info */ |
2997 |
+diff --git a/drivers/net/ethernet/emulex/benet/be_main.c b/drivers/net/ethernet/emulex/benet/be_main.c |
2998 |
+index 7524a33b7032..7cd39324106d 100644 |
2999 |
+--- a/drivers/net/ethernet/emulex/benet/be_main.c |
3000 |
++++ b/drivers/net/ethernet/emulex/benet/be_main.c |
3001 |
+@@ -5526,6 +5526,8 @@ static void be_unmap_pci_bars(struct be_adapter *adapter) |
3002 |
+ pci_iounmap(adapter->pdev, adapter->csr); |
3003 |
+ if (adapter->db) |
3004 |
+ pci_iounmap(adapter->pdev, adapter->db); |
3005 |
++ if (adapter->pcicfg && adapter->pcicfg_mapped) |
3006 |
++ pci_iounmap(adapter->pdev, adapter->pcicfg); |
3007 |
+ } |
3008 |
+ |
3009 |
+ static int db_bar(struct be_adapter *adapter) |
3010 |
+@@ -5577,8 +5579,10 @@ static int be_map_pci_bars(struct be_adapter *adapter) |
3011 |
+ if (!addr) |
3012 |
+ goto pci_map_err; |
3013 |
+ adapter->pcicfg = addr; |
3014 |
++ adapter->pcicfg_mapped = true; |
3015 |
+ } else { |
3016 |
+ adapter->pcicfg = adapter->db + SRIOV_VF_PCICFG_OFFSET; |
3017 |
++ adapter->pcicfg_mapped = false; |
3018 |
+ } |
3019 |
+ } |
3020 |
+ |
3021 |
+diff --git a/drivers/net/ethernet/ethoc.c b/drivers/net/ethernet/ethoc.c |
3022 |
+index 52f2230062e7..4d80d9f85c5d 100644 |
3023 |
+--- a/drivers/net/ethernet/ethoc.c |
3024 |
++++ b/drivers/net/ethernet/ethoc.c |
3025 |
+@@ -1088,7 +1088,7 @@ static int ethoc_probe(struct platform_device *pdev) |
3026 |
+ if (!priv->iobase) { |
3027 |
+ dev_err(&pdev->dev, "cannot remap I/O memory space\n"); |
3028 |
+ ret = -ENXIO; |
3029 |
+- goto error; |
3030 |
++ goto free; |
3031 |
+ } |
3032 |
+ |
3033 |
+ if (netdev->mem_end) { |
3034 |
+@@ -1097,7 +1097,7 @@ static int ethoc_probe(struct platform_device *pdev) |
3035 |
+ if (!priv->membase) { |
3036 |
+ dev_err(&pdev->dev, "cannot remap memory space\n"); |
3037 |
+ ret = -ENXIO; |
3038 |
+- goto error; |
3039 |
++ goto free; |
3040 |
+ } |
3041 |
+ } else { |
3042 |
+ /* Allocate buffer memory */ |
3043 |
+@@ -1108,7 +1108,7 @@ static int ethoc_probe(struct platform_device *pdev) |
3044 |
+ dev_err(&pdev->dev, "cannot allocate %dB buffer\n", |
3045 |
+ buffer_size); |
3046 |
+ ret = -ENOMEM; |
3047 |
+- goto error; |
3048 |
++ goto free; |
3049 |
+ } |
3050 |
+ netdev->mem_end = netdev->mem_start + buffer_size; |
3051 |
+ priv->dma_alloc = buffer_size; |
3052 |
+@@ -1122,7 +1122,7 @@ static int ethoc_probe(struct platform_device *pdev) |
3053 |
+ 128, (netdev->mem_end - netdev->mem_start + 1) / ETHOC_BUFSIZ); |
3054 |
+ if (num_bd < 4) { |
3055 |
+ ret = -ENODEV; |
3056 |
+- goto error; |
3057 |
++ goto free; |
3058 |
+ } |
3059 |
+ priv->num_bd = num_bd; |
3060 |
+ /* num_tx must be a power of two */ |
3061 |
+@@ -1135,7 +1135,7 @@ static int ethoc_probe(struct platform_device *pdev) |
3062 |
+ priv->vma = devm_kzalloc(&pdev->dev, num_bd*sizeof(void *), GFP_KERNEL); |
3063 |
+ if (!priv->vma) { |
3064 |
+ ret = -ENOMEM; |
3065 |
+- goto error; |
3066 |
++ goto free; |
3067 |
+ } |
3068 |
+ |
3069 |
+ /* Allow the platform setup code to pass in a MAC address. */ |
3070 |
+diff --git a/drivers/net/ethernet/hisilicon/hns/hnae.c b/drivers/net/ethernet/hisilicon/hns/hnae.c |
3071 |
+index 3ce41efe8a94..4dd57e6bb3f9 100644 |
3072 |
+--- a/drivers/net/ethernet/hisilicon/hns/hnae.c |
3073 |
++++ b/drivers/net/ethernet/hisilicon/hns/hnae.c |
3074 |
+@@ -331,8 +331,10 @@ struct hnae_handle *hnae_get_handle(struct device *owner_dev, |
3075 |
+ return ERR_PTR(-ENODEV); |
3076 |
+ |
3077 |
+ handle = dev->ops->get_handle(dev, port_id); |
3078 |
+- if (IS_ERR(handle)) |
3079 |
++ if (IS_ERR(handle)) { |
3080 |
++ put_device(&dev->cls_dev); |
3081 |
+ return handle; |
3082 |
++ } |
3083 |
+ |
3084 |
+ handle->dev = dev; |
3085 |
+ handle->owner_dev = owner_dev; |
3086 |
+@@ -355,6 +357,8 @@ out_when_init_queue: |
3087 |
+ for (j = i - 1; j >= 0; j--) |
3088 |
+ hnae_fini_queue(handle->qs[j]); |
3089 |
+ |
3090 |
++ put_device(&dev->cls_dev); |
3091 |
++ |
3092 |
+ return ERR_PTR(-ENOMEM); |
3093 |
+ } |
3094 |
+ EXPORT_SYMBOL(hnae_get_handle); |
3095 |
+@@ -376,6 +380,8 @@ void hnae_put_handle(struct hnae_handle *h) |
3096 |
+ dev->ops->put_handle(h); |
3097 |
+ |
3098 |
+ module_put(dev->owner); |
3099 |
++ |
3100 |
++ put_device(&dev->cls_dev); |
3101 |
+ } |
3102 |
+ EXPORT_SYMBOL(hnae_put_handle); |
3103 |
+ |
3104 |
+diff --git a/drivers/net/ethernet/ibm/ehea/ehea_main.c b/drivers/net/ethernet/ibm/ehea/ehea_main.c |
3105 |
+index fdbba588c6db..efe84ca20da7 100644 |
3106 |
+--- a/drivers/net/ethernet/ibm/ehea/ehea_main.c |
3107 |
++++ b/drivers/net/ethernet/ibm/ehea/ehea_main.c |
3108 |
+@@ -1169,16 +1169,15 @@ static void ehea_parse_eqe(struct ehea_adapter *adapter, u64 eqe) |
3109 |
+ ec = EHEA_BMASK_GET(NEQE_EVENT_CODE, eqe); |
3110 |
+ portnum = EHEA_BMASK_GET(NEQE_PORTNUM, eqe); |
3111 |
+ port = ehea_get_port(adapter, portnum); |
3112 |
++ if (!port) { |
3113 |
++ netdev_err(NULL, "unknown portnum %x\n", portnum); |
3114 |
++ return; |
3115 |
++ } |
3116 |
+ dev = port->netdev; |
3117 |
+ |
3118 |
+ switch (ec) { |
3119 |
+ case EHEA_EC_PORTSTATE_CHG: /* port state change */ |
3120 |
+ |
3121 |
+- if (!port) { |
3122 |
+- netdev_err(dev, "unknown portnum %x\n", portnum); |
3123 |
+- break; |
3124 |
+- } |
3125 |
+- |
3126 |
+ if (EHEA_BMASK_GET(NEQE_PORT_UP, eqe)) { |
3127 |
+ if (!netif_carrier_ok(dev)) { |
3128 |
+ ret = ehea_sense_port_attr(port); |
3129 |
+diff --git a/drivers/net/ethernet/intel/i40e/i40e_hmc.c b/drivers/net/ethernet/intel/i40e/i40e_hmc.c |
3130 |
+index 5ebe12d56ebf..a7c7b1d9b7c8 100644 |
3131 |
+--- a/drivers/net/ethernet/intel/i40e/i40e_hmc.c |
3132 |
++++ b/drivers/net/ethernet/intel/i40e/i40e_hmc.c |
3133 |
+@@ -49,7 +49,7 @@ i40e_status i40e_add_sd_table_entry(struct i40e_hw *hw, |
3134 |
+ struct i40e_hmc_sd_entry *sd_entry; |
3135 |
+ bool dma_mem_alloc_done = false; |
3136 |
+ struct i40e_dma_mem mem; |
3137 |
+- i40e_status ret_code; |
3138 |
++ i40e_status ret_code = I40E_SUCCESS; |
3139 |
+ u64 alloc_len; |
3140 |
+ |
3141 |
+ if (NULL == hmc_info->sd_table.sd_entry) { |
3142 |
+diff --git a/drivers/net/ethernet/marvell/mv643xx_eth.c b/drivers/net/ethernet/marvell/mv643xx_eth.c |
3143 |
+index 82f080a5ed5c..7fe6c2cf1c62 100644 |
3144 |
+--- a/drivers/net/ethernet/marvell/mv643xx_eth.c |
3145 |
++++ b/drivers/net/ethernet/marvell/mv643xx_eth.c |
3146 |
+@@ -762,10 +762,10 @@ txq_put_data_tso(struct net_device *dev, struct tx_queue *txq, |
3147 |
+ |
3148 |
+ if (length <= 8 && (uintptr_t)data & 0x7) { |
3149 |
+ /* Copy unaligned small data fragment to TSO header data area */ |
3150 |
+- memcpy(txq->tso_hdrs + txq->tx_curr_desc * TSO_HEADER_SIZE, |
3151 |
++ memcpy(txq->tso_hdrs + tx_index * TSO_HEADER_SIZE, |
3152 |
+ data, length); |
3153 |
+ desc->buf_ptr = txq->tso_hdrs_dma |
3154 |
+- + txq->tx_curr_desc * TSO_HEADER_SIZE; |
3155 |
++ + tx_index * TSO_HEADER_SIZE; |
3156 |
+ } else { |
3157 |
+ /* Alignment is okay, map buffer and hand off to hardware */ |
3158 |
+ txq->tx_desc_mapping[tx_index] = DESC_DMA_MAP_SINGLE; |
3159 |
+diff --git a/drivers/net/ethernet/marvell/mvneta.c b/drivers/net/ethernet/marvell/mvneta.c |
3160 |
+index 1c300259d70a..575da945f151 100644 |
3161 |
+--- a/drivers/net/ethernet/marvell/mvneta.c |
3162 |
++++ b/drivers/net/ethernet/marvell/mvneta.c |
3163 |
+@@ -3058,26 +3058,25 @@ static void mvneta_ethtool_update_stats(struct mvneta_port *pp) |
3164 |
+ const struct mvneta_statistic *s; |
3165 |
+ void __iomem *base = pp->base; |
3166 |
+ u32 high, low, val; |
3167 |
++ u64 val64; |
3168 |
+ int i; |
3169 |
+ |
3170 |
+ for (i = 0, s = mvneta_statistics; |
3171 |
+ s < mvneta_statistics + ARRAY_SIZE(mvneta_statistics); |
3172 |
+ s++, i++) { |
3173 |
+- val = 0; |
3174 |
+- |
3175 |
+ switch (s->type) { |
3176 |
+ case T_REG_32: |
3177 |
+ val = readl_relaxed(base + s->offset); |
3178 |
++ pp->ethtool_stats[i] += val; |
3179 |
+ break; |
3180 |
+ case T_REG_64: |
3181 |
+ /* Docs say to read low 32-bit then high */ |
3182 |
+ low = readl_relaxed(base + s->offset); |
3183 |
+ high = readl_relaxed(base + s->offset + 4); |
3184 |
+- val = (u64)high << 32 | low; |
3185 |
++ val64 = (u64)high << 32 | low; |
3186 |
++ pp->ethtool_stats[i] += val64; |
3187 |
+ break; |
3188 |
+ } |
3189 |
+- |
3190 |
+- pp->ethtool_stats[i] += val; |
3191 |
+ } |
3192 |
+ } |
3193 |
+ |
3194 |
+@@ -3406,7 +3405,7 @@ static int mvneta_probe(struct platform_device *pdev) |
3195 |
+ dev->features = NETIF_F_SG | NETIF_F_IP_CSUM | NETIF_F_TSO; |
3196 |
+ dev->hw_features |= dev->features; |
3197 |
+ dev->vlan_features |= dev->features; |
3198 |
+- dev->priv_flags |= IFF_UNICAST_FLT | IFF_LIVE_ADDR_CHANGE; |
3199 |
++ dev->priv_flags |= IFF_LIVE_ADDR_CHANGE; |
3200 |
+ dev->gso_max_segs = MVNETA_MAX_TSO_SEGS; |
3201 |
+ |
3202 |
+ err = register_netdev(dev); |
3203 |
+diff --git a/drivers/net/ethernet/marvell/mvpp2.c b/drivers/net/ethernet/marvell/mvpp2.c |
3204 |
+index 03f0d20aa08b..b508345aeca6 100644 |
3205 |
+--- a/drivers/net/ethernet/marvell/mvpp2.c |
3206 |
++++ b/drivers/net/ethernet/marvell/mvpp2.c |
3207 |
+@@ -3305,7 +3305,7 @@ static void mvpp2_cls_init(struct mvpp2 *priv) |
3208 |
+ mvpp2_write(priv, MVPP2_CLS_MODE_REG, MVPP2_CLS_MODE_ACTIVE_MASK); |
3209 |
+ |
3210 |
+ /* Clear classifier flow table */ |
3211 |
+- memset(&fe.data, 0, MVPP2_CLS_FLOWS_TBL_DATA_WORDS); |
3212 |
++ memset(&fe.data, 0, sizeof(fe.data)); |
3213 |
+ for (index = 0; index < MVPP2_CLS_FLOWS_TBL_SIZE; index++) { |
3214 |
+ fe.index = index; |
3215 |
+ mvpp2_cls_flow_write(priv, &fe); |
3216 |
+diff --git a/drivers/net/ethernet/mellanox/mlx4/catas.c b/drivers/net/ethernet/mellanox/mlx4/catas.c |
3217 |
+index e203d0c4e5a3..53daa6ca5d83 100644 |
3218 |
+--- a/drivers/net/ethernet/mellanox/mlx4/catas.c |
3219 |
++++ b/drivers/net/ethernet/mellanox/mlx4/catas.c |
3220 |
+@@ -182,10 +182,17 @@ void mlx4_enter_error_state(struct mlx4_dev_persistent *persist) |
3221 |
+ err = mlx4_reset_slave(dev); |
3222 |
+ else |
3223 |
+ err = mlx4_reset_master(dev); |
3224 |
+- BUG_ON(err != 0); |
3225 |
+ |
3226 |
++ if (!err) { |
3227 |
++ mlx4_err(dev, "device was reset successfully\n"); |
3228 |
++ } else { |
3229 |
++ /* EEH could have disabled the PCI channel during reset. That's |
3230 |
++ * recoverable and the PCI error flow will handle it. |
3231 |
++ */ |
3232 |
++ if (!pci_channel_offline(dev->persist->pdev)) |
3233 |
++ BUG_ON(1); |
3234 |
++ } |
3235 |
+ dev->persist->state |= MLX4_DEVICE_STATE_INTERNAL_ERROR; |
3236 |
+- mlx4_err(dev, "device was reset successfully\n"); |
3237 |
+ mutex_unlock(&persist->device_state_mutex); |
3238 |
+ |
3239 |
+ /* At that step HW was already reset, now notify clients */ |
3240 |
+diff --git a/drivers/net/ethernet/mellanox/mlx4/cmd.c b/drivers/net/ethernet/mellanox/mlx4/cmd.c |
3241 |
+index 9e104dcfa9dd..dc1cb6fc5b4e 100644 |
3242 |
+--- a/drivers/net/ethernet/mellanox/mlx4/cmd.c |
3243 |
++++ b/drivers/net/ethernet/mellanox/mlx4/cmd.c |
3244 |
+@@ -2451,6 +2451,7 @@ err_comm_admin: |
3245 |
+ kfree(priv->mfunc.master.slave_state); |
3246 |
+ err_comm: |
3247 |
+ iounmap(priv->mfunc.comm); |
3248 |
++ priv->mfunc.comm = NULL; |
3249 |
+ err_vhcr: |
3250 |
+ dma_free_coherent(&dev->persist->pdev->dev, PAGE_SIZE, |
3251 |
+ priv->mfunc.vhcr, |
3252 |
+@@ -2518,6 +2519,13 @@ void mlx4_report_internal_err_comm_event(struct mlx4_dev *dev) |
3253 |
+ int slave; |
3254 |
+ u32 slave_read; |
3255 |
+ |
3256 |
++ /* If the comm channel has not yet been initialized, |
3257 |
++ * skip reporting the internal error event to all |
3258 |
++ * the communication channels. |
3259 |
++ */ |
3260 |
++ if (!priv->mfunc.comm) |
3261 |
++ return; |
3262 |
++ |
3263 |
+ /* Report an internal error event to all |
3264 |
+ * communication channels. |
3265 |
+ */ |
3266 |
+@@ -2552,6 +2560,7 @@ void mlx4_multi_func_cleanup(struct mlx4_dev *dev) |
3267 |
+ } |
3268 |
+ |
3269 |
+ iounmap(priv->mfunc.comm); |
3270 |
++ priv->mfunc.comm = NULL; |
3271 |
+ } |
3272 |
+ |
3273 |
+ void mlx4_cmd_cleanup(struct mlx4_dev *dev, int cleanup_mask) |
3274 |
+diff --git a/drivers/net/ethernet/mellanox/mlx4/en_netdev.c b/drivers/net/ethernet/mellanox/mlx4/en_netdev.c |
3275 |
+index 232191417b93..7d61a5de9d5a 100644 |
3276 |
+--- a/drivers/net/ethernet/mellanox/mlx4/en_netdev.c |
3277 |
++++ b/drivers/net/ethernet/mellanox/mlx4/en_netdev.c |
3278 |
+@@ -424,14 +424,18 @@ static int mlx4_en_vlan_rx_add_vid(struct net_device *dev, |
3279 |
+ mutex_lock(&mdev->state_lock); |
3280 |
+ if (mdev->device_up && priv->port_up) { |
3281 |
+ err = mlx4_SET_VLAN_FLTR(mdev->dev, priv); |
3282 |
+- if (err) |
3283 |
++ if (err) { |
3284 |
+ en_err(priv, "Failed configuring VLAN filter\n"); |
3285 |
++ goto out; |
3286 |
++ } |
3287 |
+ } |
3288 |
+- if (mlx4_register_vlan(mdev->dev, priv->port, vid, &idx)) |
3289 |
+- en_dbg(HW, priv, "failed adding vlan %d\n", vid); |
3290 |
+- mutex_unlock(&mdev->state_lock); |
3291 |
++ err = mlx4_register_vlan(mdev->dev, priv->port, vid, &idx); |
3292 |
++ if (err) |
3293 |
++ en_dbg(HW, priv, "Failed adding vlan %d\n", vid); |
3294 |
+ |
3295 |
+- return 0; |
3296 |
++out: |
3297 |
++ mutex_unlock(&mdev->state_lock); |
3298 |
++ return err; |
3299 |
+ } |
3300 |
+ |
3301 |
+ static int mlx4_en_vlan_rx_kill_vid(struct net_device *dev, |
3302 |
+@@ -439,7 +443,7 @@ static int mlx4_en_vlan_rx_kill_vid(struct net_device *dev, |
3303 |
+ { |
3304 |
+ struct mlx4_en_priv *priv = netdev_priv(dev); |
3305 |
+ struct mlx4_en_dev *mdev = priv->mdev; |
3306 |
+- int err; |
3307 |
++ int err = 0; |
3308 |
+ |
3309 |
+ en_dbg(HW, priv, "Killing VID:%d\n", vid); |
3310 |
+ |
3311 |
+@@ -456,7 +460,7 @@ static int mlx4_en_vlan_rx_kill_vid(struct net_device *dev, |
3312 |
+ } |
3313 |
+ mutex_unlock(&mdev->state_lock); |
3314 |
+ |
3315 |
+- return 0; |
3316 |
++ return err; |
3317 |
+ } |
3318 |
+ |
3319 |
+ static void mlx4_en_u64_to_mac(unsigned char dst_mac[ETH_ALEN + 2], u64 src_mac) |
3320 |
+@@ -1716,6 +1720,16 @@ int mlx4_en_start_port(struct net_device *dev) |
3321 |
+ vxlan_get_rx_port(dev); |
3322 |
+ #endif |
3323 |
+ priv->port_up = true; |
3324 |
++ |
3325 |
++ /* Process all completions if exist to prevent |
3326 |
++ * the queues freezing if they are full |
3327 |
++ */ |
3328 |
++ for (i = 0; i < priv->rx_ring_num; i++) { |
3329 |
++ local_bh_disable(); |
3330 |
++ napi_schedule(&priv->rx_cq[i]->napi); |
3331 |
++ local_bh_enable(); |
3332 |
++ } |
3333 |
++ |
3334 |
+ netif_tx_start_all_queues(dev); |
3335 |
+ netif_device_attach(dev); |
3336 |
+ |
3337 |
+diff --git a/drivers/net/ethernet/mellanox/mlx4/en_port.c b/drivers/net/ethernet/mellanox/mlx4/en_port.c |
3338 |
+index 3904b5fc0b7c..96fc35a9bb05 100644 |
3339 |
+--- a/drivers/net/ethernet/mellanox/mlx4/en_port.c |
3340 |
++++ b/drivers/net/ethernet/mellanox/mlx4/en_port.c |
3341 |
+@@ -164,7 +164,7 @@ int mlx4_en_DUMP_ETH_STATS(struct mlx4_en_dev *mdev, u8 port, u8 reset) |
3342 |
+ return PTR_ERR(mailbox); |
3343 |
+ err = mlx4_cmd_box(mdev->dev, 0, mailbox->dma, in_mod, 0, |
3344 |
+ MLX4_CMD_DUMP_ETH_STATS, MLX4_CMD_TIME_CLASS_B, |
3345 |
+- MLX4_CMD_WRAPPED); |
3346 |
++ MLX4_CMD_NATIVE); |
3347 |
+ if (err) |
3348 |
+ goto out; |
3349 |
+ |
3350 |
+@@ -325,7 +325,7 @@ int mlx4_en_DUMP_ETH_STATS(struct mlx4_en_dev *mdev, u8 port, u8 reset) |
3351 |
+ err = mlx4_cmd_box(mdev->dev, 0, mailbox->dma, |
3352 |
+ in_mod | MLX4_DUMP_ETH_STATS_FLOW_CONTROL, |
3353 |
+ 0, MLX4_CMD_DUMP_ETH_STATS, |
3354 |
+- MLX4_CMD_TIME_CLASS_B, MLX4_CMD_WRAPPED); |
3355 |
++ MLX4_CMD_TIME_CLASS_B, MLX4_CMD_NATIVE); |
3356 |
+ if (err) |
3357 |
+ goto out; |
3358 |
+ } |
3359 |
+diff --git a/drivers/net/ethernet/mellanox/mlx4/fw.c b/drivers/net/ethernet/mellanox/mlx4/fw.c |
3360 |
+index 033f99d2f15c..5ac6e62f7dcc 100644 |
3361 |
+--- a/drivers/net/ethernet/mellanox/mlx4/fw.c |
3362 |
++++ b/drivers/net/ethernet/mellanox/mlx4/fw.c |
3363 |
+@@ -610,8 +610,7 @@ int mlx4_QUERY_FUNC_CAP(struct mlx4_dev *dev, u8 gen_or_port, |
3364 |
+ MLX4_GET(func_cap->phys_port_id, outbox, |
3365 |
+ QUERY_FUNC_CAP_PHYS_PORT_ID); |
3366 |
+ |
3367 |
+- MLX4_GET(field, outbox, QUERY_FUNC_CAP_FLAGS0_OFFSET); |
3368 |
+- func_cap->flags |= (field & QUERY_FUNC_CAP_PHV_BIT); |
3369 |
++ MLX4_GET(func_cap->flags0, outbox, QUERY_FUNC_CAP_FLAGS0_OFFSET); |
3370 |
+ |
3371 |
+ /* All other resources are allocated by the master, but we still report |
3372 |
+ * 'num' and 'reserved' capabilities as follows: |
3373 |
+@@ -2840,7 +2839,7 @@ int get_phv_bit(struct mlx4_dev *dev, u8 port, int *phv) |
3374 |
+ memset(&func_cap, 0, sizeof(func_cap)); |
3375 |
+ err = mlx4_QUERY_FUNC_CAP(dev, port, &func_cap); |
3376 |
+ if (!err) |
3377 |
+- *phv = func_cap.flags & QUERY_FUNC_CAP_PHV_BIT; |
3378 |
++ *phv = func_cap.flags0 & QUERY_FUNC_CAP_PHV_BIT; |
3379 |
+ return err; |
3380 |
+ } |
3381 |
+ EXPORT_SYMBOL(get_phv_bit); |
3382 |
+diff --git a/drivers/net/ethernet/mellanox/mlx4/fw.h b/drivers/net/ethernet/mellanox/mlx4/fw.h |
3383 |
+index 08de5555c2f4..074631be342b 100644 |
3384 |
+--- a/drivers/net/ethernet/mellanox/mlx4/fw.h |
3385 |
++++ b/drivers/net/ethernet/mellanox/mlx4/fw.h |
3386 |
+@@ -150,7 +150,7 @@ struct mlx4_func_cap { |
3387 |
+ u32 qp1_proxy_qpn; |
3388 |
+ u32 reserved_lkey; |
3389 |
+ u8 physical_port; |
3390 |
+- u8 port_flags; |
3391 |
++ u8 flags0; |
3392 |
+ u8 flags1; |
3393 |
+ u64 phys_port_id; |
3394 |
+ u32 extra_flags; |
3395 |
+diff --git a/drivers/net/ethernet/mellanox/mlx4/intf.c b/drivers/net/ethernet/mellanox/mlx4/intf.c |
3396 |
+index 1a134e08f010..cfc2a7632201 100644 |
3397 |
+--- a/drivers/net/ethernet/mellanox/mlx4/intf.c |
3398 |
++++ b/drivers/net/ethernet/mellanox/mlx4/intf.c |
3399 |
+@@ -217,6 +217,9 @@ void mlx4_unregister_device(struct mlx4_dev *dev) |
3400 |
+ struct mlx4_priv *priv = mlx4_priv(dev); |
3401 |
+ struct mlx4_interface *intf; |
3402 |
+ |
3403 |
++ if (!(dev->persist->interface_state & MLX4_INTERFACE_STATE_UP)) |
3404 |
++ return; |
3405 |
++ |
3406 |
+ mlx4_stop_catas_poll(dev); |
3407 |
+ if (dev->persist->interface_state & MLX4_INTERFACE_STATE_DELETION && |
3408 |
+ mlx4_is_slave(dev)) { |
3409 |
+diff --git a/drivers/net/ethernet/mellanox/mlx4/main.c b/drivers/net/ethernet/mellanox/mlx4/main.c |
3410 |
+index a7d3144c2388..f8ac0e69d14b 100644 |
3411 |
+--- a/drivers/net/ethernet/mellanox/mlx4/main.c |
3412 |
++++ b/drivers/net/ethernet/mellanox/mlx4/main.c |
3413 |
+@@ -3854,45 +3854,53 @@ static pci_ers_result_t mlx4_pci_slot_reset(struct pci_dev *pdev) |
3414 |
+ { |
3415 |
+ struct mlx4_dev_persistent *persist = pci_get_drvdata(pdev); |
3416 |
+ struct mlx4_dev *dev = persist->dev; |
3417 |
+- struct mlx4_priv *priv = mlx4_priv(dev); |
3418 |
+- int ret; |
3419 |
+- int nvfs[MLX4_MAX_PORTS + 1] = {0, 0, 0}; |
3420 |
+- int total_vfs; |
3421 |
++ int err; |
3422 |
+ |
3423 |
+ mlx4_err(dev, "mlx4_pci_slot_reset was called\n"); |
3424 |
+- ret = pci_enable_device(pdev); |
3425 |
+- if (ret) { |
3426 |
+- mlx4_err(dev, "Can not re-enable device, ret=%d\n", ret); |
3427 |
++ err = pci_enable_device(pdev); |
3428 |
++ if (err) { |
3429 |
++ mlx4_err(dev, "Can not re-enable device, err=%d\n", err); |
3430 |
+ return PCI_ERS_RESULT_DISCONNECT; |
3431 |
+ } |
3432 |
+ |
3433 |
+ pci_set_master(pdev); |
3434 |
+ pci_restore_state(pdev); |
3435 |
+ pci_save_state(pdev); |
3436 |
++ return PCI_ERS_RESULT_RECOVERED; |
3437 |
++} |
3438 |
++ |
3439 |
++static void mlx4_pci_resume(struct pci_dev *pdev) |
3440 |
++{ |
3441 |
++ struct mlx4_dev_persistent *persist = pci_get_drvdata(pdev); |
3442 |
++ struct mlx4_dev *dev = persist->dev; |
3443 |
++ struct mlx4_priv *priv = mlx4_priv(dev); |
3444 |
++ int nvfs[MLX4_MAX_PORTS + 1] = {0, 0, 0}; |
3445 |
++ int total_vfs; |
3446 |
++ int err; |
3447 |
+ |
3448 |
++ mlx4_err(dev, "%s was called\n", __func__); |
3449 |
+ total_vfs = dev->persist->num_vfs; |
3450 |
+ memcpy(nvfs, dev->persist->nvfs, sizeof(dev->persist->nvfs)); |
3451 |
+ |
3452 |
+ mutex_lock(&persist->interface_state_mutex); |
3453 |
+ if (!(persist->interface_state & MLX4_INTERFACE_STATE_UP)) { |
3454 |
+- ret = mlx4_load_one(pdev, priv->pci_dev_data, total_vfs, nvfs, |
3455 |
++ err = mlx4_load_one(pdev, priv->pci_dev_data, total_vfs, nvfs, |
3456 |
+ priv, 1); |
3457 |
+- if (ret) { |
3458 |
+- mlx4_err(dev, "%s: mlx4_load_one failed, ret=%d\n", |
3459 |
+- __func__, ret); |
3460 |
++ if (err) { |
3461 |
++ mlx4_err(dev, "%s: mlx4_load_one failed, err=%d\n", |
3462 |
++ __func__, err); |
3463 |
+ goto end; |
3464 |
+ } |
3465 |
+ |
3466 |
+- ret = restore_current_port_types(dev, dev->persist-> |
3467 |
++ err = restore_current_port_types(dev, dev->persist-> |
3468 |
+ curr_port_type, dev->persist-> |
3469 |
+ curr_port_poss_type); |
3470 |
+- if (ret) |
3471 |
+- mlx4_err(dev, "could not restore original port types (%d)\n", ret); |
3472 |
++ if (err) |
3473 |
++ mlx4_err(dev, "could not restore original port types (%d)\n", err); |
3474 |
+ } |
3475 |
+ end: |
3476 |
+ mutex_unlock(&persist->interface_state_mutex); |
3477 |
+ |
3478 |
+- return ret ? PCI_ERS_RESULT_DISCONNECT : PCI_ERS_RESULT_RECOVERED; |
3479 |
+ } |
3480 |
+ |
3481 |
+ static void mlx4_shutdown(struct pci_dev *pdev) |
3482 |
+@@ -3909,6 +3917,7 @@ static void mlx4_shutdown(struct pci_dev *pdev) |
3483 |
+ static const struct pci_error_handlers mlx4_err_handler = { |
3484 |
+ .error_detected = mlx4_pci_err_detected, |
3485 |
+ .slot_reset = mlx4_pci_slot_reset, |
3486 |
++ .resume = mlx4_pci_resume, |
3487 |
+ }; |
3488 |
+ |
3489 |
+ static struct pci_driver mlx4_driver = { |
3490 |
+diff --git a/drivers/net/ethernet/mellanox/mlx4/mcg.c b/drivers/net/ethernet/mellanox/mlx4/mcg.c |
3491 |
+index 3bf63de3a725..15c8f53f2497 100644 |
3492 |
+--- a/drivers/net/ethernet/mellanox/mlx4/mcg.c |
3493 |
++++ b/drivers/net/ethernet/mellanox/mlx4/mcg.c |
3494 |
+@@ -1109,7 +1109,7 @@ int mlx4_qp_attach_common(struct mlx4_dev *dev, struct mlx4_qp *qp, u8 gid[16], |
3495 |
+ struct mlx4_cmd_mailbox *mailbox; |
3496 |
+ struct mlx4_mgm *mgm; |
3497 |
+ u32 members_count; |
3498 |
+- int index, prev; |
3499 |
++ int index = -1, prev; |
3500 |
+ int link = 0; |
3501 |
+ int i; |
3502 |
+ int err; |
3503 |
+@@ -1188,7 +1188,7 @@ int mlx4_qp_attach_common(struct mlx4_dev *dev, struct mlx4_qp *qp, u8 gid[16], |
3504 |
+ goto out; |
3505 |
+ |
3506 |
+ out: |
3507 |
+- if (prot == MLX4_PROT_ETH) { |
3508 |
++ if (prot == MLX4_PROT_ETH && index != -1) { |
3509 |
+ /* manage the steering entry for promisc mode */ |
3510 |
+ if (new_entry) |
3511 |
+ err = new_steering_entry(dev, port, steer, |
3512 |
+@@ -1464,7 +1464,12 @@ EXPORT_SYMBOL_GPL(mlx4_multicast_detach); |
3513 |
+ int mlx4_flow_steer_promisc_add(struct mlx4_dev *dev, u8 port, |
3514 |
+ u32 qpn, enum mlx4_net_trans_promisc_mode mode) |
3515 |
+ { |
3516 |
+- struct mlx4_net_trans_rule rule; |
3517 |
++ struct mlx4_net_trans_rule rule = { |
3518 |
++ .queue_mode = MLX4_NET_TRANS_Q_FIFO, |
3519 |
++ .exclusive = 0, |
3520 |
++ .allow_loopback = 1, |
3521 |
++ }; |
3522 |
++ |
3523 |
+ u64 *regid_p; |
3524 |
+ |
3525 |
+ switch (mode) { |
3526 |
+diff --git a/drivers/net/ethernet/mellanox/mlx4/mlx4.h b/drivers/net/ethernet/mellanox/mlx4/mlx4.h |
3527 |
+index db40387ffaf6..b0af462f5e04 100644 |
3528 |
+--- a/drivers/net/ethernet/mellanox/mlx4/mlx4.h |
3529 |
++++ b/drivers/net/ethernet/mellanox/mlx4/mlx4.h |
3530 |
+@@ -143,9 +143,10 @@ enum mlx4_resource { |
3531 |
+ RES_MTT, |
3532 |
+ RES_MAC, |
3533 |
+ RES_VLAN, |
3534 |
+- RES_EQ, |
3535 |
++ RES_NPORT_ID, |
3536 |
+ RES_COUNTER, |
3537 |
+ RES_FS_RULE, |
3538 |
++ RES_EQ, |
3539 |
+ MLX4_NUM_OF_RESOURCE_TYPE |
3540 |
+ }; |
3541 |
+ |
3542 |
+@@ -1312,8 +1313,6 @@ int mlx4_SET_VLAN_FLTR_wrapper(struct mlx4_dev *dev, int slave, |
3543 |
+ struct mlx4_cmd_info *cmd); |
3544 |
+ int mlx4_common_set_vlan_fltr(struct mlx4_dev *dev, int function, |
3545 |
+ int port, void *buf); |
3546 |
+-int mlx4_common_dump_eth_stats(struct mlx4_dev *dev, int slave, u32 in_mod, |
3547 |
+- struct mlx4_cmd_mailbox *outbox); |
3548 |
+ int mlx4_DUMP_ETH_STATS_wrapper(struct mlx4_dev *dev, int slave, |
3549 |
+ struct mlx4_vhcr *vhcr, |
3550 |
+ struct mlx4_cmd_mailbox *inbox, |
3551 |
+diff --git a/drivers/net/ethernet/mellanox/mlx4/port.c b/drivers/net/ethernet/mellanox/mlx4/port.c |
3552 |
+index a9c4818448f9..d764081ef675 100644 |
3553 |
+--- a/drivers/net/ethernet/mellanox/mlx4/port.c |
3554 |
++++ b/drivers/net/ethernet/mellanox/mlx4/port.c |
3555 |
+@@ -1155,24 +1155,13 @@ int mlx4_SET_VLAN_FLTR_wrapper(struct mlx4_dev *dev, int slave, |
3556 |
+ return err; |
3557 |
+ } |
3558 |
+ |
3559 |
+-int mlx4_common_dump_eth_stats(struct mlx4_dev *dev, int slave, |
3560 |
+- u32 in_mod, struct mlx4_cmd_mailbox *outbox) |
3561 |
+-{ |
3562 |
+- return mlx4_cmd_box(dev, 0, outbox->dma, in_mod, 0, |
3563 |
+- MLX4_CMD_DUMP_ETH_STATS, MLX4_CMD_TIME_CLASS_B, |
3564 |
+- MLX4_CMD_NATIVE); |
3565 |
+-} |
3566 |
+- |
3567 |
+ int mlx4_DUMP_ETH_STATS_wrapper(struct mlx4_dev *dev, int slave, |
3568 |
+ struct mlx4_vhcr *vhcr, |
3569 |
+ struct mlx4_cmd_mailbox *inbox, |
3570 |
+ struct mlx4_cmd_mailbox *outbox, |
3571 |
+ struct mlx4_cmd_info *cmd) |
3572 |
+ { |
3573 |
+- if (slave != dev->caps.function) |
3574 |
+- return 0; |
3575 |
+- return mlx4_common_dump_eth_stats(dev, slave, |
3576 |
+- vhcr->in_modifier, outbox); |
3577 |
++ return 0; |
3578 |
+ } |
3579 |
+ |
3580 |
+ int mlx4_get_slave_from_roce_gid(struct mlx4_dev *dev, int port, u8 *gid, |
3581 |
+diff --git a/drivers/net/ethernet/mellanox/mlx4/resource_tracker.c b/drivers/net/ethernet/mellanox/mlx4/resource_tracker.c |
3582 |
+index 170a49a6803e..6466edfc833b 100644 |
3583 |
+--- a/drivers/net/ethernet/mellanox/mlx4/resource_tracker.c |
3584 |
++++ b/drivers/net/ethernet/mellanox/mlx4/resource_tracker.c |
3585 |
+@@ -918,11 +918,13 @@ static int handle_existing_counter(struct mlx4_dev *dev, u8 slave, int port, |
3586 |
+ |
3587 |
+ spin_lock_irq(mlx4_tlock(dev)); |
3588 |
+ r = find_res(dev, counter_index, RES_COUNTER); |
3589 |
+- if (!r || r->owner != slave) |
3590 |
++ if (!r || r->owner != slave) { |
3591 |
+ ret = -EINVAL; |
3592 |
+- counter = container_of(r, struct res_counter, com); |
3593 |
+- if (!counter->port) |
3594 |
+- counter->port = port; |
3595 |
++ } else { |
3596 |
++ counter = container_of(r, struct res_counter, com); |
3597 |
++ if (!counter->port) |
3598 |
++ counter->port = port; |
3599 |
++ } |
3600 |
+ |
3601 |
+ spin_unlock_irq(mlx4_tlock(dev)); |
3602 |
+ return ret; |
3603 |
+diff --git a/drivers/net/ethernet/mellanox/mlx5/core/cmd.c b/drivers/net/ethernet/mellanox/mlx5/core/cmd.c |
3604 |
+index 9ac14df0ca3b..9b8599c2aca8 100644 |
3605 |
+--- a/drivers/net/ethernet/mellanox/mlx5/core/cmd.c |
3606 |
++++ b/drivers/net/ethernet/mellanox/mlx5/core/cmd.c |
3607 |
+@@ -634,11 +634,36 @@ static void free_msg(struct mlx5_core_dev *dev, struct mlx5_cmd_msg *msg); |
3608 |
+ static void mlx5_free_cmd_msg(struct mlx5_core_dev *dev, |
3609 |
+ struct mlx5_cmd_msg *msg); |
3610 |
+ |
3611 |
++static u16 msg_to_opcode(struct mlx5_cmd_msg *in) |
3612 |
++{ |
3613 |
++ struct mlx5_inbox_hdr *hdr = (struct mlx5_inbox_hdr *)(in->first.data); |
3614 |
++ |
3615 |
++ return be16_to_cpu(hdr->opcode); |
3616 |
++} |
3617 |
++ |
3618 |
++static void cb_timeout_handler(struct work_struct *work) |
3619 |
++{ |
3620 |
++ struct delayed_work *dwork = container_of(work, struct delayed_work, |
3621 |
++ work); |
3622 |
++ struct mlx5_cmd_work_ent *ent = container_of(dwork, |
3623 |
++ struct mlx5_cmd_work_ent, |
3624 |
++ cb_timeout_work); |
3625 |
++ struct mlx5_core_dev *dev = container_of(ent->cmd, struct mlx5_core_dev, |
3626 |
++ cmd); |
3627 |
++ |
3628 |
++ ent->ret = -ETIMEDOUT; |
3629 |
++ mlx5_core_warn(dev, "%s(0x%x) timeout. Will cause a leak of a command resource\n", |
3630 |
++ mlx5_command_str(msg_to_opcode(ent->in)), |
3631 |
++ msg_to_opcode(ent->in)); |
3632 |
++ mlx5_cmd_comp_handler(dev, 1UL << ent->idx); |
3633 |
++} |
3634 |
++ |
3635 |
+ static void cmd_work_handler(struct work_struct *work) |
3636 |
+ { |
3637 |
+ struct mlx5_cmd_work_ent *ent = container_of(work, struct mlx5_cmd_work_ent, work); |
3638 |
+ struct mlx5_cmd *cmd = ent->cmd; |
3639 |
+ struct mlx5_core_dev *dev = container_of(cmd, struct mlx5_core_dev, cmd); |
3640 |
++ unsigned long cb_timeout = msecs_to_jiffies(MLX5_CMD_TIMEOUT_MSEC); |
3641 |
+ struct mlx5_cmd_layout *lay; |
3642 |
+ struct semaphore *sem; |
3643 |
+ unsigned long flags; |
3644 |
+@@ -691,6 +716,9 @@ static void cmd_work_handler(struct work_struct *work) |
3645 |
+ ent->ts1 = ktime_get_ns(); |
3646 |
+ cmd_mode = cmd->mode; |
3647 |
+ |
3648 |
++ if (ent->callback) |
3649 |
++ schedule_delayed_work(&ent->cb_timeout_work, cb_timeout); |
3650 |
++ |
3651 |
+ /* ring doorbell after the descriptor is valid */ |
3652 |
+ mlx5_core_dbg(dev, "writing 0x%x to command doorbell\n", 1 << ent->idx); |
3653 |
+ wmb(); |
3654 |
+@@ -735,13 +763,6 @@ static const char *deliv_status_to_str(u8 status) |
3655 |
+ } |
3656 |
+ } |
3657 |
+ |
3658 |
+-static u16 msg_to_opcode(struct mlx5_cmd_msg *in) |
3659 |
+-{ |
3660 |
+- struct mlx5_inbox_hdr *hdr = (struct mlx5_inbox_hdr *)(in->first.data); |
3661 |
+- |
3662 |
+- return be16_to_cpu(hdr->opcode); |
3663 |
+-} |
3664 |
+- |
3665 |
+ static int wait_func(struct mlx5_core_dev *dev, struct mlx5_cmd_work_ent *ent) |
3666 |
+ { |
3667 |
+ unsigned long timeout = msecs_to_jiffies(MLX5_CMD_TIMEOUT_MSEC); |
3668 |
+@@ -750,13 +771,13 @@ static int wait_func(struct mlx5_core_dev *dev, struct mlx5_cmd_work_ent *ent) |
3669 |
+ |
3670 |
+ if (cmd->mode == CMD_MODE_POLLING) { |
3671 |
+ wait_for_completion(&ent->done); |
3672 |
+- err = ent->ret; |
3673 |
+- } else { |
3674 |
+- if (!wait_for_completion_timeout(&ent->done, timeout)) |
3675 |
+- err = -ETIMEDOUT; |
3676 |
+- else |
3677 |
+- err = 0; |
3678 |
++ } else if (!wait_for_completion_timeout(&ent->done, timeout)) { |
3679 |
++ ent->ret = -ETIMEDOUT; |
3680 |
++ mlx5_cmd_comp_handler(dev, 1UL << ent->idx); |
3681 |
+ } |
3682 |
++ |
3683 |
++ err = ent->ret; |
3684 |
++ |
3685 |
+ if (err == -ETIMEDOUT) { |
3686 |
+ mlx5_core_warn(dev, "%s(0x%x) timeout. Will cause a leak of a command resource\n", |
3687 |
+ mlx5_command_str(msg_to_opcode(ent->in)), |
3688 |
+@@ -808,6 +829,7 @@ static int mlx5_cmd_invoke(struct mlx5_core_dev *dev, struct mlx5_cmd_msg *in, |
3689 |
+ if (!callback) |
3690 |
+ init_completion(&ent->done); |
3691 |
+ |
3692 |
++ INIT_DELAYED_WORK(&ent->cb_timeout_work, cb_timeout_handler); |
3693 |
+ INIT_WORK(&ent->work, cmd_work_handler); |
3694 |
+ if (page_queue) { |
3695 |
+ cmd_work_handler(&ent->work); |
3696 |
+@@ -817,28 +839,26 @@ static int mlx5_cmd_invoke(struct mlx5_core_dev *dev, struct mlx5_cmd_msg *in, |
3697 |
+ goto out_free; |
3698 |
+ } |
3699 |
+ |
3700 |
+- if (!callback) { |
3701 |
+- err = wait_func(dev, ent); |
3702 |
+- if (err == -ETIMEDOUT) |
3703 |
+- goto out; |
3704 |
+- |
3705 |
+- ds = ent->ts2 - ent->ts1; |
3706 |
+- op = be16_to_cpu(((struct mlx5_inbox_hdr *)in->first.data)->opcode); |
3707 |
+- if (op < ARRAY_SIZE(cmd->stats)) { |
3708 |
+- stats = &cmd->stats[op]; |
3709 |
+- spin_lock_irq(&stats->lock); |
3710 |
+- stats->sum += ds; |
3711 |
+- ++stats->n; |
3712 |
+- spin_unlock_irq(&stats->lock); |
3713 |
+- } |
3714 |
+- mlx5_core_dbg_mask(dev, 1 << MLX5_CMD_TIME, |
3715 |
+- "fw exec time for %s is %lld nsec\n", |
3716 |
+- mlx5_command_str(op), ds); |
3717 |
+- *status = ent->status; |
3718 |
+- free_cmd(ent); |
3719 |
+- } |
3720 |
++ if (callback) |
3721 |
++ goto out; |
3722 |
+ |
3723 |
+- return err; |
3724 |
++ err = wait_func(dev, ent); |
3725 |
++ if (err == -ETIMEDOUT) |
3726 |
++ goto out_free; |
3727 |
++ |
3728 |
++ ds = ent->ts2 - ent->ts1; |
3729 |
++ op = be16_to_cpu(((struct mlx5_inbox_hdr *)in->first.data)->opcode); |
3730 |
++ if (op < ARRAY_SIZE(cmd->stats)) { |
3731 |
++ stats = &cmd->stats[op]; |
3732 |
++ spin_lock_irq(&stats->lock); |
3733 |
++ stats->sum += ds; |
3734 |
++ ++stats->n; |
3735 |
++ spin_unlock_irq(&stats->lock); |
3736 |
++ } |
3737 |
++ mlx5_core_dbg_mask(dev, 1 << MLX5_CMD_TIME, |
3738 |
++ "fw exec time for %s is %lld nsec\n", |
3739 |
++ mlx5_command_str(op), ds); |
3740 |
++ *status = ent->status; |
3741 |
+ |
3742 |
+ out_free: |
3743 |
+ free_cmd(ent); |
3744 |
+@@ -1230,41 +1250,30 @@ err_dbg: |
3745 |
+ return err; |
3746 |
+ } |
3747 |
+ |
3748 |
+-void mlx5_cmd_use_events(struct mlx5_core_dev *dev) |
3749 |
++static void mlx5_cmd_change_mod(struct mlx5_core_dev *dev, int mode) |
3750 |
+ { |
3751 |
+ struct mlx5_cmd *cmd = &dev->cmd; |
3752 |
+ int i; |
3753 |
+ |
3754 |
+ for (i = 0; i < cmd->max_reg_cmds; i++) |
3755 |
+ down(&cmd->sem); |
3756 |
+- |
3757 |
+ down(&cmd->pages_sem); |
3758 |
+ |
3759 |
+- flush_workqueue(cmd->wq); |
3760 |
+- |
3761 |
+- cmd->mode = CMD_MODE_EVENTS; |
3762 |
++ cmd->mode = mode; |
3763 |
+ |
3764 |
+ up(&cmd->pages_sem); |
3765 |
+ for (i = 0; i < cmd->max_reg_cmds; i++) |
3766 |
+ up(&cmd->sem); |
3767 |
+ } |
3768 |
+ |
3769 |
+-void mlx5_cmd_use_polling(struct mlx5_core_dev *dev) |
3770 |
++void mlx5_cmd_use_events(struct mlx5_core_dev *dev) |
3771 |
+ { |
3772 |
+- struct mlx5_cmd *cmd = &dev->cmd; |
3773 |
+- int i; |
3774 |
+- |
3775 |
+- for (i = 0; i < cmd->max_reg_cmds; i++) |
3776 |
+- down(&cmd->sem); |
3777 |
+- |
3778 |
+- down(&cmd->pages_sem); |
3779 |
+- |
3780 |
+- flush_workqueue(cmd->wq); |
3781 |
+- cmd->mode = CMD_MODE_POLLING; |
3782 |
++ mlx5_cmd_change_mod(dev, CMD_MODE_EVENTS); |
3783 |
++} |
3784 |
+ |
3785 |
+- up(&cmd->pages_sem); |
3786 |
+- for (i = 0; i < cmd->max_reg_cmds; i++) |
3787 |
+- up(&cmd->sem); |
3788 |
++void mlx5_cmd_use_polling(struct mlx5_core_dev *dev) |
3789 |
++{ |
3790 |
++ mlx5_cmd_change_mod(dev, CMD_MODE_POLLING); |
3791 |
+ } |
3792 |
+ |
3793 |
+ static void free_msg(struct mlx5_core_dev *dev, struct mlx5_cmd_msg *msg) |
3794 |
+@@ -1300,6 +1309,8 @@ void mlx5_cmd_comp_handler(struct mlx5_core_dev *dev, u64 vec) |
3795 |
+ struct semaphore *sem; |
3796 |
+ |
3797 |
+ ent = cmd->ent_arr[i]; |
3798 |
++ if (ent->callback) |
3799 |
++ cancel_delayed_work(&ent->cb_timeout_work); |
3800 |
+ if (ent->page_queue) |
3801 |
+ sem = &cmd->pages_sem; |
3802 |
+ else |
3803 |
+diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en.h b/drivers/net/ethernet/mellanox/mlx5/core/en.h |
3804 |
+index 7a716733d9ca..717a381bcfd1 100644 |
3805 |
+--- a/drivers/net/ethernet/mellanox/mlx5/core/en.h |
3806 |
++++ b/drivers/net/ethernet/mellanox/mlx5/core/en.h |
3807 |
+@@ -543,7 +543,7 @@ enum mlx5e_link_mode { |
3808 |
+ MLX5E_100GBASE_KR4 = 22, |
3809 |
+ MLX5E_100GBASE_LR4 = 23, |
3810 |
+ MLX5E_100BASE_TX = 24, |
3811 |
+- MLX5E_100BASE_T = 25, |
3812 |
++ MLX5E_1000BASE_T = 25, |
3813 |
+ MLX5E_10GBASE_T = 26, |
3814 |
+ MLX5E_25GBASE_CR = 27, |
3815 |
+ MLX5E_25GBASE_KR = 28, |
3816 |
+diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c b/drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c |
3817 |
+index c1dd75fe935f..392fa74f1952 100644 |
3818 |
+--- a/drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c |
3819 |
++++ b/drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c |
3820 |
+@@ -138,10 +138,10 @@ static const struct { |
3821 |
+ [MLX5E_100BASE_TX] = { |
3822 |
+ .speed = 100, |
3823 |
+ }, |
3824 |
+- [MLX5E_100BASE_T] = { |
3825 |
+- .supported = SUPPORTED_100baseT_Full, |
3826 |
+- .advertised = ADVERTISED_100baseT_Full, |
3827 |
+- .speed = 100, |
3828 |
++ [MLX5E_1000BASE_T] = { |
3829 |
++ .supported = SUPPORTED_1000baseT_Full, |
3830 |
++ .advertised = ADVERTISED_1000baseT_Full, |
3831 |
++ .speed = 1000, |
3832 |
+ }, |
3833 |
+ [MLX5E_10GBASE_T] = { |
3834 |
+ .supported = SUPPORTED_10000baseT_Full, |
3835 |
+diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_tx.c b/drivers/net/ethernet/mellanox/mlx5/core/en_tx.c |
3836 |
+index 1341b1d3c421..7e2026429d26 100644 |
3837 |
+--- a/drivers/net/ethernet/mellanox/mlx5/core/en_tx.c |
3838 |
++++ b/drivers/net/ethernet/mellanox/mlx5/core/en_tx.c |
3839 |
+@@ -124,7 +124,7 @@ static inline u16 mlx5e_get_inline_hdr_size(struct mlx5e_sq *sq, |
3840 |
+ * headers and occur before the data gather. |
3841 |
+ * Therefore these headers must be copied into the WQE |
3842 |
+ */ |
3843 |
+-#define MLX5E_MIN_INLINE ETH_HLEN |
3844 |
++#define MLX5E_MIN_INLINE (ETH_HLEN + VLAN_HLEN) |
3845 |
+ |
3846 |
+ if (bf) { |
3847 |
+ u16 ihs = skb_headlen(skb); |
3848 |
+@@ -136,7 +136,7 @@ static inline u16 mlx5e_get_inline_hdr_size(struct mlx5e_sq *sq, |
3849 |
+ return skb_headlen(skb); |
3850 |
+ } |
3851 |
+ |
3852 |
+- return MLX5E_MIN_INLINE; |
3853 |
++ return max(skb_network_offset(skb), MLX5E_MIN_INLINE); |
3854 |
+ } |
3855 |
+ |
3856 |
+ static inline void mlx5e_insert_vlan(void *start, struct sk_buff *skb, u16 ihs) |
3857 |
+@@ -290,7 +290,8 @@ static netdev_tx_t mlx5e_sq_xmit(struct mlx5e_sq *sq, struct sk_buff *skb) |
3858 |
+ while ((sq->pc & wq->sz_m1) > sq->edge) |
3859 |
+ mlx5e_send_nop(sq, false); |
3860 |
+ |
3861 |
+- sq->bf_budget = bf ? sq->bf_budget - 1 : 0; |
3862 |
++ if (bf) |
3863 |
++ sq->bf_budget--; |
3864 |
+ |
3865 |
+ sq->stats.packets++; |
3866 |
+ return NETDEV_TX_OK; |
3867 |
+diff --git a/drivers/net/ethernet/mellanox/mlx5/core/health.c b/drivers/net/ethernet/mellanox/mlx5/core/health.c |
3868 |
+index f5deb642d0d6..94594d47cae6 100644 |
3869 |
+--- a/drivers/net/ethernet/mellanox/mlx5/core/health.c |
3870 |
++++ b/drivers/net/ethernet/mellanox/mlx5/core/health.c |
3871 |
+@@ -108,15 +108,21 @@ static int in_fatal(struct mlx5_core_dev *dev) |
3872 |
+ |
3873 |
+ void mlx5_enter_error_state(struct mlx5_core_dev *dev) |
3874 |
+ { |
3875 |
++ mutex_lock(&dev->intf_state_mutex); |
3876 |
+ if (dev->state == MLX5_DEVICE_STATE_INTERNAL_ERROR) |
3877 |
+- return; |
3878 |
++ goto unlock; |
3879 |
+ |
3880 |
+ mlx5_core_err(dev, "start\n"); |
3881 |
+- if (pci_channel_offline(dev->pdev) || in_fatal(dev)) |
3882 |
++ if (pci_channel_offline(dev->pdev) || in_fatal(dev)) { |
3883 |
+ dev->state = MLX5_DEVICE_STATE_INTERNAL_ERROR; |
3884 |
++ trigger_cmd_completions(dev); |
3885 |
++ } |
3886 |
+ |
3887 |
+ mlx5_core_event(dev, MLX5_DEV_EVENT_SYS_ERROR, 0); |
3888 |
+ mlx5_core_err(dev, "end\n"); |
3889 |
++ |
3890 |
++unlock: |
3891 |
++ mutex_unlock(&dev->intf_state_mutex); |
3892 |
+ } |
3893 |
+ |
3894 |
+ static void mlx5_handle_bad_state(struct mlx5_core_dev *dev) |
3895 |
+@@ -245,7 +251,6 @@ static void poll_health(unsigned long data) |
3896 |
+ u32 count; |
3897 |
+ |
3898 |
+ if (dev->state == MLX5_DEVICE_STATE_INTERNAL_ERROR) { |
3899 |
+- trigger_cmd_completions(dev); |
3900 |
+ mod_timer(&health->timer, get_next_poll_jiffies()); |
3901 |
+ return; |
3902 |
+ } |
3903 |
+diff --git a/drivers/net/ethernet/mellanox/mlx5/core/main.c b/drivers/net/ethernet/mellanox/mlx5/core/main.c |
3904 |
+index 35bcc6dbada9..bf4447581072 100644 |
3905 |
+--- a/drivers/net/ethernet/mellanox/mlx5/core/main.c |
3906 |
++++ b/drivers/net/ethernet/mellanox/mlx5/core/main.c |
3907 |
+@@ -1276,15 +1276,43 @@ static pci_ers_result_t mlx5_pci_err_detected(struct pci_dev *pdev, |
3908 |
+ dev_info(&pdev->dev, "%s was called\n", __func__); |
3909 |
+ mlx5_enter_error_state(dev); |
3910 |
+ mlx5_unload_one(dev, priv); |
3911 |
++ pci_save_state(pdev); |
3912 |
+ mlx5_pci_disable_device(dev); |
3913 |
+ return state == pci_channel_io_perm_failure ? |
3914 |
+ PCI_ERS_RESULT_DISCONNECT : PCI_ERS_RESULT_NEED_RESET; |
3915 |
+ } |
3916 |
+ |
3917 |
++/* wait for the device to show vital signs by waiting |
3918 |
++ * for the health counter to start counting. |
3919 |
++ */ |
3920 |
++static int wait_vital(struct pci_dev *pdev) |
3921 |
++{ |
3922 |
++ struct mlx5_core_dev *dev = pci_get_drvdata(pdev); |
3923 |
++ struct mlx5_core_health *health = &dev->priv.health; |
3924 |
++ const int niter = 100; |
3925 |
++ u32 last_count = 0; |
3926 |
++ u32 count; |
3927 |
++ int i; |
3928 |
++ |
3929 |
++ for (i = 0; i < niter; i++) { |
3930 |
++ count = ioread32be(health->health_counter); |
3931 |
++ if (count && count != 0xffffffff) { |
3932 |
++ if (last_count && last_count != count) { |
3933 |
++ dev_info(&pdev->dev, "Counter value 0x%x after %d iterations\n", count, i); |
3934 |
++ return 0; |
3935 |
++ } |
3936 |
++ last_count = count; |
3937 |
++ } |
3938 |
++ msleep(50); |
3939 |
++ } |
3940 |
++ |
3941 |
++ return -ETIMEDOUT; |
3942 |
++} |
3943 |
++ |
3944 |
+ static pci_ers_result_t mlx5_pci_slot_reset(struct pci_dev *pdev) |
3945 |
+ { |
3946 |
+ struct mlx5_core_dev *dev = pci_get_drvdata(pdev); |
3947 |
+- int err = 0; |
3948 |
++ int err; |
3949 |
+ |
3950 |
+ dev_info(&pdev->dev, "%s was called\n", __func__); |
3951 |
+ |
3952 |
+@@ -1294,11 +1322,16 @@ static pci_ers_result_t mlx5_pci_slot_reset(struct pci_dev *pdev) |
3953 |
+ , __func__, err); |
3954 |
+ return PCI_ERS_RESULT_DISCONNECT; |
3955 |
+ } |
3956 |
++ |
3957 |
+ pci_set_master(pdev); |
3958 |
+- pci_set_power_state(pdev, PCI_D0); |
3959 |
+ pci_restore_state(pdev); |
3960 |
+ |
3961 |
+- return err ? PCI_ERS_RESULT_DISCONNECT : PCI_ERS_RESULT_RECOVERED; |
3962 |
++ if (wait_vital(pdev)) { |
3963 |
++ dev_err(&pdev->dev, "%s: wait_vital timed out\n", __func__); |
3964 |
++ return PCI_ERS_RESULT_DISCONNECT; |
3965 |
++ } |
3966 |
++ |
3967 |
++ return PCI_ERS_RESULT_RECOVERED; |
3968 |
+ } |
3969 |
+ |
3970 |
+ void mlx5_disable_device(struct mlx5_core_dev *dev) |
3971 |
+@@ -1306,48 +1339,6 @@ void mlx5_disable_device(struct mlx5_core_dev *dev) |
3972 |
+ mlx5_pci_err_detected(dev->pdev, 0); |
3973 |
+ } |
3974 |
+ |
3975 |
+-/* wait for the device to show vital signs. For now we check |
3976 |
+- * that we can read the device ID and that the health buffer |
3977 |
+- * shows a non zero value which is different than 0xffffffff |
3978 |
+- */ |
3979 |
+-static void wait_vital(struct pci_dev *pdev) |
3980 |
+-{ |
3981 |
+- struct mlx5_core_dev *dev = pci_get_drvdata(pdev); |
3982 |
+- struct mlx5_core_health *health = &dev->priv.health; |
3983 |
+- const int niter = 100; |
3984 |
+- u32 count; |
3985 |
+- u16 did; |
3986 |
+- int i; |
3987 |
+- |
3988 |
+- /* Wait for firmware to be ready after reset */ |
3989 |
+- msleep(1000); |
3990 |
+- for (i = 0; i < niter; i++) { |
3991 |
+- if (pci_read_config_word(pdev, 2, &did)) { |
3992 |
+- dev_warn(&pdev->dev, "failed reading config word\n"); |
3993 |
+- break; |
3994 |
+- } |
3995 |
+- if (did == pdev->device) { |
3996 |
+- dev_info(&pdev->dev, "device ID correctly read after %d iterations\n", i); |
3997 |
+- break; |
3998 |
+- } |
3999 |
+- msleep(50); |
4000 |
+- } |
4001 |
+- if (i == niter) |
4002 |
+- dev_warn(&pdev->dev, "%s-%d: could not read device ID\n", __func__, __LINE__); |
4003 |
+- |
4004 |
+- for (i = 0; i < niter; i++) { |
4005 |
+- count = ioread32be(health->health_counter); |
4006 |
+- if (count && count != 0xffffffff) { |
4007 |
+- dev_info(&pdev->dev, "Counter value 0x%x after %d iterations\n", count, i); |
4008 |
+- break; |
4009 |
+- } |
4010 |
+- msleep(50); |
4011 |
+- } |
4012 |
+- |
4013 |
+- if (i == niter) |
4014 |
+- dev_warn(&pdev->dev, "%s-%d: could not read device ID\n", __func__, __LINE__); |
4015 |
+-} |
4016 |
+- |
4017 |
+ static void mlx5_pci_resume(struct pci_dev *pdev) |
4018 |
+ { |
4019 |
+ struct mlx5_core_dev *dev = pci_get_drvdata(pdev); |
4020 |
+@@ -1356,9 +1347,6 @@ static void mlx5_pci_resume(struct pci_dev *pdev) |
4021 |
+ |
4022 |
+ dev_info(&pdev->dev, "%s was called\n", __func__); |
4023 |
+ |
4024 |
+- pci_save_state(pdev); |
4025 |
+- wait_vital(pdev); |
4026 |
+- |
4027 |
+ err = mlx5_load_one(dev, priv); |
4028 |
+ if (err) |
4029 |
+ dev_err(&pdev->dev, "%s: mlx5_load_one failed with error code: %d\n" |
4030 |
+diff --git a/drivers/net/ethernet/mellanox/mlx5/core/pagealloc.c b/drivers/net/ethernet/mellanox/mlx5/core/pagealloc.c |
4031 |
+index 4d3377b12657..9a6bd830d104 100644 |
4032 |
+--- a/drivers/net/ethernet/mellanox/mlx5/core/pagealloc.c |
4033 |
++++ b/drivers/net/ethernet/mellanox/mlx5/core/pagealloc.c |
4034 |
+@@ -243,6 +243,7 @@ static void free_4k(struct mlx5_core_dev *dev, u64 addr) |
4035 |
+ static int alloc_system_page(struct mlx5_core_dev *dev, u16 func_id) |
4036 |
+ { |
4037 |
+ struct page *page; |
4038 |
++ u64 zero_addr = 1; |
4039 |
+ u64 addr; |
4040 |
+ int err; |
4041 |
+ int nid = dev_to_node(&dev->pdev->dev); |
4042 |
+@@ -252,26 +253,35 @@ static int alloc_system_page(struct mlx5_core_dev *dev, u16 func_id) |
4043 |
+ mlx5_core_warn(dev, "failed to allocate page\n"); |
4044 |
+ return -ENOMEM; |
4045 |
+ } |
4046 |
++map: |
4047 |
+ addr = dma_map_page(&dev->pdev->dev, page, 0, |
4048 |
+ PAGE_SIZE, DMA_BIDIRECTIONAL); |
4049 |
+ if (dma_mapping_error(&dev->pdev->dev, addr)) { |
4050 |
+ mlx5_core_warn(dev, "failed dma mapping page\n"); |
4051 |
+ err = -ENOMEM; |
4052 |
+- goto out_alloc; |
4053 |
++ goto err_mapping; |
4054 |
+ } |
4055 |
++ |
4056 |
++ /* Firmware doesn't support page with physical address 0 */ |
4057 |
++ if (addr == 0) { |
4058 |
++ zero_addr = addr; |
4059 |
++ goto map; |
4060 |
++ } |
4061 |
++ |
4062 |
+ err = insert_page(dev, addr, page, func_id); |
4063 |
+ if (err) { |
4064 |
+ mlx5_core_err(dev, "failed to track allocated page\n"); |
4065 |
+- goto out_mapping; |
4066 |
++ dma_unmap_page(&dev->pdev->dev, addr, PAGE_SIZE, |
4067 |
++ DMA_BIDIRECTIONAL); |
4068 |
+ } |
4069 |
+ |
4070 |
+- return 0; |
4071 |
+- |
4072 |
+-out_mapping: |
4073 |
+- dma_unmap_page(&dev->pdev->dev, addr, PAGE_SIZE, DMA_BIDIRECTIONAL); |
4074 |
++err_mapping: |
4075 |
++ if (err) |
4076 |
++ __free_page(page); |
4077 |
+ |
4078 |
+-out_alloc: |
4079 |
+- __free_page(page); |
4080 |
++ if (zero_addr == 0) |
4081 |
++ dma_unmap_page(&dev->pdev->dev, zero_addr, PAGE_SIZE, |
4082 |
++ DMA_BIDIRECTIONAL); |
4083 |
+ |
4084 |
+ return err; |
4085 |
+ } |
4086 |
+diff --git a/drivers/net/ethernet/mellanox/mlx5/core/qp.c b/drivers/net/ethernet/mellanox/mlx5/core/qp.c |
4087 |
+index 30e2ba3f5f16..a4f8c1b99f71 100644 |
4088 |
+--- a/drivers/net/ethernet/mellanox/mlx5/core/qp.c |
4089 |
++++ b/drivers/net/ethernet/mellanox/mlx5/core/qp.c |
4090 |
+@@ -393,7 +393,7 @@ int mlx5_core_xrcd_alloc(struct mlx5_core_dev *dev, u32 *xrcdn) |
4091 |
+ if (out.hdr.status) |
4092 |
+ err = mlx5_cmd_status_to_err(&out.hdr); |
4093 |
+ else |
4094 |
+- *xrcdn = be32_to_cpu(out.xrcdn); |
4095 |
++ *xrcdn = be32_to_cpu(out.xrcdn) & 0xffffff; |
4096 |
+ |
4097 |
+ return err; |
4098 |
+ } |
4099 |
+diff --git a/drivers/net/ethernet/mellanox/mlx5/core/wq.c b/drivers/net/ethernet/mellanox/mlx5/core/wq.c |
4100 |
+index ce21ee5b2357..821a087c7ae2 100644 |
4101 |
+--- a/drivers/net/ethernet/mellanox/mlx5/core/wq.c |
4102 |
++++ b/drivers/net/ethernet/mellanox/mlx5/core/wq.c |
4103 |
+@@ -75,14 +75,14 @@ int mlx5_wq_cyc_create(struct mlx5_core_dev *mdev, struct mlx5_wq_param *param, |
4104 |
+ |
4105 |
+ err = mlx5_db_alloc_node(mdev, &wq_ctrl->db, param->db_numa_node); |
4106 |
+ if (err) { |
4107 |
+- mlx5_core_warn(mdev, "mlx5_db_alloc() failed, %d\n", err); |
4108 |
++ mlx5_core_warn(mdev, "mlx5_db_alloc_node() failed, %d\n", err); |
4109 |
+ return err; |
4110 |
+ } |
4111 |
+ |
4112 |
+ err = mlx5_buf_alloc_node(mdev, mlx5_wq_cyc_get_byte_size(wq), |
4113 |
+ &wq_ctrl->buf, param->buf_numa_node); |
4114 |
+ if (err) { |
4115 |
+- mlx5_core_warn(mdev, "mlx5_buf_alloc() failed, %d\n", err); |
4116 |
++ mlx5_core_warn(mdev, "mlx5_buf_alloc_node() failed, %d\n", err); |
4117 |
+ goto err_db_free; |
4118 |
+ } |
4119 |
+ |
4120 |
+@@ -111,14 +111,14 @@ int mlx5_cqwq_create(struct mlx5_core_dev *mdev, struct mlx5_wq_param *param, |
4121 |
+ |
4122 |
+ err = mlx5_db_alloc_node(mdev, &wq_ctrl->db, param->db_numa_node); |
4123 |
+ if (err) { |
4124 |
+- mlx5_core_warn(mdev, "mlx5_db_alloc() failed, %d\n", err); |
4125 |
++ mlx5_core_warn(mdev, "mlx5_db_alloc_node() failed, %d\n", err); |
4126 |
+ return err; |
4127 |
+ } |
4128 |
+ |
4129 |
+ err = mlx5_buf_alloc_node(mdev, mlx5_cqwq_get_byte_size(wq), |
4130 |
+ &wq_ctrl->buf, param->buf_numa_node); |
4131 |
+ if (err) { |
4132 |
+- mlx5_core_warn(mdev, "mlx5_buf_alloc() failed, %d\n", err); |
4133 |
++ mlx5_core_warn(mdev, "mlx5_buf_alloc_node() failed, %d\n", err); |
4134 |
+ goto err_db_free; |
4135 |
+ } |
4136 |
+ |
4137 |
+@@ -148,13 +148,14 @@ int mlx5_wq_ll_create(struct mlx5_core_dev *mdev, struct mlx5_wq_param *param, |
4138 |
+ |
4139 |
+ err = mlx5_db_alloc_node(mdev, &wq_ctrl->db, param->db_numa_node); |
4140 |
+ if (err) { |
4141 |
+- mlx5_core_warn(mdev, "mlx5_db_alloc() failed, %d\n", err); |
4142 |
++ mlx5_core_warn(mdev, "mlx5_db_alloc_node() failed, %d\n", err); |
4143 |
+ return err; |
4144 |
+ } |
4145 |
+ |
4146 |
+- err = mlx5_buf_alloc(mdev, mlx5_wq_ll_get_byte_size(wq), &wq_ctrl->buf); |
4147 |
++ err = mlx5_buf_alloc_node(mdev, mlx5_wq_ll_get_byte_size(wq), |
4148 |
++ &wq_ctrl->buf, param->buf_numa_node); |
4149 |
+ if (err) { |
4150 |
+- mlx5_core_warn(mdev, "mlx5_buf_alloc() failed, %d\n", err); |
4151 |
++ mlx5_core_warn(mdev, "mlx5_buf_alloc_node() failed, %d\n", err); |
4152 |
+ goto err_db_free; |
4153 |
+ } |
4154 |
+ |
4155 |
+diff --git a/drivers/net/ethernet/mellanox/mlxsw/pci.c b/drivers/net/ethernet/mellanox/mlxsw/pci.c |
4156 |
+index de69e719dc9d..75a590d1ae40 100644 |
4157 |
+--- a/drivers/net/ethernet/mellanox/mlxsw/pci.c |
4158 |
++++ b/drivers/net/ethernet/mellanox/mlxsw/pci.c |
4159 |
+@@ -215,7 +215,7 @@ mlxsw_pci_queue_elem_info_producer_get(struct mlxsw_pci_queue *q) |
4160 |
+ { |
4161 |
+ int index = q->producer_counter & (q->count - 1); |
4162 |
+ |
4163 |
+- if ((q->producer_counter - q->consumer_counter) == q->count) |
4164 |
++ if ((u16) (q->producer_counter - q->consumer_counter) == q->count) |
4165 |
+ return NULL; |
4166 |
+ return mlxsw_pci_queue_elem_info_get(q, index); |
4167 |
+ } |
4168 |
+diff --git a/drivers/net/ethernet/mellanox/mlxsw/port.h b/drivers/net/ethernet/mellanox/mlxsw/port.h |
4169 |
+index 726f5435b32f..ae65b9940aed 100644 |
4170 |
+--- a/drivers/net/ethernet/mellanox/mlxsw/port.h |
4171 |
++++ b/drivers/net/ethernet/mellanox/mlxsw/port.h |
4172 |
+@@ -49,7 +49,7 @@ |
4173 |
+ #define MLXSW_PORT_MID 0xd000 |
4174 |
+ |
4175 |
+ #define MLXSW_PORT_MAX_PHY_PORTS 0x40 |
4176 |
+-#define MLXSW_PORT_MAX_PORTS MLXSW_PORT_MAX_PHY_PORTS |
4177 |
++#define MLXSW_PORT_MAX_PORTS (MLXSW_PORT_MAX_PHY_PORTS + 1) |
4178 |
+ |
4179 |
+ #define MLXSW_PORT_DEVID_BITS_OFFSET 10 |
4180 |
+ #define MLXSW_PORT_PHY_BITS_OFFSET 4 |
4181 |
+diff --git a/drivers/net/ethernet/mellanox/mlxsw/spectrum.c b/drivers/net/ethernet/mellanox/mlxsw/spectrum.c |
4182 |
+index cb165c2d4803..b23f508de811 100644 |
4183 |
+--- a/drivers/net/ethernet/mellanox/mlxsw/spectrum.c |
4184 |
++++ b/drivers/net/ethernet/mellanox/mlxsw/spectrum.c |
4185 |
+@@ -399,7 +399,11 @@ static netdev_tx_t mlxsw_sp_port_xmit(struct sk_buff *skb, |
4186 |
+ } |
4187 |
+ |
4188 |
+ mlxsw_sp_txhdr_construct(skb, &tx_info); |
4189 |
+- len = skb->len; |
4190 |
++ /* TX header is consumed by HW on the way so we shouldn't count its |
4191 |
++ * bytes as being sent. |
4192 |
++ */ |
4193 |
++ len = skb->len - MLXSW_TXHDR_LEN; |
4194 |
++ |
4195 |
+ /* Due to a race we might fail here because of a full queue. In that |
4196 |
+ * unlikely case we simply drop the packet. |
4197 |
+ */ |
4198 |
+@@ -1100,7 +1104,8 @@ static int mlxsw_sp_port_get_settings(struct net_device *dev, |
4199 |
+ |
4200 |
+ cmd->supported = mlxsw_sp_from_ptys_supported_port(eth_proto_cap) | |
4201 |
+ mlxsw_sp_from_ptys_supported_link(eth_proto_cap) | |
4202 |
+- SUPPORTED_Pause | SUPPORTED_Asym_Pause; |
4203 |
++ SUPPORTED_Pause | SUPPORTED_Asym_Pause | |
4204 |
++ SUPPORTED_Autoneg; |
4205 |
+ cmd->advertising = mlxsw_sp_from_ptys_advert_link(eth_proto_admin); |
4206 |
+ mlxsw_sp_from_ptys_speed_duplex(netif_carrier_ok(dev), |
4207 |
+ eth_proto_oper, cmd); |
4208 |
+@@ -1256,7 +1261,7 @@ static int mlxsw_sp_port_create(struct mlxsw_sp *mlxsw_sp, u8 local_port) |
4209 |
+ /* Each packet needs to have a Tx header (metadata) on top all other |
4210 |
+ * headers. |
4211 |
+ */ |
4212 |
+- dev->hard_header_len += MLXSW_TXHDR_LEN; |
4213 |
++ dev->needed_headroom = MLXSW_TXHDR_LEN; |
4214 |
+ |
4215 |
+ err = mlxsw_sp_port_module_check(mlxsw_sp_port, &usable); |
4216 |
+ if (err) { |
4217 |
+diff --git a/drivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c b/drivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c |
4218 |
+index d4c4c2b5156c..a1df4227ed9d 100644 |
4219 |
+--- a/drivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c |
4220 |
++++ b/drivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c |
4221 |
+@@ -87,14 +87,14 @@ static int mlxsw_sp_port_stp_state_set(struct mlxsw_sp_port *mlxsw_sp_port, |
4222 |
+ int err; |
4223 |
+ |
4224 |
+ switch (state) { |
4225 |
+- case BR_STATE_DISABLED: /* fall-through */ |
4226 |
+ case BR_STATE_FORWARDING: |
4227 |
+ spms_state = MLXSW_REG_SPMS_STATE_FORWARDING; |
4228 |
+ break; |
4229 |
+- case BR_STATE_LISTENING: /* fall-through */ |
4230 |
+ case BR_STATE_LEARNING: |
4231 |
+ spms_state = MLXSW_REG_SPMS_STATE_LEARNING; |
4232 |
+ break; |
4233 |
++ case BR_STATE_LISTENING: /* fall-through */ |
4234 |
++ case BR_STATE_DISABLED: /* fall-through */ |
4235 |
+ case BR_STATE_BLOCKING: |
4236 |
+ spms_state = MLXSW_REG_SPMS_STATE_DISCARDING; |
4237 |
+ break; |
4238 |
+diff --git a/drivers/net/ethernet/mellanox/mlxsw/switchx2.c b/drivers/net/ethernet/mellanox/mlxsw/switchx2.c |
4239 |
+index fb2d9a82ce3d..4d7b3edf6662 100644 |
4240 |
+--- a/drivers/net/ethernet/mellanox/mlxsw/switchx2.c |
4241 |
++++ b/drivers/net/ethernet/mellanox/mlxsw/switchx2.c |
4242 |
+@@ -993,7 +993,7 @@ static int mlxsw_sx_port_create(struct mlxsw_sx *mlxsw_sx, u8 local_port) |
4243 |
+ /* Each packet needs to have a Tx header (metadata) on top all other |
4244 |
+ * headers. |
4245 |
+ */ |
4246 |
+- dev->hard_header_len += MLXSW_TXHDR_LEN; |
4247 |
++ dev->needed_headroom = MLXSW_TXHDR_LEN; |
4248 |
+ |
4249 |
+ err = mlxsw_sx_port_module_check(mlxsw_sx_port, &usable); |
4250 |
+ if (err) { |
4251 |
+@@ -1074,6 +1074,7 @@ err_port_stp_state_set: |
4252 |
+ err_port_admin_status_set: |
4253 |
+ err_port_mtu_set: |
4254 |
+ err_port_speed_set: |
4255 |
++ mlxsw_sx_port_swid_set(mlxsw_sx_port, MLXSW_PORT_SWID_DISABLED_PORT); |
4256 |
+ err_port_swid_set: |
4257 |
+ err_port_system_port_mapping_set: |
4258 |
+ port_not_usable: |
4259 |
+diff --git a/drivers/net/ethernet/micrel/ks8842.c b/drivers/net/ethernet/micrel/ks8842.c |
4260 |
+index 09d2e16fd6b0..cb0102dd7f70 100644 |
4261 |
+--- a/drivers/net/ethernet/micrel/ks8842.c |
4262 |
++++ b/drivers/net/ethernet/micrel/ks8842.c |
4263 |
+@@ -561,8 +561,8 @@ static int __ks8842_start_new_rx_dma(struct net_device *netdev) |
4264 |
+ sg_init_table(sg, 1); |
4265 |
+ sg_dma_address(sg) = dma_map_single(adapter->dev, |
4266 |
+ ctl->skb->data, DMA_BUFFER_SIZE, DMA_FROM_DEVICE); |
4267 |
+- err = dma_mapping_error(adapter->dev, sg_dma_address(sg)); |
4268 |
+- if (unlikely(err)) { |
4269 |
++ if (dma_mapping_error(adapter->dev, sg_dma_address(sg))) { |
4270 |
++ err = -ENOMEM; |
4271 |
+ sg_dma_address(sg) = 0; |
4272 |
+ goto out; |
4273 |
+ } |
4274 |
+@@ -572,8 +572,10 @@ static int __ks8842_start_new_rx_dma(struct net_device *netdev) |
4275 |
+ ctl->adesc = dmaengine_prep_slave_sg(ctl->chan, |
4276 |
+ sg, 1, DMA_DEV_TO_MEM, DMA_PREP_INTERRUPT); |
4277 |
+ |
4278 |
+- if (!ctl->adesc) |
4279 |
++ if (!ctl->adesc) { |
4280 |
++ err = -ENOMEM; |
4281 |
+ goto out; |
4282 |
++ } |
4283 |
+ |
4284 |
+ ctl->adesc->callback_param = netdev; |
4285 |
+ ctl->adesc->callback = ks8842_dma_rx_cb; |
4286 |
+@@ -584,7 +586,7 @@ static int __ks8842_start_new_rx_dma(struct net_device *netdev) |
4287 |
+ goto out; |
4288 |
+ } |
4289 |
+ |
4290 |
+- return err; |
4291 |
++ return 0; |
4292 |
+ out: |
4293 |
+ if (sg_dma_address(sg)) |
4294 |
+ dma_unmap_single(adapter->dev, sg_dma_address(sg), |
4295 |
+diff --git a/drivers/net/ethernet/moxa/moxart_ether.c b/drivers/net/ethernet/moxa/moxart_ether.c |
4296 |
+index a10c928bbd6b..f1dde59c9fa6 100644 |
4297 |
+--- a/drivers/net/ethernet/moxa/moxart_ether.c |
4298 |
++++ b/drivers/net/ethernet/moxa/moxart_ether.c |
4299 |
+@@ -460,9 +460,9 @@ static int moxart_mac_probe(struct platform_device *pdev) |
4300 |
+ res = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
4301 |
+ ndev->base_addr = res->start; |
4302 |
+ priv->base = devm_ioremap_resource(p_dev, res); |
4303 |
+- ret = IS_ERR(priv->base); |
4304 |
+- if (ret) { |
4305 |
++ if (IS_ERR(priv->base)) { |
4306 |
+ dev_err(p_dev, "devm_ioremap_resource failed\n"); |
4307 |
++ ret = PTR_ERR(priv->base); |
4308 |
+ goto init_fail; |
4309 |
+ } |
4310 |
+ |
4311 |
+diff --git a/drivers/net/ethernet/qlogic/qede/qede_main.c b/drivers/net/ethernet/qlogic/qede/qede_main.c |
4312 |
+index 8b63c9d183a2..c677b69bbb0b 100644 |
4313 |
+--- a/drivers/net/ethernet/qlogic/qede/qede_main.c |
4314 |
++++ b/drivers/net/ethernet/qlogic/qede/qede_main.c |
4315 |
+@@ -400,7 +400,7 @@ netdev_tx_t qede_start_xmit(struct sk_buff *skb, |
4316 |
+ u8 xmit_type; |
4317 |
+ u16 idx; |
4318 |
+ u16 hlen; |
4319 |
+- bool data_split; |
4320 |
++ bool data_split = false; |
4321 |
+ |
4322 |
+ /* Get tx-queue context and netdev index */ |
4323 |
+ txq_index = skb_get_queue_mapping(skb); |
4324 |
+diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_io.c b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_io.c |
4325 |
+index 98042a3701b5..621eac53ab01 100644 |
4326 |
+--- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_io.c |
4327 |
++++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_io.c |
4328 |
+@@ -2220,7 +2220,7 @@ void qlcnic_83xx_process_rcv_ring_diag(struct qlcnic_host_sds_ring *sds_ring) |
4329 |
+ if (!opcode) |
4330 |
+ return; |
4331 |
+ |
4332 |
+- ring = QLCNIC_FETCH_RING_ID(qlcnic_83xx_hndl(sts_data[0])); |
4333 |
++ ring = QLCNIC_FETCH_RING_ID(sts_data[0]); |
4334 |
+ qlcnic_83xx_process_rcv_diag(adapter, ring, sts_data); |
4335 |
+ desc = &sds_ring->desc_head[consumer]; |
4336 |
+ desc->status_desc_data[0] = cpu_to_le64(STATUS_OWNER_PHANTOM); |
4337 |
+diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_minidump.c b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_minidump.c |
4338 |
+index e5ea8e972b91..5174e0bd75d1 100644 |
4339 |
+--- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_minidump.c |
4340 |
++++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_minidump.c |
4341 |
+@@ -1419,6 +1419,7 @@ void qlcnic_83xx_get_minidump_template(struct qlcnic_adapter *adapter) |
4342 |
+ struct qlcnic_fw_dump *fw_dump = &ahw->fw_dump; |
4343 |
+ struct pci_dev *pdev = adapter->pdev; |
4344 |
+ bool extended = false; |
4345 |
++ int ret; |
4346 |
+ |
4347 |
+ prev_version = adapter->fw_version; |
4348 |
+ current_version = qlcnic_83xx_get_fw_version(adapter); |
4349 |
+@@ -1429,8 +1430,11 @@ void qlcnic_83xx_get_minidump_template(struct qlcnic_adapter *adapter) |
4350 |
+ if (qlcnic_83xx_md_check_extended_dump_capability(adapter)) |
4351 |
+ extended = !qlcnic_83xx_extend_md_capab(adapter); |
4352 |
+ |
4353 |
+- if (!qlcnic_fw_cmd_get_minidump_temp(adapter)) |
4354 |
+- dev_info(&pdev->dev, "Supports FW dump capability\n"); |
4355 |
++ ret = qlcnic_fw_cmd_get_minidump_temp(adapter); |
4356 |
++ if (ret) |
4357 |
++ return; |
4358 |
++ |
4359 |
++ dev_info(&pdev->dev, "Supports FW dump capability\n"); |
4360 |
+ |
4361 |
+ /* Once we have minidump template with extended iSCSI dump |
4362 |
+ * capability, update the minidump capture mask to 0x1f as |
4363 |
+diff --git a/drivers/net/ethernet/renesas/ravb_main.c b/drivers/net/ethernet/renesas/ravb_main.c |
4364 |
+index fedfd94699cb..5b6320f9c935 100644 |
4365 |
+--- a/drivers/net/ethernet/renesas/ravb_main.c |
4366 |
++++ b/drivers/net/ethernet/renesas/ravb_main.c |
4367 |
+@@ -1528,6 +1528,8 @@ static int ravb_close(struct net_device *ndev) |
4368 |
+ priv->phydev = NULL; |
4369 |
+ } |
4370 |
+ |
4371 |
++ if (priv->chip_id == RCAR_GEN3) |
4372 |
++ free_irq(priv->emac_irq, ndev); |
4373 |
+ free_irq(ndev->irq, ndev); |
4374 |
+ |
4375 |
+ napi_disable(&priv->napi[RAVB_NC]); |
4376 |
+diff --git a/drivers/net/ethernet/sfc/ef10.c b/drivers/net/ethernet/sfc/ef10.c |
4377 |
+index 6dcd436e6e32..e289cb47e6ab 100644 |
4378 |
+--- a/drivers/net/ethernet/sfc/ef10.c |
4379 |
++++ b/drivers/net/ethernet/sfc/ef10.c |
4380 |
+@@ -1304,13 +1304,14 @@ static void efx_ef10_get_stat_mask(struct efx_nic *efx, unsigned long *mask) |
4381 |
+ } |
4382 |
+ |
4383 |
+ #if BITS_PER_LONG == 64 |
4384 |
++ BUILD_BUG_ON(BITS_TO_LONGS(EF10_STAT_COUNT) != 2); |
4385 |
+ mask[0] = raw_mask[0]; |
4386 |
+ mask[1] = raw_mask[1]; |
4387 |
+ #else |
4388 |
++ BUILD_BUG_ON(BITS_TO_LONGS(EF10_STAT_COUNT) != 3); |
4389 |
+ mask[0] = raw_mask[0] & 0xffffffff; |
4390 |
+ mask[1] = raw_mask[0] >> 32; |
4391 |
+ mask[2] = raw_mask[1] & 0xffffffff; |
4392 |
+- mask[3] = raw_mask[1] >> 32; |
4393 |
+ #endif |
4394 |
+ } |
4395 |
+ |
4396 |
+diff --git a/drivers/net/ethernet/sfc/efx.c b/drivers/net/ethernet/sfc/efx.c |
4397 |
+index a3c42a376741..167ccb27e2f1 100644 |
4398 |
+--- a/drivers/net/ethernet/sfc/efx.c |
4399 |
++++ b/drivers/net/ethernet/sfc/efx.c |
4400 |
+@@ -479,6 +479,9 @@ efx_copy_channel(const struct efx_channel *old_channel) |
4401 |
+ *channel = *old_channel; |
4402 |
+ |
4403 |
+ channel->napi_dev = NULL; |
4404 |
++ INIT_HLIST_NODE(&channel->napi_str.napi_hash_node); |
4405 |
++ channel->napi_str.napi_id = 0; |
4406 |
++ channel->napi_str.state = 0; |
4407 |
+ memset(&channel->eventq, 0, sizeof(channel->eventq)); |
4408 |
+ |
4409 |
+ for (j = 0; j < EFX_TXQ_TYPES; j++) { |
4410 |
+diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-generic.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-generic.c |
4411 |
+index b1e5f24708c9..05e46a82cdb1 100644 |
4412 |
+--- a/drivers/net/ethernet/stmicro/stmmac/dwmac-generic.c |
4413 |
++++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-generic.c |
4414 |
+@@ -53,7 +53,17 @@ static int dwmac_generic_probe(struct platform_device *pdev) |
4415 |
+ return ret; |
4416 |
+ } |
4417 |
+ |
4418 |
+- return stmmac_dvr_probe(&pdev->dev, plat_dat, &stmmac_res); |
4419 |
++ ret = stmmac_dvr_probe(&pdev->dev, plat_dat, &stmmac_res); |
4420 |
++ if (ret) |
4421 |
++ goto err_exit; |
4422 |
++ |
4423 |
++ return 0; |
4424 |
++ |
4425 |
++err_exit: |
4426 |
++ if (plat_dat->exit) |
4427 |
++ plat_dat->exit(pdev, plat_dat->bsp_priv); |
4428 |
++ |
4429 |
++ return ret; |
4430 |
+ } |
4431 |
+ |
4432 |
+ static const struct of_device_id dwmac_generic_match[] = { |
4433 |
+diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c |
4434 |
+index 68a58333bd74..f2f24f99d086 100644 |
4435 |
+--- a/drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c |
4436 |
++++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c |
4437 |
+@@ -600,7 +600,16 @@ static int rk_gmac_probe(struct platform_device *pdev) |
4438 |
+ if (ret) |
4439 |
+ return ret; |
4440 |
+ |
4441 |
+- return stmmac_dvr_probe(&pdev->dev, plat_dat, &stmmac_res); |
4442 |
++ ret = stmmac_dvr_probe(&pdev->dev, plat_dat, &stmmac_res); |
4443 |
++ if (ret) |
4444 |
++ goto err_gmac_exit; |
4445 |
++ |
4446 |
++ return 0; |
4447 |
++ |
4448 |
++err_gmac_exit: |
4449 |
++ rk_gmac_exit(pdev, plat_dat->bsp_priv); |
4450 |
++ |
4451 |
++ return ret; |
4452 |
+ } |
4453 |
+ |
4454 |
+ static const struct of_device_id rk_gmac_dwmac_match[] = { |
4455 |
+diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-sti.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-sti.c |
4456 |
+index 58c05acc2aab..a1ce018bf844 100644 |
4457 |
+--- a/drivers/net/ethernet/stmicro/stmmac/dwmac-sti.c |
4458 |
++++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-sti.c |
4459 |
+@@ -365,7 +365,16 @@ static int sti_dwmac_probe(struct platform_device *pdev) |
4460 |
+ if (ret) |
4461 |
+ return ret; |
4462 |
+ |
4463 |
+- return stmmac_dvr_probe(&pdev->dev, plat_dat, &stmmac_res); |
4464 |
++ ret = stmmac_dvr_probe(&pdev->dev, plat_dat, &stmmac_res); |
4465 |
++ if (ret) |
4466 |
++ goto err_dwmac_exit; |
4467 |
++ |
4468 |
++ return 0; |
4469 |
++ |
4470 |
++err_dwmac_exit: |
4471 |
++ sti_dwmac_exit(pdev, plat_dat->bsp_priv); |
4472 |
++ |
4473 |
++ return ret; |
4474 |
+ } |
4475 |
+ |
4476 |
+ static const struct sti_dwmac_of_data stih4xx_dwmac_data = { |
4477 |
+diff --git a/drivers/net/ethernet/ti/cpsw-phy-sel.c b/drivers/net/ethernet/ti/cpsw-phy-sel.c |
4478 |
+index e9cc61e1ec74..7b0dfdced517 100644 |
4479 |
+--- a/drivers/net/ethernet/ti/cpsw-phy-sel.c |
4480 |
++++ b/drivers/net/ethernet/ti/cpsw-phy-sel.c |
4481 |
+@@ -154,9 +154,12 @@ void cpsw_phy_sel(struct device *dev, phy_interface_t phy_mode, int slave) |
4482 |
+ } |
4483 |
+ |
4484 |
+ dev = bus_find_device(&platform_bus_type, NULL, node, match); |
4485 |
++ of_node_put(node); |
4486 |
+ priv = dev_get_drvdata(dev); |
4487 |
+ |
4488 |
+ priv->cpsw_phy_sel(priv, phy_mode, slave); |
4489 |
++ |
4490 |
++ put_device(dev); |
4491 |
+ } |
4492 |
+ EXPORT_SYMBOL_GPL(cpsw_phy_sel); |
4493 |
+ |
4494 |
+diff --git a/drivers/net/ethernet/ti/cpsw.c b/drivers/net/ethernet/ti/cpsw.c |
4495 |
+index 9a9cb6b11e4c..6ee0bd72d89b 100644 |
4496 |
+--- a/drivers/net/ethernet/ti/cpsw.c |
4497 |
++++ b/drivers/net/ethernet/ti/cpsw.c |
4498 |
+@@ -2060,7 +2060,11 @@ static int cpsw_probe_dt(struct cpsw_platform_data *data, |
4499 |
+ slave_data->phy_node = of_parse_phandle(slave_node, |
4500 |
+ "phy-handle", 0); |
4501 |
+ parp = of_get_property(slave_node, "phy_id", &lenp); |
4502 |
+- if (of_phy_is_fixed_link(slave_node)) { |
4503 |
++ if (slave_data->phy_node) { |
4504 |
++ dev_dbg(&pdev->dev, |
4505 |
++ "slave[%d] using phy-handle=\"%s\"\n", |
4506 |
++ i, slave_data->phy_node->full_name); |
4507 |
++ } else if (of_phy_is_fixed_link(slave_node)) { |
4508 |
+ struct device_node *phy_node; |
4509 |
+ struct phy_device *phy_dev; |
4510 |
+ |
4511 |
+@@ -2097,7 +2101,9 @@ static int cpsw_probe_dt(struct cpsw_platform_data *data, |
4512 |
+ PHY_ID_FMT, mdio->name, phyid); |
4513 |
+ put_device(&mdio->dev); |
4514 |
+ } else { |
4515 |
+- dev_err(&pdev->dev, "No slave[%d] phy_id or fixed-link property\n", i); |
4516 |
++ dev_err(&pdev->dev, |
4517 |
++ "No slave[%d] phy_id, phy-handle, or fixed-link property\n", |
4518 |
++ i); |
4519 |
+ goto no_phy_slave; |
4520 |
+ } |
4521 |
+ slave_data->phy_if = of_get_phy_mode(slave_node); |
4522 |
+@@ -2526,12 +2532,14 @@ static int cpsw_probe(struct platform_device *pdev) |
4523 |
+ ret = cpsw_probe_dual_emac(pdev, priv); |
4524 |
+ if (ret) { |
4525 |
+ cpsw_err(priv, probe, "error probe slave 2 emac interface\n"); |
4526 |
+- goto clean_ale_ret; |
4527 |
++ goto clean_unregister_netdev_ret; |
4528 |
+ } |
4529 |
+ } |
4530 |
+ |
4531 |
+ return 0; |
4532 |
+ |
4533 |
++clean_unregister_netdev_ret: |
4534 |
++ unregister_netdev(ndev); |
4535 |
+ clean_ale_ret: |
4536 |
+ cpsw_ale_destroy(priv->ale); |
4537 |
+ clean_dma_ret: |
4538 |
+diff --git a/drivers/net/ethernet/ti/davinci_emac.c b/drivers/net/ethernet/ti/davinci_emac.c |
4539 |
+index 8ecb24186b7f..e4c4747bdf32 100644 |
4540 |
+--- a/drivers/net/ethernet/ti/davinci_emac.c |
4541 |
++++ b/drivers/net/ethernet/ti/davinci_emac.c |
4542 |
+@@ -1512,7 +1512,10 @@ static int emac_devioctl(struct net_device *ndev, struct ifreq *ifrq, int cmd) |
4543 |
+ |
4544 |
+ /* TODO: Add phy read and write and private statistics get feature */ |
4545 |
+ |
4546 |
+- return phy_mii_ioctl(priv->phydev, ifrq, cmd); |
4547 |
++ if (priv->phydev) |
4548 |
++ return phy_mii_ioctl(priv->phydev, ifrq, cmd); |
4549 |
++ else |
4550 |
++ return -EOPNOTSUPP; |
4551 |
+ } |
4552 |
+ |
4553 |
+ static int match_first_device(struct device *dev, void *data) |
4554 |
+@@ -1885,8 +1888,6 @@ davinci_emac_of_get_pdata(struct platform_device *pdev, struct emac_priv *priv) |
4555 |
+ pdata->hw_ram_addr = auxdata->hw_ram_addr; |
4556 |
+ } |
4557 |
+ |
4558 |
+- pdev->dev.platform_data = pdata; |
4559 |
+- |
4560 |
+ return pdata; |
4561 |
+ } |
4562 |
+ |
4563 |
+diff --git a/drivers/net/ethernet/xilinx/xilinx_axienet_main.c b/drivers/net/ethernet/xilinx/xilinx_axienet_main.c |
4564 |
+index 7f1a57bb2ab1..44870fc37f54 100644 |
4565 |
+--- a/drivers/net/ethernet/xilinx/xilinx_axienet_main.c |
4566 |
++++ b/drivers/net/ethernet/xilinx/xilinx_axienet_main.c |
4567 |
+@@ -1602,9 +1602,9 @@ static int axienet_probe(struct platform_device *pdev) |
4568 |
+ |
4569 |
+ /* Find the DMA node, map the DMA registers, and decode the DMA IRQs */ |
4570 |
+ np = of_parse_phandle(pdev->dev.of_node, "axistream-connected", 0); |
4571 |
+- if (IS_ERR(np)) { |
4572 |
++ if (!np) { |
4573 |
+ dev_err(&pdev->dev, "could not find DMA node\n"); |
4574 |
+- ret = PTR_ERR(np); |
4575 |
++ ret = -ENODEV; |
4576 |
+ goto free_netdev; |
4577 |
+ } |
4578 |
+ ret = of_address_to_resource(np, 0, &dmares); |
4579 |
+diff --git a/drivers/net/geneve.c b/drivers/net/geneve.c |
4580 |
+index f0961cbaf87e..1988bc00de3c 100644 |
4581 |
+--- a/drivers/net/geneve.c |
4582 |
++++ b/drivers/net/geneve.c |
4583 |
+@@ -1340,6 +1340,7 @@ struct net_device *geneve_dev_create_fb(struct net *net, const char *name, |
4584 |
+ { |
4585 |
+ struct nlattr *tb[IFLA_MAX + 1]; |
4586 |
+ struct net_device *dev; |
4587 |
++ LIST_HEAD(list_kill); |
4588 |
+ int err; |
4589 |
+ |
4590 |
+ memset(tb, 0, sizeof(tb)); |
4591 |
+@@ -1350,8 +1351,10 @@ struct net_device *geneve_dev_create_fb(struct net *net, const char *name, |
4592 |
+ |
4593 |
+ err = geneve_configure(net, dev, &geneve_remote_unspec, |
4594 |
+ 0, 0, 0, htons(dst_port), true); |
4595 |
+- if (err) |
4596 |
+- goto err; |
4597 |
++ if (err) { |
4598 |
++ free_netdev(dev); |
4599 |
++ return ERR_PTR(err); |
4600 |
++ } |
4601 |
+ |
4602 |
+ /* openvswitch users expect packet sizes to be unrestricted, |
4603 |
+ * so set the largest MTU we can. |
4604 |
+@@ -1360,10 +1363,15 @@ struct net_device *geneve_dev_create_fb(struct net *net, const char *name, |
4605 |
+ if (err) |
4606 |
+ goto err; |
4607 |
+ |
4608 |
++ err = rtnl_configure_link(dev, NULL); |
4609 |
++ if (err < 0) |
4610 |
++ goto err; |
4611 |
++ |
4612 |
+ return dev; |
4613 |
+ |
4614 |
+ err: |
4615 |
+- free_netdev(dev); |
4616 |
++ geneve_dellink(dev, &list_kill); |
4617 |
++ unregister_netdevice_many(&list_kill); |
4618 |
+ return ERR_PTR(err); |
4619 |
+ } |
4620 |
+ EXPORT_SYMBOL_GPL(geneve_dev_create_fb); |
4621 |
+diff --git a/drivers/net/macvlan.c b/drivers/net/macvlan.c |
4622 |
+index d5d4d109ee10..0c4e1ef80355 100644 |
4623 |
+--- a/drivers/net/macvlan.c |
4624 |
++++ b/drivers/net/macvlan.c |
4625 |
+@@ -305,6 +305,8 @@ static void macvlan_process_broadcast(struct work_struct *w) |
4626 |
+ |
4627 |
+ rcu_read_unlock(); |
4628 |
+ |
4629 |
++ if (src) |
4630 |
++ dev_put(src->dev); |
4631 |
+ kfree_skb(skb); |
4632 |
+ |
4633 |
+ cond_resched(); |
4634 |
+@@ -312,6 +314,7 @@ static void macvlan_process_broadcast(struct work_struct *w) |
4635 |
+ } |
4636 |
+ |
4637 |
+ static void macvlan_broadcast_enqueue(struct macvlan_port *port, |
4638 |
++ const struct macvlan_dev *src, |
4639 |
+ struct sk_buff *skb) |
4640 |
+ { |
4641 |
+ struct sk_buff *nskb; |
4642 |
+@@ -321,8 +324,12 @@ static void macvlan_broadcast_enqueue(struct macvlan_port *port, |
4643 |
+ if (!nskb) |
4644 |
+ goto err; |
4645 |
+ |
4646 |
++ MACVLAN_SKB_CB(nskb)->src = src; |
4647 |
++ |
4648 |
+ spin_lock(&port->bc_queue.lock); |
4649 |
+ if (skb_queue_len(&port->bc_queue) < MACVLAN_BC_QUEUE_LEN) { |
4650 |
++ if (src) |
4651 |
++ dev_hold(src->dev); |
4652 |
+ __skb_queue_tail(&port->bc_queue, nskb); |
4653 |
+ err = 0; |
4654 |
+ } |
4655 |
+@@ -432,8 +439,7 @@ static rx_handler_result_t macvlan_handle_frame(struct sk_buff **pskb) |
4656 |
+ goto out; |
4657 |
+ } |
4658 |
+ |
4659 |
+- MACVLAN_SKB_CB(skb)->src = src; |
4660 |
+- macvlan_broadcast_enqueue(port, skb); |
4661 |
++ macvlan_broadcast_enqueue(port, src, skb); |
4662 |
+ |
4663 |
+ return RX_HANDLER_PASS; |
4664 |
+ } |
4665 |
+diff --git a/drivers/net/macvtap.c b/drivers/net/macvtap.c |
4666 |
+index ed96fdefd8e5..3a76ca395103 100644 |
4667 |
+--- a/drivers/net/macvtap.c |
4668 |
++++ b/drivers/net/macvtap.c |
4669 |
+@@ -373,7 +373,7 @@ static rx_handler_result_t macvtap_handle_frame(struct sk_buff **pskb) |
4670 |
+ goto wake_up; |
4671 |
+ } |
4672 |
+ |
4673 |
+- kfree_skb(skb); |
4674 |
++ consume_skb(skb); |
4675 |
+ while (segs) { |
4676 |
+ struct sk_buff *nskb = segs->next; |
4677 |
+ |
4678 |
+diff --git a/drivers/net/phy/at803x.c b/drivers/net/phy/at803x.c |
4679 |
+index 37333d38b576..f88e7cc813ef 100644 |
4680 |
+--- a/drivers/net/phy/at803x.c |
4681 |
++++ b/drivers/net/phy/at803x.c |
4682 |
+@@ -198,7 +198,7 @@ static int at803x_probe(struct phy_device *phydev) |
4683 |
+ if (!priv) |
4684 |
+ return -ENOMEM; |
4685 |
+ |
4686 |
+- gpiod_reset = devm_gpiod_get_optional(dev, "reset", GPIOD_OUT_HIGH); |
4687 |
++ gpiod_reset = devm_gpiod_get_optional(dev, "reset", GPIOD_OUT_LOW); |
4688 |
+ if (IS_ERR(gpiod_reset)) |
4689 |
+ return PTR_ERR(gpiod_reset); |
4690 |
+ |
4691 |
+@@ -274,10 +274,10 @@ static void at803x_link_change_notify(struct phy_device *phydev) |
4692 |
+ |
4693 |
+ at803x_context_save(phydev, &context); |
4694 |
+ |
4695 |
+- gpiod_set_value(priv->gpiod_reset, 0); |
4696 |
+- msleep(1); |
4697 |
+ gpiod_set_value(priv->gpiod_reset, 1); |
4698 |
+ msleep(1); |
4699 |
++ gpiod_set_value(priv->gpiod_reset, 0); |
4700 |
++ msleep(1); |
4701 |
+ |
4702 |
+ at803x_context_restore(phydev, &context); |
4703 |
+ |
4704 |
+diff --git a/drivers/net/phy/bcm7xxx.c b/drivers/net/phy/bcm7xxx.c |
4705 |
+index bffa70e46202..b7bc27a89454 100644 |
4706 |
+--- a/drivers/net/phy/bcm7xxx.c |
4707 |
++++ b/drivers/net/phy/bcm7xxx.c |
4708 |
+@@ -270,7 +270,7 @@ static int bcm7xxx_config_init(struct phy_device *phydev) |
4709 |
+ phy_write(phydev, MII_BCM7XXX_100TX_FALSE_CAR, 0x7555); |
4710 |
+ |
4711 |
+ /* reset shadow mode 2 */ |
4712 |
+- ret = phy_set_clr_bits(phydev, MII_BCM7XXX_TEST, MII_BCM7XXX_SHD_MODE_2, 0); |
4713 |
++ ret = phy_set_clr_bits(phydev, MII_BCM7XXX_TEST, 0, MII_BCM7XXX_SHD_MODE_2); |
4714 |
+ if (ret < 0) |
4715 |
+ return ret; |
4716 |
+ |
4717 |
+diff --git a/drivers/net/phy/mdio-sun4i.c b/drivers/net/phy/mdio-sun4i.c |
4718 |
+index afd76e07088b..0e8dd446e8c1 100644 |
4719 |
+--- a/drivers/net/phy/mdio-sun4i.c |
4720 |
++++ b/drivers/net/phy/mdio-sun4i.c |
4721 |
+@@ -134,6 +134,7 @@ static int sun4i_mdio_probe(struct platform_device *pdev) |
4722 |
+ } |
4723 |
+ |
4724 |
+ dev_info(&pdev->dev, "no regulator found\n"); |
4725 |
++ data->regulator = NULL; |
4726 |
+ } else { |
4727 |
+ ret = regulator_enable(data->regulator); |
4728 |
+ if (ret) |
4729 |
+@@ -149,7 +150,8 @@ static int sun4i_mdio_probe(struct platform_device *pdev) |
4730 |
+ return 0; |
4731 |
+ |
4732 |
+ err_out_disable_regulator: |
4733 |
+- regulator_disable(data->regulator); |
4734 |
++ if (data->regulator) |
4735 |
++ regulator_disable(data->regulator); |
4736 |
+ err_out_free_mdiobus: |
4737 |
+ mdiobus_free(bus); |
4738 |
+ return ret; |
4739 |
+diff --git a/drivers/net/phy/micrel.c b/drivers/net/phy/micrel.c |
4740 |
+index ba84fc3637b1..4eba646789c3 100644 |
4741 |
+--- a/drivers/net/phy/micrel.c |
4742 |
++++ b/drivers/net/phy/micrel.c |
4743 |
+@@ -482,9 +482,17 @@ static int ksz9031_config_init(struct phy_device *phydev) |
4744 |
+ "txd2-skew-ps", "txd3-skew-ps" |
4745 |
+ }; |
4746 |
+ static const char *control_skews[2] = {"txen-skew-ps", "rxdv-skew-ps"}; |
4747 |
++ const struct device *dev_walker; |
4748 |
+ |
4749 |
+- if (!of_node && dev->parent->of_node) |
4750 |
+- of_node = dev->parent->of_node; |
4751 |
++ /* The Micrel driver has a deprecated option to place phy OF |
4752 |
++ * properties in the MAC node. Walk up the tree of devices to |
4753 |
++ * find a device with an OF node. |
4754 |
++ */ |
4755 |
++ dev_walker = &phydev->dev; |
4756 |
++ do { |
4757 |
++ of_node = dev_walker->of_node; |
4758 |
++ dev_walker = dev_walker->parent; |
4759 |
++ } while (!of_node && dev_walker); |
4760 |
+ |
4761 |
+ if (of_node) { |
4762 |
+ ksz9031_of_load_skew_values(phydev, of_node, |
4763 |
+diff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c |
4764 |
+index 7d2cf015c5e7..e1c17ab5c2d5 100644 |
4765 |
+--- a/drivers/net/phy/phy.c |
4766 |
++++ b/drivers/net/phy/phy.c |
4767 |
+@@ -699,25 +699,29 @@ void phy_change(struct work_struct *work) |
4768 |
+ struct phy_device *phydev = |
4769 |
+ container_of(work, struct phy_device, phy_queue); |
4770 |
+ |
4771 |
+- if (phydev->drv->did_interrupt && |
4772 |
+- !phydev->drv->did_interrupt(phydev)) |
4773 |
+- goto ignore; |
4774 |
++ if (phy_interrupt_is_valid(phydev)) { |
4775 |
++ if (phydev->drv->did_interrupt && |
4776 |
++ !phydev->drv->did_interrupt(phydev)) |
4777 |
++ goto ignore; |
4778 |
+ |
4779 |
+- if (phy_disable_interrupts(phydev)) |
4780 |
+- goto phy_err; |
4781 |
++ if (phy_disable_interrupts(phydev)) |
4782 |
++ goto phy_err; |
4783 |
++ } |
4784 |
+ |
4785 |
+ mutex_lock(&phydev->lock); |
4786 |
+ if ((PHY_RUNNING == phydev->state) || (PHY_NOLINK == phydev->state)) |
4787 |
+ phydev->state = PHY_CHANGELINK; |
4788 |
+ mutex_unlock(&phydev->lock); |
4789 |
+ |
4790 |
+- atomic_dec(&phydev->irq_disable); |
4791 |
+- enable_irq(phydev->irq); |
4792 |
++ if (phy_interrupt_is_valid(phydev)) { |
4793 |
++ atomic_dec(&phydev->irq_disable); |
4794 |
++ enable_irq(phydev->irq); |
4795 |
+ |
4796 |
+- /* Reenable interrupts */ |
4797 |
+- if (PHY_HALTED != phydev->state && |
4798 |
+- phy_config_interrupt(phydev, PHY_INTERRUPT_ENABLED)) |
4799 |
+- goto irq_enable_err; |
4800 |
++ /* Reenable interrupts */ |
4801 |
++ if (PHY_HALTED != phydev->state && |
4802 |
++ phy_config_interrupt(phydev, PHY_INTERRUPT_ENABLED)) |
4803 |
++ goto irq_enable_err; |
4804 |
++ } |
4805 |
+ |
4806 |
+ /* reschedule state queue work to run as soon as possible */ |
4807 |
+ cancel_delayed_work_sync(&phydev->state_queue); |
4808 |
+@@ -912,10 +916,10 @@ void phy_state_machine(struct work_struct *work) |
4809 |
+ phydev->adjust_link(phydev->attached_dev); |
4810 |
+ break; |
4811 |
+ case PHY_RUNNING: |
4812 |
+- /* Only register a CHANGE if we are polling or ignoring |
4813 |
+- * interrupts and link changed since latest checking. |
4814 |
++ /* Only register a CHANGE if we are polling and link changed |
4815 |
++ * since latest checking. |
4816 |
+ */ |
4817 |
+- if (!phy_interrupt_is_valid(phydev)) { |
4818 |
++ if (phydev->irq == PHY_POLL) { |
4819 |
+ old_link = phydev->link; |
4820 |
+ err = phy_read_status(phydev); |
4821 |
+ if (err) |
4822 |
+@@ -1015,15 +1019,21 @@ void phy_state_machine(struct work_struct *work) |
4823 |
+ dev_dbg(&phydev->dev, "PHY state change %s -> %s\n", |
4824 |
+ phy_state_to_str(old_state), phy_state_to_str(phydev->state)); |
4825 |
+ |
4826 |
+- queue_delayed_work(system_power_efficient_wq, &phydev->state_queue, |
4827 |
+- PHY_STATE_TIME * HZ); |
4828 |
++ /* Only re-schedule a PHY state machine change if we are polling the |
4829 |
++ * PHY, if PHY_IGNORE_INTERRUPT is set, then we will be moving |
4830 |
++ * between states from phy_mac_interrupt() |
4831 |
++ */ |
4832 |
++ if (phydev->irq == PHY_POLL) |
4833 |
++ queue_delayed_work(system_power_efficient_wq, &phydev->state_queue, |
4834 |
++ PHY_STATE_TIME * HZ); |
4835 |
+ } |
4836 |
+ |
4837 |
+ void phy_mac_interrupt(struct phy_device *phydev, int new_link) |
4838 |
+ { |
4839 |
+- cancel_work_sync(&phydev->phy_queue); |
4840 |
+ phydev->link = new_link; |
4841 |
+- schedule_work(&phydev->phy_queue); |
4842 |
++ |
4843 |
++ /* Trigger a state machine change */ |
4844 |
++ queue_work(system_power_efficient_wq, &phydev->phy_queue); |
4845 |
+ } |
4846 |
+ EXPORT_SYMBOL(phy_mac_interrupt); |
4847 |
+ |
4848 |
+diff --git a/drivers/net/phy/phy_device.c b/drivers/net/phy/phy_device.c |
4849 |
+index b15eceb8b442..3b2b853ee3d3 100644 |
4850 |
+--- a/drivers/net/phy/phy_device.c |
4851 |
++++ b/drivers/net/phy/phy_device.c |
4852 |
+@@ -522,6 +522,7 @@ struct phy_device *phy_connect(struct net_device *dev, const char *bus_id, |
4853 |
+ phydev = to_phy_device(d); |
4854 |
+ |
4855 |
+ rc = phy_connect_direct(dev, phydev, handler, interface); |
4856 |
++ put_device(d); |
4857 |
+ if (rc) |
4858 |
+ return ERR_PTR(rc); |
4859 |
+ |
4860 |
+@@ -721,6 +722,7 @@ struct phy_device *phy_attach(struct net_device *dev, const char *bus_id, |
4861 |
+ phydev = to_phy_device(d); |
4862 |
+ |
4863 |
+ rc = phy_attach_direct(dev, phydev, phydev->dev_flags, interface); |
4864 |
++ put_device(d); |
4865 |
+ if (rc) |
4866 |
+ return ERR_PTR(rc); |
4867 |
+ |
4868 |
+diff --git a/drivers/net/vrf.c b/drivers/net/vrf.c |
4869 |
+index d3d59122a357..27fd5640a273 100644 |
4870 |
+--- a/drivers/net/vrf.c |
4871 |
++++ b/drivers/net/vrf.c |
4872 |
+@@ -71,41 +71,6 @@ struct pcpu_dstats { |
4873 |
+ struct u64_stats_sync syncp; |
4874 |
+ }; |
4875 |
+ |
4876 |
+-static struct dst_entry *vrf_ip_check(struct dst_entry *dst, u32 cookie) |
4877 |
+-{ |
4878 |
+- return dst; |
4879 |
+-} |
4880 |
+- |
4881 |
+-static int vrf_ip_local_out(struct net *net, struct sock *sk, struct sk_buff *skb) |
4882 |
+-{ |
4883 |
+- return ip_local_out(net, sk, skb); |
4884 |
+-} |
4885 |
+- |
4886 |
+-static unsigned int vrf_v4_mtu(const struct dst_entry *dst) |
4887 |
+-{ |
4888 |
+- /* TO-DO: return max ethernet size? */ |
4889 |
+- return dst->dev->mtu; |
4890 |
+-} |
4891 |
+- |
4892 |
+-static void vrf_dst_destroy(struct dst_entry *dst) |
4893 |
+-{ |
4894 |
+- /* our dst lives forever - or until the device is closed */ |
4895 |
+-} |
4896 |
+- |
4897 |
+-static unsigned int vrf_default_advmss(const struct dst_entry *dst) |
4898 |
+-{ |
4899 |
+- return 65535 - 40; |
4900 |
+-} |
4901 |
+- |
4902 |
+-static struct dst_ops vrf_dst_ops = { |
4903 |
+- .family = AF_INET, |
4904 |
+- .local_out = vrf_ip_local_out, |
4905 |
+- .check = vrf_ip_check, |
4906 |
+- .mtu = vrf_v4_mtu, |
4907 |
+- .destroy = vrf_dst_destroy, |
4908 |
+- .default_advmss = vrf_default_advmss, |
4909 |
+-}; |
4910 |
+- |
4911 |
+ /* neighbor handling is done with actual device; do not want |
4912 |
+ * to flip skb->dev for those ndisc packets. This really fails |
4913 |
+ * for multiple next protocols (e.g., NEXTHDR_HOP). But it is |
4914 |
+@@ -363,46 +328,6 @@ static netdev_tx_t vrf_xmit(struct sk_buff *skb, struct net_device *dev) |
4915 |
+ } |
4916 |
+ |
4917 |
+ #if IS_ENABLED(CONFIG_IPV6) |
4918 |
+-static struct dst_entry *vrf_ip6_check(struct dst_entry *dst, u32 cookie) |
4919 |
+-{ |
4920 |
+- return dst; |
4921 |
+-} |
4922 |
+- |
4923 |
+-static struct dst_ops vrf_dst_ops6 = { |
4924 |
+- .family = AF_INET6, |
4925 |
+- .local_out = ip6_local_out, |
4926 |
+- .check = vrf_ip6_check, |
4927 |
+- .mtu = vrf_v4_mtu, |
4928 |
+- .destroy = vrf_dst_destroy, |
4929 |
+- .default_advmss = vrf_default_advmss, |
4930 |
+-}; |
4931 |
+- |
4932 |
+-static int init_dst_ops6_kmem_cachep(void) |
4933 |
+-{ |
4934 |
+- vrf_dst_ops6.kmem_cachep = kmem_cache_create("vrf_ip6_dst_cache", |
4935 |
+- sizeof(struct rt6_info), |
4936 |
+- 0, |
4937 |
+- SLAB_HWCACHE_ALIGN, |
4938 |
+- NULL); |
4939 |
+- |
4940 |
+- if (!vrf_dst_ops6.kmem_cachep) |
4941 |
+- return -ENOMEM; |
4942 |
+- |
4943 |
+- return 0; |
4944 |
+-} |
4945 |
+- |
4946 |
+-static void free_dst_ops6_kmem_cachep(void) |
4947 |
+-{ |
4948 |
+- kmem_cache_destroy(vrf_dst_ops6.kmem_cachep); |
4949 |
+-} |
4950 |
+- |
4951 |
+-static int vrf_input6(struct sk_buff *skb) |
4952 |
+-{ |
4953 |
+- skb->dev->stats.rx_errors++; |
4954 |
+- kfree_skb(skb); |
4955 |
+- return 0; |
4956 |
+-} |
4957 |
+- |
4958 |
+ /* modelled after ip6_finish_output2 */ |
4959 |
+ static int vrf_finish_output6(struct net *net, struct sock *sk, |
4960 |
+ struct sk_buff *skb) |
4961 |
+@@ -445,67 +370,34 @@ static int vrf_output6(struct net *net, struct sock *sk, struct sk_buff *skb) |
4962 |
+ !(IP6CB(skb)->flags & IP6SKB_REROUTED)); |
4963 |
+ } |
4964 |
+ |
4965 |
+-static void vrf_rt6_destroy(struct net_vrf *vrf) |
4966 |
++static void vrf_rt6_release(struct net_vrf *vrf) |
4967 |
+ { |
4968 |
+- dst_destroy(&vrf->rt6->dst); |
4969 |
+- free_percpu(vrf->rt6->rt6i_pcpu); |
4970 |
++ dst_release(&vrf->rt6->dst); |
4971 |
+ vrf->rt6 = NULL; |
4972 |
+ } |
4973 |
+ |
4974 |
+ static int vrf_rt6_create(struct net_device *dev) |
4975 |
+ { |
4976 |
+ struct net_vrf *vrf = netdev_priv(dev); |
4977 |
+- struct dst_entry *dst; |
4978 |
++ struct net *net = dev_net(dev); |
4979 |
+ struct rt6_info *rt6; |
4980 |
+- int cpu; |
4981 |
+ int rc = -ENOMEM; |
4982 |
+ |
4983 |
+- rt6 = dst_alloc(&vrf_dst_ops6, dev, 0, |
4984 |
+- DST_OBSOLETE_NONE, |
4985 |
+- (DST_HOST | DST_NOPOLICY | DST_NOXFRM)); |
4986 |
++ rt6 = ip6_dst_alloc(net, dev, |
4987 |
++ DST_HOST | DST_NOPOLICY | DST_NOXFRM | DST_NOCACHE); |
4988 |
+ if (!rt6) |
4989 |
+ goto out; |
4990 |
+ |
4991 |
+- dst = &rt6->dst; |
4992 |
+- |
4993 |
+- rt6->rt6i_pcpu = alloc_percpu_gfp(struct rt6_info *, GFP_KERNEL); |
4994 |
+- if (!rt6->rt6i_pcpu) { |
4995 |
+- dst_destroy(dst); |
4996 |
+- goto out; |
4997 |
+- } |
4998 |
+- for_each_possible_cpu(cpu) { |
4999 |
+- struct rt6_info **p = per_cpu_ptr(rt6->rt6i_pcpu, cpu); |
5000 |
+- *p = NULL; |
5001 |
+- } |
5002 |
+- |
5003 |
+- memset(dst + 1, 0, sizeof(*rt6) - sizeof(*dst)); |
5004 |
+- |
5005 |
+- INIT_LIST_HEAD(&rt6->rt6i_siblings); |
5006 |
+- INIT_LIST_HEAD(&rt6->rt6i_uncached); |
5007 |
+- |
5008 |
+- rt6->dst.input = vrf_input6; |
5009 |
+ rt6->dst.output = vrf_output6; |
5010 |
+- |
5011 |
+- rt6->rt6i_table = fib6_get_table(dev_net(dev), vrf->tb_id); |
5012 |
+- |
5013 |
+- atomic_set(&rt6->dst.__refcnt, 2); |
5014 |
+- |
5015 |
++ rt6->rt6i_table = fib6_get_table(net, vrf->tb_id); |
5016 |
++ dst_hold(&rt6->dst); |
5017 |
+ vrf->rt6 = rt6; |
5018 |
+ rc = 0; |
5019 |
+ out: |
5020 |
+ return rc; |
5021 |
+ } |
5022 |
+ #else |
5023 |
+-static int init_dst_ops6_kmem_cachep(void) |
5024 |
+-{ |
5025 |
+- return 0; |
5026 |
+-} |
5027 |
+- |
5028 |
+-static void free_dst_ops6_kmem_cachep(void) |
5029 |
+-{ |
5030 |
+-} |
5031 |
+- |
5032 |
+-static void vrf_rt6_destroy(struct net_vrf *vrf) |
5033 |
++static void vrf_rt6_release(struct net_vrf *vrf) |
5034 |
+ { |
5035 |
+ } |
5036 |
+ |
5037 |
+@@ -577,11 +469,11 @@ static int vrf_output(struct net *net, struct sock *sk, struct sk_buff *skb) |
5038 |
+ !(IPCB(skb)->flags & IPSKB_REROUTED)); |
5039 |
+ } |
5040 |
+ |
5041 |
+-static void vrf_rtable_destroy(struct net_vrf *vrf) |
5042 |
++static void vrf_rtable_release(struct net_vrf *vrf) |
5043 |
+ { |
5044 |
+ struct dst_entry *dst = (struct dst_entry *)vrf->rth; |
5045 |
+ |
5046 |
+- dst_destroy(dst); |
5047 |
++ dst_release(dst); |
5048 |
+ vrf->rth = NULL; |
5049 |
+ } |
5050 |
+ |
5051 |
+@@ -590,22 +482,10 @@ static struct rtable *vrf_rtable_create(struct net_device *dev) |
5052 |
+ struct net_vrf *vrf = netdev_priv(dev); |
5053 |
+ struct rtable *rth; |
5054 |
+ |
5055 |
+- rth = dst_alloc(&vrf_dst_ops, dev, 2, |
5056 |
+- DST_OBSOLETE_NONE, |
5057 |
+- (DST_HOST | DST_NOPOLICY | DST_NOXFRM)); |
5058 |
++ rth = rt_dst_alloc(dev, 0, RTN_UNICAST, 1, 1, 0); |
5059 |
+ if (rth) { |
5060 |
+ rth->dst.output = vrf_output; |
5061 |
+- rth->rt_genid = rt_genid_ipv4(dev_net(dev)); |
5062 |
+- rth->rt_flags = 0; |
5063 |
+- rth->rt_type = RTN_UNICAST; |
5064 |
+- rth->rt_is_input = 0; |
5065 |
+- rth->rt_iif = 0; |
5066 |
+- rth->rt_pmtu = 0; |
5067 |
+- rth->rt_gateway = 0; |
5068 |
+- rth->rt_uses_gateway = 0; |
5069 |
+ rth->rt_table_id = vrf->tb_id; |
5070 |
+- INIT_LIST_HEAD(&rth->rt_uncached); |
5071 |
+- rth->rt_uncached_list = NULL; |
5072 |
+ } |
5073 |
+ |
5074 |
+ return rth; |
5075 |
+@@ -739,8 +619,8 @@ static void vrf_dev_uninit(struct net_device *dev) |
5076 |
+ // struct list_head *head = &queue->all_slaves; |
5077 |
+ // struct slave *slave, *next; |
5078 |
+ |
5079 |
+- vrf_rtable_destroy(vrf); |
5080 |
+- vrf_rt6_destroy(vrf); |
5081 |
++ vrf_rtable_release(vrf); |
5082 |
++ vrf_rt6_release(vrf); |
5083 |
+ |
5084 |
+ // list_for_each_entry_safe(slave, next, head, list) |
5085 |
+ // vrf_del_slave(dev, slave->dev); |
5086 |
+@@ -772,7 +652,7 @@ static int vrf_dev_init(struct net_device *dev) |
5087 |
+ return 0; |
5088 |
+ |
5089 |
+ out_rth: |
5090 |
+- vrf_rtable_destroy(vrf); |
5091 |
++ vrf_rtable_release(vrf); |
5092 |
+ out_stats: |
5093 |
+ free_percpu(dev->dstats); |
5094 |
+ dev->dstats = NULL; |
5095 |
+@@ -805,7 +685,7 @@ static struct rtable *vrf_get_rtable(const struct net_device *dev, |
5096 |
+ struct net_vrf *vrf = netdev_priv(dev); |
5097 |
+ |
5098 |
+ rth = vrf->rth; |
5099 |
+- atomic_inc(&rth->dst.__refcnt); |
5100 |
++ dst_hold(&rth->dst); |
5101 |
+ } |
5102 |
+ |
5103 |
+ return rth; |
5104 |
+@@ -856,7 +736,7 @@ static struct dst_entry *vrf_get_rt6_dst(const struct net_device *dev, |
5105 |
+ struct net_vrf *vrf = netdev_priv(dev); |
5106 |
+ |
5107 |
+ rt = vrf->rt6; |
5108 |
+- atomic_inc(&rt->dst.__refcnt); |
5109 |
++ dst_hold(&rt->dst); |
5110 |
+ } |
5111 |
+ |
5112 |
+ return (struct dst_entry *)rt; |
5113 |
+@@ -1003,19 +883,6 @@ static int __init vrf_init_module(void) |
5114 |
+ { |
5115 |
+ int rc; |
5116 |
+ |
5117 |
+- vrf_dst_ops.kmem_cachep = |
5118 |
+- kmem_cache_create("vrf_ip_dst_cache", |
5119 |
+- sizeof(struct rtable), 0, |
5120 |
+- SLAB_HWCACHE_ALIGN, |
5121 |
+- NULL); |
5122 |
+- |
5123 |
+- if (!vrf_dst_ops.kmem_cachep) |
5124 |
+- return -ENOMEM; |
5125 |
+- |
5126 |
+- rc = init_dst_ops6_kmem_cachep(); |
5127 |
+- if (rc != 0) |
5128 |
+- goto error2; |
5129 |
+- |
5130 |
+ register_netdevice_notifier(&vrf_notifier_block); |
5131 |
+ |
5132 |
+ rc = rtnl_link_register(&vrf_link_ops); |
5133 |
+@@ -1026,22 +893,10 @@ static int __init vrf_init_module(void) |
5134 |
+ |
5135 |
+ error: |
5136 |
+ unregister_netdevice_notifier(&vrf_notifier_block); |
5137 |
+- free_dst_ops6_kmem_cachep(); |
5138 |
+-error2: |
5139 |
+- kmem_cache_destroy(vrf_dst_ops.kmem_cachep); |
5140 |
+ return rc; |
5141 |
+ } |
5142 |
+ |
5143 |
+-static void __exit vrf_cleanup_module(void) |
5144 |
+-{ |
5145 |
+- rtnl_link_unregister(&vrf_link_ops); |
5146 |
+- unregister_netdevice_notifier(&vrf_notifier_block); |
5147 |
+- kmem_cache_destroy(vrf_dst_ops.kmem_cachep); |
5148 |
+- free_dst_ops6_kmem_cachep(); |
5149 |
+-} |
5150 |
+- |
5151 |
+ module_init(vrf_init_module); |
5152 |
+-module_exit(vrf_cleanup_module); |
5153 |
+ MODULE_AUTHOR("Shrijeet Mukherjee, David Ahern"); |
5154 |
+ MODULE_DESCRIPTION("Device driver to instantiate VRF domains"); |
5155 |
+ MODULE_LICENSE("GPL"); |
5156 |
+diff --git a/drivers/net/vxlan.c b/drivers/net/vxlan.c |
5157 |
+index d294949005bd..752f44a0e3af 100644 |
5158 |
+--- a/drivers/net/vxlan.c |
5159 |
++++ b/drivers/net/vxlan.c |
5160 |
+@@ -2054,7 +2054,7 @@ static void vxlan_xmit_one(struct sk_buff *skb, struct net_device *dev, |
5161 |
+ } |
5162 |
+ |
5163 |
+ /* Bypass encapsulation if the destination is local */ |
5164 |
+- if (rt->rt_flags & RTCF_LOCAL && |
5165 |
++ if (!info && rt->rt_flags & RTCF_LOCAL && |
5166 |
+ !(rt->rt_flags & (RTCF_BROADCAST | RTCF_MULTICAST))) { |
5167 |
+ struct vxlan_dev *dst_vxlan; |
5168 |
+ |
5169 |
+@@ -2112,7 +2112,7 @@ static void vxlan_xmit_one(struct sk_buff *skb, struct net_device *dev, |
5170 |
+ |
5171 |
+ /* Bypass encapsulation if the destination is local */ |
5172 |
+ rt6i_flags = ((struct rt6_info *)ndst)->rt6i_flags; |
5173 |
+- if (rt6i_flags & RTF_LOCAL && |
5174 |
++ if (!info && rt6i_flags & RTF_LOCAL && |
5175 |
+ !(rt6i_flags & (RTCF_BROADCAST | RTCF_MULTICAST))) { |
5176 |
+ struct vxlan_dev *dst_vxlan; |
5177 |
+ |
5178 |
+@@ -2927,30 +2927,6 @@ static int vxlan_dev_configure(struct net *src_net, struct net_device *dev, |
5179 |
+ return 0; |
5180 |
+ } |
5181 |
+ |
5182 |
+-struct net_device *vxlan_dev_create(struct net *net, const char *name, |
5183 |
+- u8 name_assign_type, struct vxlan_config *conf) |
5184 |
+-{ |
5185 |
+- struct nlattr *tb[IFLA_MAX+1]; |
5186 |
+- struct net_device *dev; |
5187 |
+- int err; |
5188 |
+- |
5189 |
+- memset(&tb, 0, sizeof(tb)); |
5190 |
+- |
5191 |
+- dev = rtnl_create_link(net, name, name_assign_type, |
5192 |
+- &vxlan_link_ops, tb); |
5193 |
+- if (IS_ERR(dev)) |
5194 |
+- return dev; |
5195 |
+- |
5196 |
+- err = vxlan_dev_configure(net, dev, conf); |
5197 |
+- if (err < 0) { |
5198 |
+- free_netdev(dev); |
5199 |
+- return ERR_PTR(err); |
5200 |
+- } |
5201 |
+- |
5202 |
+- return dev; |
5203 |
+-} |
5204 |
+-EXPORT_SYMBOL_GPL(vxlan_dev_create); |
5205 |
+- |
5206 |
+ static int vxlan_newlink(struct net *src_net, struct net_device *dev, |
5207 |
+ struct nlattr *tb[], struct nlattr *data[]) |
5208 |
+ { |
5209 |
+@@ -3218,6 +3194,40 @@ static struct rtnl_link_ops vxlan_link_ops __read_mostly = { |
5210 |
+ .get_link_net = vxlan_get_link_net, |
5211 |
+ }; |
5212 |
+ |
5213 |
++struct net_device *vxlan_dev_create(struct net *net, const char *name, |
5214 |
++ u8 name_assign_type, |
5215 |
++ struct vxlan_config *conf) |
5216 |
++{ |
5217 |
++ struct nlattr *tb[IFLA_MAX + 1]; |
5218 |
++ struct net_device *dev; |
5219 |
++ int err; |
5220 |
++ |
5221 |
++ memset(&tb, 0, sizeof(tb)); |
5222 |
++ |
5223 |
++ dev = rtnl_create_link(net, name, name_assign_type, |
5224 |
++ &vxlan_link_ops, tb); |
5225 |
++ if (IS_ERR(dev)) |
5226 |
++ return dev; |
5227 |
++ |
5228 |
++ err = vxlan_dev_configure(net, dev, conf); |
5229 |
++ if (err < 0) { |
5230 |
++ free_netdev(dev); |
5231 |
++ return ERR_PTR(err); |
5232 |
++ } |
5233 |
++ |
5234 |
++ err = rtnl_configure_link(dev, NULL); |
5235 |
++ if (err < 0) { |
5236 |
++ LIST_HEAD(list_kill); |
5237 |
++ |
5238 |
++ vxlan_dellink(dev, &list_kill); |
5239 |
++ unregister_netdevice_many(&list_kill); |
5240 |
++ return ERR_PTR(err); |
5241 |
++ } |
5242 |
++ |
5243 |
++ return dev; |
5244 |
++} |
5245 |
++EXPORT_SYMBOL_GPL(vxlan_dev_create); |
5246 |
++ |
5247 |
+ static void vxlan_handle_lowerdev_unregister(struct vxlan_net *vn, |
5248 |
+ struct net_device *dev) |
5249 |
+ { |
5250 |
+diff --git a/drivers/net/wimax/i2400m/usb-fw.c b/drivers/net/wimax/i2400m/usb-fw.c |
5251 |
+index e74664b84925..4e4167976acf 100644 |
5252 |
+--- a/drivers/net/wimax/i2400m/usb-fw.c |
5253 |
++++ b/drivers/net/wimax/i2400m/usb-fw.c |
5254 |
+@@ -354,6 +354,7 @@ out: |
5255 |
+ usb_autopm_put_interface(i2400mu->usb_iface); |
5256 |
+ d_fnend(8, dev, "(i2400m %p ack %p size %zu) = %ld\n", |
5257 |
+ i2400m, ack, ack_size, (long) result); |
5258 |
++ usb_put_urb(¬if_urb); |
5259 |
+ return result; |
5260 |
+ |
5261 |
+ error_exceeded: |
5262 |
+diff --git a/drivers/net/wireless/ath/ath10k/core.c b/drivers/net/wireless/ath/ath10k/core.c |
5263 |
+index 0c23768aa1ec..ef9fb9ddde5e 100644 |
5264 |
+--- a/drivers/net/wireless/ath/ath10k/core.c |
5265 |
++++ b/drivers/net/wireless/ath/ath10k/core.c |
5266 |
+@@ -1805,7 +1805,7 @@ static int ath10k_core_probe_fw(struct ath10k *ar) |
5267 |
+ if (ret && ret != -EOPNOTSUPP) { |
5268 |
+ ath10k_err(ar, "failed to get board id from otp for qca99x0: %d\n", |
5269 |
+ ret); |
5270 |
+- return ret; |
5271 |
++ goto err_free_firmware_files; |
5272 |
+ } |
5273 |
+ |
5274 |
+ ret = ath10k_core_fetch_board_file(ar); |
5275 |
+diff --git a/drivers/net/wireless/ath/ath9k/htc_hst.c b/drivers/net/wireless/ath/ath9k/htc_hst.c |
5276 |
+index 2294709ee8b0..fd85f996c554 100644 |
5277 |
+--- a/drivers/net/wireless/ath/ath9k/htc_hst.c |
5278 |
++++ b/drivers/net/wireless/ath/ath9k/htc_hst.c |
5279 |
+@@ -414,7 +414,7 @@ void ath9k_htc_rx_msg(struct htc_target *htc_handle, |
5280 |
+ return; |
5281 |
+ } |
5282 |
+ |
5283 |
+- if (epid >= ENDPOINT_MAX) { |
5284 |
++ if (epid < 0 || epid >= ENDPOINT_MAX) { |
5285 |
+ if (pipe_id != USB_REG_IN_PIPE) |
5286 |
+ dev_kfree_skb_any(skb); |
5287 |
+ else |
5288 |
+diff --git a/drivers/net/wireless/brcm80211/brcmfmac/cfg80211.c b/drivers/net/wireless/brcm80211/brcmfmac/cfg80211.c |
5289 |
+index 231c0ba6acb9..1992aae137cd 100644 |
5290 |
+--- a/drivers/net/wireless/brcm80211/brcmfmac/cfg80211.c |
5291 |
++++ b/drivers/net/wireless/brcm80211/brcmfmac/cfg80211.c |
5292 |
+@@ -2419,12 +2419,14 @@ brcmf_cfg80211_get_station(struct wiphy *wiphy, struct net_device *ndev, |
5293 |
+ const u8 *mac, struct station_info *sinfo) |
5294 |
+ { |
5295 |
+ struct brcmf_if *ifp = netdev_priv(ndev); |
5296 |
++ struct brcmf_scb_val_le scb_val; |
5297 |
+ s32 err = 0; |
5298 |
+ struct brcmf_sta_info_le sta_info_le; |
5299 |
+ u32 sta_flags; |
5300 |
+ u32 is_tdls_peer; |
5301 |
+ s32 total_rssi; |
5302 |
+ s32 count_rssi; |
5303 |
++ int rssi; |
5304 |
+ u32 i; |
5305 |
+ |
5306 |
+ brcmf_dbg(TRACE, "Enter, MAC %pM\n", mac); |
5307 |
+@@ -2505,6 +2507,20 @@ brcmf_cfg80211_get_station(struct wiphy *wiphy, struct net_device *ndev, |
5308 |
+ sinfo->filled |= BIT(NL80211_STA_INFO_SIGNAL); |
5309 |
+ total_rssi /= count_rssi; |
5310 |
+ sinfo->signal = total_rssi; |
5311 |
++ } else if (test_bit(BRCMF_VIF_STATUS_CONNECTED, |
5312 |
++ &ifp->vif->sme_state)) { |
5313 |
++ memset(&scb_val, 0, sizeof(scb_val)); |
5314 |
++ err = brcmf_fil_cmd_data_get(ifp, BRCMF_C_GET_RSSI, |
5315 |
++ &scb_val, sizeof(scb_val)); |
5316 |
++ if (err) { |
5317 |
++ brcmf_err("Could not get rssi (%d)\n", err); |
5318 |
++ goto done; |
5319 |
++ } else { |
5320 |
++ rssi = le32_to_cpu(scb_val.val); |
5321 |
++ sinfo->filled |= BIT(NL80211_STA_INFO_SIGNAL); |
5322 |
++ sinfo->signal = rssi; |
5323 |
++ brcmf_dbg(CONN, "RSSI %d dBm\n", rssi); |
5324 |
++ } |
5325 |
+ } |
5326 |
+ } |
5327 |
+ done: |
5328 |
+diff --git a/drivers/net/wireless/brcm80211/brcmfmac/fwsignal.c b/drivers/net/wireless/brcm80211/brcmfmac/fwsignal.c |
5329 |
+index 086cac3f86d6..7b120d841aed 100644 |
5330 |
+--- a/drivers/net/wireless/brcm80211/brcmfmac/fwsignal.c |
5331 |
++++ b/drivers/net/wireless/brcm80211/brcmfmac/fwsignal.c |
5332 |
+@@ -2262,10 +2262,22 @@ void brcmf_fws_bustxfail(struct brcmf_fws_info *fws, struct sk_buff *skb) |
5333 |
+ void brcmf_fws_bus_blocked(struct brcmf_pub *drvr, bool flow_blocked) |
5334 |
+ { |
5335 |
+ struct brcmf_fws_info *fws = drvr->fws; |
5336 |
++ struct brcmf_if *ifp; |
5337 |
++ int i; |
5338 |
+ |
5339 |
+- fws->bus_flow_blocked = flow_blocked; |
5340 |
+- if (!flow_blocked) |
5341 |
+- brcmf_fws_schedule_deq(fws); |
5342 |
+- else |
5343 |
+- fws->stats.bus_flow_block++; |
5344 |
++ if (fws->avoid_queueing) { |
5345 |
++ for (i = 0; i < BRCMF_MAX_IFS; i++) { |
5346 |
++ ifp = drvr->iflist[i]; |
5347 |
++ if (!ifp || !ifp->ndev) |
5348 |
++ continue; |
5349 |
++ brcmf_txflowblock_if(ifp, BRCMF_NETIF_STOP_REASON_FLOW, |
5350 |
++ flow_blocked); |
5351 |
++ } |
5352 |
++ } else { |
5353 |
++ fws->bus_flow_blocked = flow_blocked; |
5354 |
++ if (!flow_blocked) |
5355 |
++ brcmf_fws_schedule_deq(fws); |
5356 |
++ else |
5357 |
++ fws->stats.bus_flow_block++; |
5358 |
++ } |
5359 |
+ } |
5360 |
+diff --git a/drivers/net/wireless/brcm80211/brcmfmac/msgbuf.c b/drivers/net/wireless/brcm80211/brcmfmac/msgbuf.c |
5361 |
+index 6f7138cea555..f944f356d9c5 100644 |
5362 |
+--- a/drivers/net/wireless/brcm80211/brcmfmac/msgbuf.c |
5363 |
++++ b/drivers/net/wireless/brcm80211/brcmfmac/msgbuf.c |
5364 |
+@@ -1155,6 +1155,8 @@ brcmf_msgbuf_process_rx_complete(struct brcmf_msgbuf *msgbuf, void *buf) |
5365 |
+ brcmu_pkt_buf_free_skb(skb); |
5366 |
+ return; |
5367 |
+ } |
5368 |
++ |
5369 |
++ skb->protocol = eth_type_trans(skb, ifp->ndev); |
5370 |
+ brcmf_netif_rx(ifp, skb); |
5371 |
+ } |
5372 |
+ |
5373 |
+diff --git a/drivers/net/wireless/iwlwifi/iwl-7000.c b/drivers/net/wireless/iwlwifi/iwl-7000.c |
5374 |
+index d9a4aee246a6..c7e34bb486c9 100644 |
5375 |
+--- a/drivers/net/wireless/iwlwifi/iwl-7000.c |
5376 |
++++ b/drivers/net/wireless/iwlwifi/iwl-7000.c |
5377 |
+@@ -70,7 +70,7 @@ |
5378 |
+ |
5379 |
+ /* Highest firmware API version supported */ |
5380 |
+ #define IWL7260_UCODE_API_MAX 17 |
5381 |
+-#define IWL7265_UCODE_API_MAX 19 |
5382 |
++#define IWL7265_UCODE_API_MAX 17 |
5383 |
+ #define IWL7265D_UCODE_API_MAX 19 |
5384 |
+ |
5385 |
+ /* Oldest version we won't warn about */ |
5386 |
+diff --git a/drivers/net/wireless/mwifiex/pcie.h b/drivers/net/wireless/mwifiex/pcie.h |
5387 |
+index 48e549c3b285..347ba45f1f2a 100644 |
5388 |
+--- a/drivers/net/wireless/mwifiex/pcie.h |
5389 |
++++ b/drivers/net/wireless/mwifiex/pcie.h |
5390 |
+@@ -210,17 +210,17 @@ static const struct mwifiex_pcie_card_reg mwifiex_reg_8997 = { |
5391 |
+ .cmdrsp_addr_lo = PCIE_SCRATCH_4_REG, |
5392 |
+ .cmdrsp_addr_hi = PCIE_SCRATCH_5_REG, |
5393 |
+ .tx_rdptr = 0xC1A4, |
5394 |
+- .tx_wrptr = 0xC1A8, |
5395 |
+- .rx_rdptr = 0xC1A8, |
5396 |
++ .tx_wrptr = 0xC174, |
5397 |
++ .rx_rdptr = 0xC174, |
5398 |
+ .rx_wrptr = 0xC1A4, |
5399 |
+ .evt_rdptr = PCIE_SCRATCH_10_REG, |
5400 |
+ .evt_wrptr = PCIE_SCRATCH_11_REG, |
5401 |
+ .drv_rdy = PCIE_SCRATCH_12_REG, |
5402 |
+ .tx_start_ptr = 16, |
5403 |
+ .tx_mask = 0x0FFF0000, |
5404 |
+- .tx_wrap_mask = 0x01FF0000, |
5405 |
++ .tx_wrap_mask = 0x1FFF0000, |
5406 |
+ .rx_mask = 0x00000FFF, |
5407 |
+- .rx_wrap_mask = 0x000001FF, |
5408 |
++ .rx_wrap_mask = 0x00001FFF, |
5409 |
+ .tx_rollover_ind = BIT(28), |
5410 |
+ .rx_rollover_ind = BIT(12), |
5411 |
+ .evt_rollover_ind = MWIFIEX_BD_FLAG_EVT_ROLLOVER_IND, |
5412 |
+@@ -342,6 +342,7 @@ mwifiex_pcie_txbd_empty(struct pcie_service_card *card, u32 rdptr) |
5413 |
+ return 1; |
5414 |
+ break; |
5415 |
+ case PCIE_DEVICE_ID_MARVELL_88W8897: |
5416 |
++ case PCIE_DEVICE_ID_MARVELL_88W8997: |
5417 |
+ if (((card->txbd_wrptr & reg->tx_mask) == |
5418 |
+ (rdptr & reg->tx_mask)) && |
5419 |
+ ((card->txbd_wrptr & reg->tx_rollover_ind) == |
5420 |
+diff --git a/drivers/net/wireless/mwifiex/sta_event.c b/drivers/net/wireless/mwifiex/sta_event.c |
5421 |
+index ff3ee9dfbbd5..23bae87d4d3d 100644 |
5422 |
+--- a/drivers/net/wireless/mwifiex/sta_event.c |
5423 |
++++ b/drivers/net/wireless/mwifiex/sta_event.c |
5424 |
+@@ -607,11 +607,13 @@ int mwifiex_process_sta_event(struct mwifiex_private *priv) |
5425 |
+ |
5426 |
+ case EVENT_PS_AWAKE: |
5427 |
+ mwifiex_dbg(adapter, EVENT, "info: EVENT: AWAKE\n"); |
5428 |
+- if (!adapter->pps_uapsd_mode && priv->port_open && |
5429 |
++ if (!adapter->pps_uapsd_mode && |
5430 |
++ (priv->port_open || |
5431 |
++ (priv->bss_mode == NL80211_IFTYPE_ADHOC)) && |
5432 |
+ priv->media_connected && adapter->sleep_period.period) { |
5433 |
+- adapter->pps_uapsd_mode = true; |
5434 |
+- mwifiex_dbg(adapter, EVENT, |
5435 |
+- "event: PPS/UAPSD mode activated\n"); |
5436 |
++ adapter->pps_uapsd_mode = true; |
5437 |
++ mwifiex_dbg(adapter, EVENT, |
5438 |
++ "event: PPS/UAPSD mode activated\n"); |
5439 |
+ } |
5440 |
+ adapter->tx_lock_flag = false; |
5441 |
+ if (adapter->pps_uapsd_mode && adapter->gen_null_pkt) { |
5442 |
+diff --git a/drivers/net/wireless/mwifiex/wmm.c b/drivers/net/wireless/mwifiex/wmm.c |
5443 |
+index 3a2ecb6cf1c3..cad399221b61 100644 |
5444 |
+--- a/drivers/net/wireless/mwifiex/wmm.c |
5445 |
++++ b/drivers/net/wireless/mwifiex/wmm.c |
5446 |
+@@ -475,7 +475,8 @@ mwifiex_wmm_lists_empty(struct mwifiex_adapter *adapter) |
5447 |
+ priv = adapter->priv[i]; |
5448 |
+ if (!priv) |
5449 |
+ continue; |
5450 |
+- if (!priv->port_open) |
5451 |
++ if (!priv->port_open && |
5452 |
++ (priv->bss_mode != NL80211_IFTYPE_ADHOC)) |
5453 |
+ continue; |
5454 |
+ if (adapter->if_ops.is_port_ready && |
5455 |
+ !adapter->if_ops.is_port_ready(priv)) |
5456 |
+@@ -1109,7 +1110,8 @@ mwifiex_wmm_get_highest_priolist_ptr(struct mwifiex_adapter *adapter, |
5457 |
+ |
5458 |
+ priv_tmp = adapter->bss_prio_tbl[j].bss_prio_cur->priv; |
5459 |
+ |
5460 |
+- if (!priv_tmp->port_open || |
5461 |
++ if (((priv_tmp->bss_mode != NL80211_IFTYPE_ADHOC) && |
5462 |
++ !priv_tmp->port_open) || |
5463 |
+ (atomic_read(&priv_tmp->wmm.tx_pkts_queued) == 0)) |
5464 |
+ continue; |
5465 |
+ |
5466 |
+diff --git a/drivers/of/of_mdio.c b/drivers/of/of_mdio.c |
5467 |
+index a87a868fed64..2b1ccb806249 100644 |
5468 |
+--- a/drivers/of/of_mdio.c |
5469 |
++++ b/drivers/of/of_mdio.c |
5470 |
+@@ -334,8 +334,11 @@ int of_phy_register_fixed_link(struct device_node *np) |
5471 |
+ status.link = 1; |
5472 |
+ status.duplex = of_property_read_bool(fixed_link_node, |
5473 |
+ "full-duplex"); |
5474 |
+- if (of_property_read_u32(fixed_link_node, "speed", &status.speed)) |
5475 |
++ if (of_property_read_u32(fixed_link_node, "speed", |
5476 |
++ &status.speed)) { |
5477 |
++ of_node_put(fixed_link_node); |
5478 |
+ return -EINVAL; |
5479 |
++ } |
5480 |
+ status.pause = of_property_read_bool(fixed_link_node, "pause"); |
5481 |
+ status.asym_pause = of_property_read_bool(fixed_link_node, |
5482 |
+ "asym-pause"); |
5483 |
+diff --git a/drivers/pci/pci-sysfs.c b/drivers/pci/pci-sysfs.c |
5484 |
+index 6ac6618c1c10..ac9c1172c84a 100644 |
5485 |
+--- a/drivers/pci/pci-sysfs.c |
5486 |
++++ b/drivers/pci/pci-sysfs.c |
5487 |
+@@ -1027,6 +1027,9 @@ static int pci_mmap_resource(struct kobject *kobj, struct bin_attribute *attr, |
5488 |
+ if (i >= PCI_ROM_RESOURCE) |
5489 |
+ return -ENODEV; |
5490 |
+ |
5491 |
++ if (res->flags & IORESOURCE_MEM && iomem_is_exclusive(res->start)) |
5492 |
++ return -EINVAL; |
5493 |
++ |
5494 |
+ if (!pci_mmap_fits(pdev, i, vma, PCI_MMAP_SYSFS)) { |
5495 |
+ WARN(1, "process \"%s\" tried to map 0x%08lx bytes at page 0x%08lx on %s BAR %d (start 0x%16Lx, size 0x%16Lx)\n", |
5496 |
+ current->comm, vma->vm_end-vma->vm_start, vma->vm_pgoff, |
5497 |
+@@ -1043,10 +1046,6 @@ static int pci_mmap_resource(struct kobject *kobj, struct bin_attribute *attr, |
5498 |
+ pci_resource_to_user(pdev, i, res, &start, &end); |
5499 |
+ vma->vm_pgoff += start >> PAGE_SHIFT; |
5500 |
+ mmap_type = res->flags & IORESOURCE_MEM ? pci_mmap_mem : pci_mmap_io; |
5501 |
+- |
5502 |
+- if (res->flags & IORESOURCE_MEM && iomem_is_exclusive(start)) |
5503 |
+- return -EINVAL; |
5504 |
+- |
5505 |
+ return pci_mmap_page_range(pdev, vma, mmap_type, write_combine); |
5506 |
+ } |
5507 |
+ |
5508 |
+diff --git a/drivers/pinctrl/bcm/pinctrl-bcm2835.c b/drivers/pinctrl/bcm/pinctrl-bcm2835.c |
5509 |
+index 17dd8fe12b54..4ae15edde037 100644 |
5510 |
+--- a/drivers/pinctrl/bcm/pinctrl-bcm2835.c |
5511 |
++++ b/drivers/pinctrl/bcm/pinctrl-bcm2835.c |
5512 |
+@@ -795,7 +795,7 @@ static int bcm2835_pctl_dt_node_to_map(struct pinctrl_dev *pctldev, |
5513 |
+ return 0; |
5514 |
+ |
5515 |
+ out: |
5516 |
+- kfree(maps); |
5517 |
++ bcm2835_pctl_dt_free_map(pctldev, maps, num_pins * maps_per_pin); |
5518 |
+ return err; |
5519 |
+ } |
5520 |
+ |
5521 |
+diff --git a/drivers/pinctrl/pinctrl-tegra.c b/drivers/pinctrl/pinctrl-tegra.c |
5522 |
+index a30e967d75c2..d3d1dceaec2d 100644 |
5523 |
+--- a/drivers/pinctrl/pinctrl-tegra.c |
5524 |
++++ b/drivers/pinctrl/pinctrl-tegra.c |
5525 |
+@@ -418,7 +418,7 @@ static int tegra_pinconf_reg(struct tegra_pmx *pmx, |
5526 |
+ return -ENOTSUPP; |
5527 |
+ } |
5528 |
+ |
5529 |
+- if (*reg < 0 || *bit > 31) { |
5530 |
++ if (*reg < 0 || *bit < 0) { |
5531 |
+ if (report_err) { |
5532 |
+ const char *prop = "unknown"; |
5533 |
+ int i; |
5534 |
+diff --git a/drivers/power/bq27xxx_battery.c b/drivers/power/bq27xxx_battery.c |
5535 |
+index 6c3a447f378b..286122df3e01 100644 |
5536 |
+--- a/drivers/power/bq27xxx_battery.c |
5537 |
++++ b/drivers/power/bq27xxx_battery.c |
5538 |
+@@ -198,10 +198,10 @@ static u8 bq27500_regs[] = { |
5539 |
+ INVALID_REG_ADDR, /* TTECP - NA */ |
5540 |
+ 0x0c, /* NAC */ |
5541 |
+ 0x12, /* LMD(FCC) */ |
5542 |
+- 0x1e, /* CYCT */ |
5543 |
++ 0x2a, /* CYCT */ |
5544 |
+ INVALID_REG_ADDR, /* AE - NA */ |
5545 |
+- 0x20, /* SOC(RSOC) */ |
5546 |
+- 0x2e, /* DCAP(ILMD) */ |
5547 |
++ 0x2c, /* SOC(RSOC) */ |
5548 |
++ 0x3c, /* DCAP(ILMD) */ |
5549 |
+ INVALID_REG_ADDR, /* AP - NA */ |
5550 |
+ }; |
5551 |
+ |
5552 |
+@@ -242,7 +242,7 @@ static u8 bq27541_regs[] = { |
5553 |
+ INVALID_REG_ADDR, /* AE - NA */ |
5554 |
+ 0x2c, /* SOC(RSOC) */ |
5555 |
+ 0x3c, /* DCAP */ |
5556 |
+- 0x76, /* AP */ |
5557 |
++ 0x24, /* AP */ |
5558 |
+ }; |
5559 |
+ |
5560 |
+ static u8 bq27545_regs[] = { |
5561 |
+@@ -471,7 +471,10 @@ static int bq27xxx_battery_read_soc(struct bq27xxx_device_info *di) |
5562 |
+ { |
5563 |
+ int soc; |
5564 |
+ |
5565 |
+- soc = bq27xxx_read(di, BQ27XXX_REG_SOC, false); |
5566 |
++ if (di->chip == BQ27000 || di->chip == BQ27010) |
5567 |
++ soc = bq27xxx_read(di, BQ27XXX_REG_SOC, true); |
5568 |
++ else |
5569 |
++ soc = bq27xxx_read(di, BQ27XXX_REG_SOC, false); |
5570 |
+ |
5571 |
+ if (soc < 0) |
5572 |
+ dev_dbg(di->dev, "error reading State-of-Charge\n"); |
5573 |
+@@ -536,7 +539,10 @@ static int bq27xxx_battery_read_dcap(struct bq27xxx_device_info *di) |
5574 |
+ { |
5575 |
+ int dcap; |
5576 |
+ |
5577 |
+- dcap = bq27xxx_read(di, BQ27XXX_REG_DCAP, false); |
5578 |
++ if (di->chip == BQ27000 || di->chip == BQ27010) |
5579 |
++ dcap = bq27xxx_read(di, BQ27XXX_REG_DCAP, true); |
5580 |
++ else |
5581 |
++ dcap = bq27xxx_read(di, BQ27XXX_REG_DCAP, false); |
5582 |
+ |
5583 |
+ if (dcap < 0) { |
5584 |
+ dev_dbg(di->dev, "error reading initial last measured discharge\n"); |
5585 |
+@@ -544,7 +550,7 @@ static int bq27xxx_battery_read_dcap(struct bq27xxx_device_info *di) |
5586 |
+ } |
5587 |
+ |
5588 |
+ if (di->chip == BQ27000 || di->chip == BQ27010) |
5589 |
+- dcap *= BQ27XXX_CURRENT_CONSTANT / BQ27XXX_RS; |
5590 |
++ dcap = (dcap << 8) * BQ27XXX_CURRENT_CONSTANT / BQ27XXX_RS; |
5591 |
+ else |
5592 |
+ dcap *= 1000; |
5593 |
+ |
5594 |
+diff --git a/drivers/power/ipaq_micro_battery.c b/drivers/power/ipaq_micro_battery.c |
5595 |
+index f03014ea1dc4..65e9921c5a11 100644 |
5596 |
+--- a/drivers/power/ipaq_micro_battery.c |
5597 |
++++ b/drivers/power/ipaq_micro_battery.c |
5598 |
+@@ -261,7 +261,7 @@ static int micro_batt_probe(struct platform_device *pdev) |
5599 |
+ return 0; |
5600 |
+ |
5601 |
+ ac_err: |
5602 |
+- power_supply_unregister(micro_ac_power); |
5603 |
++ power_supply_unregister(micro_batt_power); |
5604 |
+ batt_err: |
5605 |
+ cancel_delayed_work_sync(&mb->update); |
5606 |
+ destroy_workqueue(mb->wq); |
5607 |
+diff --git a/drivers/power/test_power.c b/drivers/power/test_power.c |
5608 |
+index 83c42ea88f2b..57246cdbd042 100644 |
5609 |
+--- a/drivers/power/test_power.c |
5610 |
++++ b/drivers/power/test_power.c |
5611 |
+@@ -301,6 +301,8 @@ static int map_get_value(struct battery_property_map *map, const char *key, |
5612 |
+ buf[MAX_KEYLENGTH-1] = '\0'; |
5613 |
+ |
5614 |
+ cr = strnlen(buf, MAX_KEYLENGTH) - 1; |
5615 |
++ if (cr < 0) |
5616 |
++ return def_val; |
5617 |
+ if (buf[cr] == '\n') |
5618 |
+ buf[cr] = '\0'; |
5619 |
+ |
5620 |
+diff --git a/drivers/power/tps65217_charger.c b/drivers/power/tps65217_charger.c |
5621 |
+index 040a40b4b173..4c56e54af6ac 100644 |
5622 |
+--- a/drivers/power/tps65217_charger.c |
5623 |
++++ b/drivers/power/tps65217_charger.c |
5624 |
+@@ -197,6 +197,7 @@ static int tps65217_charger_probe(struct platform_device *pdev) |
5625 |
+ { |
5626 |
+ struct tps65217 *tps = dev_get_drvdata(pdev->dev.parent); |
5627 |
+ struct tps65217_charger *charger; |
5628 |
++ struct power_supply_config cfg = {}; |
5629 |
+ int ret; |
5630 |
+ |
5631 |
+ dev_dbg(&pdev->dev, "%s\n", __func__); |
5632 |
+@@ -209,9 +210,12 @@ static int tps65217_charger_probe(struct platform_device *pdev) |
5633 |
+ charger->tps = tps; |
5634 |
+ charger->dev = &pdev->dev; |
5635 |
+ |
5636 |
++ cfg.of_node = pdev->dev.of_node; |
5637 |
++ cfg.drv_data = charger; |
5638 |
++ |
5639 |
+ charger->ac = devm_power_supply_register(&pdev->dev, |
5640 |
+ &tps65217_charger_desc, |
5641 |
+- NULL); |
5642 |
++ &cfg); |
5643 |
+ if (IS_ERR(charger->ac)) { |
5644 |
+ dev_err(&pdev->dev, "failed: power supply register\n"); |
5645 |
+ return PTR_ERR(charger->ac); |
5646 |
+diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c |
5647 |
+index f9b8c44677eb..fbf16603c494 100644 |
5648 |
+--- a/drivers/regulator/core.c |
5649 |
++++ b/drivers/regulator/core.c |
5650 |
+@@ -1057,18 +1057,18 @@ static int set_machine_constraints(struct regulator_dev *rdev, |
5651 |
+ |
5652 |
+ ret = machine_constraints_voltage(rdev, rdev->constraints); |
5653 |
+ if (ret != 0) |
5654 |
+- goto out; |
5655 |
++ return ret; |
5656 |
+ |
5657 |
+ ret = machine_constraints_current(rdev, rdev->constraints); |
5658 |
+ if (ret != 0) |
5659 |
+- goto out; |
5660 |
++ return ret; |
5661 |
+ |
5662 |
+ if (rdev->constraints->ilim_uA && ops->set_input_current_limit) { |
5663 |
+ ret = ops->set_input_current_limit(rdev, |
5664 |
+ rdev->constraints->ilim_uA); |
5665 |
+ if (ret < 0) { |
5666 |
+ rdev_err(rdev, "failed to set input limit\n"); |
5667 |
+- goto out; |
5668 |
++ return ret; |
5669 |
+ } |
5670 |
+ } |
5671 |
+ |
5672 |
+@@ -1077,21 +1077,20 @@ static int set_machine_constraints(struct regulator_dev *rdev, |
5673 |
+ ret = suspend_prepare(rdev, rdev->constraints->initial_state); |
5674 |
+ if (ret < 0) { |
5675 |
+ rdev_err(rdev, "failed to set suspend state\n"); |
5676 |
+- goto out; |
5677 |
++ return ret; |
5678 |
+ } |
5679 |
+ } |
5680 |
+ |
5681 |
+ if (rdev->constraints->initial_mode) { |
5682 |
+ if (!ops->set_mode) { |
5683 |
+ rdev_err(rdev, "no set_mode operation\n"); |
5684 |
+- ret = -EINVAL; |
5685 |
+- goto out; |
5686 |
++ return -EINVAL; |
5687 |
+ } |
5688 |
+ |
5689 |
+ ret = ops->set_mode(rdev, rdev->constraints->initial_mode); |
5690 |
+ if (ret < 0) { |
5691 |
+ rdev_err(rdev, "failed to set initial mode: %d\n", ret); |
5692 |
+- goto out; |
5693 |
++ return ret; |
5694 |
+ } |
5695 |
+ } |
5696 |
+ |
5697 |
+@@ -1102,7 +1101,7 @@ static int set_machine_constraints(struct regulator_dev *rdev, |
5698 |
+ ret = _regulator_do_enable(rdev); |
5699 |
+ if (ret < 0 && ret != -EINVAL) { |
5700 |
+ rdev_err(rdev, "failed to enable\n"); |
5701 |
+- goto out; |
5702 |
++ return ret; |
5703 |
+ } |
5704 |
+ } |
5705 |
+ |
5706 |
+@@ -1111,7 +1110,7 @@ static int set_machine_constraints(struct regulator_dev *rdev, |
5707 |
+ ret = ops->set_ramp_delay(rdev, rdev->constraints->ramp_delay); |
5708 |
+ if (ret < 0) { |
5709 |
+ rdev_err(rdev, "failed to set ramp_delay\n"); |
5710 |
+- goto out; |
5711 |
++ return ret; |
5712 |
+ } |
5713 |
+ } |
5714 |
+ |
5715 |
+@@ -1119,7 +1118,7 @@ static int set_machine_constraints(struct regulator_dev *rdev, |
5716 |
+ ret = ops->set_pull_down(rdev); |
5717 |
+ if (ret < 0) { |
5718 |
+ rdev_err(rdev, "failed to set pull down\n"); |
5719 |
+- goto out; |
5720 |
++ return ret; |
5721 |
+ } |
5722 |
+ } |
5723 |
+ |
5724 |
+@@ -1127,7 +1126,7 @@ static int set_machine_constraints(struct regulator_dev *rdev, |
5725 |
+ ret = ops->set_soft_start(rdev); |
5726 |
+ if (ret < 0) { |
5727 |
+ rdev_err(rdev, "failed to set soft start\n"); |
5728 |
+- goto out; |
5729 |
++ return ret; |
5730 |
+ } |
5731 |
+ } |
5732 |
+ |
5733 |
+@@ -1136,16 +1135,12 @@ static int set_machine_constraints(struct regulator_dev *rdev, |
5734 |
+ ret = ops->set_over_current_protection(rdev); |
5735 |
+ if (ret < 0) { |
5736 |
+ rdev_err(rdev, "failed to set over current protection\n"); |
5737 |
+- goto out; |
5738 |
++ return ret; |
5739 |
+ } |
5740 |
+ } |
5741 |
+ |
5742 |
+ print_constraints(rdev); |
5743 |
+ return 0; |
5744 |
+-out: |
5745 |
+- kfree(rdev->constraints); |
5746 |
+- rdev->constraints = NULL; |
5747 |
+- return ret; |
5748 |
+ } |
5749 |
+ |
5750 |
+ /** |
5751 |
+@@ -3983,7 +3978,7 @@ unset_supplies: |
5752 |
+ |
5753 |
+ scrub: |
5754 |
+ regulator_ena_gpio_free(rdev); |
5755 |
+- kfree(rdev->constraints); |
5756 |
++ |
5757 |
+ wash: |
5758 |
+ device_unregister(&rdev->dev); |
5759 |
+ /* device core frees rdev */ |
5760 |
+diff --git a/drivers/scsi/cxgbi/libcxgbi.c b/drivers/scsi/cxgbi/libcxgbi.c |
5761 |
+index 5eaf14c15590..59cb3af9a318 100644 |
5762 |
+--- a/drivers/scsi/cxgbi/libcxgbi.c |
5763 |
++++ b/drivers/scsi/cxgbi/libcxgbi.c |
5764 |
+@@ -692,6 +692,7 @@ static struct rt6_info *find_route_ipv6(const struct in6_addr *saddr, |
5765 |
+ { |
5766 |
+ struct flowi6 fl; |
5767 |
+ |
5768 |
++ memset(&fl, 0, sizeof(fl)); |
5769 |
+ if (saddr) |
5770 |
+ memcpy(&fl.saddr, saddr, sizeof(struct in6_addr)); |
5771 |
+ if (daddr) |
5772 |
+diff --git a/drivers/staging/media/lirc/lirc_imon.c b/drivers/staging/media/lirc/lirc_imon.c |
5773 |
+index 534b8103ae80..ff1926ca1f96 100644 |
5774 |
+--- a/drivers/staging/media/lirc/lirc_imon.c |
5775 |
++++ b/drivers/staging/media/lirc/lirc_imon.c |
5776 |
+@@ -885,12 +885,14 @@ static int imon_probe(struct usb_interface *interface, |
5777 |
+ vendor, product, ifnum, usbdev->bus->busnum, usbdev->devnum); |
5778 |
+ |
5779 |
+ /* Everything went fine. Just unlock and return retval (with is 0) */ |
5780 |
++ mutex_unlock(&context->ctx_lock); |
5781 |
+ goto driver_unlock; |
5782 |
+ |
5783 |
+ unregister_lirc: |
5784 |
+ lirc_unregister_driver(driver->minor); |
5785 |
+ |
5786 |
+ free_tx_urb: |
5787 |
++ mutex_unlock(&context->ctx_lock); |
5788 |
+ usb_free_urb(tx_urb); |
5789 |
+ |
5790 |
+ free_rx_urb: |
5791 |
+diff --git a/drivers/staging/rtl8192u/r8192U_core.c b/drivers/staging/rtl8192u/r8192U_core.c |
5792 |
+index 0f6bc6b8e4c6..1e0d2a33787e 100644 |
5793 |
+--- a/drivers/staging/rtl8192u/r8192U_core.c |
5794 |
++++ b/drivers/staging/rtl8192u/r8192U_core.c |
5795 |
+@@ -1050,7 +1050,7 @@ static void rtl8192_hard_data_xmit(struct sk_buff *skb, struct net_device *dev, |
5796 |
+ |
5797 |
+ spin_lock_irqsave(&priv->tx_lock, flags); |
5798 |
+ |
5799 |
+- memcpy((unsigned char *)(skb->cb), &dev, sizeof(dev)); |
5800 |
++ *(struct net_device **)(skb->cb) = dev; |
5801 |
+ tcb_desc->bTxEnableFwCalcDur = 1; |
5802 |
+ skb_push(skb, priv->ieee80211->tx_headroom); |
5803 |
+ ret = rtl8192_tx(dev, skb); |
5804 |
+@@ -1092,7 +1092,7 @@ static int rtl8192_hard_start_xmit(struct sk_buff *skb, struct net_device *dev) |
5805 |
+ static void rtl8192_tx_isr(struct urb *tx_urb) |
5806 |
+ { |
5807 |
+ struct sk_buff *skb = (struct sk_buff *)tx_urb->context; |
5808 |
+- struct net_device *dev = (struct net_device *)(skb->cb); |
5809 |
++ struct net_device *dev = *(struct net_device **)(skb->cb); |
5810 |
+ struct r8192_priv *priv = NULL; |
5811 |
+ cb_desc *tcb_desc = (cb_desc *)(skb->cb + MAX_DEV_ADDR_SIZE); |
5812 |
+ u8 queue_index = tcb_desc->queue_index; |
5813 |
+diff --git a/drivers/target/target_core_configfs.c b/drivers/target/target_core_configfs.c |
5814 |
+index b9b9ffde4c7a..d2ceefe4a076 100644 |
5815 |
+--- a/drivers/target/target_core_configfs.c |
5816 |
++++ b/drivers/target/target_core_configfs.c |
5817 |
+@@ -1980,14 +1980,14 @@ static ssize_t target_dev_lba_map_store(struct config_item *item, |
5818 |
+ struct se_device *dev = to_device(item); |
5819 |
+ struct t10_alua_lba_map *lba_map = NULL; |
5820 |
+ struct list_head lba_list; |
5821 |
+- char *map_entries, *ptr; |
5822 |
++ char *map_entries, *orig, *ptr; |
5823 |
+ char state; |
5824 |
+ int pg_num = -1, pg; |
5825 |
+ int ret = 0, num = 0, pg_id, alua_state; |
5826 |
+ unsigned long start_lba = -1, end_lba = -1; |
5827 |
+ unsigned long segment_size = -1, segment_mult = -1; |
5828 |
+ |
5829 |
+- map_entries = kstrdup(page, GFP_KERNEL); |
5830 |
++ orig = map_entries = kstrdup(page, GFP_KERNEL); |
5831 |
+ if (!map_entries) |
5832 |
+ return -ENOMEM; |
5833 |
+ |
5834 |
+@@ -2085,7 +2085,7 @@ out: |
5835 |
+ } else |
5836 |
+ core_alua_set_lba_map(dev, &lba_list, |
5837 |
+ segment_size, segment_mult); |
5838 |
+- kfree(map_entries); |
5839 |
++ kfree(orig); |
5840 |
+ return count; |
5841 |
+ } |
5842 |
+ |
5843 |
+diff --git a/drivers/tty/serial/msm_serial.c b/drivers/tty/serial/msm_serial.c |
5844 |
+index 1a4df5005aec..5fbb2d56565d 100644 |
5845 |
+--- a/drivers/tty/serial/msm_serial.c |
5846 |
++++ b/drivers/tty/serial/msm_serial.c |
5847 |
+@@ -872,37 +872,72 @@ struct msm_baud_map { |
5848 |
+ }; |
5849 |
+ |
5850 |
+ static const struct msm_baud_map * |
5851 |
+-msm_find_best_baud(struct uart_port *port, unsigned int baud) |
5852 |
++msm_find_best_baud(struct uart_port *port, unsigned int baud, |
5853 |
++ unsigned long *rate) |
5854 |
+ { |
5855 |
+- unsigned int i, divisor; |
5856 |
+- const struct msm_baud_map *entry; |
5857 |
++ struct msm_port *msm_port = UART_TO_MSM(port); |
5858 |
++ unsigned int divisor, result; |
5859 |
++ unsigned long target, old, best_rate = 0, diff, best_diff = ULONG_MAX; |
5860 |
++ const struct msm_baud_map *entry, *end, *best; |
5861 |
+ static const struct msm_baud_map table[] = { |
5862 |
+- { 1536, 0x00, 1 }, |
5863 |
+- { 768, 0x11, 1 }, |
5864 |
+- { 384, 0x22, 1 }, |
5865 |
+- { 192, 0x33, 1 }, |
5866 |
+- { 96, 0x44, 1 }, |
5867 |
+- { 48, 0x55, 1 }, |
5868 |
+- { 32, 0x66, 1 }, |
5869 |
+- { 24, 0x77, 1 }, |
5870 |
+- { 16, 0x88, 1 }, |
5871 |
+- { 12, 0x99, 6 }, |
5872 |
+- { 8, 0xaa, 6 }, |
5873 |
+- { 6, 0xbb, 6 }, |
5874 |
+- { 4, 0xcc, 6 }, |
5875 |
+- { 3, 0xdd, 8 }, |
5876 |
+- { 2, 0xee, 16 }, |
5877 |
+ { 1, 0xff, 31 }, |
5878 |
+- { 0, 0xff, 31 }, |
5879 |
++ { 2, 0xee, 16 }, |
5880 |
++ { 3, 0xdd, 8 }, |
5881 |
++ { 4, 0xcc, 6 }, |
5882 |
++ { 6, 0xbb, 6 }, |
5883 |
++ { 8, 0xaa, 6 }, |
5884 |
++ { 12, 0x99, 6 }, |
5885 |
++ { 16, 0x88, 1 }, |
5886 |
++ { 24, 0x77, 1 }, |
5887 |
++ { 32, 0x66, 1 }, |
5888 |
++ { 48, 0x55, 1 }, |
5889 |
++ { 96, 0x44, 1 }, |
5890 |
++ { 192, 0x33, 1 }, |
5891 |
++ { 384, 0x22, 1 }, |
5892 |
++ { 768, 0x11, 1 }, |
5893 |
++ { 1536, 0x00, 1 }, |
5894 |
+ }; |
5895 |
+ |
5896 |
+- divisor = uart_get_divisor(port, baud); |
5897 |
++ best = table; /* Default to smallest divider */ |
5898 |
++ target = clk_round_rate(msm_port->clk, 16 * baud); |
5899 |
++ divisor = DIV_ROUND_CLOSEST(target, 16 * baud); |
5900 |
++ |
5901 |
++ end = table + ARRAY_SIZE(table); |
5902 |
++ entry = table; |
5903 |
++ while (entry < end) { |
5904 |
++ if (entry->divisor <= divisor) { |
5905 |
++ result = target / entry->divisor / 16; |
5906 |
++ diff = abs(result - baud); |
5907 |
++ |
5908 |
++ /* Keep track of best entry */ |
5909 |
++ if (diff < best_diff) { |
5910 |
++ best_diff = diff; |
5911 |
++ best = entry; |
5912 |
++ best_rate = target; |
5913 |
++ } |
5914 |
+ |
5915 |
+- for (i = 0, entry = table; i < ARRAY_SIZE(table); i++, entry++) |
5916 |
+- if (entry->divisor <= divisor) |
5917 |
+- break; |
5918 |
++ if (result == baud) |
5919 |
++ break; |
5920 |
++ } else if (entry->divisor > divisor) { |
5921 |
++ old = target; |
5922 |
++ target = clk_round_rate(msm_port->clk, old + 1); |
5923 |
++ /* |
5924 |
++ * The rate didn't get any faster so we can't do |
5925 |
++ * better at dividing it down |
5926 |
++ */ |
5927 |
++ if (target == old) |
5928 |
++ break; |
5929 |
++ |
5930 |
++ /* Start the divisor search over at this new rate */ |
5931 |
++ entry = table; |
5932 |
++ divisor = DIV_ROUND_CLOSEST(target, 16 * baud); |
5933 |
++ continue; |
5934 |
++ } |
5935 |
++ entry++; |
5936 |
++ } |
5937 |
+ |
5938 |
+- return entry; /* Default to smallest divider */ |
5939 |
++ *rate = best_rate; |
5940 |
++ return best; |
5941 |
+ } |
5942 |
+ |
5943 |
+ static int msm_set_baud_rate(struct uart_port *port, unsigned int baud, |
5944 |
+@@ -911,22 +946,20 @@ static int msm_set_baud_rate(struct uart_port *port, unsigned int baud, |
5945 |
+ unsigned int rxstale, watermark, mask; |
5946 |
+ struct msm_port *msm_port = UART_TO_MSM(port); |
5947 |
+ const struct msm_baud_map *entry; |
5948 |
+- unsigned long flags; |
5949 |
+- |
5950 |
+- entry = msm_find_best_baud(port, baud); |
5951 |
+- |
5952 |
+- msm_write(port, entry->code, UART_CSR); |
5953 |
+- |
5954 |
+- if (baud > 460800) |
5955 |
+- port->uartclk = baud * 16; |
5956 |
++ unsigned long flags, rate; |
5957 |
+ |
5958 |
+ flags = *saved_flags; |
5959 |
+ spin_unlock_irqrestore(&port->lock, flags); |
5960 |
+ |
5961 |
+- clk_set_rate(msm_port->clk, port->uartclk); |
5962 |
++ entry = msm_find_best_baud(port, baud, &rate); |
5963 |
++ clk_set_rate(msm_port->clk, rate); |
5964 |
++ baud = rate / 16 / entry->divisor; |
5965 |
+ |
5966 |
+ spin_lock_irqsave(&port->lock, flags); |
5967 |
+ *saved_flags = flags; |
5968 |
++ port->uartclk = rate; |
5969 |
++ |
5970 |
++ msm_write(port, entry->code, UART_CSR); |
5971 |
+ |
5972 |
+ /* RX stale watermark */ |
5973 |
+ rxstale = entry->rxstale; |
5974 |
+diff --git a/drivers/tty/serial/samsung.c b/drivers/tty/serial/samsung.c |
5975 |
+index 12bac2cbae4b..8d485f82443e 100644 |
5976 |
+--- a/drivers/tty/serial/samsung.c |
5977 |
++++ b/drivers/tty/serial/samsung.c |
5978 |
+@@ -1841,8 +1841,6 @@ static int s3c24xx_serial_probe(struct platform_device *pdev) |
5979 |
+ ourport->min_dma_size = max_t(int, ourport->port.fifosize, |
5980 |
+ dma_get_cache_alignment()); |
5981 |
+ |
5982 |
+- probe_index++; |
5983 |
+- |
5984 |
+ dbg("%s: initialising port %p...\n", __func__, ourport); |
5985 |
+ |
5986 |
+ ret = s3c24xx_serial_init_port(ourport, pdev); |
5987 |
+@@ -1872,6 +1870,8 @@ static int s3c24xx_serial_probe(struct platform_device *pdev) |
5988 |
+ if (ret < 0) |
5989 |
+ dev_err(&pdev->dev, "failed to add cpufreq notifier\n"); |
5990 |
+ |
5991 |
++ probe_index++; |
5992 |
++ |
5993 |
+ return 0; |
5994 |
+ } |
5995 |
+ |
5996 |
+diff --git a/drivers/usb/gadget/function/f_acm.c b/drivers/usb/gadget/function/f_acm.c |
5997 |
+index 67e474b13fca..670a89f197cd 100644 |
5998 |
+--- a/drivers/usb/gadget/function/f_acm.c |
5999 |
++++ b/drivers/usb/gadget/function/f_acm.c |
6000 |
+@@ -779,10 +779,10 @@ static ssize_t f_acm_port_num_show(struct config_item *item, char *page) |
6001 |
+ return sprintf(page, "%u\n", to_f_serial_opts(item)->port_num); |
6002 |
+ } |
6003 |
+ |
6004 |
+-CONFIGFS_ATTR_RO(f_acm_port_, num); |
6005 |
++CONFIGFS_ATTR_RO(f_acm_, port_num); |
6006 |
+ |
6007 |
+ static struct configfs_attribute *acm_attrs[] = { |
6008 |
+- &f_acm_port_attr_num, |
6009 |
++ &f_acm_attr_port_num, |
6010 |
+ NULL, |
6011 |
+ }; |
6012 |
+ |
6013 |
+diff --git a/drivers/usb/gadget/udc/pch_udc.c b/drivers/usb/gadget/udc/pch_udc.c |
6014 |
+index 2806457b4748..3fd603494e86 100644 |
6015 |
+--- a/drivers/usb/gadget/udc/pch_udc.c |
6016 |
++++ b/drivers/usb/gadget/udc/pch_udc.c |
6017 |
+@@ -1488,11 +1488,11 @@ static void complete_req(struct pch_udc_ep *ep, struct pch_udc_request *req, |
6018 |
+ req->dma_mapped = 0; |
6019 |
+ } |
6020 |
+ ep->halted = 1; |
6021 |
+- spin_lock(&dev->lock); |
6022 |
++ spin_unlock(&dev->lock); |
6023 |
+ if (!ep->in) |
6024 |
+ pch_udc_ep_clear_rrdy(ep); |
6025 |
+ usb_gadget_giveback_request(&ep->ep, &req->req); |
6026 |
+- spin_unlock(&dev->lock); |
6027 |
++ spin_lock(&dev->lock); |
6028 |
+ ep->halted = halted; |
6029 |
+ } |
6030 |
+ |
6031 |
+@@ -1731,14 +1731,12 @@ static int pch_udc_pcd_ep_enable(struct usb_ep *usbep, |
6032 |
+ static int pch_udc_pcd_ep_disable(struct usb_ep *usbep) |
6033 |
+ { |
6034 |
+ struct pch_udc_ep *ep; |
6035 |
+- struct pch_udc_dev *dev; |
6036 |
+ unsigned long iflags; |
6037 |
+ |
6038 |
+ if (!usbep) |
6039 |
+ return -EINVAL; |
6040 |
+ |
6041 |
+ ep = container_of(usbep, struct pch_udc_ep, ep); |
6042 |
+- dev = ep->dev; |
6043 |
+ if ((usbep->name == ep0_string) || !ep->ep.desc) |
6044 |
+ return -EINVAL; |
6045 |
+ |
6046 |
+@@ -1769,12 +1767,10 @@ static struct usb_request *pch_udc_alloc_request(struct usb_ep *usbep, |
6047 |
+ struct pch_udc_request *req; |
6048 |
+ struct pch_udc_ep *ep; |
6049 |
+ struct pch_udc_data_dma_desc *dma_desc; |
6050 |
+- struct pch_udc_dev *dev; |
6051 |
+ |
6052 |
+ if (!usbep) |
6053 |
+ return NULL; |
6054 |
+ ep = container_of(usbep, struct pch_udc_ep, ep); |
6055 |
+- dev = ep->dev; |
6056 |
+ req = kzalloc(sizeof *req, gfp); |
6057 |
+ if (!req) |
6058 |
+ return NULL; |
6059 |
+@@ -1947,12 +1943,10 @@ static int pch_udc_pcd_dequeue(struct usb_ep *usbep, |
6060 |
+ { |
6061 |
+ struct pch_udc_ep *ep; |
6062 |
+ struct pch_udc_request *req; |
6063 |
+- struct pch_udc_dev *dev; |
6064 |
+ unsigned long flags; |
6065 |
+ int ret = -EINVAL; |
6066 |
+ |
6067 |
+ ep = container_of(usbep, struct pch_udc_ep, ep); |
6068 |
+- dev = ep->dev; |
6069 |
+ if (!usbep || !usbreq || (!ep->ep.desc && ep->num)) |
6070 |
+ return ret; |
6071 |
+ req = container_of(usbreq, struct pch_udc_request, req); |
6072 |
+@@ -1984,14 +1978,12 @@ static int pch_udc_pcd_dequeue(struct usb_ep *usbep, |
6073 |
+ static int pch_udc_pcd_set_halt(struct usb_ep *usbep, int halt) |
6074 |
+ { |
6075 |
+ struct pch_udc_ep *ep; |
6076 |
+- struct pch_udc_dev *dev; |
6077 |
+ unsigned long iflags; |
6078 |
+ int ret; |
6079 |
+ |
6080 |
+ if (!usbep) |
6081 |
+ return -EINVAL; |
6082 |
+ ep = container_of(usbep, struct pch_udc_ep, ep); |
6083 |
+- dev = ep->dev; |
6084 |
+ if (!ep->ep.desc && !ep->num) |
6085 |
+ return -EINVAL; |
6086 |
+ if (!ep->dev->driver || (ep->dev->gadget.speed == USB_SPEED_UNKNOWN)) |
6087 |
+@@ -2029,14 +2021,12 @@ static int pch_udc_pcd_set_halt(struct usb_ep *usbep, int halt) |
6088 |
+ static int pch_udc_pcd_set_wedge(struct usb_ep *usbep) |
6089 |
+ { |
6090 |
+ struct pch_udc_ep *ep; |
6091 |
+- struct pch_udc_dev *dev; |
6092 |
+ unsigned long iflags; |
6093 |
+ int ret; |
6094 |
+ |
6095 |
+ if (!usbep) |
6096 |
+ return -EINVAL; |
6097 |
+ ep = container_of(usbep, struct pch_udc_ep, ep); |
6098 |
+- dev = ep->dev; |
6099 |
+ if (!ep->ep.desc && !ep->num) |
6100 |
+ return -EINVAL; |
6101 |
+ if (!ep->dev->driver || (ep->dev->gadget.speed == USB_SPEED_UNKNOWN)) |
6102 |
+@@ -2593,9 +2583,9 @@ static void pch_udc_svc_ur_interrupt(struct pch_udc_dev *dev) |
6103 |
+ empty_req_queue(ep); |
6104 |
+ } |
6105 |
+ if (dev->driver) { |
6106 |
+- spin_lock(&dev->lock); |
6107 |
+- usb_gadget_udc_reset(&dev->gadget, dev->driver); |
6108 |
+ spin_unlock(&dev->lock); |
6109 |
++ usb_gadget_udc_reset(&dev->gadget, dev->driver); |
6110 |
++ spin_lock(&dev->lock); |
6111 |
+ } |
6112 |
+ } |
6113 |
+ |
6114 |
+@@ -2646,7 +2636,7 @@ static void pch_udc_svc_enum_interrupt(struct pch_udc_dev *dev) |
6115 |
+ static void pch_udc_svc_intf_interrupt(struct pch_udc_dev *dev) |
6116 |
+ { |
6117 |
+ u32 reg, dev_stat = 0; |
6118 |
+- int i, ret; |
6119 |
++ int i; |
6120 |
+ |
6121 |
+ dev_stat = pch_udc_read_device_status(dev); |
6122 |
+ dev->cfg_data.cur_intf = (dev_stat & UDC_DEVSTS_INTF_MASK) >> |
6123 |
+@@ -2674,9 +2664,9 @@ static void pch_udc_svc_intf_interrupt(struct pch_udc_dev *dev) |
6124 |
+ dev->ep[i].halted = 0; |
6125 |
+ } |
6126 |
+ dev->stall = 0; |
6127 |
+- spin_lock(&dev->lock); |
6128 |
+- ret = dev->driver->setup(&dev->gadget, &dev->setup_data); |
6129 |
+ spin_unlock(&dev->lock); |
6130 |
++ dev->driver->setup(&dev->gadget, &dev->setup_data); |
6131 |
++ spin_lock(&dev->lock); |
6132 |
+ } |
6133 |
+ |
6134 |
+ /** |
6135 |
+@@ -2686,7 +2676,7 @@ static void pch_udc_svc_intf_interrupt(struct pch_udc_dev *dev) |
6136 |
+ */ |
6137 |
+ static void pch_udc_svc_cfg_interrupt(struct pch_udc_dev *dev) |
6138 |
+ { |
6139 |
+- int i, ret; |
6140 |
++ int i; |
6141 |
+ u32 reg, dev_stat = 0; |
6142 |
+ |
6143 |
+ dev_stat = pch_udc_read_device_status(dev); |
6144 |
+@@ -2711,9 +2701,9 @@ static void pch_udc_svc_cfg_interrupt(struct pch_udc_dev *dev) |
6145 |
+ dev->stall = 0; |
6146 |
+ |
6147 |
+ /* call gadget zero with setup data received */ |
6148 |
+- spin_lock(&dev->lock); |
6149 |
+- ret = dev->driver->setup(&dev->gadget, &dev->setup_data); |
6150 |
+ spin_unlock(&dev->lock); |
6151 |
++ dev->driver->setup(&dev->gadget, &dev->setup_data); |
6152 |
++ spin_lock(&dev->lock); |
6153 |
+ } |
6154 |
+ |
6155 |
+ /** |
6156 |
+diff --git a/drivers/usb/gadget/udc/udc-core.c b/drivers/usb/gadget/udc/udc-core.c |
6157 |
+index 89f7cd66f5e6..a6a1678cb927 100644 |
6158 |
+--- a/drivers/usb/gadget/udc/udc-core.c |
6159 |
++++ b/drivers/usb/gadget/udc/udc-core.c |
6160 |
+@@ -97,7 +97,7 @@ void usb_gadget_unmap_request(struct usb_gadget *gadget, |
6161 |
+ return; |
6162 |
+ |
6163 |
+ if (req->num_mapped_sgs) { |
6164 |
+- dma_unmap_sg(gadget->dev.parent, req->sg, req->num_mapped_sgs, |
6165 |
++ dma_unmap_sg(gadget->dev.parent, req->sg, req->num_sgs, |
6166 |
+ is_in ? DMA_TO_DEVICE : DMA_FROM_DEVICE); |
6167 |
+ |
6168 |
+ req->num_mapped_sgs = 0; |
6169 |
+diff --git a/drivers/vfio/pci/vfio_pci_config.c b/drivers/vfio/pci/vfio_pci_config.c |
6170 |
+index ad5929fbceb1..98a12be76c9c 100644 |
6171 |
+--- a/drivers/vfio/pci/vfio_pci_config.c |
6172 |
++++ b/drivers/vfio/pci/vfio_pci_config.c |
6173 |
+@@ -698,7 +698,8 @@ static int vfio_vpd_config_write(struct vfio_pci_device *vdev, int pos, |
6174 |
+ if (pci_write_vpd(pdev, addr & ~PCI_VPD_ADDR_F, 4, &data) != 4) |
6175 |
+ return count; |
6176 |
+ } else { |
6177 |
+- if (pci_read_vpd(pdev, addr, 4, &data) != 4) |
6178 |
++ data = 0; |
6179 |
++ if (pci_read_vpd(pdev, addr, 4, &data) < 0) |
6180 |
+ return count; |
6181 |
+ *pdata = cpu_to_le32(data); |
6182 |
+ } |
6183 |
+diff --git a/drivers/vfio/platform/reset/vfio_platform_amdxgbe.c b/drivers/vfio/platform/reset/vfio_platform_amdxgbe.c |
6184 |
+index da5356f48d0b..d4030d0c38e9 100644 |
6185 |
+--- a/drivers/vfio/platform/reset/vfio_platform_amdxgbe.c |
6186 |
++++ b/drivers/vfio/platform/reset/vfio_platform_amdxgbe.c |
6187 |
+@@ -110,7 +110,7 @@ int vfio_platform_amdxgbe_reset(struct vfio_platform_device *vdev) |
6188 |
+ usleep_range(10, 15); |
6189 |
+ |
6190 |
+ count = 2000; |
6191 |
+- while (count-- && (ioread32(xgmac_regs->ioaddr + DMA_MR) & 1)) |
6192 |
++ while (--count && (ioread32(xgmac_regs->ioaddr + DMA_MR) & 1)) |
6193 |
+ usleep_range(500, 600); |
6194 |
+ |
6195 |
+ if (!count) |
6196 |
+diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c |
6197 |
+index 774728143b63..de63cb9bc64b 100644 |
6198 |
+--- a/fs/btrfs/disk-io.c |
6199 |
++++ b/fs/btrfs/disk-io.c |
6200 |
+@@ -1750,7 +1750,7 @@ static int cleaner_kthread(void *arg) |
6201 |
+ */ |
6202 |
+ btrfs_delete_unused_bgs(root->fs_info); |
6203 |
+ sleep: |
6204 |
+- if (!try_to_freeze() && !again) { |
6205 |
++ if (!again) { |
6206 |
+ set_current_state(TASK_INTERRUPTIBLE); |
6207 |
+ if (!kthread_should_stop()) |
6208 |
+ schedule(); |
6209 |
+diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c |
6210 |
+index 34ffc125763f..3bb731b2156c 100644 |
6211 |
+--- a/fs/btrfs/extent-tree.c |
6212 |
++++ b/fs/btrfs/extent-tree.c |
6213 |
+@@ -10688,7 +10688,7 @@ int btrfs_init_space_info(struct btrfs_fs_info *fs_info) |
6214 |
+ |
6215 |
+ disk_super = fs_info->super_copy; |
6216 |
+ if (!btrfs_super_root(disk_super)) |
6217 |
+- return 1; |
6218 |
++ return -EINVAL; |
6219 |
+ |
6220 |
+ features = btrfs_super_incompat_flags(disk_super); |
6221 |
+ if (features & BTRFS_FEATURE_INCOMPAT_MIXED_GROUPS) |
6222 |
+diff --git a/fs/cifs/connect.c b/fs/cifs/connect.c |
6223 |
+index cf104bbe30a1..c9793ce0d336 100644 |
6224 |
+--- a/fs/cifs/connect.c |
6225 |
++++ b/fs/cifs/connect.c |
6226 |
+@@ -338,8 +338,10 @@ static int reconn_set_ipaddr(struct TCP_Server_Info *server) |
6227 |
+ return rc; |
6228 |
+ } |
6229 |
+ |
6230 |
++ spin_lock(&cifs_tcp_ses_lock); |
6231 |
+ rc = cifs_convert_address((struct sockaddr *)&server->dstaddr, ipaddr, |
6232 |
+ strlen(ipaddr)); |
6233 |
++ spin_unlock(&cifs_tcp_ses_lock); |
6234 |
+ kfree(ipaddr); |
6235 |
+ |
6236 |
+ return !rc ? -1 : 0; |
6237 |
+diff --git a/fs/gfs2/file.c b/fs/gfs2/file.c |
6238 |
+index 8744bd773823..dec23fb358ec 100644 |
6239 |
+--- a/fs/gfs2/file.c |
6240 |
++++ b/fs/gfs2/file.c |
6241 |
+@@ -1035,7 +1035,10 @@ static int do_flock(struct file *file, int cmd, struct file_lock *fl) |
6242 |
+ if (fl_gh->gh_state == state) |
6243 |
+ goto out; |
6244 |
+ locks_lock_file_wait(file, |
6245 |
+- &(struct file_lock){.fl_type = F_UNLCK}); |
6246 |
++ &(struct file_lock) { |
6247 |
++ .fl_type = F_UNLCK, |
6248 |
++ .fl_flags = FL_FLOCK |
6249 |
++ }); |
6250 |
+ gfs2_glock_dq(fl_gh); |
6251 |
+ gfs2_holder_reinit(state, flags, fl_gh); |
6252 |
+ } else { |
6253 |
+diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c |
6254 |
+index 08207001d475..0308b5689638 100644 |
6255 |
+--- a/fs/nfs/nfs4proc.c |
6256 |
++++ b/fs/nfs/nfs4proc.c |
6257 |
+@@ -6054,6 +6054,7 @@ static int nfs41_lock_expired(struct nfs4_state *state, struct file_lock *reques |
6258 |
+ static int _nfs4_proc_setlk(struct nfs4_state *state, int cmd, struct file_lock *request) |
6259 |
+ { |
6260 |
+ struct nfs_inode *nfsi = NFS_I(state->inode); |
6261 |
++ struct nfs4_state_owner *sp = state->owner; |
6262 |
+ unsigned char fl_flags = request->fl_flags; |
6263 |
+ int status = -ENOLCK; |
6264 |
+ |
6265 |
+@@ -6068,6 +6069,7 @@ static int _nfs4_proc_setlk(struct nfs4_state *state, int cmd, struct file_lock |
6266 |
+ status = do_vfs_lock(state->inode, request); |
6267 |
+ if (status < 0) |
6268 |
+ goto out; |
6269 |
++ mutex_lock(&sp->so_delegreturn_mutex); |
6270 |
+ down_read(&nfsi->rwsem); |
6271 |
+ if (test_bit(NFS_DELEGATED_STATE, &state->flags)) { |
6272 |
+ /* Yes: cache locks! */ |
6273 |
+@@ -6075,9 +6077,11 @@ static int _nfs4_proc_setlk(struct nfs4_state *state, int cmd, struct file_lock |
6274 |
+ request->fl_flags = fl_flags & ~FL_SLEEP; |
6275 |
+ status = do_vfs_lock(state->inode, request); |
6276 |
+ up_read(&nfsi->rwsem); |
6277 |
++ mutex_unlock(&sp->so_delegreturn_mutex); |
6278 |
+ goto out; |
6279 |
+ } |
6280 |
+ up_read(&nfsi->rwsem); |
6281 |
++ mutex_unlock(&sp->so_delegreturn_mutex); |
6282 |
+ status = _nfs4_do_setlk(state, cmd, request, NFS_LOCK_NEW); |
6283 |
+ out: |
6284 |
+ request->fl_flags = fl_flags; |
6285 |
+diff --git a/include/asm-generic/preempt.h b/include/asm-generic/preempt.h |
6286 |
+index 5d8ffa3e6f8c..c1cde3577551 100644 |
6287 |
+--- a/include/asm-generic/preempt.h |
6288 |
++++ b/include/asm-generic/preempt.h |
6289 |
+@@ -7,10 +7,10 @@ |
6290 |
+ |
6291 |
+ static __always_inline int preempt_count(void) |
6292 |
+ { |
6293 |
+- return current_thread_info()->preempt_count; |
6294 |
++ return READ_ONCE(current_thread_info()->preempt_count); |
6295 |
+ } |
6296 |
+ |
6297 |
+-static __always_inline int *preempt_count_ptr(void) |
6298 |
++static __always_inline volatile int *preempt_count_ptr(void) |
6299 |
+ { |
6300 |
+ return ¤t_thread_info()->preempt_count; |
6301 |
+ } |
6302 |
+diff --git a/include/linux/cpufreq.h b/include/linux/cpufreq.h |
6303 |
+index e684a9ba98a3..a0e12cf8919c 100644 |
6304 |
+--- a/include/linux/cpufreq.h |
6305 |
++++ b/include/linux/cpufreq.h |
6306 |
+@@ -100,10 +100,6 @@ struct cpufreq_policy { |
6307 |
+ * - Any routine that will write to the policy structure and/or may take away |
6308 |
+ * the policy altogether (eg. CPU hotplug), will hold this lock in write |
6309 |
+ * mode before doing so. |
6310 |
+- * |
6311 |
+- * Additional rules: |
6312 |
+- * - Lock should not be held across |
6313 |
+- * __cpufreq_governor(data, CPUFREQ_GOV_POLICY_EXIT); |
6314 |
+ */ |
6315 |
+ struct rw_semaphore rwsem; |
6316 |
+ |
6317 |
+diff --git a/include/linux/ieee80211.h b/include/linux/ieee80211.h |
6318 |
+index 149a7a6687e9..e7a278ca1fde 100644 |
6319 |
+--- a/include/linux/ieee80211.h |
6320 |
++++ b/include/linux/ieee80211.h |
6321 |
+@@ -606,6 +606,15 @@ static inline bool ieee80211_is_qos_nullfunc(__le16 fc) |
6322 |
+ cpu_to_le16(IEEE80211_FTYPE_DATA | IEEE80211_STYPE_QOS_NULLFUNC); |
6323 |
+ } |
6324 |
+ |
6325 |
++/** |
6326 |
++ * ieee80211_is_any_nullfunc - check if frame is regular or QoS nullfunc frame |
6327 |
++ * @fc: frame control bytes in little-endian byteorder |
6328 |
++ */ |
6329 |
++static inline bool ieee80211_is_any_nullfunc(__le16 fc) |
6330 |
++{ |
6331 |
++ return (ieee80211_is_nullfunc(fc) || ieee80211_is_qos_nullfunc(fc)); |
6332 |
++} |
6333 |
++ |
6334 |
+ /** |
6335 |
+ * ieee80211_is_bufferable_mmpdu - check if frame is bufferable MMPDU |
6336 |
+ * @fc: frame control field in little-endian byteorder |
6337 |
+diff --git a/include/linux/mlx5/driver.h b/include/linux/mlx5/driver.h |
6338 |
+index 412aa988c6ad..06cc39623d13 100644 |
6339 |
+--- a/include/linux/mlx5/driver.h |
6340 |
++++ b/include/linux/mlx5/driver.h |
6341 |
+@@ -54,7 +54,7 @@ enum { |
6342 |
+ /* one minute for the sake of bringup. Generally, commands must always |
6343 |
+ * complete and we may need to increase this timeout value |
6344 |
+ */ |
6345 |
+- MLX5_CMD_TIMEOUT_MSEC = 7200 * 1000, |
6346 |
++ MLX5_CMD_TIMEOUT_MSEC = 60 * 1000, |
6347 |
+ MLX5_CMD_WQ_MAX_NAME = 32, |
6348 |
+ }; |
6349 |
+ |
6350 |
+@@ -566,6 +566,7 @@ struct mlx5_cmd_work_ent { |
6351 |
+ void *uout; |
6352 |
+ int uout_size; |
6353 |
+ mlx5_cmd_cbk_t callback; |
6354 |
++ struct delayed_work cb_timeout_work; |
6355 |
+ void *context; |
6356 |
+ int idx; |
6357 |
+ struct completion done; |
6358 |
+diff --git a/include/linux/mlx5/qp.h b/include/linux/mlx5/qp.h |
6359 |
+index a8786d27ab81..489fc317746a 100644 |
6360 |
+--- a/include/linux/mlx5/qp.h |
6361 |
++++ b/include/linux/mlx5/qp.h |
6362 |
+@@ -539,6 +539,7 @@ struct mlx5_modify_qp_mbox_in { |
6363 |
+ __be32 optparam; |
6364 |
+ u8 rsvd1[4]; |
6365 |
+ struct mlx5_qp_context ctx; |
6366 |
++ u8 rsvd2[16]; |
6367 |
+ }; |
6368 |
+ |
6369 |
+ struct mlx5_modify_qp_mbox_out { |
6370 |
+diff --git a/include/linux/mtd/nand.h b/include/linux/mtd/nand.h |
6371 |
+index 5a9d1d4c2487..93fc37200793 100644 |
6372 |
+--- a/include/linux/mtd/nand.h |
6373 |
++++ b/include/linux/mtd/nand.h |
6374 |
+@@ -276,7 +276,7 @@ struct nand_onfi_params { |
6375 |
+ __le16 t_r; |
6376 |
+ __le16 t_ccs; |
6377 |
+ __le16 src_sync_timing_mode; |
6378 |
+- __le16 src_ssync_features; |
6379 |
++ u8 src_ssync_features; |
6380 |
+ __le16 clk_pin_capacitance_typ; |
6381 |
+ __le16 io_pin_capacitance_typ; |
6382 |
+ __le16 input_pin_capacitance_typ; |
6383 |
+@@ -284,7 +284,7 @@ struct nand_onfi_params { |
6384 |
+ u8 driver_strength_support; |
6385 |
+ __le16 t_int_r; |
6386 |
+ __le16 t_ald; |
6387 |
+- u8 reserved4[7]; |
6388 |
++ u8 reserved4[8]; |
6389 |
+ |
6390 |
+ /* vendor */ |
6391 |
+ __le16 vendor_revision; |
6392 |
+diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h |
6393 |
+index d999e503ba8a..c1a42027ee0e 100644 |
6394 |
+--- a/include/linux/netdevice.h |
6395 |
++++ b/include/linux/netdevice.h |
6396 |
+@@ -2013,7 +2013,10 @@ struct napi_gro_cb { |
6397 |
+ /* Number of gro_receive callbacks this packet already went through */ |
6398 |
+ u8 recursion_counter:4; |
6399 |
+ |
6400 |
+- /* 3 bit hole */ |
6401 |
++ /* Used in GRE, set in fou/gue_gro_receive */ |
6402 |
++ u8 is_fou:1; |
6403 |
++ |
6404 |
++ /* 2 bit hole */ |
6405 |
+ |
6406 |
+ /* used to support CHECKSUM_COMPLETE for tunneling protocols */ |
6407 |
+ __wsum csum; |
6408 |
+diff --git a/include/linux/sunrpc/msg_prot.h b/include/linux/sunrpc/msg_prot.h |
6409 |
+index 807371357160..59cbf16eaeb5 100644 |
6410 |
+--- a/include/linux/sunrpc/msg_prot.h |
6411 |
++++ b/include/linux/sunrpc/msg_prot.h |
6412 |
+@@ -158,9 +158,9 @@ typedef __be32 rpc_fraghdr; |
6413 |
+ |
6414 |
+ /* |
6415 |
+ * Note that RFC 1833 does not put any size restrictions on the |
6416 |
+- * netid string, but all currently defined netid's fit in 4 bytes. |
6417 |
++ * netid string, but all currently defined netid's fit in 5 bytes. |
6418 |
+ */ |
6419 |
+-#define RPCBIND_MAXNETIDLEN (4u) |
6420 |
++#define RPCBIND_MAXNETIDLEN (5u) |
6421 |
+ |
6422 |
+ /* |
6423 |
+ * Universal addresses are introduced in RFC 1833 and further spelled |
6424 |
+diff --git a/include/net/bonding.h b/include/net/bonding.h |
6425 |
+index d5abd3a80896..6fbfc21b27b1 100644 |
6426 |
+--- a/include/net/bonding.h |
6427 |
++++ b/include/net/bonding.h |
6428 |
+@@ -34,6 +34,9 @@ |
6429 |
+ |
6430 |
+ #define BOND_DEFAULT_MIIMON 100 |
6431 |
+ |
6432 |
++#ifndef __long_aligned |
6433 |
++#define __long_aligned __attribute__((aligned((sizeof(long))))) |
6434 |
++#endif |
6435 |
+ /* |
6436 |
+ * Less bad way to call ioctl from within the kernel; this needs to be |
6437 |
+ * done some other way to get the call out of interrupt context. |
6438 |
+@@ -138,7 +141,9 @@ struct bond_params { |
6439 |
+ struct reciprocal_value reciprocal_packets_per_slave; |
6440 |
+ u16 ad_actor_sys_prio; |
6441 |
+ u16 ad_user_port_key; |
6442 |
+- u8 ad_actor_system[ETH_ALEN]; |
6443 |
++ |
6444 |
++ /* 2 bytes of padding : see ether_addr_equal_64bits() */ |
6445 |
++ u8 ad_actor_system[ETH_ALEN + 2]; |
6446 |
+ }; |
6447 |
+ |
6448 |
+ struct bond_parm_tbl { |
6449 |
+diff --git a/include/net/ip6_fib.h b/include/net/ip6_fib.h |
6450 |
+index fa5e703a14ed..a6bcb18ac4c3 100644 |
6451 |
+--- a/include/net/ip6_fib.h |
6452 |
++++ b/include/net/ip6_fib.h |
6453 |
+@@ -258,6 +258,8 @@ struct fib6_table { |
6454 |
+ rwlock_t tb6_lock; |
6455 |
+ struct fib6_node tb6_root; |
6456 |
+ struct inet_peer_base tb6_peers; |
6457 |
++ unsigned int flags; |
6458 |
++#define RT6_TABLE_HAS_DFLT_ROUTER BIT(0) |
6459 |
+ }; |
6460 |
+ |
6461 |
+ #define RT6_TABLE_UNSPEC RT_TABLE_UNSPEC |
6462 |
+diff --git a/include/net/ip6_route.h b/include/net/ip6_route.h |
6463 |
+index df6474c37ca0..8d0a9b1fc39a 100644 |
6464 |
+--- a/include/net/ip6_route.h |
6465 |
++++ b/include/net/ip6_route.h |
6466 |
+@@ -103,6 +103,9 @@ void fib6_force_start_gc(struct net *net); |
6467 |
+ struct rt6_info *addrconf_dst_alloc(struct inet6_dev *idev, |
6468 |
+ const struct in6_addr *addr, bool anycast); |
6469 |
+ |
6470 |
++struct rt6_info *ip6_dst_alloc(struct net *net, struct net_device *dev, |
6471 |
++ int flags); |
6472 |
++ |
6473 |
+ /* |
6474 |
+ * support functions for ND |
6475 |
+ * |
6476 |
+diff --git a/include/net/ip_fib.h b/include/net/ip_fib.h |
6477 |
+index f6ff83b2ac87..b8dfab88c877 100644 |
6478 |
+--- a/include/net/ip_fib.h |
6479 |
++++ b/include/net/ip_fib.h |
6480 |
+@@ -112,6 +112,7 @@ struct fib_info { |
6481 |
+ unsigned char fib_scope; |
6482 |
+ unsigned char fib_type; |
6483 |
+ __be32 fib_prefsrc; |
6484 |
++ u32 fib_tb_id; |
6485 |
+ u32 fib_priority; |
6486 |
+ struct dst_metrics *fib_metrics; |
6487 |
+ #define fib_mtu fib_metrics->metrics[RTAX_MTU-1] |
6488 |
+@@ -320,7 +321,7 @@ void fib_flush_external(struct net *net); |
6489 |
+ /* Exported by fib_semantics.c */ |
6490 |
+ int ip_fib_check_default(__be32 gw, struct net_device *dev); |
6491 |
+ int fib_sync_down_dev(struct net_device *dev, unsigned long event, bool force); |
6492 |
+-int fib_sync_down_addr(struct net *net, __be32 local); |
6493 |
++int fib_sync_down_addr(struct net_device *dev, __be32 local); |
6494 |
+ int fib_sync_up(struct net_device *dev, unsigned int nh_flags); |
6495 |
+ void fib_sync_mtu(struct net_device *dev, u32 orig_mtu); |
6496 |
+ |
6497 |
+diff --git a/include/net/route.h b/include/net/route.h |
6498 |
+index d2a92d94ff72..6be55d00a200 100644 |
6499 |
+--- a/include/net/route.h |
6500 |
++++ b/include/net/route.h |
6501 |
+@@ -210,6 +210,9 @@ unsigned int inet_addr_type_dev_table(struct net *net, |
6502 |
+ void ip_rt_multicast_event(struct in_device *); |
6503 |
+ int ip_rt_ioctl(struct net *, unsigned int cmd, void __user *arg); |
6504 |
+ void ip_rt_get_source(u8 *src, struct sk_buff *skb, struct rtable *rt); |
6505 |
++struct rtable *rt_dst_alloc(struct net_device *dev, |
6506 |
++ unsigned int flags, u16 type, |
6507 |
++ bool nopolicy, bool noxfrm, bool will_cache); |
6508 |
+ |
6509 |
+ struct in_ifaddr; |
6510 |
+ void fib_add_ifaddr(struct in_ifaddr *); |
6511 |
+diff --git a/include/net/sch_generic.h b/include/net/sch_generic.h |
6512 |
+index ccd2a964dad7..d236ce450da3 100644 |
6513 |
+--- a/include/net/sch_generic.h |
6514 |
++++ b/include/net/sch_generic.h |
6515 |
+@@ -674,9 +674,11 @@ static inline struct sk_buff *qdisc_peek_dequeued(struct Qdisc *sch) |
6516 |
+ /* we can reuse ->gso_skb because peek isn't called for root qdiscs */ |
6517 |
+ if (!sch->gso_skb) { |
6518 |
+ sch->gso_skb = sch->dequeue(sch); |
6519 |
+- if (sch->gso_skb) |
6520 |
++ if (sch->gso_skb) { |
6521 |
+ /* it's still part of the queue */ |
6522 |
++ qdisc_qstats_backlog_inc(sch, sch->gso_skb); |
6523 |
+ sch->q.qlen++; |
6524 |
++ } |
6525 |
+ } |
6526 |
+ |
6527 |
+ return sch->gso_skb; |
6528 |
+@@ -689,6 +691,7 @@ static inline struct sk_buff *qdisc_dequeue_peeked(struct Qdisc *sch) |
6529 |
+ |
6530 |
+ if (skb) { |
6531 |
+ sch->gso_skb = NULL; |
6532 |
++ qdisc_qstats_backlog_dec(sch, skb); |
6533 |
+ sch->q.qlen--; |
6534 |
+ } else { |
6535 |
+ skb = sch->dequeue(sch); |
6536 |
+diff --git a/include/net/sock.h b/include/net/sock.h |
6537 |
+index de4434284a34..be5ec94020f1 100644 |
6538 |
+--- a/include/net/sock.h |
6539 |
++++ b/include/net/sock.h |
6540 |
+@@ -1204,11 +1204,13 @@ static inline void memcg_memory_allocated_add(struct cg_proto *prot, |
6541 |
+ unsigned long amt, |
6542 |
+ int *parent_status) |
6543 |
+ { |
6544 |
+- page_counter_charge(&prot->memory_allocated, amt); |
6545 |
++ struct page_counter *counter; |
6546 |
++ |
6547 |
++ if (page_counter_try_charge(&prot->memory_allocated, amt, &counter)) |
6548 |
++ return; |
6549 |
+ |
6550 |
+- if (page_counter_read(&prot->memory_allocated) > |
6551 |
+- prot->memory_allocated.limit) |
6552 |
+- *parent_status = OVER_LIMIT; |
6553 |
++ page_counter_charge(&prot->memory_allocated, amt); |
6554 |
++ *parent_status = OVER_LIMIT; |
6555 |
+ } |
6556 |
+ |
6557 |
+ static inline void memcg_memory_allocated_sub(struct cg_proto *prot, |
6558 |
+@@ -1651,7 +1653,13 @@ static inline void sock_put(struct sock *sk) |
6559 |
+ */ |
6560 |
+ void sock_gen_put(struct sock *sk); |
6561 |
+ |
6562 |
+-int sk_receive_skb(struct sock *sk, struct sk_buff *skb, const int nested); |
6563 |
++int __sk_receive_skb(struct sock *sk, struct sk_buff *skb, const int nested, |
6564 |
++ unsigned int trim_cap); |
6565 |
++static inline int sk_receive_skb(struct sock *sk, struct sk_buff *skb, |
6566 |
++ const int nested) |
6567 |
++{ |
6568 |
++ return __sk_receive_skb(sk, skb, nested, 1); |
6569 |
++} |
6570 |
+ |
6571 |
+ static inline void sk_tx_queue_set(struct sock *sk, int tx_queue) |
6572 |
+ { |
6573 |
+diff --git a/include/net/xfrm.h b/include/net/xfrm.h |
6574 |
+index 631614856afc..89685c7bc7c0 100644 |
6575 |
+--- a/include/net/xfrm.h |
6576 |
++++ b/include/net/xfrm.h |
6577 |
+@@ -1551,8 +1551,10 @@ int xfrm4_tunnel_deregister(struct xfrm_tunnel *handler, unsigned short family); |
6578 |
+ void xfrm4_local_error(struct sk_buff *skb, u32 mtu); |
6579 |
+ int xfrm6_extract_header(struct sk_buff *skb); |
6580 |
+ int xfrm6_extract_input(struct xfrm_state *x, struct sk_buff *skb); |
6581 |
+-int xfrm6_rcv_spi(struct sk_buff *skb, int nexthdr, __be32 spi); |
6582 |
++int xfrm6_rcv_spi(struct sk_buff *skb, int nexthdr, __be32 spi, |
6583 |
++ struct ip6_tnl *t); |
6584 |
+ int xfrm6_transport_finish(struct sk_buff *skb, int async); |
6585 |
++int xfrm6_rcv_tnl(struct sk_buff *skb, struct ip6_tnl *t); |
6586 |
+ int xfrm6_rcv(struct sk_buff *skb); |
6587 |
+ int xfrm6_input_addr(struct sk_buff *skb, xfrm_address_t *daddr, |
6588 |
+ xfrm_address_t *saddr, u8 proto); |
6589 |
+diff --git a/kernel/bpf/syscall.c b/kernel/bpf/syscall.c |
6590 |
+index fd3fd8d17ef5..01431ef8cf07 100644 |
6591 |
+--- a/kernel/bpf/syscall.c |
6592 |
++++ b/kernel/bpf/syscall.c |
6593 |
+@@ -152,7 +152,7 @@ static int map_create(union bpf_attr *attr) |
6594 |
+ |
6595 |
+ err = bpf_map_charge_memlock(map); |
6596 |
+ if (err) |
6597 |
+- goto free_map; |
6598 |
++ goto free_map_nouncharge; |
6599 |
+ |
6600 |
+ err = bpf_map_new_fd(map); |
6601 |
+ if (err < 0) |
6602 |
+@@ -162,6 +162,8 @@ static int map_create(union bpf_attr *attr) |
6603 |
+ return err; |
6604 |
+ |
6605 |
+ free_map: |
6606 |
++ bpf_map_uncharge_memlock(map); |
6607 |
++free_map_nouncharge: |
6608 |
+ map->ops->map_free(map); |
6609 |
+ return err; |
6610 |
+ } |
6611 |
+diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c |
6612 |
+index b42d2b8b283e..0daf4a40a985 100644 |
6613 |
+--- a/kernel/sched/fair.c |
6614 |
++++ b/kernel/sched/fair.c |
6615 |
+@@ -2394,28 +2394,22 @@ account_entity_dequeue(struct cfs_rq *cfs_rq, struct sched_entity *se) |
6616 |
+ |
6617 |
+ #ifdef CONFIG_FAIR_GROUP_SCHED |
6618 |
+ # ifdef CONFIG_SMP |
6619 |
+-static inline long calc_tg_weight(struct task_group *tg, struct cfs_rq *cfs_rq) |
6620 |
++static long calc_cfs_shares(struct cfs_rq *cfs_rq, struct task_group *tg) |
6621 |
+ { |
6622 |
+- long tg_weight; |
6623 |
++ long tg_weight, load, shares; |
6624 |
+ |
6625 |
+ /* |
6626 |
+- * Use this CPU's real-time load instead of the last load contribution |
6627 |
+- * as the updating of the contribution is delayed, and we will use the |
6628 |
+- * the real-time load to calc the share. See update_tg_load_avg(). |
6629 |
++ * This really should be: cfs_rq->avg.load_avg, but instead we use |
6630 |
++ * cfs_rq->load.weight, which is its upper bound. This helps ramp up |
6631 |
++ * the shares for small weight interactive tasks. |
6632 |
+ */ |
6633 |
+- tg_weight = atomic_long_read(&tg->load_avg); |
6634 |
+- tg_weight -= cfs_rq->tg_load_avg_contrib; |
6635 |
+- tg_weight += cfs_rq->load.weight; |
6636 |
+- |
6637 |
+- return tg_weight; |
6638 |
+-} |
6639 |
++ load = scale_load_down(cfs_rq->load.weight); |
6640 |
+ |
6641 |
+-static long calc_cfs_shares(struct cfs_rq *cfs_rq, struct task_group *tg) |
6642 |
+-{ |
6643 |
+- long tg_weight, load, shares; |
6644 |
++ tg_weight = atomic_long_read(&tg->load_avg); |
6645 |
+ |
6646 |
+- tg_weight = calc_tg_weight(tg, cfs_rq); |
6647 |
+- load = cfs_rq->load.weight; |
6648 |
++ /* Ensure tg_weight >= load */ |
6649 |
++ tg_weight -= cfs_rq->tg_load_avg_contrib; |
6650 |
++ tg_weight += load; |
6651 |
+ |
6652 |
+ shares = (tg->shares * load); |
6653 |
+ if (tg_weight) |
6654 |
+@@ -2434,6 +2428,7 @@ static inline long calc_cfs_shares(struct cfs_rq *cfs_rq, struct task_group *tg) |
6655 |
+ return tg->shares; |
6656 |
+ } |
6657 |
+ # endif /* CONFIG_SMP */ |
6658 |
++ |
6659 |
+ static void reweight_entity(struct cfs_rq *cfs_rq, struct sched_entity *se, |
6660 |
+ unsigned long weight) |
6661 |
+ { |
6662 |
+diff --git a/kernel/trace/bpf_trace.c b/kernel/trace/bpf_trace.c |
6663 |
+index 3dd40c736067..a71bdad638d5 100644 |
6664 |
+--- a/kernel/trace/bpf_trace.c |
6665 |
++++ b/kernel/trace/bpf_trace.c |
6666 |
+@@ -206,6 +206,10 @@ static u64 bpf_perf_event_read(u64 r1, u64 index, u64 r3, u64 r4, u64 r5) |
6667 |
+ event->pmu->count) |
6668 |
+ return -EINVAL; |
6669 |
+ |
6670 |
++ if (unlikely(event->attr.type != PERF_TYPE_HARDWARE && |
6671 |
++ event->attr.type != PERF_TYPE_RAW)) |
6672 |
++ return -EINVAL; |
6673 |
++ |
6674 |
+ /* |
6675 |
+ * we don't know if the function is run successfully by the |
6676 |
+ * return value. It can be judged in other places, such as |
6677 |
+diff --git a/lib/mpi/longlong.h b/lib/mpi/longlong.h |
6678 |
+index d2ecf0a09180..f1f31c754b3e 100644 |
6679 |
+--- a/lib/mpi/longlong.h |
6680 |
++++ b/lib/mpi/longlong.h |
6681 |
+@@ -756,22 +756,22 @@ do { \ |
6682 |
+ do { \ |
6683 |
+ if (__builtin_constant_p(bh) && (bh) == 0) \ |
6684 |
+ __asm__ ("{a%I4|add%I4c} %1,%3,%4\n\t{aze|addze} %0,%2" \ |
6685 |
+- : "=r" ((USItype)(sh)), \ |
6686 |
+- "=&r" ((USItype)(sl)) \ |
6687 |
++ : "=r" (sh), \ |
6688 |
++ "=&r" (sl) \ |
6689 |
+ : "%r" ((USItype)(ah)), \ |
6690 |
+ "%r" ((USItype)(al)), \ |
6691 |
+ "rI" ((USItype)(bl))); \ |
6692 |
+ else if (__builtin_constant_p(bh) && (bh) == ~(USItype) 0) \ |
6693 |
+ __asm__ ("{a%I4|add%I4c} %1,%3,%4\n\t{ame|addme} %0,%2" \ |
6694 |
+- : "=r" ((USItype)(sh)), \ |
6695 |
+- "=&r" ((USItype)(sl)) \ |
6696 |
++ : "=r" (sh), \ |
6697 |
++ "=&r" (sl) \ |
6698 |
+ : "%r" ((USItype)(ah)), \ |
6699 |
+ "%r" ((USItype)(al)), \ |
6700 |
+ "rI" ((USItype)(bl))); \ |
6701 |
+ else \ |
6702 |
+ __asm__ ("{a%I5|add%I5c} %1,%4,%5\n\t{ae|adde} %0,%2,%3" \ |
6703 |
+- : "=r" ((USItype)(sh)), \ |
6704 |
+- "=&r" ((USItype)(sl)) \ |
6705 |
++ : "=r" (sh), \ |
6706 |
++ "=&r" (sl) \ |
6707 |
+ : "%r" ((USItype)(ah)), \ |
6708 |
+ "r" ((USItype)(bh)), \ |
6709 |
+ "%r" ((USItype)(al)), \ |
6710 |
+@@ -781,36 +781,36 @@ do { \ |
6711 |
+ do { \ |
6712 |
+ if (__builtin_constant_p(ah) && (ah) == 0) \ |
6713 |
+ __asm__ ("{sf%I3|subf%I3c} %1,%4,%3\n\t{sfze|subfze} %0,%2" \ |
6714 |
+- : "=r" ((USItype)(sh)), \ |
6715 |
+- "=&r" ((USItype)(sl)) \ |
6716 |
++ : "=r" (sh), \ |
6717 |
++ "=&r" (sl) \ |
6718 |
+ : "r" ((USItype)(bh)), \ |
6719 |
+ "rI" ((USItype)(al)), \ |
6720 |
+ "r" ((USItype)(bl))); \ |
6721 |
+ else if (__builtin_constant_p(ah) && (ah) == ~(USItype) 0) \ |
6722 |
+ __asm__ ("{sf%I3|subf%I3c} %1,%4,%3\n\t{sfme|subfme} %0,%2" \ |
6723 |
+- : "=r" ((USItype)(sh)), \ |
6724 |
+- "=&r" ((USItype)(sl)) \ |
6725 |
++ : "=r" (sh), \ |
6726 |
++ "=&r" (sl) \ |
6727 |
+ : "r" ((USItype)(bh)), \ |
6728 |
+ "rI" ((USItype)(al)), \ |
6729 |
+ "r" ((USItype)(bl))); \ |
6730 |
+ else if (__builtin_constant_p(bh) && (bh) == 0) \ |
6731 |
+ __asm__ ("{sf%I3|subf%I3c} %1,%4,%3\n\t{ame|addme} %0,%2" \ |
6732 |
+- : "=r" ((USItype)(sh)), \ |
6733 |
+- "=&r" ((USItype)(sl)) \ |
6734 |
++ : "=r" (sh), \ |
6735 |
++ "=&r" (sl) \ |
6736 |
+ : "r" ((USItype)(ah)), \ |
6737 |
+ "rI" ((USItype)(al)), \ |
6738 |
+ "r" ((USItype)(bl))); \ |
6739 |
+ else if (__builtin_constant_p(bh) && (bh) == ~(USItype) 0) \ |
6740 |
+ __asm__ ("{sf%I3|subf%I3c} %1,%4,%3\n\t{aze|addze} %0,%2" \ |
6741 |
+- : "=r" ((USItype)(sh)), \ |
6742 |
+- "=&r" ((USItype)(sl)) \ |
6743 |
++ : "=r" (sh), \ |
6744 |
++ "=&r" (sl) \ |
6745 |
+ : "r" ((USItype)(ah)), \ |
6746 |
+ "rI" ((USItype)(al)), \ |
6747 |
+ "r" ((USItype)(bl))); \ |
6748 |
+ else \ |
6749 |
+ __asm__ ("{sf%I4|subf%I4c} %1,%5,%4\n\t{sfe|subfe} %0,%3,%2" \ |
6750 |
+- : "=r" ((USItype)(sh)), \ |
6751 |
+- "=&r" ((USItype)(sl)) \ |
6752 |
++ : "=r" (sh), \ |
6753 |
++ "=&r" (sl) \ |
6754 |
+ : "r" ((USItype)(ah)), \ |
6755 |
+ "r" ((USItype)(bh)), \ |
6756 |
+ "rI" ((USItype)(al)), \ |
6757 |
+@@ -821,7 +821,7 @@ do { \ |
6758 |
+ do { \ |
6759 |
+ USItype __m0 = (m0), __m1 = (m1); \ |
6760 |
+ __asm__ ("mulhwu %0,%1,%2" \ |
6761 |
+- : "=r" ((USItype) ph) \ |
6762 |
++ : "=r" (ph) \ |
6763 |
+ : "%r" (__m0), \ |
6764 |
+ "r" (__m1)); \ |
6765 |
+ (pl) = __m0 * __m1; \ |
6766 |
+diff --git a/net/batman-adv/main.c b/net/batman-adv/main.c |
6767 |
+index 2bdbaff3279b..88cea5154113 100644 |
6768 |
+--- a/net/batman-adv/main.c |
6769 |
++++ b/net/batman-adv/main.c |
6770 |
+@@ -747,7 +747,7 @@ static u16 batadv_tvlv_container_list_size(struct batadv_priv *bat_priv) |
6771 |
+ static void batadv_tvlv_container_remove(struct batadv_priv *bat_priv, |
6772 |
+ struct batadv_tvlv_container *tvlv) |
6773 |
+ { |
6774 |
+- lockdep_assert_held(&bat_priv->tvlv.handler_list_lock); |
6775 |
++ lockdep_assert_held(&bat_priv->tvlv.container_list_lock); |
6776 |
+ |
6777 |
+ if (!tvlv) |
6778 |
+ return; |
6779 |
+diff --git a/net/batman-adv/translation-table.c b/net/batman-adv/translation-table.c |
6780 |
+index 67ee7c83a28d..06f366d234ff 100644 |
6781 |
+--- a/net/batman-adv/translation-table.c |
6782 |
++++ b/net/batman-adv/translation-table.c |
6783 |
+@@ -614,8 +614,10 @@ bool batadv_tt_local_add(struct net_device *soft_iface, const u8 *addr, |
6784 |
+ |
6785 |
+ /* increase the refcounter of the related vlan */ |
6786 |
+ vlan = batadv_softif_vlan_get(bat_priv, vid); |
6787 |
+- if (WARN(!vlan, "adding TT local entry %pM to non-existent VLAN %d", |
6788 |
+- addr, BATADV_PRINT_VID(vid))) { |
6789 |
++ if (!vlan) { |
6790 |
++ net_ratelimited_function(batadv_info, soft_iface, |
6791 |
++ "adding TT local entry %pM to non-existent VLAN %d\n", |
6792 |
++ addr, BATADV_PRINT_VID(vid)); |
6793 |
+ kfree(tt_local); |
6794 |
+ tt_local = NULL; |
6795 |
+ goto out; |
6796 |
+diff --git a/net/bridge/br_fdb.c b/net/bridge/br_fdb.c |
6797 |
+index 09442e0f7f67..1aa1d3d4979f 100644 |
6798 |
+--- a/net/bridge/br_fdb.c |
6799 |
++++ b/net/bridge/br_fdb.c |
6800 |
+@@ -266,7 +266,7 @@ void br_fdb_change_mac_address(struct net_bridge *br, const u8 *newaddr) |
6801 |
+ |
6802 |
+ /* If old entry was unassociated with any port, then delete it. */ |
6803 |
+ f = __br_fdb_get(br, br->dev->dev_addr, 0); |
6804 |
+- if (f && f->is_local && !f->dst) |
6805 |
++ if (f && f->is_local && !f->dst && !f->added_by_user) |
6806 |
+ fdb_delete_local(br, NULL, f); |
6807 |
+ |
6808 |
+ fdb_insert(br, NULL, newaddr, 0); |
6809 |
+@@ -281,7 +281,7 @@ void br_fdb_change_mac_address(struct net_bridge *br, const u8 *newaddr) |
6810 |
+ if (!br_vlan_should_use(v)) |
6811 |
+ continue; |
6812 |
+ f = __br_fdb_get(br, br->dev->dev_addr, v->vid); |
6813 |
+- if (f && f->is_local && !f->dst) |
6814 |
++ if (f && f->is_local && !f->dst && !f->added_by_user) |
6815 |
+ fdb_delete_local(br, NULL, f); |
6816 |
+ fdb_insert(br, NULL, newaddr, v->vid); |
6817 |
+ } |
6818 |
+@@ -758,20 +758,25 @@ out: |
6819 |
+ } |
6820 |
+ |
6821 |
+ /* Update (create or replace) forwarding database entry */ |
6822 |
+-static int fdb_add_entry(struct net_bridge_port *source, const __u8 *addr, |
6823 |
+- __u16 state, __u16 flags, __u16 vid) |
6824 |
++static int fdb_add_entry(struct net_bridge *br, struct net_bridge_port *source, |
6825 |
++ const __u8 *addr, __u16 state, __u16 flags, __u16 vid) |
6826 |
+ { |
6827 |
+- struct net_bridge *br = source->br; |
6828 |
+ struct hlist_head *head = &br->hash[br_mac_hash(addr, vid)]; |
6829 |
+ struct net_bridge_fdb_entry *fdb; |
6830 |
+ bool modified = false; |
6831 |
+ |
6832 |
+ /* If the port cannot learn allow only local and static entries */ |
6833 |
+- if (!(state & NUD_PERMANENT) && !(state & NUD_NOARP) && |
6834 |
++ if (source && !(state & NUD_PERMANENT) && !(state & NUD_NOARP) && |
6835 |
+ !(source->state == BR_STATE_LEARNING || |
6836 |
+ source->state == BR_STATE_FORWARDING)) |
6837 |
+ return -EPERM; |
6838 |
+ |
6839 |
++ if (!source && !(state & NUD_PERMANENT)) { |
6840 |
++ pr_info("bridge: RTM_NEWNEIGH %s without NUD_PERMANENT\n", |
6841 |
++ br->dev->name); |
6842 |
++ return -EINVAL; |
6843 |
++ } |
6844 |
++ |
6845 |
+ fdb = fdb_find(head, addr, vid); |
6846 |
+ if (fdb == NULL) { |
6847 |
+ if (!(flags & NLM_F_CREATE)) |
6848 |
+@@ -826,22 +831,28 @@ static int fdb_add_entry(struct net_bridge_port *source, const __u8 *addr, |
6849 |
+ return 0; |
6850 |
+ } |
6851 |
+ |
6852 |
+-static int __br_fdb_add(struct ndmsg *ndm, struct net_bridge_port *p, |
6853 |
+- const unsigned char *addr, u16 nlh_flags, u16 vid) |
6854 |
++static int __br_fdb_add(struct ndmsg *ndm, struct net_bridge *br, |
6855 |
++ struct net_bridge_port *p, const unsigned char *addr, |
6856 |
++ u16 nlh_flags, u16 vid) |
6857 |
+ { |
6858 |
+ int err = 0; |
6859 |
+ |
6860 |
+ if (ndm->ndm_flags & NTF_USE) { |
6861 |
++ if (!p) { |
6862 |
++ pr_info("bridge: RTM_NEWNEIGH %s with NTF_USE is not supported\n", |
6863 |
++ br->dev->name); |
6864 |
++ return -EINVAL; |
6865 |
++ } |
6866 |
+ local_bh_disable(); |
6867 |
+ rcu_read_lock(); |
6868 |
+- br_fdb_update(p->br, p, addr, vid, true); |
6869 |
++ br_fdb_update(br, p, addr, vid, true); |
6870 |
+ rcu_read_unlock(); |
6871 |
+ local_bh_enable(); |
6872 |
+ } else { |
6873 |
+- spin_lock_bh(&p->br->hash_lock); |
6874 |
+- err = fdb_add_entry(p, addr, ndm->ndm_state, |
6875 |
++ spin_lock_bh(&br->hash_lock); |
6876 |
++ err = fdb_add_entry(br, p, addr, ndm->ndm_state, |
6877 |
+ nlh_flags, vid); |
6878 |
+- spin_unlock_bh(&p->br->hash_lock); |
6879 |
++ spin_unlock_bh(&br->hash_lock); |
6880 |
+ } |
6881 |
+ |
6882 |
+ return err; |
6883 |
+@@ -878,6 +889,7 @@ int br_fdb_add(struct ndmsg *ndm, struct nlattr *tb[], |
6884 |
+ dev->name); |
6885 |
+ return -EINVAL; |
6886 |
+ } |
6887 |
++ br = p->br; |
6888 |
+ vg = nbp_vlan_group(p); |
6889 |
+ } |
6890 |
+ |
6891 |
+@@ -889,15 +901,9 @@ int br_fdb_add(struct ndmsg *ndm, struct nlattr *tb[], |
6892 |
+ } |
6893 |
+ |
6894 |
+ /* VID was specified, so use it. */ |
6895 |
+- if (dev->priv_flags & IFF_EBRIDGE) |
6896 |
+- err = br_fdb_insert(br, NULL, addr, vid); |
6897 |
+- else |
6898 |
+- err = __br_fdb_add(ndm, p, addr, nlh_flags, vid); |
6899 |
++ err = __br_fdb_add(ndm, br, p, addr, nlh_flags, vid); |
6900 |
+ } else { |
6901 |
+- if (dev->priv_flags & IFF_EBRIDGE) |
6902 |
+- err = br_fdb_insert(br, NULL, addr, 0); |
6903 |
+- else |
6904 |
+- err = __br_fdb_add(ndm, p, addr, nlh_flags, 0); |
6905 |
++ err = __br_fdb_add(ndm, br, p, addr, nlh_flags, 0); |
6906 |
+ if (err || !vg || !vg->num_vlans) |
6907 |
+ goto out; |
6908 |
+ |
6909 |
+@@ -908,11 +914,7 @@ int br_fdb_add(struct ndmsg *ndm, struct nlattr *tb[], |
6910 |
+ list_for_each_entry(v, &vg->vlan_list, vlist) { |
6911 |
+ if (!br_vlan_should_use(v)) |
6912 |
+ continue; |
6913 |
+- if (dev->priv_flags & IFF_EBRIDGE) |
6914 |
+- err = br_fdb_insert(br, NULL, addr, v->vid); |
6915 |
+- else |
6916 |
+- err = __br_fdb_add(ndm, p, addr, nlh_flags, |
6917 |
+- v->vid); |
6918 |
++ err = __br_fdb_add(ndm, br, p, addr, nlh_flags, v->vid); |
6919 |
+ if (err) |
6920 |
+ goto out; |
6921 |
+ } |
6922 |
+diff --git a/net/bridge/br_input.c b/net/bridge/br_input.c |
6923 |
+index e24754a0e052..920b7c0f1e2d 100644 |
6924 |
+--- a/net/bridge/br_input.c |
6925 |
++++ b/net/bridge/br_input.c |
6926 |
+@@ -78,13 +78,10 @@ static void br_do_proxy_arp(struct sk_buff *skb, struct net_bridge *br, |
6927 |
+ |
6928 |
+ BR_INPUT_SKB_CB(skb)->proxyarp_replied = false; |
6929 |
+ |
6930 |
+- if (dev->flags & IFF_NOARP) |
6931 |
++ if ((dev->flags & IFF_NOARP) || |
6932 |
++ !pskb_may_pull(skb, arp_hdr_len(dev))) |
6933 |
+ return; |
6934 |
+ |
6935 |
+- if (!pskb_may_pull(skb, arp_hdr_len(dev))) { |
6936 |
+- dev->stats.tx_dropped++; |
6937 |
+- return; |
6938 |
+- } |
6939 |
+ parp = arp_hdr(skb); |
6940 |
+ |
6941 |
+ if (parp->ar_pro != htons(ETH_P_IP) || |
6942 |
+diff --git a/net/core/dev.c b/net/core/dev.c |
6943 |
+index 108c32903a74..a1043225c0c0 100644 |
6944 |
+--- a/net/core/dev.c |
6945 |
++++ b/net/core/dev.c |
6946 |
+@@ -4320,6 +4320,7 @@ static enum gro_result dev_gro_receive(struct napi_struct *napi, struct sk_buff |
6947 |
+ NAPI_GRO_CB(skb)->free = 0; |
6948 |
+ NAPI_GRO_CB(skb)->encap_mark = 0; |
6949 |
+ NAPI_GRO_CB(skb)->recursion_counter = 0; |
6950 |
++ NAPI_GRO_CB(skb)->is_fou = 0; |
6951 |
+ NAPI_GRO_CB(skb)->gro_remcsum_start = 0; |
6952 |
+ |
6953 |
+ /* Setup for GRO checksum validation */ |
6954 |
+diff --git a/net/core/flow_dissector.c b/net/core/flow_dissector.c |
6955 |
+index 496bfcb787e7..189c3f2326f9 100644 |
6956 |
+--- a/net/core/flow_dissector.c |
6957 |
++++ b/net/core/flow_dissector.c |
6958 |
+@@ -178,15 +178,16 @@ ip: |
6959 |
+ |
6960 |
+ ip_proto = iph->protocol; |
6961 |
+ |
6962 |
+- if (!dissector_uses_key(flow_dissector, |
6963 |
+- FLOW_DISSECTOR_KEY_IPV4_ADDRS)) |
6964 |
+- break; |
6965 |
++ if (dissector_uses_key(flow_dissector, |
6966 |
++ FLOW_DISSECTOR_KEY_IPV4_ADDRS)) { |
6967 |
++ key_addrs = skb_flow_dissector_target(flow_dissector, |
6968 |
++ FLOW_DISSECTOR_KEY_IPV4_ADDRS, |
6969 |
++ target_container); |
6970 |
+ |
6971 |
+- key_addrs = skb_flow_dissector_target(flow_dissector, |
6972 |
+- FLOW_DISSECTOR_KEY_IPV4_ADDRS, target_container); |
6973 |
+- memcpy(&key_addrs->v4addrs, &iph->saddr, |
6974 |
+- sizeof(key_addrs->v4addrs)); |
6975 |
+- key_control->addr_type = FLOW_DISSECTOR_KEY_IPV4_ADDRS; |
6976 |
++ memcpy(&key_addrs->v4addrs, &iph->saddr, |
6977 |
++ sizeof(key_addrs->v4addrs)); |
6978 |
++ key_control->addr_type = FLOW_DISSECTOR_KEY_IPV4_ADDRS; |
6979 |
++ } |
6980 |
+ |
6981 |
+ if (ip_is_fragment(iph)) { |
6982 |
+ key_control->flags |= FLOW_DIS_IS_FRAGMENT; |
6983 |
+diff --git a/net/core/rtnetlink.c b/net/core/rtnetlink.c |
6984 |
+index a9da58204afa..6f32d3086c7a 100644 |
6985 |
+--- a/net/core/rtnetlink.c |
6986 |
++++ b/net/core/rtnetlink.c |
6987 |
+@@ -253,6 +253,7 @@ int rtnl_unregister(int protocol, int msgtype) |
6988 |
+ |
6989 |
+ rtnl_msg_handlers[protocol][msgindex].doit = NULL; |
6990 |
+ rtnl_msg_handlers[protocol][msgindex].dumpit = NULL; |
6991 |
++ rtnl_msg_handlers[protocol][msgindex].calcit = NULL; |
6992 |
+ |
6993 |
+ return 0; |
6994 |
+ } |
6995 |
+diff --git a/net/core/skbuff.c b/net/core/skbuff.c |
6996 |
+index 2f63a90065e6..4e944fe98627 100644 |
6997 |
+--- a/net/core/skbuff.c |
6998 |
++++ b/net/core/skbuff.c |
6999 |
+@@ -4451,9 +4451,8 @@ int skb_vlan_pop(struct sk_buff *skb) |
7000 |
+ if (likely(skb_vlan_tag_present(skb))) { |
7001 |
+ skb->vlan_tci = 0; |
7002 |
+ } else { |
7003 |
+- if (unlikely((skb->protocol != htons(ETH_P_8021Q) && |
7004 |
+- skb->protocol != htons(ETH_P_8021AD)) || |
7005 |
+- skb->len < VLAN_ETH_HLEN)) |
7006 |
++ if (unlikely(skb->protocol != htons(ETH_P_8021Q) && |
7007 |
++ skb->protocol != htons(ETH_P_8021AD))) |
7008 |
+ return 0; |
7009 |
+ |
7010 |
+ err = __skb_vlan_pop(skb, &vlan_tci); |
7011 |
+@@ -4461,9 +4460,8 @@ int skb_vlan_pop(struct sk_buff *skb) |
7012 |
+ return err; |
7013 |
+ } |
7014 |
+ /* move next vlan tag to hw accel tag */ |
7015 |
+- if (likely((skb->protocol != htons(ETH_P_8021Q) && |
7016 |
+- skb->protocol != htons(ETH_P_8021AD)) || |
7017 |
+- skb->len < VLAN_ETH_HLEN)) |
7018 |
++ if (likely(skb->protocol != htons(ETH_P_8021Q) && |
7019 |
++ skb->protocol != htons(ETH_P_8021AD))) |
7020 |
+ return 0; |
7021 |
+ |
7022 |
+ vlan_proto = skb->protocol; |
7023 |
+diff --git a/net/core/sock.c b/net/core/sock.c |
7024 |
+index 0f4c15fcd87d..60b19c3bb0f7 100644 |
7025 |
+--- a/net/core/sock.c |
7026 |
++++ b/net/core/sock.c |
7027 |
+@@ -484,11 +484,12 @@ int sock_queue_rcv_skb(struct sock *sk, struct sk_buff *skb) |
7028 |
+ } |
7029 |
+ EXPORT_SYMBOL(sock_queue_rcv_skb); |
7030 |
+ |
7031 |
+-int sk_receive_skb(struct sock *sk, struct sk_buff *skb, const int nested) |
7032 |
++int __sk_receive_skb(struct sock *sk, struct sk_buff *skb, |
7033 |
++ const int nested, unsigned int trim_cap) |
7034 |
+ { |
7035 |
+ int rc = NET_RX_SUCCESS; |
7036 |
+ |
7037 |
+- if (sk_filter(sk, skb)) |
7038 |
++ if (sk_filter_trim_cap(sk, skb, trim_cap)) |
7039 |
+ goto discard_and_relse; |
7040 |
+ |
7041 |
+ skb->dev = NULL; |
7042 |
+@@ -524,7 +525,7 @@ discard_and_relse: |
7043 |
+ kfree_skb(skb); |
7044 |
+ goto out; |
7045 |
+ } |
7046 |
+-EXPORT_SYMBOL(sk_receive_skb); |
7047 |
++EXPORT_SYMBOL(__sk_receive_skb); |
7048 |
+ |
7049 |
+ struct dst_entry *__sk_dst_check(struct sock *sk, u32 cookie) |
7050 |
+ { |
7051 |
+diff --git a/net/dccp/ipv4.c b/net/dccp/ipv4.c |
7052 |
+index ef4c44d46293..3f51280374f0 100644 |
7053 |
+--- a/net/dccp/ipv4.c |
7054 |
++++ b/net/dccp/ipv4.c |
7055 |
+@@ -868,7 +868,7 @@ lookup: |
7056 |
+ goto discard_and_relse; |
7057 |
+ nf_reset(skb); |
7058 |
+ |
7059 |
+- return sk_receive_skb(sk, skb, 1); |
7060 |
++ return __sk_receive_skb(sk, skb, 1, dh->dccph_doff * 4); |
7061 |
+ |
7062 |
+ no_dccp_socket: |
7063 |
+ if (!xfrm4_policy_check(NULL, XFRM_POLICY_IN, skb)) |
7064 |
+diff --git a/net/dccp/ipv6.c b/net/dccp/ipv6.c |
7065 |
+index d2caa4d69159..10eabd1a60aa 100644 |
7066 |
+--- a/net/dccp/ipv6.c |
7067 |
++++ b/net/dccp/ipv6.c |
7068 |
+@@ -741,7 +741,7 @@ lookup: |
7069 |
+ if (!xfrm6_policy_check(sk, XFRM_POLICY_IN, skb)) |
7070 |
+ goto discard_and_relse; |
7071 |
+ |
7072 |
+- return sk_receive_skb(sk, skb, 1) ? -1 : 0; |
7073 |
++ return __sk_receive_skb(sk, skb, 1, dh->dccph_doff * 4) ? -1 : 0; |
7074 |
+ |
7075 |
+ no_dccp_socket: |
7076 |
+ if (!xfrm6_policy_check(NULL, XFRM_POLICY_IN, skb)) |
7077 |
+diff --git a/net/dsa/slave.c b/net/dsa/slave.c |
7078 |
+index 4256ac95a141..061c3939f93b 100644 |
7079 |
+--- a/net/dsa/slave.c |
7080 |
++++ b/net/dsa/slave.c |
7081 |
+@@ -1031,7 +1031,7 @@ static int dsa_slave_phy_setup(struct dsa_slave_priv *p, |
7082 |
+ p->phy_interface = mode; |
7083 |
+ |
7084 |
+ phy_dn = of_parse_phandle(port_dn, "phy-handle", 0); |
7085 |
+- if (of_phy_is_fixed_link(port_dn)) { |
7086 |
++ if (!phy_dn && of_phy_is_fixed_link(port_dn)) { |
7087 |
+ /* In the case of a fixed PHY, the DT node associated |
7088 |
+ * to the fixed PHY is the Port DT node |
7089 |
+ */ |
7090 |
+@@ -1041,7 +1041,7 @@ static int dsa_slave_phy_setup(struct dsa_slave_priv *p, |
7091 |
+ return ret; |
7092 |
+ } |
7093 |
+ phy_is_fixed = true; |
7094 |
+- phy_dn = port_dn; |
7095 |
++ phy_dn = of_node_get(port_dn); |
7096 |
+ } |
7097 |
+ |
7098 |
+ if (ds->drv->get_phy_flags) |
7099 |
+@@ -1060,6 +1060,7 @@ static int dsa_slave_phy_setup(struct dsa_slave_priv *p, |
7100 |
+ ret = dsa_slave_phy_connect(p, slave_dev, phy_id); |
7101 |
+ if (ret) { |
7102 |
+ netdev_err(slave_dev, "failed to connect to phy%d: %d\n", phy_id, ret); |
7103 |
++ of_node_put(phy_dn); |
7104 |
+ return ret; |
7105 |
+ } |
7106 |
+ } else { |
7107 |
+@@ -1068,6 +1069,8 @@ static int dsa_slave_phy_setup(struct dsa_slave_priv *p, |
7108 |
+ phy_flags, |
7109 |
+ p->phy_interface); |
7110 |
+ } |
7111 |
++ |
7112 |
++ of_node_put(phy_dn); |
7113 |
+ } |
7114 |
+ |
7115 |
+ if (p->phy && phy_is_fixed) |
7116 |
+diff --git a/net/ipv4/devinet.c b/net/ipv4/devinet.c |
7117 |
+index 03ccacff3c3d..b062f4c41306 100644 |
7118 |
+--- a/net/ipv4/devinet.c |
7119 |
++++ b/net/ipv4/devinet.c |
7120 |
+@@ -1814,7 +1814,7 @@ void inet_netconf_notify_devconf(struct net *net, int type, int ifindex, |
7121 |
+ struct sk_buff *skb; |
7122 |
+ int err = -ENOBUFS; |
7123 |
+ |
7124 |
+- skb = nlmsg_new(inet_netconf_msgsize_devconf(type), GFP_ATOMIC); |
7125 |
++ skb = nlmsg_new(inet_netconf_msgsize_devconf(type), GFP_KERNEL); |
7126 |
+ if (!skb) |
7127 |
+ goto errout; |
7128 |
+ |
7129 |
+@@ -1826,7 +1826,7 @@ void inet_netconf_notify_devconf(struct net *net, int type, int ifindex, |
7130 |
+ kfree_skb(skb); |
7131 |
+ goto errout; |
7132 |
+ } |
7133 |
+- rtnl_notify(skb, net, 0, RTNLGRP_IPV4_NETCONF, NULL, GFP_ATOMIC); |
7134 |
++ rtnl_notify(skb, net, 0, RTNLGRP_IPV4_NETCONF, NULL, GFP_KERNEL); |
7135 |
+ return; |
7136 |
+ errout: |
7137 |
+ if (err < 0) |
7138 |
+@@ -1883,7 +1883,7 @@ static int inet_netconf_get_devconf(struct sk_buff *in_skb, |
7139 |
+ } |
7140 |
+ |
7141 |
+ err = -ENOBUFS; |
7142 |
+- skb = nlmsg_new(inet_netconf_msgsize_devconf(-1), GFP_ATOMIC); |
7143 |
++ skb = nlmsg_new(inet_netconf_msgsize_devconf(-1), GFP_KERNEL); |
7144 |
+ if (!skb) |
7145 |
+ goto errout; |
7146 |
+ |
7147 |
+@@ -2007,16 +2007,16 @@ static void inet_forward_change(struct net *net) |
7148 |
+ |
7149 |
+ for_each_netdev(net, dev) { |
7150 |
+ struct in_device *in_dev; |
7151 |
++ |
7152 |
+ if (on) |
7153 |
+ dev_disable_lro(dev); |
7154 |
+- rcu_read_lock(); |
7155 |
+- in_dev = __in_dev_get_rcu(dev); |
7156 |
++ |
7157 |
++ in_dev = __in_dev_get_rtnl(dev); |
7158 |
+ if (in_dev) { |
7159 |
+ IN_DEV_CONF_SET(in_dev, FORWARDING, on); |
7160 |
+ inet_netconf_notify_devconf(net, NETCONFA_FORWARDING, |
7161 |
+ dev->ifindex, &in_dev->cnf); |
7162 |
+ } |
7163 |
+- rcu_read_unlock(); |
7164 |
+ } |
7165 |
+ } |
7166 |
+ |
7167 |
+diff --git a/net/ipv4/fib_frontend.c b/net/ipv4/fib_frontend.c |
7168 |
+index 1f7b47ca2243..7d98aaa3bcad 100644 |
7169 |
+--- a/net/ipv4/fib_frontend.c |
7170 |
++++ b/net/ipv4/fib_frontend.c |
7171 |
+@@ -509,6 +509,7 @@ static int rtentry_to_fib_config(struct net *net, int cmd, struct rtentry *rt, |
7172 |
+ if (!dev) |
7173 |
+ return -ENODEV; |
7174 |
+ cfg->fc_oif = dev->ifindex; |
7175 |
++ cfg->fc_table = l3mdev_fib_table(dev); |
7176 |
+ if (colon) { |
7177 |
+ struct in_ifaddr *ifa; |
7178 |
+ struct in_device *in_dev = __in_dev_get_rtnl(dev); |
7179 |
+@@ -1034,7 +1035,7 @@ no_promotions: |
7180 |
+ * First of all, we scan fib_info list searching |
7181 |
+ * for stray nexthop entries, then ignite fib_flush. |
7182 |
+ */ |
7183 |
+- if (fib_sync_down_addr(dev_net(dev), ifa->ifa_local)) |
7184 |
++ if (fib_sync_down_addr(dev, ifa->ifa_local)) |
7185 |
+ fib_flush(dev_net(dev)); |
7186 |
+ } |
7187 |
+ } |
7188 |
+diff --git a/net/ipv4/fib_semantics.c b/net/ipv4/fib_semantics.c |
7189 |
+index 3109b9bb95d2..498d5a929d6f 100644 |
7190 |
+--- a/net/ipv4/fib_semantics.c |
7191 |
++++ b/net/ipv4/fib_semantics.c |
7192 |
+@@ -1069,6 +1069,7 @@ struct fib_info *fib_create_info(struct fib_config *cfg) |
7193 |
+ fi->fib_priority = cfg->fc_priority; |
7194 |
+ fi->fib_prefsrc = cfg->fc_prefsrc; |
7195 |
+ fi->fib_type = cfg->fc_type; |
7196 |
++ fi->fib_tb_id = cfg->fc_table; |
7197 |
+ |
7198 |
+ fi->fib_nhs = nhs; |
7199 |
+ change_nexthops(fi) { |
7200 |
+@@ -1352,18 +1353,21 @@ nla_put_failure: |
7201 |
+ * referring to it. |
7202 |
+ * - device went down -> we must shutdown all nexthops going via it. |
7203 |
+ */ |
7204 |
+-int fib_sync_down_addr(struct net *net, __be32 local) |
7205 |
++int fib_sync_down_addr(struct net_device *dev, __be32 local) |
7206 |
+ { |
7207 |
+ int ret = 0; |
7208 |
+ unsigned int hash = fib_laddr_hashfn(local); |
7209 |
+ struct hlist_head *head = &fib_info_laddrhash[hash]; |
7210 |
++ int tb_id = l3mdev_fib_table(dev) ? : RT_TABLE_MAIN; |
7211 |
++ struct net *net = dev_net(dev); |
7212 |
+ struct fib_info *fi; |
7213 |
+ |
7214 |
+ if (!fib_info_laddrhash || local == 0) |
7215 |
+ return 0; |
7216 |
+ |
7217 |
+ hlist_for_each_entry(fi, head, fib_lhash) { |
7218 |
+- if (!net_eq(fi->fib_net, net)) |
7219 |
++ if (!net_eq(fi->fib_net, net) || |
7220 |
++ fi->fib_tb_id != tb_id) |
7221 |
+ continue; |
7222 |
+ if (fi->fib_prefsrc == local) { |
7223 |
+ fi->fib_flags |= RTNH_F_DEAD; |
7224 |
+diff --git a/net/ipv4/fib_trie.c b/net/ipv4/fib_trie.c |
7225 |
+index 0d87639deb27..09b01b888583 100644 |
7226 |
+--- a/net/ipv4/fib_trie.c |
7227 |
++++ b/net/ipv4/fib_trie.c |
7228 |
+@@ -1714,8 +1714,10 @@ struct fib_table *fib_trie_unmerge(struct fib_table *oldtb) |
7229 |
+ local_l = fib_find_node(lt, &local_tp, l->key); |
7230 |
+ |
7231 |
+ if (fib_insert_alias(lt, local_tp, local_l, new_fa, |
7232 |
+- NULL, l->key)) |
7233 |
++ NULL, l->key)) { |
7234 |
++ kmem_cache_free(fn_alias_kmem, new_fa); |
7235 |
+ goto out; |
7236 |
++ } |
7237 |
+ } |
7238 |
+ |
7239 |
+ /* stop loop if key wrapped back to 0 */ |
7240 |
+diff --git a/net/ipv4/fou.c b/net/ipv4/fou.c |
7241 |
+index b5a137338e50..7ac370505e44 100644 |
7242 |
+--- a/net/ipv4/fou.c |
7243 |
++++ b/net/ipv4/fou.c |
7244 |
+@@ -205,6 +205,9 @@ static struct sk_buff **fou_gro_receive(struct sk_buff **head, |
7245 |
+ */ |
7246 |
+ NAPI_GRO_CB(skb)->encap_mark = 0; |
7247 |
+ |
7248 |
++ /* Flag this frame as already having an outer encap header */ |
7249 |
++ NAPI_GRO_CB(skb)->is_fou = 1; |
7250 |
++ |
7251 |
+ rcu_read_lock(); |
7252 |
+ offloads = NAPI_GRO_CB(skb)->is_ipv6 ? inet6_offloads : inet_offloads; |
7253 |
+ ops = rcu_dereference(offloads[proto]); |
7254 |
+@@ -372,6 +375,9 @@ static struct sk_buff **gue_gro_receive(struct sk_buff **head, |
7255 |
+ */ |
7256 |
+ NAPI_GRO_CB(skb)->encap_mark = 0; |
7257 |
+ |
7258 |
++ /* Flag this frame as already having an outer encap header */ |
7259 |
++ NAPI_GRO_CB(skb)->is_fou = 1; |
7260 |
++ |
7261 |
+ rcu_read_lock(); |
7262 |
+ offloads = NAPI_GRO_CB(skb)->is_ipv6 ? inet6_offloads : inet_offloads; |
7263 |
+ ops = rcu_dereference(offloads[guehdr->proto_ctype]); |
7264 |
+diff --git a/net/ipv4/gre_offload.c b/net/ipv4/gre_offload.c |
7265 |
+index 79ae0d7becbf..d9268af2ea44 100644 |
7266 |
+--- a/net/ipv4/gre_offload.c |
7267 |
++++ b/net/ipv4/gre_offload.c |
7268 |
+@@ -151,6 +151,14 @@ static struct sk_buff **gre_gro_receive(struct sk_buff **head, |
7269 |
+ if ((greh->flags & ~(GRE_KEY|GRE_CSUM)) != 0) |
7270 |
+ goto out; |
7271 |
+ |
7272 |
++ /* We can only support GRE_CSUM if we can track the location of |
7273 |
++ * the GRE header. In the case of FOU/GUE we cannot because the |
7274 |
++ * outer UDP header displaces the GRE header leaving us in a state |
7275 |
++ * of limbo. |
7276 |
++ */ |
7277 |
++ if ((greh->flags & GRE_CSUM) && NAPI_GRO_CB(skb)->is_fou) |
7278 |
++ goto out; |
7279 |
++ |
7280 |
+ type = greh->protocol; |
7281 |
+ |
7282 |
+ rcu_read_lock(); |
7283 |
+diff --git a/net/ipv4/icmp.c b/net/ipv4/icmp.c |
7284 |
+index 031945bead36..9a9f49b55abd 100644 |
7285 |
+--- a/net/ipv4/icmp.c |
7286 |
++++ b/net/ipv4/icmp.c |
7287 |
+@@ -478,7 +478,7 @@ static struct rtable *icmp_route_lookup(struct net *net, |
7288 |
+ fl4->flowi4_proto = IPPROTO_ICMP; |
7289 |
+ fl4->fl4_icmp_type = type; |
7290 |
+ fl4->fl4_icmp_code = code; |
7291 |
+- fl4->flowi4_oif = l3mdev_master_ifindex(skb_in->dev); |
7292 |
++ fl4->flowi4_oif = l3mdev_master_ifindex(skb_dst(skb_in)->dev); |
7293 |
+ |
7294 |
+ security_skb_classify_flow(skb_in, flowi4_to_flowi(fl4)); |
7295 |
+ rt = __ip_route_output_key_hash(net, fl4, |
7296 |
+@@ -503,7 +503,7 @@ static struct rtable *icmp_route_lookup(struct net *net, |
7297 |
+ if (err) |
7298 |
+ goto relookup_failed; |
7299 |
+ |
7300 |
+- if (inet_addr_type_dev_table(net, skb_in->dev, |
7301 |
++ if (inet_addr_type_dev_table(net, skb_dst(skb_in)->dev, |
7302 |
+ fl4_dec.saddr) == RTN_LOCAL) { |
7303 |
+ rt2 = __ip_route_output_key(net, &fl4_dec); |
7304 |
+ if (IS_ERR(rt2)) |
7305 |
+diff --git a/net/ipv4/ip_gre.c b/net/ipv4/ip_gre.c |
7306 |
+index 3e4184088082..e5448570d648 100644 |
7307 |
+--- a/net/ipv4/ip_gre.c |
7308 |
++++ b/net/ipv4/ip_gre.c |
7309 |
+@@ -520,7 +520,8 @@ static struct rtable *gre_get_rt(struct sk_buff *skb, |
7310 |
+ return ip_route_output_key(net, fl); |
7311 |
+ } |
7312 |
+ |
7313 |
+-static void gre_fb_xmit(struct sk_buff *skb, struct net_device *dev) |
7314 |
++static void gre_fb_xmit(struct sk_buff *skb, struct net_device *dev, |
7315 |
++ __be16 proto) |
7316 |
+ { |
7317 |
+ struct ip_tunnel_info *tun_info; |
7318 |
+ const struct ip_tunnel_key *key; |
7319 |
+@@ -563,7 +564,7 @@ static void gre_fb_xmit(struct sk_buff *skb, struct net_device *dev) |
7320 |
+ } |
7321 |
+ |
7322 |
+ flags = tun_info->key.tun_flags & (TUNNEL_CSUM | TUNNEL_KEY); |
7323 |
+- build_header(skb, tunnel_hlen, flags, htons(ETH_P_TEB), |
7324 |
++ build_header(skb, tunnel_hlen, flags, proto, |
7325 |
+ tunnel_id_to_key(tun_info->key.tun_id), 0); |
7326 |
+ |
7327 |
+ df = key->tun_flags & TUNNEL_DONT_FRAGMENT ? htons(IP_DF) : 0; |
7328 |
+@@ -605,7 +606,7 @@ static netdev_tx_t ipgre_xmit(struct sk_buff *skb, |
7329 |
+ const struct iphdr *tnl_params; |
7330 |
+ |
7331 |
+ if (tunnel->collect_md) { |
7332 |
+- gre_fb_xmit(skb, dev); |
7333 |
++ gre_fb_xmit(skb, dev, skb->protocol); |
7334 |
+ return NETDEV_TX_OK; |
7335 |
+ } |
7336 |
+ |
7337 |
+@@ -649,7 +650,7 @@ static netdev_tx_t gre_tap_xmit(struct sk_buff *skb, |
7338 |
+ struct ip_tunnel *tunnel = netdev_priv(dev); |
7339 |
+ |
7340 |
+ if (tunnel->collect_md) { |
7341 |
+- gre_fb_xmit(skb, dev); |
7342 |
++ gre_fb_xmit(skb, dev, htons(ETH_P_TEB)); |
7343 |
+ return NETDEV_TX_OK; |
7344 |
+ } |
7345 |
+ |
7346 |
+@@ -851,9 +852,16 @@ static void __gre_tunnel_init(struct net_device *dev) |
7347 |
+ dev->hw_features |= GRE_FEATURES; |
7348 |
+ |
7349 |
+ if (!(tunnel->parms.o_flags & TUNNEL_SEQ)) { |
7350 |
+- /* TCP offload with GRE SEQ is not supported. */ |
7351 |
+- dev->features |= NETIF_F_GSO_SOFTWARE; |
7352 |
+- dev->hw_features |= NETIF_F_GSO_SOFTWARE; |
7353 |
++ /* TCP offload with GRE SEQ is not supported, nor |
7354 |
++ * can we support 2 levels of outer headers requiring |
7355 |
++ * an update. |
7356 |
++ */ |
7357 |
++ if (!(tunnel->parms.o_flags & TUNNEL_CSUM) || |
7358 |
++ (tunnel->encap.type == TUNNEL_ENCAP_NONE)) { |
7359 |
++ dev->features |= NETIF_F_GSO_SOFTWARE; |
7360 |
++ dev->hw_features |= NETIF_F_GSO_SOFTWARE; |
7361 |
++ } |
7362 |
++ |
7363 |
+ /* Can use a lockless transmit, unless we generate |
7364 |
+ * output sequences |
7365 |
+ */ |
7366 |
+@@ -875,7 +883,7 @@ static int ipgre_tunnel_init(struct net_device *dev) |
7367 |
+ netif_keep_dst(dev); |
7368 |
+ dev->addr_len = 4; |
7369 |
+ |
7370 |
+- if (iph->daddr) { |
7371 |
++ if (iph->daddr && !tunnel->collect_md) { |
7372 |
+ #ifdef CONFIG_NET_IPGRE_BROADCAST |
7373 |
+ if (ipv4_is_multicast(iph->daddr)) { |
7374 |
+ if (!iph->saddr) |
7375 |
+@@ -884,8 +892,9 @@ static int ipgre_tunnel_init(struct net_device *dev) |
7376 |
+ dev->header_ops = &ipgre_header_ops; |
7377 |
+ } |
7378 |
+ #endif |
7379 |
+- } else |
7380 |
++ } else if (!tunnel->collect_md) { |
7381 |
+ dev->header_ops = &ipgre_header_ops; |
7382 |
++ } |
7383 |
+ |
7384 |
+ return ip_tunnel_init(dev); |
7385 |
+ } |
7386 |
+@@ -928,6 +937,11 @@ static int ipgre_tunnel_validate(struct nlattr *tb[], struct nlattr *data[]) |
7387 |
+ if (flags & (GRE_VERSION|GRE_ROUTING)) |
7388 |
+ return -EINVAL; |
7389 |
+ |
7390 |
++ if (data[IFLA_GRE_COLLECT_METADATA] && |
7391 |
++ data[IFLA_GRE_ENCAP_TYPE] && |
7392 |
++ nla_get_u16(data[IFLA_GRE_ENCAP_TYPE]) != TUNNEL_ENCAP_NONE) |
7393 |
++ return -EINVAL; |
7394 |
++ |
7395 |
+ return 0; |
7396 |
+ } |
7397 |
+ |
7398 |
+@@ -1230,6 +1244,7 @@ struct net_device *gretap_fb_dev_create(struct net *net, const char *name, |
7399 |
+ { |
7400 |
+ struct nlattr *tb[IFLA_MAX + 1]; |
7401 |
+ struct net_device *dev; |
7402 |
++ LIST_HEAD(list_kill); |
7403 |
+ struct ip_tunnel *t; |
7404 |
+ int err; |
7405 |
+ |
7406 |
+@@ -1245,8 +1260,10 @@ struct net_device *gretap_fb_dev_create(struct net *net, const char *name, |
7407 |
+ t->collect_md = true; |
7408 |
+ |
7409 |
+ err = ipgre_newlink(net, dev, tb, NULL); |
7410 |
+- if (err < 0) |
7411 |
+- goto out; |
7412 |
++ if (err < 0) { |
7413 |
++ free_netdev(dev); |
7414 |
++ return ERR_PTR(err); |
7415 |
++ } |
7416 |
+ |
7417 |
+ /* openvswitch users expect packet sizes to be unrestricted, |
7418 |
+ * so set the largest MTU we can. |
7419 |
+@@ -1255,9 +1272,14 @@ struct net_device *gretap_fb_dev_create(struct net *net, const char *name, |
7420 |
+ if (err) |
7421 |
+ goto out; |
7422 |
+ |
7423 |
++ err = rtnl_configure_link(dev, NULL); |
7424 |
++ if (err < 0) |
7425 |
++ goto out; |
7426 |
++ |
7427 |
+ return dev; |
7428 |
+ out: |
7429 |
+- free_netdev(dev); |
7430 |
++ ip_tunnel_dellink(dev, &list_kill); |
7431 |
++ unregister_netdevice_many(&list_kill); |
7432 |
+ return ERR_PTR(err); |
7433 |
+ } |
7434 |
+ EXPORT_SYMBOL_GPL(gretap_fb_dev_create); |
7435 |
+diff --git a/net/ipv4/ip_sockglue.c b/net/ipv4/ip_sockglue.c |
7436 |
+index 1ea36bf778e6..9a7b60d6c670 100644 |
7437 |
+--- a/net/ipv4/ip_sockglue.c |
7438 |
++++ b/net/ipv4/ip_sockglue.c |
7439 |
+@@ -279,9 +279,12 @@ int ip_cmsg_send(struct net *net, struct msghdr *msg, struct ipcm_cookie *ipc, |
7440 |
+ ipc->ttl = val; |
7441 |
+ break; |
7442 |
+ case IP_TOS: |
7443 |
+- if (cmsg->cmsg_len != CMSG_LEN(sizeof(int))) |
7444 |
++ if (cmsg->cmsg_len == CMSG_LEN(sizeof(int))) |
7445 |
++ val = *(int *)CMSG_DATA(cmsg); |
7446 |
++ else if (cmsg->cmsg_len == CMSG_LEN(sizeof(u8))) |
7447 |
++ val = *(u8 *)CMSG_DATA(cmsg); |
7448 |
++ else |
7449 |
+ return -EINVAL; |
7450 |
+- val = *(int *)CMSG_DATA(cmsg); |
7451 |
+ if (val < 0 || val > 255) |
7452 |
+ return -EINVAL; |
7453 |
+ ipc->tos = val; |
7454 |
+diff --git a/net/ipv4/netfilter/nft_dup_ipv4.c b/net/ipv4/netfilter/nft_dup_ipv4.c |
7455 |
+index bf855e64fc45..0c01a270bf9f 100644 |
7456 |
+--- a/net/ipv4/netfilter/nft_dup_ipv4.c |
7457 |
++++ b/net/ipv4/netfilter/nft_dup_ipv4.c |
7458 |
+@@ -28,7 +28,7 @@ static void nft_dup_ipv4_eval(const struct nft_expr *expr, |
7459 |
+ struct in_addr gw = { |
7460 |
+ .s_addr = (__force __be32)regs->data[priv->sreg_addr], |
7461 |
+ }; |
7462 |
+- int oif = regs->data[priv->sreg_dev]; |
7463 |
++ int oif = priv->sreg_dev ? regs->data[priv->sreg_dev] : -1; |
7464 |
+ |
7465 |
+ nf_dup_ipv4(pkt->net, pkt->skb, pkt->hook, &gw, oif); |
7466 |
+ } |
7467 |
+@@ -59,7 +59,9 @@ static int nft_dup_ipv4_dump(struct sk_buff *skb, const struct nft_expr *expr) |
7468 |
+ { |
7469 |
+ struct nft_dup_ipv4 *priv = nft_expr_priv(expr); |
7470 |
+ |
7471 |
+- if (nft_dump_register(skb, NFTA_DUP_SREG_ADDR, priv->sreg_addr) || |
7472 |
++ if (nft_dump_register(skb, NFTA_DUP_SREG_ADDR, priv->sreg_addr)) |
7473 |
++ goto nla_put_failure; |
7474 |
++ if (priv->sreg_dev && |
7475 |
+ nft_dump_register(skb, NFTA_DUP_SREG_DEV, priv->sreg_dev)) |
7476 |
+ goto nla_put_failure; |
7477 |
+ |
7478 |
+diff --git a/net/ipv4/route.c b/net/ipv4/route.c |
7479 |
+index 74ae703c6909..29a87fadf01b 100644 |
7480 |
+--- a/net/ipv4/route.c |
7481 |
++++ b/net/ipv4/route.c |
7482 |
+@@ -477,12 +477,18 @@ u32 ip_idents_reserve(u32 hash, int segs) |
7483 |
+ atomic_t *p_id = ip_idents + hash % IP_IDENTS_SZ; |
7484 |
+ u32 old = ACCESS_ONCE(*p_tstamp); |
7485 |
+ u32 now = (u32)jiffies; |
7486 |
+- u32 delta = 0; |
7487 |
++ u32 new, delta = 0; |
7488 |
+ |
7489 |
+ if (old != now && cmpxchg(p_tstamp, old, now) == old) |
7490 |
+ delta = prandom_u32_max(now - old); |
7491 |
+ |
7492 |
+- return atomic_add_return(segs + delta, p_id) - segs; |
7493 |
++ /* Do not use atomic_add_return() as it makes UBSAN unhappy */ |
7494 |
++ do { |
7495 |
++ old = (u32)atomic_read(p_id); |
7496 |
++ new = old + delta + segs; |
7497 |
++ } while (atomic_cmpxchg(p_id, old, new) != old); |
7498 |
++ |
7499 |
++ return new - segs; |
7500 |
+ } |
7501 |
+ EXPORT_SYMBOL(ip_idents_reserve); |
7502 |
+ |
7503 |
+@@ -1494,9 +1500,9 @@ static void rt_set_nexthop(struct rtable *rt, __be32 daddr, |
7504 |
+ #endif |
7505 |
+ } |
7506 |
+ |
7507 |
+-static struct rtable *rt_dst_alloc(struct net_device *dev, |
7508 |
+- unsigned int flags, u16 type, |
7509 |
+- bool nopolicy, bool noxfrm, bool will_cache) |
7510 |
++struct rtable *rt_dst_alloc(struct net_device *dev, |
7511 |
++ unsigned int flags, u16 type, |
7512 |
++ bool nopolicy, bool noxfrm, bool will_cache) |
7513 |
+ { |
7514 |
+ struct rtable *rt; |
7515 |
+ |
7516 |
+@@ -1525,6 +1531,7 @@ static struct rtable *rt_dst_alloc(struct net_device *dev, |
7517 |
+ |
7518 |
+ return rt; |
7519 |
+ } |
7520 |
++EXPORT_SYMBOL(rt_dst_alloc); |
7521 |
+ |
7522 |
+ /* called in rcu_read_lock() section */ |
7523 |
+ static int ip_route_input_mc(struct sk_buff *skb, __be32 daddr, __be32 saddr, |
7524 |
+diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c |
7525 |
+index 88bfd663d9a2..64c7265793a5 100644 |
7526 |
+--- a/net/ipv4/tcp_input.c |
7527 |
++++ b/net/ipv4/tcp_input.c |
7528 |
+@@ -2926,7 +2926,10 @@ static void tcp_update_rtt_min(struct sock *sk, u32 rtt_us) |
7529 |
+ { |
7530 |
+ const u32 now = tcp_time_stamp, wlen = sysctl_tcp_min_rtt_wlen * HZ; |
7531 |
+ struct rtt_meas *m = tcp_sk(sk)->rtt_min; |
7532 |
+- struct rtt_meas rttm = { .rtt = (rtt_us ? : 1), .ts = now }; |
7533 |
++ struct rtt_meas rttm = { |
7534 |
++ .rtt = likely(rtt_us) ? rtt_us : jiffies_to_usecs(1), |
7535 |
++ .ts = now, |
7536 |
++ }; |
7537 |
+ u32 elapsed; |
7538 |
+ |
7539 |
+ /* Check if the new measurement updates the 1st, 2nd, or 3rd choices */ |
7540 |
+diff --git a/net/ipv4/udp.c b/net/ipv4/udp.c |
7541 |
+index 0924f93a0aff..bb306996c15e 100644 |
7542 |
+--- a/net/ipv4/udp.c |
7543 |
++++ b/net/ipv4/udp.c |
7544 |
+@@ -1685,10 +1685,10 @@ static int __udp4_lib_mcast_deliver(struct net *net, struct sk_buff *skb, |
7545 |
+ |
7546 |
+ if (use_hash2) { |
7547 |
+ hash2_any = udp4_portaddr_hash(net, htonl(INADDR_ANY), hnum) & |
7548 |
+- udp_table.mask; |
7549 |
+- hash2 = udp4_portaddr_hash(net, daddr, hnum) & udp_table.mask; |
7550 |
++ udptable->mask; |
7551 |
++ hash2 = udp4_portaddr_hash(net, daddr, hnum) & udptable->mask; |
7552 |
+ start_lookup: |
7553 |
+- hslot = &udp_table.hash2[hash2]; |
7554 |
++ hslot = &udptable->hash2[hash2]; |
7555 |
+ offset = offsetof(typeof(*sk), __sk_common.skc_portaddr_node); |
7556 |
+ } |
7557 |
+ |
7558 |
+@@ -1754,8 +1754,11 @@ static inline int udp4_csum_init(struct sk_buff *skb, struct udphdr *uh, |
7559 |
+ } |
7560 |
+ } |
7561 |
+ |
7562 |
+- return skb_checksum_init_zero_check(skb, proto, uh->check, |
7563 |
+- inet_compute_pseudo); |
7564 |
++ /* Note, we are only interested in != 0 or == 0, thus the |
7565 |
++ * force to int. |
7566 |
++ */ |
7567 |
++ return (__force int)skb_checksum_init_zero_check(skb, proto, uh->check, |
7568 |
++ inet_compute_pseudo); |
7569 |
+ } |
7570 |
+ |
7571 |
+ /* |
7572 |
+diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c |
7573 |
+index 086cdf9f0501..583765a330ff 100644 |
7574 |
+--- a/net/ipv6/addrconf.c |
7575 |
++++ b/net/ipv6/addrconf.c |
7576 |
+@@ -540,7 +540,7 @@ void inet6_netconf_notify_devconf(struct net *net, int type, int ifindex, |
7577 |
+ struct sk_buff *skb; |
7578 |
+ int err = -ENOBUFS; |
7579 |
+ |
7580 |
+- skb = nlmsg_new(inet6_netconf_msgsize_devconf(type), GFP_ATOMIC); |
7581 |
++ skb = nlmsg_new(inet6_netconf_msgsize_devconf(type), GFP_KERNEL); |
7582 |
+ if (!skb) |
7583 |
+ goto errout; |
7584 |
+ |
7585 |
+@@ -552,7 +552,7 @@ void inet6_netconf_notify_devconf(struct net *net, int type, int ifindex, |
7586 |
+ kfree_skb(skb); |
7587 |
+ goto errout; |
7588 |
+ } |
7589 |
+- rtnl_notify(skb, net, 0, RTNLGRP_IPV6_NETCONF, NULL, GFP_ATOMIC); |
7590 |
++ rtnl_notify(skb, net, 0, RTNLGRP_IPV6_NETCONF, NULL, GFP_KERNEL); |
7591 |
+ return; |
7592 |
+ errout: |
7593 |
+ rtnl_set_sk_err(net, RTNLGRP_IPV6_NETCONF, err); |
7594 |
+@@ -771,7 +771,14 @@ static int addrconf_fixup_forwarding(struct ctl_table *table, int *p, int newf) |
7595 |
+ } |
7596 |
+ |
7597 |
+ if (p == &net->ipv6.devconf_all->forwarding) { |
7598 |
++ int old_dflt = net->ipv6.devconf_dflt->forwarding; |
7599 |
++ |
7600 |
+ net->ipv6.devconf_dflt->forwarding = newf; |
7601 |
++ if ((!newf) ^ (!old_dflt)) |
7602 |
++ inet6_netconf_notify_devconf(net, NETCONFA_FORWARDING, |
7603 |
++ NETCONFA_IFINDEX_DEFAULT, |
7604 |
++ net->ipv6.devconf_dflt); |
7605 |
++ |
7606 |
+ addrconf_forward_change(net, newf); |
7607 |
+ if ((!newf) ^ (!old)) |
7608 |
+ inet6_netconf_notify_devconf(net, NETCONFA_FORWARDING, |
7609 |
+@@ -3146,6 +3153,7 @@ static int addrconf_notify(struct notifier_block *this, unsigned long event, |
7610 |
+ void *ptr) |
7611 |
+ { |
7612 |
+ struct net_device *dev = netdev_notifier_info_to_dev(ptr); |
7613 |
++ struct netdev_notifier_changeupper_info *info; |
7614 |
+ struct inet6_dev *idev = __in6_dev_get(dev); |
7615 |
+ struct net *net = dev_net(dev); |
7616 |
+ int run_pending = 0; |
7617 |
+@@ -3307,6 +3315,15 @@ static int addrconf_notify(struct notifier_block *this, unsigned long event, |
7618 |
+ case NETDEV_POST_TYPE_CHANGE: |
7619 |
+ addrconf_type_change(dev, event); |
7620 |
+ break; |
7621 |
++ |
7622 |
++ case NETDEV_CHANGEUPPER: |
7623 |
++ info = ptr; |
7624 |
++ |
7625 |
++ /* flush all routes if dev is linked to or unlinked from |
7626 |
++ * an L3 master device (e.g., VRF) |
7627 |
++ */ |
7628 |
++ if (info->upper_dev && netif_is_l3_master(info->upper_dev)) |
7629 |
++ addrconf_ifdown(dev, 0); |
7630 |
+ } |
7631 |
+ |
7632 |
+ return NOTIFY_OK; |
7633 |
+diff --git a/net/ipv6/icmp.c b/net/ipv6/icmp.c |
7634 |
+index 3697cd08c515..d21e81cd6120 100644 |
7635 |
+--- a/net/ipv6/icmp.c |
7636 |
++++ b/net/ipv6/icmp.c |
7637 |
+@@ -445,6 +445,8 @@ static void icmp6_send(struct sk_buff *skb, u8 type, u8 code, __u32 info) |
7638 |
+ |
7639 |
+ if (__ipv6_addr_needs_scope_id(addr_type)) |
7640 |
+ iif = skb->dev->ifindex; |
7641 |
++ else |
7642 |
++ iif = l3mdev_master_ifindex(skb_dst(skb)->dev); |
7643 |
+ |
7644 |
+ /* |
7645 |
+ * Must not send error if the source does not uniquely |
7646 |
+@@ -499,9 +501,6 @@ static void icmp6_send(struct sk_buff *skb, u8 type, u8 code, __u32 info) |
7647 |
+ else if (!fl6.flowi6_oif) |
7648 |
+ fl6.flowi6_oif = np->ucast_oif; |
7649 |
+ |
7650 |
+- if (!fl6.flowi6_oif) |
7651 |
+- fl6.flowi6_oif = l3mdev_master_ifindex(skb->dev); |
7652 |
+- |
7653 |
+ dst = icmpv6_route_lookup(net, skb, sk, &fl6); |
7654 |
+ if (IS_ERR(dst)) |
7655 |
+ goto out; |
7656 |
+diff --git a/net/ipv6/ip6_checksum.c b/net/ipv6/ip6_checksum.c |
7657 |
+index 391a8fedb27e..1132624edee9 100644 |
7658 |
+--- a/net/ipv6/ip6_checksum.c |
7659 |
++++ b/net/ipv6/ip6_checksum.c |
7660 |
+@@ -84,9 +84,12 @@ int udp6_csum_init(struct sk_buff *skb, struct udphdr *uh, int proto) |
7661 |
+ * we accept a checksum of zero here. When we find the socket |
7662 |
+ * for the UDP packet we'll check if that socket allows zero checksum |
7663 |
+ * for IPv6 (set by socket option). |
7664 |
++ * |
7665 |
++ * Note, we are only interested in != 0 or == 0, thus the |
7666 |
++ * force to int. |
7667 |
+ */ |
7668 |
+- return skb_checksum_init_zero_check(skb, proto, uh->check, |
7669 |
+- ip6_compute_pseudo); |
7670 |
++ return (__force int)skb_checksum_init_zero_check(skb, proto, uh->check, |
7671 |
++ ip6_compute_pseudo); |
7672 |
+ } |
7673 |
+ EXPORT_SYMBOL(udp6_csum_init); |
7674 |
+ |
7675 |
+diff --git a/net/ipv6/ip6_vti.c b/net/ipv6/ip6_vti.c |
7676 |
+index 4d273adcf130..2267920c086a 100644 |
7677 |
+--- a/net/ipv6/ip6_vti.c |
7678 |
++++ b/net/ipv6/ip6_vti.c |
7679 |
+@@ -324,11 +324,9 @@ static int vti6_rcv(struct sk_buff *skb) |
7680 |
+ goto discard; |
7681 |
+ } |
7682 |
+ |
7683 |
+- XFRM_TUNNEL_SKB_CB(skb)->tunnel.ip6 = t; |
7684 |
+- |
7685 |
+ rcu_read_unlock(); |
7686 |
+ |
7687 |
+- return xfrm6_rcv(skb); |
7688 |
++ return xfrm6_rcv_tnl(skb, t); |
7689 |
+ } |
7690 |
+ rcu_read_unlock(); |
7691 |
+ return -EINVAL; |
7692 |
+diff --git a/net/ipv6/ip6mr.c b/net/ipv6/ip6mr.c |
7693 |
+index 91f16e679f63..20812e8b24dd 100644 |
7694 |
+--- a/net/ipv6/ip6mr.c |
7695 |
++++ b/net/ipv6/ip6mr.c |
7696 |
+@@ -1594,14 +1594,15 @@ static int ip6mr_sk_init(struct mr6_table *mrt, struct sock *sk) |
7697 |
+ if (likely(mrt->mroute6_sk == NULL)) { |
7698 |
+ mrt->mroute6_sk = sk; |
7699 |
+ net->ipv6.devconf_all->mc_forwarding++; |
7700 |
+- inet6_netconf_notify_devconf(net, NETCONFA_MC_FORWARDING, |
7701 |
+- NETCONFA_IFINDEX_ALL, |
7702 |
+- net->ipv6.devconf_all); |
7703 |
+- } |
7704 |
+- else |
7705 |
++ } else { |
7706 |
+ err = -EADDRINUSE; |
7707 |
++ } |
7708 |
+ write_unlock_bh(&mrt_lock); |
7709 |
+ |
7710 |
++ if (!err) |
7711 |
++ inet6_netconf_notify_devconf(net, NETCONFA_MC_FORWARDING, |
7712 |
++ NETCONFA_IFINDEX_ALL, |
7713 |
++ net->ipv6.devconf_all); |
7714 |
+ rtnl_unlock(); |
7715 |
+ |
7716 |
+ return err; |
7717 |
+@@ -1619,11 +1620,11 @@ int ip6mr_sk_done(struct sock *sk) |
7718 |
+ write_lock_bh(&mrt_lock); |
7719 |
+ mrt->mroute6_sk = NULL; |
7720 |
+ net->ipv6.devconf_all->mc_forwarding--; |
7721 |
++ write_unlock_bh(&mrt_lock); |
7722 |
+ inet6_netconf_notify_devconf(net, |
7723 |
+ NETCONFA_MC_FORWARDING, |
7724 |
+ NETCONFA_IFINDEX_ALL, |
7725 |
+ net->ipv6.devconf_all); |
7726 |
+- write_unlock_bh(&mrt_lock); |
7727 |
+ |
7728 |
+ mroute_clean_tables(mrt, false); |
7729 |
+ err = 0; |
7730 |
+diff --git a/net/ipv6/netfilter/nft_dup_ipv6.c b/net/ipv6/netfilter/nft_dup_ipv6.c |
7731 |
+index 8bfd470cbe72..831f86e1ec08 100644 |
7732 |
+--- a/net/ipv6/netfilter/nft_dup_ipv6.c |
7733 |
++++ b/net/ipv6/netfilter/nft_dup_ipv6.c |
7734 |
+@@ -26,7 +26,7 @@ static void nft_dup_ipv6_eval(const struct nft_expr *expr, |
7735 |
+ { |
7736 |
+ struct nft_dup_ipv6 *priv = nft_expr_priv(expr); |
7737 |
+ struct in6_addr *gw = (struct in6_addr *)®s->data[priv->sreg_addr]; |
7738 |
+- int oif = regs->data[priv->sreg_dev]; |
7739 |
++ int oif = priv->sreg_dev ? regs->data[priv->sreg_dev] : -1; |
7740 |
+ |
7741 |
+ nf_dup_ipv6(pkt->net, pkt->skb, pkt->hook, gw, oif); |
7742 |
+ } |
7743 |
+@@ -57,7 +57,9 @@ static int nft_dup_ipv6_dump(struct sk_buff *skb, const struct nft_expr *expr) |
7744 |
+ { |
7745 |
+ struct nft_dup_ipv6 *priv = nft_expr_priv(expr); |
7746 |
+ |
7747 |
+- if (nft_dump_register(skb, NFTA_DUP_SREG_ADDR, priv->sreg_addr) || |
7748 |
++ if (nft_dump_register(skb, NFTA_DUP_SREG_ADDR, priv->sreg_addr)) |
7749 |
++ goto nla_put_failure; |
7750 |
++ if (priv->sreg_dev && |
7751 |
+ nft_dump_register(skb, NFTA_DUP_SREG_DEV, priv->sreg_dev)) |
7752 |
+ goto nla_put_failure; |
7753 |
+ |
7754 |
+diff --git a/net/ipv6/route.c b/net/ipv6/route.c |
7755 |
+index 63a7d31fa9f0..50eba77f5a0d 100644 |
7756 |
+--- a/net/ipv6/route.c |
7757 |
++++ b/net/ipv6/route.c |
7758 |
+@@ -101,11 +101,13 @@ static int rt6_score_route(struct rt6_info *rt, int oif, int strict); |
7759 |
+ #ifdef CONFIG_IPV6_ROUTE_INFO |
7760 |
+ static struct rt6_info *rt6_add_route_info(struct net *net, |
7761 |
+ const struct in6_addr *prefix, int prefixlen, |
7762 |
+- const struct in6_addr *gwaddr, int ifindex, |
7763 |
++ const struct in6_addr *gwaddr, |
7764 |
++ struct net_device *dev, |
7765 |
+ unsigned int pref); |
7766 |
+ static struct rt6_info *rt6_get_route_info(struct net *net, |
7767 |
+ const struct in6_addr *prefix, int prefixlen, |
7768 |
+- const struct in6_addr *gwaddr, int ifindex); |
7769 |
++ const struct in6_addr *gwaddr, |
7770 |
++ struct net_device *dev); |
7771 |
+ #endif |
7772 |
+ |
7773 |
+ struct uncached_list { |
7774 |
+@@ -337,9 +339,9 @@ static struct rt6_info *__ip6_dst_alloc(struct net *net, |
7775 |
+ return rt; |
7776 |
+ } |
7777 |
+ |
7778 |
+-static struct rt6_info *ip6_dst_alloc(struct net *net, |
7779 |
+- struct net_device *dev, |
7780 |
+- int flags) |
7781 |
++struct rt6_info *ip6_dst_alloc(struct net *net, |
7782 |
++ struct net_device *dev, |
7783 |
++ int flags) |
7784 |
+ { |
7785 |
+ struct rt6_info *rt = __ip6_dst_alloc(net, dev, flags); |
7786 |
+ |
7787 |
+@@ -363,6 +365,7 @@ static struct rt6_info *ip6_dst_alloc(struct net *net, |
7788 |
+ |
7789 |
+ return rt; |
7790 |
+ } |
7791 |
++EXPORT_SYMBOL(ip6_dst_alloc); |
7792 |
+ |
7793 |
+ static void ip6_dst_destroy(struct dst_entry *dst) |
7794 |
+ { |
7795 |
+@@ -801,7 +804,7 @@ int rt6_route_rcv(struct net_device *dev, u8 *opt, int len, |
7796 |
+ rt = rt6_get_dflt_router(gwaddr, dev); |
7797 |
+ else |
7798 |
+ rt = rt6_get_route_info(net, prefix, rinfo->prefix_len, |
7799 |
+- gwaddr, dev->ifindex); |
7800 |
++ gwaddr, dev); |
7801 |
+ |
7802 |
+ if (rt && !lifetime) { |
7803 |
+ ip6_del_rt(rt); |
7804 |
+@@ -809,8 +812,8 @@ int rt6_route_rcv(struct net_device *dev, u8 *opt, int len, |
7805 |
+ } |
7806 |
+ |
7807 |
+ if (!rt && lifetime) |
7808 |
+- rt = rt6_add_route_info(net, prefix, rinfo->prefix_len, gwaddr, dev->ifindex, |
7809 |
+- pref); |
7810 |
++ rt = rt6_add_route_info(net, prefix, rinfo->prefix_len, gwaddr, |
7811 |
++ dev, pref); |
7812 |
+ else if (rt) |
7813 |
+ rt->rt6i_flags = RTF_ROUTEINFO | |
7814 |
+ (rt->rt6i_flags & ~RTF_PREF_MASK) | RTF_PREF(pref); |
7815 |
+@@ -2273,13 +2276,16 @@ static void ip6_rt_copy_init(struct rt6_info *rt, struct rt6_info *ort) |
7816 |
+ #ifdef CONFIG_IPV6_ROUTE_INFO |
7817 |
+ static struct rt6_info *rt6_get_route_info(struct net *net, |
7818 |
+ const struct in6_addr *prefix, int prefixlen, |
7819 |
+- const struct in6_addr *gwaddr, int ifindex) |
7820 |
++ const struct in6_addr *gwaddr, |
7821 |
++ struct net_device *dev) |
7822 |
+ { |
7823 |
++ u32 tb_id = l3mdev_fib_table(dev) ? : RT6_TABLE_INFO; |
7824 |
++ int ifindex = dev->ifindex; |
7825 |
+ struct fib6_node *fn; |
7826 |
+ struct rt6_info *rt = NULL; |
7827 |
+ struct fib6_table *table; |
7828 |
+ |
7829 |
+- table = fib6_get_table(net, RT6_TABLE_INFO); |
7830 |
++ table = fib6_get_table(net, tb_id); |
7831 |
+ if (!table) |
7832 |
+ return NULL; |
7833 |
+ |
7834 |
+@@ -2305,12 +2311,13 @@ out: |
7835 |
+ |
7836 |
+ static struct rt6_info *rt6_add_route_info(struct net *net, |
7837 |
+ const struct in6_addr *prefix, int prefixlen, |
7838 |
+- const struct in6_addr *gwaddr, int ifindex, |
7839 |
++ const struct in6_addr *gwaddr, |
7840 |
++ struct net_device *dev, |
7841 |
+ unsigned int pref) |
7842 |
+ { |
7843 |
+ struct fib6_config cfg = { |
7844 |
+ .fc_metric = IP6_RT_PRIO_USER, |
7845 |
+- .fc_ifindex = ifindex, |
7846 |
++ .fc_ifindex = dev->ifindex, |
7847 |
+ .fc_dst_len = prefixlen, |
7848 |
+ .fc_flags = RTF_GATEWAY | RTF_ADDRCONF | RTF_ROUTEINFO | |
7849 |
+ RTF_UP | RTF_PREF(pref), |
7850 |
+@@ -2319,7 +2326,7 @@ static struct rt6_info *rt6_add_route_info(struct net *net, |
7851 |
+ .fc_nlinfo.nl_net = net, |
7852 |
+ }; |
7853 |
+ |
7854 |
+- cfg.fc_table = l3mdev_fib_table_by_index(net, ifindex) ? : RT6_TABLE_INFO; |
7855 |
++ cfg.fc_table = l3mdev_fib_table(dev) ? : RT6_TABLE_INFO, |
7856 |
+ cfg.fc_dst = *prefix; |
7857 |
+ cfg.fc_gateway = *gwaddr; |
7858 |
+ |
7859 |
+@@ -2329,16 +2336,17 @@ static struct rt6_info *rt6_add_route_info(struct net *net, |
7860 |
+ |
7861 |
+ ip6_route_add(&cfg); |
7862 |
+ |
7863 |
+- return rt6_get_route_info(net, prefix, prefixlen, gwaddr, ifindex); |
7864 |
++ return rt6_get_route_info(net, prefix, prefixlen, gwaddr, dev); |
7865 |
+ } |
7866 |
+ #endif |
7867 |
+ |
7868 |
+ struct rt6_info *rt6_get_dflt_router(const struct in6_addr *addr, struct net_device *dev) |
7869 |
+ { |
7870 |
++ u32 tb_id = l3mdev_fib_table(dev) ? : RT6_TABLE_DFLT; |
7871 |
+ struct rt6_info *rt; |
7872 |
+ struct fib6_table *table; |
7873 |
+ |
7874 |
+- table = fib6_get_table(dev_net(dev), RT6_TABLE_DFLT); |
7875 |
++ table = fib6_get_table(dev_net(dev), tb_id); |
7876 |
+ if (!table) |
7877 |
+ return NULL; |
7878 |
+ |
7879 |
+@@ -2372,20 +2380,20 @@ struct rt6_info *rt6_add_dflt_router(const struct in6_addr *gwaddr, |
7880 |
+ |
7881 |
+ cfg.fc_gateway = *gwaddr; |
7882 |
+ |
7883 |
+- ip6_route_add(&cfg); |
7884 |
++ if (!ip6_route_add(&cfg)) { |
7885 |
++ struct fib6_table *table; |
7886 |
++ |
7887 |
++ table = fib6_get_table(dev_net(dev), cfg.fc_table); |
7888 |
++ if (table) |
7889 |
++ table->flags |= RT6_TABLE_HAS_DFLT_ROUTER; |
7890 |
++ } |
7891 |
+ |
7892 |
+ return rt6_get_dflt_router(gwaddr, dev); |
7893 |
+ } |
7894 |
+ |
7895 |
+-void rt6_purge_dflt_routers(struct net *net) |
7896 |
++static void __rt6_purge_dflt_routers(struct fib6_table *table) |
7897 |
+ { |
7898 |
+ struct rt6_info *rt; |
7899 |
+- struct fib6_table *table; |
7900 |
+- |
7901 |
+- /* NOTE: Keep consistent with rt6_get_dflt_router */ |
7902 |
+- table = fib6_get_table(net, RT6_TABLE_DFLT); |
7903 |
+- if (!table) |
7904 |
+- return; |
7905 |
+ |
7906 |
+ restart: |
7907 |
+ read_lock_bh(&table->tb6_lock); |
7908 |
+@@ -2399,6 +2407,27 @@ restart: |
7909 |
+ } |
7910 |
+ } |
7911 |
+ read_unlock_bh(&table->tb6_lock); |
7912 |
++ |
7913 |
++ table->flags &= ~RT6_TABLE_HAS_DFLT_ROUTER; |
7914 |
++} |
7915 |
++ |
7916 |
++void rt6_purge_dflt_routers(struct net *net) |
7917 |
++{ |
7918 |
++ struct fib6_table *table; |
7919 |
++ struct hlist_head *head; |
7920 |
++ unsigned int h; |
7921 |
++ |
7922 |
++ rcu_read_lock(); |
7923 |
++ |
7924 |
++ for (h = 0; h < FIB6_TABLE_HASHSZ; h++) { |
7925 |
++ head = &net->ipv6.fib_table_hash[h]; |
7926 |
++ hlist_for_each_entry_rcu(table, head, tb6_hlist) { |
7927 |
++ if (table->flags & RT6_TABLE_HAS_DFLT_ROUTER) |
7928 |
++ __rt6_purge_dflt_routers(table); |
7929 |
++ } |
7930 |
++ } |
7931 |
++ |
7932 |
++ rcu_read_unlock(); |
7933 |
+ } |
7934 |
+ |
7935 |
+ static void rtmsg_to_fib6_config(struct net *net, |
7936 |
+diff --git a/net/ipv6/tcp_ipv6.c b/net/ipv6/tcp_ipv6.c |
7937 |
+index 6e7f99569bdf..6a36fcc5c4e1 100644 |
7938 |
+--- a/net/ipv6/tcp_ipv6.c |
7939 |
++++ b/net/ipv6/tcp_ipv6.c |
7940 |
+@@ -815,8 +815,13 @@ static void tcp_v6_send_response(const struct sock *sk, struct sk_buff *skb, u32 |
7941 |
+ fl6.flowi6_proto = IPPROTO_TCP; |
7942 |
+ if (rt6_need_strict(&fl6.daddr) && !oif) |
7943 |
+ fl6.flowi6_oif = tcp_v6_iif(skb); |
7944 |
+- else |
7945 |
++ else { |
7946 |
++ if (!oif && netif_index_is_l3_master(net, skb->skb_iif)) |
7947 |
++ oif = skb->skb_iif; |
7948 |
++ |
7949 |
+ fl6.flowi6_oif = oif; |
7950 |
++ } |
7951 |
++ |
7952 |
+ fl6.flowi6_mark = IP6_REPLY_MARK(net, skb->mark); |
7953 |
+ fl6.fl6_dport = t1->dest; |
7954 |
+ fl6.fl6_sport = t1->source; |
7955 |
+diff --git a/net/ipv6/udp.c b/net/ipv6/udp.c |
7956 |
+index f4e06748f86b..73f111206e36 100644 |
7957 |
+--- a/net/ipv6/udp.c |
7958 |
++++ b/net/ipv6/udp.c |
7959 |
+@@ -801,10 +801,10 @@ static int __udp6_lib_mcast_deliver(struct net *net, struct sk_buff *skb, |
7960 |
+ |
7961 |
+ if (use_hash2) { |
7962 |
+ hash2_any = udp6_portaddr_hash(net, &in6addr_any, hnum) & |
7963 |
+- udp_table.mask; |
7964 |
+- hash2 = udp6_portaddr_hash(net, daddr, hnum) & udp_table.mask; |
7965 |
++ udptable->mask; |
7966 |
++ hash2 = udp6_portaddr_hash(net, daddr, hnum) & udptable->mask; |
7967 |
+ start_lookup: |
7968 |
+- hslot = &udp_table.hash2[hash2]; |
7969 |
++ hslot = &udptable->hash2[hash2]; |
7970 |
+ offset = offsetof(typeof(*sk), __sk_common.skc_portaddr_node); |
7971 |
+ } |
7972 |
+ |
7973 |
+diff --git a/net/ipv6/xfrm6_input.c b/net/ipv6/xfrm6_input.c |
7974 |
+index 0eaab1fa6be5..b5789562aded 100644 |
7975 |
+--- a/net/ipv6/xfrm6_input.c |
7976 |
++++ b/net/ipv6/xfrm6_input.c |
7977 |
+@@ -21,8 +21,10 @@ int xfrm6_extract_input(struct xfrm_state *x, struct sk_buff *skb) |
7978 |
+ return xfrm6_extract_header(skb); |
7979 |
+ } |
7980 |
+ |
7981 |
+-int xfrm6_rcv_spi(struct sk_buff *skb, int nexthdr, __be32 spi) |
7982 |
++int xfrm6_rcv_spi(struct sk_buff *skb, int nexthdr, __be32 spi, |
7983 |
++ struct ip6_tnl *t) |
7984 |
+ { |
7985 |
++ XFRM_TUNNEL_SKB_CB(skb)->tunnel.ip6 = t; |
7986 |
+ XFRM_SPI_SKB_CB(skb)->family = AF_INET6; |
7987 |
+ XFRM_SPI_SKB_CB(skb)->daddroff = offsetof(struct ipv6hdr, daddr); |
7988 |
+ return xfrm_input(skb, nexthdr, spi, 0); |
7989 |
+@@ -48,13 +50,18 @@ int xfrm6_transport_finish(struct sk_buff *skb, int async) |
7990 |
+ return -1; |
7991 |
+ } |
7992 |
+ |
7993 |
+-int xfrm6_rcv(struct sk_buff *skb) |
7994 |
++int xfrm6_rcv_tnl(struct sk_buff *skb, struct ip6_tnl *t) |
7995 |
+ { |
7996 |
+ return xfrm6_rcv_spi(skb, skb_network_header(skb)[IP6CB(skb)->nhoff], |
7997 |
+- 0); |
7998 |
++ 0, t); |
7999 |
+ } |
8000 |
+-EXPORT_SYMBOL(xfrm6_rcv); |
8001 |
++EXPORT_SYMBOL(xfrm6_rcv_tnl); |
8002 |
+ |
8003 |
++int xfrm6_rcv(struct sk_buff *skb) |
8004 |
++{ |
8005 |
++ return xfrm6_rcv_tnl(skb, NULL); |
8006 |
++} |
8007 |
++EXPORT_SYMBOL(xfrm6_rcv); |
8008 |
+ int xfrm6_input_addr(struct sk_buff *skb, xfrm_address_t *daddr, |
8009 |
+ xfrm_address_t *saddr, u8 proto) |
8010 |
+ { |
8011 |
+diff --git a/net/ipv6/xfrm6_tunnel.c b/net/ipv6/xfrm6_tunnel.c |
8012 |
+index f9d493c59d6c..07b7b2540579 100644 |
8013 |
+--- a/net/ipv6/xfrm6_tunnel.c |
8014 |
++++ b/net/ipv6/xfrm6_tunnel.c |
8015 |
+@@ -239,7 +239,7 @@ static int xfrm6_tunnel_rcv(struct sk_buff *skb) |
8016 |
+ __be32 spi; |
8017 |
+ |
8018 |
+ spi = xfrm6_tunnel_spi_lookup(net, (const xfrm_address_t *)&iph->saddr); |
8019 |
+- return xfrm6_rcv_spi(skb, IPPROTO_IPV6, spi); |
8020 |
++ return xfrm6_rcv_spi(skb, IPPROTO_IPV6, spi, NULL); |
8021 |
+ } |
8022 |
+ |
8023 |
+ static int xfrm6_tunnel_err(struct sk_buff *skb, struct inet6_skb_parm *opt, |
8024 |
+diff --git a/net/irda/af_irda.c b/net/irda/af_irda.c |
8025 |
+index 7cc9db38e1b6..0e8f8a3f7b23 100644 |
8026 |
+--- a/net/irda/af_irda.c |
8027 |
++++ b/net/irda/af_irda.c |
8028 |
+@@ -839,7 +839,7 @@ static int irda_accept(struct socket *sock, struct socket *newsock, int flags) |
8029 |
+ struct sock *sk = sock->sk; |
8030 |
+ struct irda_sock *new, *self = irda_sk(sk); |
8031 |
+ struct sock *newsk; |
8032 |
+- struct sk_buff *skb; |
8033 |
++ struct sk_buff *skb = NULL; |
8034 |
+ int err; |
8035 |
+ |
8036 |
+ err = irda_create(sock_net(sk), newsock, sk->sk_protocol, 0); |
8037 |
+@@ -907,7 +907,6 @@ static int irda_accept(struct socket *sock, struct socket *newsock, int flags) |
8038 |
+ err = -EPERM; /* value does not seem to make sense. -arnd */ |
8039 |
+ if (!new->tsap) { |
8040 |
+ pr_debug("%s(), dup failed!\n", __func__); |
8041 |
+- kfree_skb(skb); |
8042 |
+ goto out; |
8043 |
+ } |
8044 |
+ |
8045 |
+@@ -926,7 +925,6 @@ static int irda_accept(struct socket *sock, struct socket *newsock, int flags) |
8046 |
+ /* Clean up the original one to keep it in listen state */ |
8047 |
+ irttp_listen(self->tsap); |
8048 |
+ |
8049 |
+- kfree_skb(skb); |
8050 |
+ sk->sk_ack_backlog--; |
8051 |
+ |
8052 |
+ newsock->state = SS_CONNECTED; |
8053 |
+@@ -934,6 +932,7 @@ static int irda_accept(struct socket *sock, struct socket *newsock, int flags) |
8054 |
+ irda_connect_response(new); |
8055 |
+ err = 0; |
8056 |
+ out: |
8057 |
++ kfree_skb(skb); |
8058 |
+ release_sock(sk); |
8059 |
+ return err; |
8060 |
+ } |
8061 |
+diff --git a/net/l2tp/l2tp_core.c b/net/l2tp/l2tp_core.c |
8062 |
+index 2b8b5c57c7f0..8cbccddc0b1e 100644 |
8063 |
+--- a/net/l2tp/l2tp_core.c |
8064 |
++++ b/net/l2tp/l2tp_core.c |
8065 |
+@@ -1953,6 +1953,9 @@ static __net_exit void l2tp_exit_net(struct net *net) |
8066 |
+ l2tp_tunnel_delete(tunnel); |
8067 |
+ } |
8068 |
+ rcu_read_unlock_bh(); |
8069 |
++ |
8070 |
++ flush_workqueue(l2tp_wq); |
8071 |
++ rcu_barrier(); |
8072 |
+ } |
8073 |
+ |
8074 |
+ static struct pernet_operations l2tp_net_ops = { |
8075 |
+diff --git a/net/mac80211/ieee80211_i.h b/net/mac80211/ieee80211_i.h |
8076 |
+index 72f76da88912..a991d1df6774 100644 |
8077 |
+--- a/net/mac80211/ieee80211_i.h |
8078 |
++++ b/net/mac80211/ieee80211_i.h |
8079 |
+@@ -1706,6 +1706,10 @@ ieee80211_vht_cap_ie_to_sta_vht_cap(struct ieee80211_sub_if_data *sdata, |
8080 |
+ enum ieee80211_sta_rx_bandwidth ieee80211_sta_cap_rx_bw(struct sta_info *sta); |
8081 |
+ enum ieee80211_sta_rx_bandwidth ieee80211_sta_cur_vht_bw(struct sta_info *sta); |
8082 |
+ void ieee80211_sta_set_rx_nss(struct sta_info *sta); |
8083 |
++enum ieee80211_sta_rx_bandwidth |
8084 |
++ieee80211_chan_width_to_rx_bw(enum nl80211_chan_width width); |
8085 |
++enum nl80211_chan_width ieee80211_sta_cap_chan_bw(struct sta_info *sta); |
8086 |
++void ieee80211_sta_set_rx_nss(struct sta_info *sta); |
8087 |
+ u32 __ieee80211_vht_handle_opmode(struct ieee80211_sub_if_data *sdata, |
8088 |
+ struct sta_info *sta, u8 opmode, |
8089 |
+ enum ieee80211_band band); |
8090 |
+diff --git a/net/mac80211/mlme.c b/net/mac80211/mlme.c |
8091 |
+index 031fbfd36d58..4ab78bc6c2ca 100644 |
8092 |
+--- a/net/mac80211/mlme.c |
8093 |
++++ b/net/mac80211/mlme.c |
8094 |
+@@ -2283,7 +2283,7 @@ void ieee80211_sta_tx_notify(struct ieee80211_sub_if_data *sdata, |
8095 |
+ if (!ieee80211_is_data(hdr->frame_control)) |
8096 |
+ return; |
8097 |
+ |
8098 |
+- if (ieee80211_is_nullfunc(hdr->frame_control) && |
8099 |
++ if (ieee80211_is_any_nullfunc(hdr->frame_control) && |
8100 |
+ sdata->u.mgd.probe_send_count > 0) { |
8101 |
+ if (ack) |
8102 |
+ ieee80211_sta_reset_conn_monitor(sdata); |
8103 |
+diff --git a/net/mac80211/offchannel.c b/net/mac80211/offchannel.c |
8104 |
+index b6be51940ead..af489405d5b3 100644 |
8105 |
+--- a/net/mac80211/offchannel.c |
8106 |
++++ b/net/mac80211/offchannel.c |
8107 |
+@@ -308,11 +308,10 @@ void ieee80211_roc_notify_destroy(struct ieee80211_roc_work *roc, bool free) |
8108 |
+ |
8109 |
+ /* was never transmitted */ |
8110 |
+ if (roc->frame) { |
8111 |
+- cfg80211_mgmt_tx_status(&roc->sdata->wdev, |
8112 |
+- (unsigned long)roc->frame, |
8113 |
++ cfg80211_mgmt_tx_status(&roc->sdata->wdev, roc->mgmt_tx_cookie, |
8114 |
+ roc->frame->data, roc->frame->len, |
8115 |
+ false, GFP_KERNEL); |
8116 |
+- kfree_skb(roc->frame); |
8117 |
++ ieee80211_free_txskb(&roc->sdata->local->hw, roc->frame); |
8118 |
+ } |
8119 |
+ |
8120 |
+ if (!roc->mgmt_tx_cookie) |
8121 |
+diff --git a/net/mac80211/rx.c b/net/mac80211/rx.c |
8122 |
+index 2b7975c4dac7..a74a6ff18f91 100644 |
8123 |
+--- a/net/mac80211/rx.c |
8124 |
++++ b/net/mac80211/rx.c |
8125 |
+@@ -1110,8 +1110,7 @@ ieee80211_rx_h_check_dup(struct ieee80211_rx_data *rx) |
8126 |
+ return RX_CONTINUE; |
8127 |
+ |
8128 |
+ if (ieee80211_is_ctl(hdr->frame_control) || |
8129 |
+- ieee80211_is_nullfunc(hdr->frame_control) || |
8130 |
+- ieee80211_is_qos_nullfunc(hdr->frame_control) || |
8131 |
++ ieee80211_is_any_nullfunc(hdr->frame_control) || |
8132 |
+ is_multicast_ether_addr(hdr->addr1)) |
8133 |
+ return RX_CONTINUE; |
8134 |
+ |
8135 |
+@@ -1487,8 +1486,7 @@ ieee80211_rx_h_sta_process(struct ieee80211_rx_data *rx) |
8136 |
+ * Drop (qos-)data::nullfunc frames silently, since they |
8137 |
+ * are used only to control station power saving mode. |
8138 |
+ */ |
8139 |
+- if (ieee80211_is_nullfunc(hdr->frame_control) || |
8140 |
+- ieee80211_is_qos_nullfunc(hdr->frame_control)) { |
8141 |
++ if (ieee80211_is_any_nullfunc(hdr->frame_control)) { |
8142 |
+ I802_DEBUG_INC(rx->local->rx_handlers_drop_nullfunc); |
8143 |
+ |
8144 |
+ /* |
8145 |
+@@ -1977,7 +1975,7 @@ static int ieee80211_drop_unencrypted(struct ieee80211_rx_data *rx, __le16 fc) |
8146 |
+ |
8147 |
+ /* Drop unencrypted frames if key is set. */ |
8148 |
+ if (unlikely(!ieee80211_has_protected(fc) && |
8149 |
+- !ieee80211_is_nullfunc(fc) && |
8150 |
++ !ieee80211_is_any_nullfunc(fc) && |
8151 |
+ ieee80211_is_data(fc) && rx->key)) |
8152 |
+ return -EACCES; |
8153 |
+ |
8154 |
+diff --git a/net/mac80211/status.c b/net/mac80211/status.c |
8155 |
+index d221300e59e5..618479e0d648 100644 |
8156 |
+--- a/net/mac80211/status.c |
8157 |
++++ b/net/mac80211/status.c |
8158 |
+@@ -474,8 +474,7 @@ static void ieee80211_report_ack_skb(struct ieee80211_local *local, |
8159 |
+ rcu_read_lock(); |
8160 |
+ sdata = ieee80211_sdata_from_skb(local, skb); |
8161 |
+ if (sdata) { |
8162 |
+- if (ieee80211_is_nullfunc(hdr->frame_control) || |
8163 |
+- ieee80211_is_qos_nullfunc(hdr->frame_control)) |
8164 |
++ if (ieee80211_is_any_nullfunc(hdr->frame_control)) |
8165 |
+ cfg80211_probe_status(sdata->dev, hdr->addr1, |
8166 |
+ cookie, acked, |
8167 |
+ GFP_ATOMIC); |
8168 |
+@@ -905,7 +904,7 @@ void ieee80211_tx_status(struct ieee80211_hw *hw, struct sk_buff *skb) |
8169 |
+ I802_DEBUG_INC(local->dot11FailedCount); |
8170 |
+ } |
8171 |
+ |
8172 |
+- if (ieee80211_is_nullfunc(fc) && ieee80211_has_pm(fc) && |
8173 |
++ if (ieee80211_is_any_nullfunc(fc) && ieee80211_has_pm(fc) && |
8174 |
+ ieee80211_hw_check(&local->hw, REPORTS_TX_ACK_STATUS) && |
8175 |
+ !(info->flags & IEEE80211_TX_CTL_INJECTED) && |
8176 |
+ local->ps_sdata && !(local->scanning)) { |
8177 |
+diff --git a/net/mac80211/tdls.c b/net/mac80211/tdls.c |
8178 |
+index ce2ece424384..ef6bde9b4ef9 100644 |
8179 |
+--- a/net/mac80211/tdls.c |
8180 |
++++ b/net/mac80211/tdls.c |
8181 |
+@@ -4,7 +4,7 @@ |
8182 |
+ * Copyright 2006-2010 Johannes Berg <johannes@××××××××××××.net> |
8183 |
+ * Copyright 2014, Intel Corporation |
8184 |
+ * Copyright 2014 Intel Mobile Communications GmbH |
8185 |
+- * Copyright 2015 Intel Deutschland GmbH |
8186 |
++ * Copyright 2015 - 2016 Intel Deutschland GmbH |
8187 |
+ * |
8188 |
+ * This file is GPLv2 as found in COPYING. |
8189 |
+ */ |
8190 |
+@@ -15,6 +15,7 @@ |
8191 |
+ #include <linux/rtnetlink.h> |
8192 |
+ #include "ieee80211_i.h" |
8193 |
+ #include "driver-ops.h" |
8194 |
++#include "rate.h" |
8195 |
+ |
8196 |
+ /* give usermode some time for retries in setting up the TDLS session */ |
8197 |
+ #define TDLS_PEER_SETUP_TIMEOUT (15 * HZ) |
8198 |
+@@ -302,7 +303,7 @@ ieee80211_tdls_chandef_vht_upgrade(struct ieee80211_sub_if_data *sdata, |
8199 |
+ /* IEEE802.11ac-2013 Table E-4 */ |
8200 |
+ u16 centers_80mhz[] = { 5210, 5290, 5530, 5610, 5690, 5775 }; |
8201 |
+ struct cfg80211_chan_def uc = sta->tdls_chandef; |
8202 |
+- enum nl80211_chan_width max_width = ieee80211_get_sta_bw(&sta->sta); |
8203 |
++ enum nl80211_chan_width max_width = ieee80211_sta_cap_chan_bw(sta); |
8204 |
+ int i; |
8205 |
+ |
8206 |
+ /* only support upgrading non-narrow channels up to 80Mhz */ |
8207 |
+@@ -313,7 +314,7 @@ ieee80211_tdls_chandef_vht_upgrade(struct ieee80211_sub_if_data *sdata, |
8208 |
+ if (max_width > NL80211_CHAN_WIDTH_80) |
8209 |
+ max_width = NL80211_CHAN_WIDTH_80; |
8210 |
+ |
8211 |
+- if (uc.width == max_width) |
8212 |
++ if (uc.width >= max_width) |
8213 |
+ return; |
8214 |
+ /* |
8215 |
+ * Channel usage constrains in the IEEE802.11ac-2013 specification only |
8216 |
+@@ -324,6 +325,7 @@ ieee80211_tdls_chandef_vht_upgrade(struct ieee80211_sub_if_data *sdata, |
8217 |
+ for (i = 0; i < ARRAY_SIZE(centers_80mhz); i++) |
8218 |
+ if (abs(uc.chan->center_freq - centers_80mhz[i]) <= 30) { |
8219 |
+ uc.center_freq1 = centers_80mhz[i]; |
8220 |
++ uc.center_freq2 = 0; |
8221 |
+ uc.width = NL80211_CHAN_WIDTH_80; |
8222 |
+ break; |
8223 |
+ } |
8224 |
+@@ -332,7 +334,7 @@ ieee80211_tdls_chandef_vht_upgrade(struct ieee80211_sub_if_data *sdata, |
8225 |
+ return; |
8226 |
+ |
8227 |
+ /* proceed to downgrade the chandef until usable or the same */ |
8228 |
+- while (uc.width > max_width && |
8229 |
++ while (uc.width > max_width || |
8230 |
+ !cfg80211_reg_can_beacon_relax(sdata->local->hw.wiphy, &uc, |
8231 |
+ sdata->wdev.iftype)) |
8232 |
+ ieee80211_chandef_downgrade(&uc); |
8233 |
+@@ -1242,18 +1244,44 @@ int ieee80211_tdls_mgmt(struct wiphy *wiphy, struct net_device *dev, |
8234 |
+ return ret; |
8235 |
+ } |
8236 |
+ |
8237 |
+-static void iee80211_tdls_recalc_chanctx(struct ieee80211_sub_if_data *sdata) |
8238 |
++static void iee80211_tdls_recalc_chanctx(struct ieee80211_sub_if_data *sdata, |
8239 |
++ struct sta_info *sta) |
8240 |
+ { |
8241 |
+ struct ieee80211_local *local = sdata->local; |
8242 |
+ struct ieee80211_chanctx_conf *conf; |
8243 |
+ struct ieee80211_chanctx *ctx; |
8244 |
++ enum nl80211_chan_width width; |
8245 |
++ struct ieee80211_supported_band *sband; |
8246 |
+ |
8247 |
+ mutex_lock(&local->chanctx_mtx); |
8248 |
+ conf = rcu_dereference_protected(sdata->vif.chanctx_conf, |
8249 |
+ lockdep_is_held(&local->chanctx_mtx)); |
8250 |
+ if (conf) { |
8251 |
++ width = conf->def.width; |
8252 |
++ sband = local->hw.wiphy->bands[conf->def.chan->band]; |
8253 |
+ ctx = container_of(conf, struct ieee80211_chanctx, conf); |
8254 |
+ ieee80211_recalc_chanctx_chantype(local, ctx); |
8255 |
++ |
8256 |
++ /* if width changed and a peer is given, update its BW */ |
8257 |
++ if (width != conf->def.width && sta && |
8258 |
++ test_sta_flag(sta, WLAN_STA_TDLS_WIDER_BW)) { |
8259 |
++ enum ieee80211_sta_rx_bandwidth bw; |
8260 |
++ |
8261 |
++ bw = ieee80211_chan_width_to_rx_bw(conf->def.width); |
8262 |
++ bw = min(bw, ieee80211_sta_cap_rx_bw(sta)); |
8263 |
++ if (bw != sta->sta.bandwidth) { |
8264 |
++ sta->sta.bandwidth = bw; |
8265 |
++ rate_control_rate_update(local, sband, sta, |
8266 |
++ IEEE80211_RC_BW_CHANGED); |
8267 |
++ /* |
8268 |
++ * if a TDLS peer BW was updated, we need to |
8269 |
++ * recalc the chandef width again, to get the |
8270 |
++ * correct chanctx min_def |
8271 |
++ */ |
8272 |
++ ieee80211_recalc_chanctx_chantype(local, ctx); |
8273 |
++ } |
8274 |
++ } |
8275 |
++ |
8276 |
+ } |
8277 |
+ mutex_unlock(&local->chanctx_mtx); |
8278 |
+ } |
8279 |
+@@ -1350,8 +1378,6 @@ int ieee80211_tdls_oper(struct wiphy *wiphy, struct net_device *dev, |
8280 |
+ break; |
8281 |
+ } |
8282 |
+ |
8283 |
+- iee80211_tdls_recalc_chanctx(sdata); |
8284 |
+- |
8285 |
+ mutex_lock(&local->sta_mtx); |
8286 |
+ sta = sta_info_get(sdata, peer); |
8287 |
+ if (!sta) { |
8288 |
+@@ -1360,6 +1386,7 @@ int ieee80211_tdls_oper(struct wiphy *wiphy, struct net_device *dev, |
8289 |
+ break; |
8290 |
+ } |
8291 |
+ |
8292 |
++ iee80211_tdls_recalc_chanctx(sdata, sta); |
8293 |
+ iee80211_tdls_recalc_ht_protection(sdata, sta); |
8294 |
+ |
8295 |
+ set_sta_flag(sta, WLAN_STA_TDLS_PEER_AUTH); |
8296 |
+@@ -1390,7 +1417,7 @@ int ieee80211_tdls_oper(struct wiphy *wiphy, struct net_device *dev, |
8297 |
+ iee80211_tdls_recalc_ht_protection(sdata, NULL); |
8298 |
+ mutex_unlock(&local->sta_mtx); |
8299 |
+ |
8300 |
+- iee80211_tdls_recalc_chanctx(sdata); |
8301 |
++ iee80211_tdls_recalc_chanctx(sdata, NULL); |
8302 |
+ break; |
8303 |
+ default: |
8304 |
+ ret = -ENOTSUPP; |
8305 |
+diff --git a/net/mac80211/tx.c b/net/mac80211/tx.c |
8306 |
+index 41f3eb565ef3..98c34c3adf39 100644 |
8307 |
+--- a/net/mac80211/tx.c |
8308 |
++++ b/net/mac80211/tx.c |
8309 |
+@@ -291,7 +291,7 @@ ieee80211_tx_h_check_assoc(struct ieee80211_tx_data *tx) |
8310 |
+ if (unlikely(test_bit(SCAN_SW_SCANNING, &tx->local->scanning)) && |
8311 |
+ test_bit(SDATA_STATE_OFFCHANNEL, &tx->sdata->state) && |
8312 |
+ !ieee80211_is_probe_req(hdr->frame_control) && |
8313 |
+- !ieee80211_is_nullfunc(hdr->frame_control)) |
8314 |
++ !ieee80211_is_any_nullfunc(hdr->frame_control)) |
8315 |
+ /* |
8316 |
+ * When software scanning only nullfunc frames (to notify |
8317 |
+ * the sleep state to the AP) and probe requests (for the |
8318 |
+diff --git a/net/mac80211/vht.c b/net/mac80211/vht.c |
8319 |
+index c38b2f07a919..c77ef4e2daa3 100644 |
8320 |
+--- a/net/mac80211/vht.c |
8321 |
++++ b/net/mac80211/vht.c |
8322 |
+@@ -299,7 +299,30 @@ enum ieee80211_sta_rx_bandwidth ieee80211_sta_cap_rx_bw(struct sta_info *sta) |
8323 |
+ return IEEE80211_STA_RX_BW_80; |
8324 |
+ } |
8325 |
+ |
8326 |
+-static enum ieee80211_sta_rx_bandwidth |
8327 |
++enum nl80211_chan_width ieee80211_sta_cap_chan_bw(struct sta_info *sta) |
8328 |
++{ |
8329 |
++ struct ieee80211_sta_vht_cap *vht_cap = &sta->sta.vht_cap; |
8330 |
++ u32 cap_width; |
8331 |
++ |
8332 |
++ if (!vht_cap->vht_supported) { |
8333 |
++ if (!sta->sta.ht_cap.ht_supported) |
8334 |
++ return NL80211_CHAN_WIDTH_20_NOHT; |
8335 |
++ |
8336 |
++ return sta->sta.ht_cap.cap & IEEE80211_HT_CAP_SUP_WIDTH_20_40 ? |
8337 |
++ NL80211_CHAN_WIDTH_40 : NL80211_CHAN_WIDTH_20; |
8338 |
++ } |
8339 |
++ |
8340 |
++ cap_width = vht_cap->cap & IEEE80211_VHT_CAP_SUPP_CHAN_WIDTH_MASK; |
8341 |
++ |
8342 |
++ if (cap_width == IEEE80211_VHT_CAP_SUPP_CHAN_WIDTH_160MHZ) |
8343 |
++ return NL80211_CHAN_WIDTH_160; |
8344 |
++ else if (cap_width == IEEE80211_VHT_CAP_SUPP_CHAN_WIDTH_160_80PLUS80MHZ) |
8345 |
++ return NL80211_CHAN_WIDTH_80P80; |
8346 |
++ |
8347 |
++ return NL80211_CHAN_WIDTH_80; |
8348 |
++} |
8349 |
++ |
8350 |
++enum ieee80211_sta_rx_bandwidth |
8351 |
+ ieee80211_chan_width_to_rx_bw(enum nl80211_chan_width width) |
8352 |
+ { |
8353 |
+ switch (width) { |
8354 |
+@@ -327,10 +350,7 @@ enum ieee80211_sta_rx_bandwidth ieee80211_sta_cur_vht_bw(struct sta_info *sta) |
8355 |
+ |
8356 |
+ bw = ieee80211_sta_cap_rx_bw(sta); |
8357 |
+ bw = min(bw, sta->cur_max_bandwidth); |
8358 |
+- |
8359 |
+- /* do not cap the BW of TDLS WIDER_BW peers by the bss */ |
8360 |
+- if (!test_sta_flag(sta, WLAN_STA_TDLS_WIDER_BW)) |
8361 |
+- bw = min(bw, ieee80211_chan_width_to_rx_bw(bss_width)); |
8362 |
++ bw = min(bw, ieee80211_chan_width_to_rx_bw(bss_width)); |
8363 |
+ |
8364 |
+ return bw; |
8365 |
+ } |
8366 |
+diff --git a/net/netfilter/nf_tables_api.c b/net/netfilter/nf_tables_api.c |
8367 |
+index a7967af0da82..6203995003a5 100644 |
8368 |
+--- a/net/netfilter/nf_tables_api.c |
8369 |
++++ b/net/netfilter/nf_tables_api.c |
8370 |
+@@ -2849,12 +2849,14 @@ static int nf_tables_newset(struct net *net, struct sock *nlsk, |
8371 |
+ |
8372 |
+ err = nft_trans_set_add(&ctx, NFT_MSG_NEWSET, set); |
8373 |
+ if (err < 0) |
8374 |
+- goto err2; |
8375 |
++ goto err3; |
8376 |
+ |
8377 |
+ list_add_tail_rcu(&set->list, &table->sets); |
8378 |
+ table->use++; |
8379 |
+ return 0; |
8380 |
+ |
8381 |
++err3: |
8382 |
++ ops->destroy(set); |
8383 |
+ err2: |
8384 |
+ kfree(set); |
8385 |
+ err1: |
8386 |
+diff --git a/net/netfilter/nf_tables_core.c b/net/netfilter/nf_tables_core.c |
8387 |
+index 99bc2f87a974..204be9374657 100644 |
8388 |
+--- a/net/netfilter/nf_tables_core.c |
8389 |
++++ b/net/netfilter/nf_tables_core.c |
8390 |
+@@ -130,7 +130,7 @@ next_rule: |
8391 |
+ list_for_each_entry_continue_rcu(rule, &chain->rules, list) { |
8392 |
+ |
8393 |
+ /* This rule is not active, skip. */ |
8394 |
+- if (unlikely(rule->genmask & (1 << gencursor))) |
8395 |
++ if (unlikely(rule->genmask & gencursor)) |
8396 |
+ continue; |
8397 |
+ |
8398 |
+ rulenum++; |
8399 |
+diff --git a/net/netfilter/nfnetlink.c b/net/netfilter/nfnetlink.c |
8400 |
+index 044559c10e98..f01764b94b34 100644 |
8401 |
+--- a/net/netfilter/nfnetlink.c |
8402 |
++++ b/net/netfilter/nfnetlink.c |
8403 |
+@@ -309,14 +309,14 @@ replay: |
8404 |
+ #endif |
8405 |
+ { |
8406 |
+ nfnl_unlock(subsys_id); |
8407 |
+- netlink_ack(skb, nlh, -EOPNOTSUPP); |
8408 |
++ netlink_ack(oskb, nlh, -EOPNOTSUPP); |
8409 |
+ return kfree_skb(skb); |
8410 |
+ } |
8411 |
+ } |
8412 |
+ |
8413 |
+ if (!ss->commit || !ss->abort) { |
8414 |
+ nfnl_unlock(subsys_id); |
8415 |
+- netlink_ack(skb, nlh, -EOPNOTSUPP); |
8416 |
++ netlink_ack(oskb, nlh, -EOPNOTSUPP); |
8417 |
+ return kfree_skb(skb); |
8418 |
+ } |
8419 |
+ |
8420 |
+@@ -406,7 +406,7 @@ ack: |
8421 |
+ * pointing to the batch header. |
8422 |
+ */ |
8423 |
+ nfnl_err_reset(&err_list); |
8424 |
+- netlink_ack(skb, nlmsg_hdr(oskb), -ENOMEM); |
8425 |
++ netlink_ack(oskb, nlmsg_hdr(oskb), -ENOMEM); |
8426 |
+ status |= NFNL_BATCH_FAILURE; |
8427 |
+ goto done; |
8428 |
+ } |
8429 |
+diff --git a/net/netfilter/nft_dynset.c b/net/netfilter/nft_dynset.c |
8430 |
+index 0a5df0cbaa28..a6c29c5bbfbd 100644 |
8431 |
+--- a/net/netfilter/nft_dynset.c |
8432 |
++++ b/net/netfilter/nft_dynset.c |
8433 |
+@@ -121,6 +121,9 @@ static int nft_dynset_init(const struct nft_ctx *ctx, |
8434 |
+ return PTR_ERR(set); |
8435 |
+ } |
8436 |
+ |
8437 |
++ if (set->ops->update == NULL) |
8438 |
++ return -EOPNOTSUPP; |
8439 |
++ |
8440 |
+ if (set->flags & NFT_SET_CONSTANT) |
8441 |
+ return -EBUSY; |
8442 |
+ |
8443 |
+diff --git a/net/nfc/nci/core.c b/net/nfc/nci/core.c |
8444 |
+index 67583ad7f610..6ac1a8d19b88 100644 |
8445 |
+--- a/net/nfc/nci/core.c |
8446 |
++++ b/net/nfc/nci/core.c |
8447 |
+@@ -610,14 +610,14 @@ int nci_core_conn_create(struct nci_dev *ndev, u8 destination_type, |
8448 |
+ struct nci_core_conn_create_cmd *cmd; |
8449 |
+ struct core_conn_create_data data; |
8450 |
+ |
8451 |
++ if (!number_destination_params) |
8452 |
++ return -EINVAL; |
8453 |
++ |
8454 |
+ data.length = params_len + sizeof(struct nci_core_conn_create_cmd); |
8455 |
+ cmd = kzalloc(data.length, GFP_KERNEL); |
8456 |
+ if (!cmd) |
8457 |
+ return -ENOMEM; |
8458 |
+ |
8459 |
+- if (!number_destination_params) |
8460 |
+- return -EINVAL; |
8461 |
+- |
8462 |
+ cmd->destination_type = destination_type; |
8463 |
+ cmd->number_destination_params = number_destination_params; |
8464 |
+ memcpy(cmd->params, params, params_len); |
8465 |
+diff --git a/net/openvswitch/actions.c b/net/openvswitch/actions.c |
8466 |
+index 7cb8184ac165..fd6c587b6a04 100644 |
8467 |
+--- a/net/openvswitch/actions.c |
8468 |
++++ b/net/openvswitch/actions.c |
8469 |
+@@ -137,11 +137,23 @@ static bool is_flow_key_valid(const struct sw_flow_key *key) |
8470 |
+ return !!key->eth.type; |
8471 |
+ } |
8472 |
+ |
8473 |
++static void update_ethertype(struct sk_buff *skb, struct ethhdr *hdr, |
8474 |
++ __be16 ethertype) |
8475 |
++{ |
8476 |
++ if (skb->ip_summed == CHECKSUM_COMPLETE) { |
8477 |
++ __be16 diff[] = { ~(hdr->h_proto), ethertype }; |
8478 |
++ |
8479 |
++ skb->csum = ~csum_partial((char *)diff, sizeof(diff), |
8480 |
++ ~skb->csum); |
8481 |
++ } |
8482 |
++ |
8483 |
++ hdr->h_proto = ethertype; |
8484 |
++} |
8485 |
++ |
8486 |
+ static int push_mpls(struct sk_buff *skb, struct sw_flow_key *key, |
8487 |
+ const struct ovs_action_push_mpls *mpls) |
8488 |
+ { |
8489 |
+ __be32 *new_mpls_lse; |
8490 |
+- struct ethhdr *hdr; |
8491 |
+ |
8492 |
+ /* Networking stack do not allow simultaneous Tunnel and MPLS GSO. */ |
8493 |
+ if (skb->encapsulation) |
8494 |
+@@ -160,9 +172,7 @@ static int push_mpls(struct sk_buff *skb, struct sw_flow_key *key, |
8495 |
+ |
8496 |
+ skb_postpush_rcsum(skb, new_mpls_lse, MPLS_HLEN); |
8497 |
+ |
8498 |
+- hdr = eth_hdr(skb); |
8499 |
+- hdr->h_proto = mpls->mpls_ethertype; |
8500 |
+- |
8501 |
++ update_ethertype(skb, eth_hdr(skb), mpls->mpls_ethertype); |
8502 |
+ if (!skb->inner_protocol) |
8503 |
+ skb_set_inner_protocol(skb, skb->protocol); |
8504 |
+ skb->protocol = mpls->mpls_ethertype; |
8505 |
+@@ -193,7 +203,7 @@ static int pop_mpls(struct sk_buff *skb, struct sw_flow_key *key, |
8506 |
+ * field correctly in the presence of VLAN tags. |
8507 |
+ */ |
8508 |
+ hdr = (struct ethhdr *)(skb_mpls_header(skb) - ETH_HLEN); |
8509 |
+- hdr->h_proto = ethertype; |
8510 |
++ update_ethertype(skb, hdr, ethertype); |
8511 |
+ if (eth_p_mpls(skb->protocol)) |
8512 |
+ skb->protocol = ethertype; |
8513 |
+ |
8514 |
+diff --git a/net/rds/tcp.c b/net/rds/tcp.c |
8515 |
+index c10622a9321c..465756fe7958 100644 |
8516 |
+--- a/net/rds/tcp.c |
8517 |
++++ b/net/rds/tcp.c |
8518 |
+@@ -110,7 +110,7 @@ void rds_tcp_restore_callbacks(struct socket *sock, |
8519 |
+ |
8520 |
+ /* |
8521 |
+ * This is the only path that sets tc->t_sock. Send and receive trust that |
8522 |
+- * it is set. The RDS_CONN_CONNECTED bit protects those paths from being |
8523 |
++ * it is set. The RDS_CONN_UP bit protects those paths from being |
8524 |
+ * called while it isn't set. |
8525 |
+ */ |
8526 |
+ void rds_tcp_set_callbacks(struct socket *sock, struct rds_connection *conn) |
8527 |
+diff --git a/net/rds/tcp_listen.c b/net/rds/tcp_listen.c |
8528 |
+index e353e3255206..5213cd781c24 100644 |
8529 |
+--- a/net/rds/tcp_listen.c |
8530 |
++++ b/net/rds/tcp_listen.c |
8531 |
+@@ -115,24 +115,32 @@ int rds_tcp_accept_one(struct socket *sock) |
8532 |
+ * rds_tcp_state_change() will do that cleanup |
8533 |
+ */ |
8534 |
+ rs_tcp = (struct rds_tcp_connection *)conn->c_transport_data; |
8535 |
+- if (rs_tcp->t_sock && |
8536 |
+- ntohl(inet->inet_saddr) < ntohl(inet->inet_daddr)) { |
8537 |
+- struct sock *nsk = new_sock->sk; |
8538 |
+- |
8539 |
+- nsk->sk_user_data = NULL; |
8540 |
+- nsk->sk_prot->disconnect(nsk, 0); |
8541 |
+- tcp_done(nsk); |
8542 |
+- new_sock = NULL; |
8543 |
+- ret = 0; |
8544 |
+- goto out; |
8545 |
+- } else if (rs_tcp->t_sock) { |
8546 |
+- rds_tcp_restore_callbacks(rs_tcp->t_sock, rs_tcp); |
8547 |
+- conn->c_outgoing = 0; |
8548 |
+- } |
8549 |
+- |
8550 |
+ rds_conn_transition(conn, RDS_CONN_DOWN, RDS_CONN_CONNECTING); |
8551 |
++ if (rs_tcp->t_sock) { |
8552 |
++ /* Need to resolve a duelling SYN between peers. |
8553 |
++ * We have an outstanding SYN to this peer, which may |
8554 |
++ * potentially have transitioned to the RDS_CONN_UP state, |
8555 |
++ * so we must quiesce any send threads before resetting |
8556 |
++ * c_transport_data. |
8557 |
++ */ |
8558 |
++ wait_event(conn->c_waitq, |
8559 |
++ !test_bit(RDS_IN_XMIT, &conn->c_flags)); |
8560 |
++ if (ntohl(inet->inet_saddr) < ntohl(inet->inet_daddr)) { |
8561 |
++ struct sock *nsk = new_sock->sk; |
8562 |
++ |
8563 |
++ nsk->sk_user_data = NULL; |
8564 |
++ nsk->sk_prot->disconnect(nsk, 0); |
8565 |
++ tcp_done(nsk); |
8566 |
++ new_sock = NULL; |
8567 |
++ ret = 0; |
8568 |
++ goto out; |
8569 |
++ } else if (rs_tcp->t_sock) { |
8570 |
++ rds_tcp_restore_callbacks(rs_tcp->t_sock, rs_tcp); |
8571 |
++ conn->c_outgoing = 0; |
8572 |
++ } |
8573 |
++ } |
8574 |
+ rds_tcp_set_callbacks(new_sock, conn); |
8575 |
+- rds_connect_complete(conn); |
8576 |
++ rds_connect_complete(conn); /* marks RDS_CONN_UP */ |
8577 |
+ new_sock = NULL; |
8578 |
+ ret = 0; |
8579 |
+ |
8580 |
+diff --git a/net/sched/cls_bpf.c b/net/sched/cls_bpf.c |
8581 |
+index 3eef0215e53f..cdfb8d33bcba 100644 |
8582 |
+--- a/net/sched/cls_bpf.c |
8583 |
++++ b/net/sched/cls_bpf.c |
8584 |
+@@ -107,8 +107,9 @@ static int cls_bpf_classify(struct sk_buff *skb, const struct tcf_proto *tp, |
8585 |
+ } |
8586 |
+ |
8587 |
+ if (prog->exts_integrated) { |
8588 |
+- res->class = prog->res.class; |
8589 |
+- res->classid = qdisc_skb_cb(skb)->tc_classid; |
8590 |
++ res->class = 0; |
8591 |
++ res->classid = TC_H_MAJ(prog->res.classid) | |
8592 |
++ qdisc_skb_cb(skb)->tc_classid; |
8593 |
+ |
8594 |
+ ret = cls_bpf_exec_opcode(filter_res); |
8595 |
+ if (ret == TC_ACT_UNSPEC) |
8596 |
+@@ -118,10 +119,12 @@ static int cls_bpf_classify(struct sk_buff *skb, const struct tcf_proto *tp, |
8597 |
+ |
8598 |
+ if (filter_res == 0) |
8599 |
+ continue; |
8600 |
+- |
8601 |
+- *res = prog->res; |
8602 |
+- if (filter_res != -1) |
8603 |
++ if (filter_res != -1) { |
8604 |
++ res->class = 0; |
8605 |
+ res->classid = filter_res; |
8606 |
++ } else { |
8607 |
++ *res = prog->res; |
8608 |
++ } |
8609 |
+ |
8610 |
+ ret = tcf_exts_exec(skb, &prog->exts, res); |
8611 |
+ if (ret < 0) |
8612 |
+diff --git a/net/sched/cls_flower.c b/net/sched/cls_flower.c |
8613 |
+index 5ab8205f988b..a97096a7f801 100644 |
8614 |
+--- a/net/sched/cls_flower.c |
8615 |
++++ b/net/sched/cls_flower.c |
8616 |
+@@ -351,12 +351,10 @@ static int fl_init_hashtable(struct cls_fl_head *head, |
8617 |
+ |
8618 |
+ #define FL_KEY_MEMBER_OFFSET(member) offsetof(struct fl_flow_key, member) |
8619 |
+ #define FL_KEY_MEMBER_SIZE(member) (sizeof(((struct fl_flow_key *) 0)->member)) |
8620 |
+-#define FL_KEY_MEMBER_END_OFFSET(member) \ |
8621 |
+- (FL_KEY_MEMBER_OFFSET(member) + FL_KEY_MEMBER_SIZE(member)) |
8622 |
+ |
8623 |
+-#define FL_KEY_IN_RANGE(mask, member) \ |
8624 |
+- (FL_KEY_MEMBER_OFFSET(member) <= (mask)->range.end && \ |
8625 |
+- FL_KEY_MEMBER_END_OFFSET(member) >= (mask)->range.start) |
8626 |
++#define FL_KEY_IS_MASKED(mask, member) \ |
8627 |
++ memchr_inv(((char *)mask) + FL_KEY_MEMBER_OFFSET(member), \ |
8628 |
++ 0, FL_KEY_MEMBER_SIZE(member)) \ |
8629 |
+ |
8630 |
+ #define FL_KEY_SET(keys, cnt, id, member) \ |
8631 |
+ do { \ |
8632 |
+@@ -365,9 +363,9 @@ static int fl_init_hashtable(struct cls_fl_head *head, |
8633 |
+ cnt++; \ |
8634 |
+ } while(0); |
8635 |
+ |
8636 |
+-#define FL_KEY_SET_IF_IN_RANGE(mask, keys, cnt, id, member) \ |
8637 |
++#define FL_KEY_SET_IF_MASKED(mask, keys, cnt, id, member) \ |
8638 |
+ do { \ |
8639 |
+- if (FL_KEY_IN_RANGE(mask, member)) \ |
8640 |
++ if (FL_KEY_IS_MASKED(mask, member)) \ |
8641 |
+ FL_KEY_SET(keys, cnt, id, member); \ |
8642 |
+ } while(0); |
8643 |
+ |
8644 |
+@@ -379,14 +377,14 @@ static void fl_init_dissector(struct cls_fl_head *head, |
8645 |
+ |
8646 |
+ FL_KEY_SET(keys, cnt, FLOW_DISSECTOR_KEY_CONTROL, control); |
8647 |
+ FL_KEY_SET(keys, cnt, FLOW_DISSECTOR_KEY_BASIC, basic); |
8648 |
+- FL_KEY_SET_IF_IN_RANGE(mask, keys, cnt, |
8649 |
+- FLOW_DISSECTOR_KEY_ETH_ADDRS, eth); |
8650 |
+- FL_KEY_SET_IF_IN_RANGE(mask, keys, cnt, |
8651 |
+- FLOW_DISSECTOR_KEY_IPV4_ADDRS, ipv4); |
8652 |
+- FL_KEY_SET_IF_IN_RANGE(mask, keys, cnt, |
8653 |
+- FLOW_DISSECTOR_KEY_IPV6_ADDRS, ipv6); |
8654 |
+- FL_KEY_SET_IF_IN_RANGE(mask, keys, cnt, |
8655 |
+- FLOW_DISSECTOR_KEY_PORTS, tp); |
8656 |
++ FL_KEY_SET_IF_MASKED(&mask->key, keys, cnt, |
8657 |
++ FLOW_DISSECTOR_KEY_ETH_ADDRS, eth); |
8658 |
++ FL_KEY_SET_IF_MASKED(&mask->key, keys, cnt, |
8659 |
++ FLOW_DISSECTOR_KEY_IPV4_ADDRS, ipv4); |
8660 |
++ FL_KEY_SET_IF_MASKED(&mask->key, keys, cnt, |
8661 |
++ FLOW_DISSECTOR_KEY_IPV6_ADDRS, ipv6); |
8662 |
++ FL_KEY_SET_IF_MASKED(&mask->key, keys, cnt, |
8663 |
++ FLOW_DISSECTOR_KEY_PORTS, tp); |
8664 |
+ |
8665 |
+ skb_flow_dissector_init(&head->dissector, keys, cnt); |
8666 |
+ } |
8667 |
+diff --git a/net/sched/sch_drr.c b/net/sched/sch_drr.c |
8668 |
+index d6e3ad43cecb..06e42727590a 100644 |
8669 |
+--- a/net/sched/sch_drr.c |
8670 |
++++ b/net/sched/sch_drr.c |
8671 |
+@@ -375,6 +375,7 @@ static int drr_enqueue(struct sk_buff *skb, struct Qdisc *sch) |
8672 |
+ cl->deficit = cl->quantum; |
8673 |
+ } |
8674 |
+ |
8675 |
++ qdisc_qstats_backlog_inc(sch, skb); |
8676 |
+ sch->q.qlen++; |
8677 |
+ return err; |
8678 |
+ } |
8679 |
+@@ -405,6 +406,7 @@ static struct sk_buff *drr_dequeue(struct Qdisc *sch) |
8680 |
+ |
8681 |
+ bstats_update(&cl->bstats, skb); |
8682 |
+ qdisc_bstats_update(sch, skb); |
8683 |
++ qdisc_qstats_backlog_dec(sch, skb); |
8684 |
+ sch->q.qlen--; |
8685 |
+ return skb; |
8686 |
+ } |
8687 |
+@@ -426,6 +428,7 @@ static unsigned int drr_drop(struct Qdisc *sch) |
8688 |
+ if (cl->qdisc->ops->drop) { |
8689 |
+ len = cl->qdisc->ops->drop(cl->qdisc); |
8690 |
+ if (len > 0) { |
8691 |
++ sch->qstats.backlog -= len; |
8692 |
+ sch->q.qlen--; |
8693 |
+ if (cl->qdisc->q.qlen == 0) |
8694 |
+ list_del(&cl->alist); |
8695 |
+@@ -461,6 +464,7 @@ static void drr_reset_qdisc(struct Qdisc *sch) |
8696 |
+ qdisc_reset(cl->qdisc); |
8697 |
+ } |
8698 |
+ } |
8699 |
++ sch->qstats.backlog = 0; |
8700 |
+ sch->q.qlen = 0; |
8701 |
+ } |
8702 |
+ |
8703 |
+diff --git a/net/sched/sch_fq.c b/net/sched/sch_fq.c |
8704 |
+index eb814ffc0902..f4aa2ab4713a 100644 |
8705 |
+--- a/net/sched/sch_fq.c |
8706 |
++++ b/net/sched/sch_fq.c |
8707 |
+@@ -830,20 +830,24 @@ nla_put_failure: |
8708 |
+ static int fq_dump_stats(struct Qdisc *sch, struct gnet_dump *d) |
8709 |
+ { |
8710 |
+ struct fq_sched_data *q = qdisc_priv(sch); |
8711 |
+- u64 now = ktime_get_ns(); |
8712 |
+- struct tc_fq_qd_stats st = { |
8713 |
+- .gc_flows = q->stat_gc_flows, |
8714 |
+- .highprio_packets = q->stat_internal_packets, |
8715 |
+- .tcp_retrans = q->stat_tcp_retrans, |
8716 |
+- .throttled = q->stat_throttled, |
8717 |
+- .flows_plimit = q->stat_flows_plimit, |
8718 |
+- .pkts_too_long = q->stat_pkts_too_long, |
8719 |
+- .allocation_errors = q->stat_allocation_errors, |
8720 |
+- .flows = q->flows, |
8721 |
+- .inactive_flows = q->inactive_flows, |
8722 |
+- .throttled_flows = q->throttled_flows, |
8723 |
+- .time_next_delayed_flow = q->time_next_delayed_flow - now, |
8724 |
+- }; |
8725 |
++ struct tc_fq_qd_stats st; |
8726 |
++ |
8727 |
++ sch_tree_lock(sch); |
8728 |
++ |
8729 |
++ st.gc_flows = q->stat_gc_flows; |
8730 |
++ st.highprio_packets = q->stat_internal_packets; |
8731 |
++ st.tcp_retrans = q->stat_tcp_retrans; |
8732 |
++ st.throttled = q->stat_throttled; |
8733 |
++ st.flows_plimit = q->stat_flows_plimit; |
8734 |
++ st.pkts_too_long = q->stat_pkts_too_long; |
8735 |
++ st.allocation_errors = q->stat_allocation_errors; |
8736 |
++ st.time_next_delayed_flow = q->time_next_delayed_flow - ktime_get_ns(); |
8737 |
++ st.flows = q->flows; |
8738 |
++ st.inactive_flows = q->inactive_flows; |
8739 |
++ st.throttled_flows = q->throttled_flows; |
8740 |
++ st.pad = 0; |
8741 |
++ |
8742 |
++ sch_tree_unlock(sch); |
8743 |
+ |
8744 |
+ return gnet_stats_copy_app(d, &st, sizeof(st)); |
8745 |
+ } |
8746 |
+diff --git a/net/sched/sch_fq_codel.c b/net/sched/sch_fq_codel.c |
8747 |
+index 1800f7977595..70e0dfd21f04 100644 |
8748 |
+--- a/net/sched/sch_fq_codel.c |
8749 |
++++ b/net/sched/sch_fq_codel.c |
8750 |
+@@ -588,7 +588,7 @@ static int fq_codel_dump_class_stats(struct Qdisc *sch, unsigned long cl, |
8751 |
+ qs.backlog = q->backlogs[idx]; |
8752 |
+ qs.drops = flow->dropped; |
8753 |
+ } |
8754 |
+- if (gnet_stats_copy_queue(d, NULL, &qs, 0) < 0) |
8755 |
++ if (gnet_stats_copy_queue(d, NULL, &qs, qs.qlen) < 0) |
8756 |
+ return -1; |
8757 |
+ if (idx < q->flows_cnt) |
8758 |
+ return gnet_stats_copy_app(d, &xstats, sizeof(xstats)); |
8759 |
+diff --git a/net/sched/sch_generic.c b/net/sched/sch_generic.c |
8760 |
+index eec6dc2d3152..09cd65434748 100644 |
8761 |
+--- a/net/sched/sch_generic.c |
8762 |
++++ b/net/sched/sch_generic.c |
8763 |
+@@ -49,6 +49,7 @@ static inline int dev_requeue_skb(struct sk_buff *skb, struct Qdisc *q) |
8764 |
+ { |
8765 |
+ q->gso_skb = skb; |
8766 |
+ q->qstats.requeues++; |
8767 |
++ qdisc_qstats_backlog_inc(q, skb); |
8768 |
+ q->q.qlen++; /* it's still part of the queue */ |
8769 |
+ __netif_schedule(q); |
8770 |
+ |
8771 |
+@@ -92,6 +93,7 @@ static struct sk_buff *dequeue_skb(struct Qdisc *q, bool *validate, |
8772 |
+ txq = skb_get_tx_queue(txq->dev, skb); |
8773 |
+ if (!netif_xmit_frozen_or_stopped(txq)) { |
8774 |
+ q->gso_skb = NULL; |
8775 |
++ qdisc_qstats_backlog_dec(q, skb); |
8776 |
+ q->q.qlen--; |
8777 |
+ } else |
8778 |
+ skb = NULL; |
8779 |
+@@ -624,18 +626,19 @@ struct Qdisc *qdisc_create_dflt(struct netdev_queue *dev_queue, |
8780 |
+ struct Qdisc *sch; |
8781 |
+ |
8782 |
+ if (!try_module_get(ops->owner)) |
8783 |
+- goto errout; |
8784 |
++ return NULL; |
8785 |
+ |
8786 |
+ sch = qdisc_alloc(dev_queue, ops); |
8787 |
+- if (IS_ERR(sch)) |
8788 |
+- goto errout; |
8789 |
++ if (IS_ERR(sch)) { |
8790 |
++ module_put(ops->owner); |
8791 |
++ return NULL; |
8792 |
++ } |
8793 |
+ sch->parent = parentid; |
8794 |
+ |
8795 |
+ if (!ops->init || ops->init(sch, NULL) == 0) |
8796 |
+ return sch; |
8797 |
+ |
8798 |
+ qdisc_destroy(sch); |
8799 |
+-errout: |
8800 |
+ return NULL; |
8801 |
+ } |
8802 |
+ EXPORT_SYMBOL(qdisc_create_dflt); |
8803 |
+diff --git a/net/sched/sch_hfsc.c b/net/sched/sch_hfsc.c |
8804 |
+index d783d7cc3348..1ac9f9f03fe3 100644 |
8805 |
+--- a/net/sched/sch_hfsc.c |
8806 |
++++ b/net/sched/sch_hfsc.c |
8807 |
+@@ -1529,6 +1529,7 @@ hfsc_reset_qdisc(struct Qdisc *sch) |
8808 |
+ q->eligible = RB_ROOT; |
8809 |
+ INIT_LIST_HEAD(&q->droplist); |
8810 |
+ qdisc_watchdog_cancel(&q->watchdog); |
8811 |
++ sch->qstats.backlog = 0; |
8812 |
+ sch->q.qlen = 0; |
8813 |
+ } |
8814 |
+ |
8815 |
+@@ -1559,14 +1560,6 @@ hfsc_dump_qdisc(struct Qdisc *sch, struct sk_buff *skb) |
8816 |
+ struct hfsc_sched *q = qdisc_priv(sch); |
8817 |
+ unsigned char *b = skb_tail_pointer(skb); |
8818 |
+ struct tc_hfsc_qopt qopt; |
8819 |
+- struct hfsc_class *cl; |
8820 |
+- unsigned int i; |
8821 |
+- |
8822 |
+- sch->qstats.backlog = 0; |
8823 |
+- for (i = 0; i < q->clhash.hashsize; i++) { |
8824 |
+- hlist_for_each_entry(cl, &q->clhash.hash[i], cl_common.hnode) |
8825 |
+- sch->qstats.backlog += cl->qdisc->qstats.backlog; |
8826 |
+- } |
8827 |
+ |
8828 |
+ qopt.defcls = q->defcls; |
8829 |
+ if (nla_put(skb, TCA_OPTIONS, sizeof(qopt), &qopt)) |
8830 |
+@@ -1604,6 +1597,7 @@ hfsc_enqueue(struct sk_buff *skb, struct Qdisc *sch) |
8831 |
+ if (cl->qdisc->q.qlen == 1) |
8832 |
+ set_active(cl, qdisc_pkt_len(skb)); |
8833 |
+ |
8834 |
++ qdisc_qstats_backlog_inc(sch, skb); |
8835 |
+ sch->q.qlen++; |
8836 |
+ |
8837 |
+ return NET_XMIT_SUCCESS; |
8838 |
+@@ -1672,6 +1666,7 @@ hfsc_dequeue(struct Qdisc *sch) |
8839 |
+ |
8840 |
+ qdisc_unthrottled(sch); |
8841 |
+ qdisc_bstats_update(sch, skb); |
8842 |
++ qdisc_qstats_backlog_dec(sch, skb); |
8843 |
+ sch->q.qlen--; |
8844 |
+ |
8845 |
+ return skb; |
8846 |
+@@ -1695,6 +1690,7 @@ hfsc_drop(struct Qdisc *sch) |
8847 |
+ } |
8848 |
+ cl->qstats.drops++; |
8849 |
+ qdisc_qstats_drop(sch); |
8850 |
++ sch->qstats.backlog -= len; |
8851 |
+ sch->q.qlen--; |
8852 |
+ return len; |
8853 |
+ } |
8854 |
+diff --git a/net/sched/sch_prio.c b/net/sched/sch_prio.c |
8855 |
+index ca9fb2b0c14a..40ed14433f2c 100644 |
8856 |
+--- a/net/sched/sch_prio.c |
8857 |
++++ b/net/sched/sch_prio.c |
8858 |
+@@ -85,6 +85,7 @@ prio_enqueue(struct sk_buff *skb, struct Qdisc *sch) |
8859 |
+ |
8860 |
+ ret = qdisc_enqueue(skb, qdisc); |
8861 |
+ if (ret == NET_XMIT_SUCCESS) { |
8862 |
++ qdisc_qstats_backlog_inc(sch, skb); |
8863 |
+ sch->q.qlen++; |
8864 |
+ return NET_XMIT_SUCCESS; |
8865 |
+ } |
8866 |
+@@ -117,6 +118,7 @@ static struct sk_buff *prio_dequeue(struct Qdisc *sch) |
8867 |
+ struct sk_buff *skb = qdisc_dequeue_peeked(qdisc); |
8868 |
+ if (skb) { |
8869 |
+ qdisc_bstats_update(sch, skb); |
8870 |
++ qdisc_qstats_backlog_dec(sch, skb); |
8871 |
+ sch->q.qlen--; |
8872 |
+ return skb; |
8873 |
+ } |
8874 |
+@@ -135,6 +137,7 @@ static unsigned int prio_drop(struct Qdisc *sch) |
8875 |
+ for (prio = q->bands-1; prio >= 0; prio--) { |
8876 |
+ qdisc = q->queues[prio]; |
8877 |
+ if (qdisc->ops->drop && (len = qdisc->ops->drop(qdisc)) != 0) { |
8878 |
++ sch->qstats.backlog -= len; |
8879 |
+ sch->q.qlen--; |
8880 |
+ return len; |
8881 |
+ } |
8882 |
+@@ -151,6 +154,7 @@ prio_reset(struct Qdisc *sch) |
8883 |
+ |
8884 |
+ for (prio = 0; prio < q->bands; prio++) |
8885 |
+ qdisc_reset(q->queues[prio]); |
8886 |
++ sch->qstats.backlog = 0; |
8887 |
+ sch->q.qlen = 0; |
8888 |
+ } |
8889 |
+ |
8890 |
+diff --git a/net/sched/sch_qfq.c b/net/sched/sch_qfq.c |
8891 |
+index 8d2d8d953432..8dabd8257b49 100644 |
8892 |
+--- a/net/sched/sch_qfq.c |
8893 |
++++ b/net/sched/sch_qfq.c |
8894 |
+@@ -1150,6 +1150,7 @@ static struct sk_buff *qfq_dequeue(struct Qdisc *sch) |
8895 |
+ if (!skb) |
8896 |
+ return NULL; |
8897 |
+ |
8898 |
++ qdisc_qstats_backlog_dec(sch, skb); |
8899 |
+ sch->q.qlen--; |
8900 |
+ qdisc_bstats_update(sch, skb); |
8901 |
+ |
8902 |
+@@ -1250,6 +1251,7 @@ static int qfq_enqueue(struct sk_buff *skb, struct Qdisc *sch) |
8903 |
+ } |
8904 |
+ |
8905 |
+ bstats_update(&cl->bstats, skb); |
8906 |
++ qdisc_qstats_backlog_inc(sch, skb); |
8907 |
+ ++sch->q.qlen; |
8908 |
+ |
8909 |
+ agg = cl->agg; |
8910 |
+@@ -1516,6 +1518,7 @@ static void qfq_reset_qdisc(struct Qdisc *sch) |
8911 |
+ qdisc_reset(cl->qdisc); |
8912 |
+ } |
8913 |
+ } |
8914 |
++ sch->qstats.backlog = 0; |
8915 |
+ sch->q.qlen = 0; |
8916 |
+ } |
8917 |
+ |
8918 |
+diff --git a/net/sched/sch_sfb.c b/net/sched/sch_sfb.c |
8919 |
+index 10c0b184cdbe..624b5e6fa52f 100644 |
8920 |
+--- a/net/sched/sch_sfb.c |
8921 |
++++ b/net/sched/sch_sfb.c |
8922 |
+@@ -400,6 +400,7 @@ static int sfb_enqueue(struct sk_buff *skb, struct Qdisc *sch) |
8923 |
+ enqueue: |
8924 |
+ ret = qdisc_enqueue(skb, child); |
8925 |
+ if (likely(ret == NET_XMIT_SUCCESS)) { |
8926 |
++ qdisc_qstats_backlog_inc(sch, skb); |
8927 |
+ sch->q.qlen++; |
8928 |
+ increment_qlen(skb, q); |
8929 |
+ } else if (net_xmit_drop_count(ret)) { |
8930 |
+@@ -428,6 +429,7 @@ static struct sk_buff *sfb_dequeue(struct Qdisc *sch) |
8931 |
+ |
8932 |
+ if (skb) { |
8933 |
+ qdisc_bstats_update(sch, skb); |
8934 |
++ qdisc_qstats_backlog_dec(sch, skb); |
8935 |
+ sch->q.qlen--; |
8936 |
+ decrement_qlen(skb, q); |
8937 |
+ } |
8938 |
+@@ -450,6 +452,7 @@ static void sfb_reset(struct Qdisc *sch) |
8939 |
+ struct sfb_sched_data *q = qdisc_priv(sch); |
8940 |
+ |
8941 |
+ qdisc_reset(q->qdisc); |
8942 |
++ sch->qstats.backlog = 0; |
8943 |
+ sch->q.qlen = 0; |
8944 |
+ q->slot = 0; |
8945 |
+ q->double_buffering = false; |
8946 |
+diff --git a/net/sched/sch_tbf.c b/net/sched/sch_tbf.c |
8947 |
+index 05c7a66f64da..87dee4deb66e 100644 |
8948 |
+--- a/net/sched/sch_tbf.c |
8949 |
++++ b/net/sched/sch_tbf.c |
8950 |
+@@ -197,6 +197,7 @@ static int tbf_enqueue(struct sk_buff *skb, struct Qdisc *sch) |
8951 |
+ return ret; |
8952 |
+ } |
8953 |
+ |
8954 |
++ qdisc_qstats_backlog_inc(sch, skb); |
8955 |
+ sch->q.qlen++; |
8956 |
+ return NET_XMIT_SUCCESS; |
8957 |
+ } |
8958 |
+@@ -207,6 +208,7 @@ static unsigned int tbf_drop(struct Qdisc *sch) |
8959 |
+ unsigned int len = 0; |
8960 |
+ |
8961 |
+ if (q->qdisc->ops->drop && (len = q->qdisc->ops->drop(q->qdisc)) != 0) { |
8962 |
++ sch->qstats.backlog -= len; |
8963 |
+ sch->q.qlen--; |
8964 |
+ qdisc_qstats_drop(sch); |
8965 |
+ } |
8966 |
+@@ -253,6 +255,7 @@ static struct sk_buff *tbf_dequeue(struct Qdisc *sch) |
8967 |
+ q->t_c = now; |
8968 |
+ q->tokens = toks; |
8969 |
+ q->ptokens = ptoks; |
8970 |
++ qdisc_qstats_backlog_dec(sch, skb); |
8971 |
+ sch->q.qlen--; |
8972 |
+ qdisc_unthrottled(sch); |
8973 |
+ qdisc_bstats_update(sch, skb); |
8974 |
+@@ -284,6 +287,7 @@ static void tbf_reset(struct Qdisc *sch) |
8975 |
+ struct tbf_sched_data *q = qdisc_priv(sch); |
8976 |
+ |
8977 |
+ qdisc_reset(q->qdisc); |
8978 |
++ sch->qstats.backlog = 0; |
8979 |
+ sch->q.qlen = 0; |
8980 |
+ q->t_c = ktime_get_ns(); |
8981 |
+ q->tokens = q->buffer; |
8982 |
+diff --git a/net/sctp/associola.c b/net/sctp/associola.c |
8983 |
+index f085b01b6603..f24d31f12cb4 100644 |
8984 |
+--- a/net/sctp/associola.c |
8985 |
++++ b/net/sctp/associola.c |
8986 |
+@@ -1290,7 +1290,7 @@ static struct sctp_transport *sctp_trans_elect_best(struct sctp_transport *curr, |
8987 |
+ if (score_curr > score_best) |
8988 |
+ return curr; |
8989 |
+ else if (score_curr == score_best) |
8990 |
+- return sctp_trans_elect_tie(curr, best); |
8991 |
++ return sctp_trans_elect_tie(best, curr); |
8992 |
+ else |
8993 |
+ return best; |
8994 |
+ } |
8995 |
+diff --git a/net/sctp/sm_make_chunk.c b/net/sctp/sm_make_chunk.c |
8996 |
+index 509e9426a056..e3e44237de1c 100644 |
8997 |
+--- a/net/sctp/sm_make_chunk.c |
8998 |
++++ b/net/sctp/sm_make_chunk.c |
8999 |
+@@ -857,7 +857,11 @@ struct sctp_chunk *sctp_make_shutdown(const struct sctp_association *asoc, |
9000 |
+ sctp_shutdownhdr_t shut; |
9001 |
+ __u32 ctsn; |
9002 |
+ |
9003 |
+- ctsn = sctp_tsnmap_get_ctsn(&asoc->peer.tsn_map); |
9004 |
++ if (chunk && chunk->asoc) |
9005 |
++ ctsn = sctp_tsnmap_get_ctsn(&chunk->asoc->peer.tsn_map); |
9006 |
++ else |
9007 |
++ ctsn = sctp_tsnmap_get_ctsn(&asoc->peer.tsn_map); |
9008 |
++ |
9009 |
+ shut.cum_tsn_ack = htonl(ctsn); |
9010 |
+ |
9011 |
+ retval = sctp_make_control(asoc, SCTP_CID_SHUTDOWN, 0, |
9012 |
+diff --git a/net/sctp/transport.c b/net/sctp/transport.c |
9013 |
+index aab9e3f29755..fbbe268e34e7 100644 |
9014 |
+--- a/net/sctp/transport.c |
9015 |
++++ b/net/sctp/transport.c |
9016 |
+@@ -72,7 +72,7 @@ static struct sctp_transport *sctp_transport_init(struct net *net, |
9017 |
+ */ |
9018 |
+ peer->rto = msecs_to_jiffies(net->sctp.rto_initial); |
9019 |
+ |
9020 |
+- peer->last_time_heard = ktime_get(); |
9021 |
++ peer->last_time_heard = ktime_set(0, 0); |
9022 |
+ peer->last_time_ecne_reduced = jiffies; |
9023 |
+ |
9024 |
+ peer->param_flags = SPP_HB_DISABLE | |
9025 |
+diff --git a/net/sunrpc/xprtrdma/backchannel.c b/net/sunrpc/xprtrdma/backchannel.c |
9026 |
+index 2dcb44f69e53..ddd70aec4d88 100644 |
9027 |
+--- a/net/sunrpc/xprtrdma/backchannel.c |
9028 |
++++ b/net/sunrpc/xprtrdma/backchannel.c |
9029 |
+@@ -42,8 +42,8 @@ static int rpcrdma_bc_setup_rqst(struct rpcrdma_xprt *r_xprt, |
9030 |
+ size_t size; |
9031 |
+ |
9032 |
+ req = rpcrdma_create_req(r_xprt); |
9033 |
+- if (!req) |
9034 |
+- return -ENOMEM; |
9035 |
++ if (IS_ERR(req)) |
9036 |
++ return PTR_ERR(req); |
9037 |
+ req->rl_backchannel = true; |
9038 |
+ |
9039 |
+ size = RPCRDMA_INLINE_WRITE_THRESHOLD(rqst); |
9040 |
+@@ -84,25 +84,13 @@ out_fail: |
9041 |
+ static int rpcrdma_bc_setup_reps(struct rpcrdma_xprt *r_xprt, |
9042 |
+ unsigned int count) |
9043 |
+ { |
9044 |
+- struct rpcrdma_buffer *buffers = &r_xprt->rx_buf; |
9045 |
+- struct rpcrdma_rep *rep; |
9046 |
+- unsigned long flags; |
9047 |
+ int rc = 0; |
9048 |
+ |
9049 |
+ while (count--) { |
9050 |
+- rep = rpcrdma_create_rep(r_xprt); |
9051 |
+- if (IS_ERR(rep)) { |
9052 |
+- pr_err("RPC: %s: reply buffer alloc failed\n", |
9053 |
+- __func__); |
9054 |
+- rc = PTR_ERR(rep); |
9055 |
++ rc = rpcrdma_create_rep(r_xprt); |
9056 |
++ if (rc) |
9057 |
+ break; |
9058 |
+- } |
9059 |
+- |
9060 |
+- spin_lock_irqsave(&buffers->rb_lock, flags); |
9061 |
+- list_add(&rep->rr_list, &buffers->rb_recv_bufs); |
9062 |
+- spin_unlock_irqrestore(&buffers->rb_lock, flags); |
9063 |
+ } |
9064 |
+- |
9065 |
+ return rc; |
9066 |
+ } |
9067 |
+ |
9068 |
+@@ -341,6 +329,8 @@ void rpcrdma_bc_receive_call(struct rpcrdma_xprt *r_xprt, |
9069 |
+ rqst->rq_reply_bytes_recvd = 0; |
9070 |
+ rqst->rq_bytes_sent = 0; |
9071 |
+ rqst->rq_xid = headerp->rm_xid; |
9072 |
++ |
9073 |
++ rqst->rq_private_buf.len = size; |
9074 |
+ set_bit(RPC_BC_PA_IN_USE, &rqst->rq_bc_pa_state); |
9075 |
+ |
9076 |
+ buf = &rqst->rq_rcv_buf; |
9077 |
+diff --git a/net/sunrpc/xprtrdma/transport.c b/net/sunrpc/xprtrdma/transport.c |
9078 |
+index 8c545f7d7525..740bddcf3488 100644 |
9079 |
+--- a/net/sunrpc/xprtrdma/transport.c |
9080 |
++++ b/net/sunrpc/xprtrdma/transport.c |
9081 |
+@@ -576,6 +576,9 @@ xprt_rdma_free(void *buffer) |
9082 |
+ |
9083 |
+ rb = container_of(buffer, struct rpcrdma_regbuf, rg_base[0]); |
9084 |
+ req = rb->rg_owner; |
9085 |
++ if (req->rl_backchannel) |
9086 |
++ return; |
9087 |
++ |
9088 |
+ r_xprt = container_of(req->rl_buffer, struct rpcrdma_xprt, rx_buf); |
9089 |
+ |
9090 |
+ dprintk("RPC: %s: called on 0x%p\n", __func__, req->rl_reply); |
9091 |
+diff --git a/net/sunrpc/xprtrdma/verbs.c b/net/sunrpc/xprtrdma/verbs.c |
9092 |
+index eadd1655145a..b6879a1986a7 100644 |
9093 |
+--- a/net/sunrpc/xprtrdma/verbs.c |
9094 |
++++ b/net/sunrpc/xprtrdma/verbs.c |
9095 |
+@@ -911,10 +911,17 @@ rpcrdma_create_req(struct rpcrdma_xprt *r_xprt) |
9096 |
+ return req; |
9097 |
+ } |
9098 |
+ |
9099 |
+-struct rpcrdma_rep * |
9100 |
+-rpcrdma_create_rep(struct rpcrdma_xprt *r_xprt) |
9101 |
++/** |
9102 |
++ * rpcrdma_create_rep - Allocate an rpcrdma_rep object |
9103 |
++ * @r_xprt: controlling transport |
9104 |
++ * |
9105 |
++ * Returns 0 on success or a negative errno on failure. |
9106 |
++ */ |
9107 |
++int |
9108 |
++ rpcrdma_create_rep(struct rpcrdma_xprt *r_xprt) |
9109 |
+ { |
9110 |
+ struct rpcrdma_create_data_internal *cdata = &r_xprt->rx_data; |
9111 |
++ struct rpcrdma_buffer *buf = &r_xprt->rx_buf; |
9112 |
+ struct rpcrdma_ia *ia = &r_xprt->rx_ia; |
9113 |
+ struct rpcrdma_rep *rep; |
9114 |
+ int rc; |
9115 |
+@@ -934,12 +941,18 @@ rpcrdma_create_rep(struct rpcrdma_xprt *r_xprt) |
9116 |
+ rep->rr_device = ia->ri_device; |
9117 |
+ rep->rr_rxprt = r_xprt; |
9118 |
+ INIT_WORK(&rep->rr_work, rpcrdma_receive_worker); |
9119 |
+- return rep; |
9120 |
++ |
9121 |
++ spin_lock(&buf->rb_lock); |
9122 |
++ list_add(&rep->rr_list, &buf->rb_recv_bufs); |
9123 |
++ spin_unlock(&buf->rb_lock); |
9124 |
++ return 0; |
9125 |
+ |
9126 |
+ out_free: |
9127 |
+ kfree(rep); |
9128 |
+ out: |
9129 |
+- return ERR_PTR(rc); |
9130 |
++ dprintk("RPC: %s: reply buffer %d alloc failed\n", |
9131 |
++ __func__, rc); |
9132 |
++ return rc; |
9133 |
+ } |
9134 |
+ |
9135 |
+ int |
9136 |
+@@ -975,17 +988,10 @@ rpcrdma_buffer_create(struct rpcrdma_xprt *r_xprt) |
9137 |
+ } |
9138 |
+ |
9139 |
+ INIT_LIST_HEAD(&buf->rb_recv_bufs); |
9140 |
+- for (i = 0; i < buf->rb_max_requests + 2; i++) { |
9141 |
+- struct rpcrdma_rep *rep; |
9142 |
+- |
9143 |
+- rep = rpcrdma_create_rep(r_xprt); |
9144 |
+- if (IS_ERR(rep)) { |
9145 |
+- dprintk("RPC: %s: reply buffer %d alloc failed\n", |
9146 |
+- __func__, i); |
9147 |
+- rc = PTR_ERR(rep); |
9148 |
++ for (i = 0; i <= buf->rb_max_requests; i++) { |
9149 |
++ rc = rpcrdma_create_rep(r_xprt); |
9150 |
++ if (rc) |
9151 |
+ goto out; |
9152 |
+- } |
9153 |
+- list_add(&rep->rr_list, &buf->rb_recv_bufs); |
9154 |
+ } |
9155 |
+ |
9156 |
+ return 0; |
9157 |
+@@ -1337,15 +1343,14 @@ rpcrdma_ep_post_extra_recv(struct rpcrdma_xprt *r_xprt, unsigned int count) |
9158 |
+ struct rpcrdma_ia *ia = &r_xprt->rx_ia; |
9159 |
+ struct rpcrdma_ep *ep = &r_xprt->rx_ep; |
9160 |
+ struct rpcrdma_rep *rep; |
9161 |
+- unsigned long flags; |
9162 |
+ int rc; |
9163 |
+ |
9164 |
+ while (count--) { |
9165 |
+- spin_lock_irqsave(&buffers->rb_lock, flags); |
9166 |
++ spin_lock(&buffers->rb_lock); |
9167 |
+ if (list_empty(&buffers->rb_recv_bufs)) |
9168 |
+ goto out_reqbuf; |
9169 |
+ rep = rpcrdma_buffer_get_rep_locked(buffers); |
9170 |
+- spin_unlock_irqrestore(&buffers->rb_lock, flags); |
9171 |
++ spin_unlock(&buffers->rb_lock); |
9172 |
+ |
9173 |
+ rc = rpcrdma_ep_post_recv(ia, ep, rep); |
9174 |
+ if (rc) |
9175 |
+@@ -1355,7 +1360,7 @@ rpcrdma_ep_post_extra_recv(struct rpcrdma_xprt *r_xprt, unsigned int count) |
9176 |
+ return 0; |
9177 |
+ |
9178 |
+ out_reqbuf: |
9179 |
+- spin_unlock_irqrestore(&buffers->rb_lock, flags); |
9180 |
++ spin_unlock(&buffers->rb_lock); |
9181 |
+ pr_warn("%s: no extra receive buffers\n", __func__); |
9182 |
+ return -ENOMEM; |
9183 |
+ |
9184 |
+diff --git a/net/sunrpc/xprtrdma/xprt_rdma.h b/net/sunrpc/xprtrdma/xprt_rdma.h |
9185 |
+index ac7f8d4f632a..36ec6a602665 100644 |
9186 |
+--- a/net/sunrpc/xprtrdma/xprt_rdma.h |
9187 |
++++ b/net/sunrpc/xprtrdma/xprt_rdma.h |
9188 |
+@@ -431,8 +431,8 @@ int rpcrdma_ep_post_recv(struct rpcrdma_ia *, struct rpcrdma_ep *, |
9189 |
+ * Buffer calls - xprtrdma/verbs.c |
9190 |
+ */ |
9191 |
+ struct rpcrdma_req *rpcrdma_create_req(struct rpcrdma_xprt *); |
9192 |
+-struct rpcrdma_rep *rpcrdma_create_rep(struct rpcrdma_xprt *); |
9193 |
+ void rpcrdma_destroy_req(struct rpcrdma_ia *, struct rpcrdma_req *); |
9194 |
++int rpcrdma_create_rep(struct rpcrdma_xprt *r_xprt); |
9195 |
+ int rpcrdma_buffer_create(struct rpcrdma_xprt *); |
9196 |
+ void rpcrdma_buffer_destroy(struct rpcrdma_buffer *); |
9197 |
+ |
9198 |
+diff --git a/net/tipc/udp_media.c b/net/tipc/udp_media.c |
9199 |
+index 78d6b78de29d..cb39f1c4251e 100644 |
9200 |
+--- a/net/tipc/udp_media.c |
9201 |
++++ b/net/tipc/udp_media.c |
9202 |
+@@ -405,10 +405,13 @@ static int tipc_udp_enable(struct net *net, struct tipc_bearer *b, |
9203 |
+ tuncfg.encap_destroy = NULL; |
9204 |
+ setup_udp_tunnel_sock(net, ub->ubsock, &tuncfg); |
9205 |
+ |
9206 |
+- if (enable_mcast(ub, remote)) |
9207 |
++ err = enable_mcast(ub, remote); |
9208 |
++ if (err) |
9209 |
+ goto err; |
9210 |
+ return 0; |
9211 |
+ err: |
9212 |
++ if (ub->ubsock) |
9213 |
++ udp_tunnel_sock_release(ub->ubsock); |
9214 |
+ kfree(ub); |
9215 |
+ return err; |
9216 |
+ } |
9217 |
+diff --git a/net/xfrm/xfrm_input.c b/net/xfrm/xfrm_input.c |
9218 |
+index 1c4ad477ce93..6e3f0254d8a1 100644 |
9219 |
+--- a/net/xfrm/xfrm_input.c |
9220 |
++++ b/net/xfrm/xfrm_input.c |
9221 |
+@@ -207,15 +207,15 @@ int xfrm_input(struct sk_buff *skb, int nexthdr, __be32 spi, int encap_type) |
9222 |
+ family = XFRM_SPI_SKB_CB(skb)->family; |
9223 |
+ |
9224 |
+ /* if tunnel is present override skb->mark value with tunnel i_key */ |
9225 |
+- if (XFRM_TUNNEL_SKB_CB(skb)->tunnel.ip4) { |
9226 |
+- switch (family) { |
9227 |
+- case AF_INET: |
9228 |
++ switch (family) { |
9229 |
++ case AF_INET: |
9230 |
++ if (XFRM_TUNNEL_SKB_CB(skb)->tunnel.ip4) |
9231 |
+ mark = be32_to_cpu(XFRM_TUNNEL_SKB_CB(skb)->tunnel.ip4->parms.i_key); |
9232 |
+- break; |
9233 |
+- case AF_INET6: |
9234 |
++ break; |
9235 |
++ case AF_INET6: |
9236 |
++ if (XFRM_TUNNEL_SKB_CB(skb)->tunnel.ip6) |
9237 |
+ mark = be32_to_cpu(XFRM_TUNNEL_SKB_CB(skb)->tunnel.ip6->parms.i_key); |
9238 |
+- break; |
9239 |
+- } |
9240 |
++ break; |
9241 |
+ } |
9242 |
+ |
9243 |
+ /* Allocate new secpath or COW existing one. */ |
9244 |
+diff --git a/net/xfrm/xfrm_state.c b/net/xfrm/xfrm_state.c |
9245 |
+index 787f2cac18c5..d3595f1d00f2 100644 |
9246 |
+--- a/net/xfrm/xfrm_state.c |
9247 |
++++ b/net/xfrm/xfrm_state.c |
9248 |
+@@ -332,6 +332,7 @@ static void xfrm_state_gc_destroy(struct xfrm_state *x) |
9249 |
+ { |
9250 |
+ tasklet_hrtimer_cancel(&x->mtimer); |
9251 |
+ del_timer_sync(&x->rtimer); |
9252 |
++ kfree(x->aead); |
9253 |
+ kfree(x->aalg); |
9254 |
+ kfree(x->ealg); |
9255 |
+ kfree(x->calg); |
9256 |
+diff --git a/net/xfrm/xfrm_user.c b/net/xfrm/xfrm_user.c |
9257 |
+index dd0509ee14da..158f630cc7a6 100644 |
9258 |
+--- a/net/xfrm/xfrm_user.c |
9259 |
++++ b/net/xfrm/xfrm_user.c |
9260 |
+@@ -609,9 +609,12 @@ static struct xfrm_state *xfrm_state_construct(struct net *net, |
9261 |
+ if (err) |
9262 |
+ goto error; |
9263 |
+ |
9264 |
+- if (attrs[XFRMA_SEC_CTX] && |
9265 |
+- security_xfrm_state_alloc(x, nla_data(attrs[XFRMA_SEC_CTX]))) |
9266 |
+- goto error; |
9267 |
++ if (attrs[XFRMA_SEC_CTX]) { |
9268 |
++ err = security_xfrm_state_alloc(x, |
9269 |
++ nla_data(attrs[XFRMA_SEC_CTX])); |
9270 |
++ if (err) |
9271 |
++ goto error; |
9272 |
++ } |
9273 |
+ |
9274 |
+ if ((err = xfrm_alloc_replay_state_esn(&x->replay_esn, &x->preplay_esn, |
9275 |
+ attrs[XFRMA_REPLAY_ESN_VAL]))) |
9276 |
+@@ -923,7 +926,8 @@ static int xfrm_dump_sa_done(struct netlink_callback *cb) |
9277 |
+ struct sock *sk = cb->skb->sk; |
9278 |
+ struct net *net = sock_net(sk); |
9279 |
+ |
9280 |
+- xfrm_state_walk_done(walk, net); |
9281 |
++ if (cb->args[0]) |
9282 |
++ xfrm_state_walk_done(walk, net); |
9283 |
+ return 0; |
9284 |
+ } |
9285 |
+ |
9286 |
+@@ -948,8 +952,6 @@ static int xfrm_dump_sa(struct sk_buff *skb, struct netlink_callback *cb) |
9287 |
+ u8 proto = 0; |
9288 |
+ int err; |
9289 |
+ |
9290 |
+- cb->args[0] = 1; |
9291 |
+- |
9292 |
+ err = nlmsg_parse(cb->nlh, 0, attrs, XFRMA_MAX, |
9293 |
+ xfrma_policy); |
9294 |
+ if (err < 0) |
9295 |
+@@ -966,6 +968,7 @@ static int xfrm_dump_sa(struct sk_buff *skb, struct netlink_callback *cb) |
9296 |
+ proto = nla_get_u8(attrs[XFRMA_PROTO]); |
9297 |
+ |
9298 |
+ xfrm_state_walk_init(walk, proto, filter); |
9299 |
++ cb->args[0] = 1; |
9300 |
+ } |
9301 |
+ |
9302 |
+ (void) xfrm_state_walk(net, walk, dump_one_state, &info); |
9303 |
+diff --git a/scripts/config b/scripts/config |
9304 |
+index 026aeb4f32ee..73de17d39698 100755 |
9305 |
+--- a/scripts/config |
9306 |
++++ b/scripts/config |
9307 |
+@@ -6,6 +6,9 @@ myname=${0##*/} |
9308 |
+ # If no prefix forced, use the default CONFIG_ |
9309 |
+ CONFIG_="${CONFIG_-CONFIG_}" |
9310 |
+ |
9311 |
++# We use an uncommon delimiter for sed substitutions |
9312 |
++SED_DELIM=$(echo -en "\001") |
9313 |
++ |
9314 |
+ usage() { |
9315 |
+ cat >&2 <<EOL |
9316 |
+ Manipulate options in a .config file from the command line. |
9317 |
+@@ -82,7 +85,7 @@ txt_subst() { |
9318 |
+ local infile="$3" |
9319 |
+ local tmpfile="$infile.swp" |
9320 |
+ |
9321 |
+- sed -e "s:$before:$after:" "$infile" >"$tmpfile" |
9322 |
++ sed -e "s$SED_DELIM$before$SED_DELIM$after$SED_DELIM" "$infile" >"$tmpfile" |
9323 |
+ # replace original file with the edited one |
9324 |
+ mv "$tmpfile" "$infile" |
9325 |
+ } |
9326 |
+diff --git a/sound/pci/fm801.c b/sound/pci/fm801.c |
9327 |
+index d6e89a6d0bb9..71a00b55d5ea 100644 |
9328 |
+--- a/sound/pci/fm801.c |
9329 |
++++ b/sound/pci/fm801.c |
9330 |
+@@ -1088,26 +1088,20 @@ static int wait_for_codec(struct fm801 *chip, unsigned int codec_id, |
9331 |
+ return -EIO; |
9332 |
+ } |
9333 |
+ |
9334 |
+-static int snd_fm801_chip_init(struct fm801 *chip, int resume) |
9335 |
++static int reset_codec(struct fm801 *chip) |
9336 |
+ { |
9337 |
+- unsigned short cmdw; |
9338 |
+- |
9339 |
+- if (chip->tea575x_tuner & TUNER_ONLY) |
9340 |
+- goto __ac97_ok; |
9341 |
+- |
9342 |
+ /* codec cold reset + AC'97 warm reset */ |
9343 |
+ fm801_writew(chip, CODEC_CTRL, (1 << 5) | (1 << 6)); |
9344 |
+ fm801_readw(chip, CODEC_CTRL); /* flush posting data */ |
9345 |
+ udelay(100); |
9346 |
+ fm801_writew(chip, CODEC_CTRL, 0); |
9347 |
+ |
9348 |
+- if (wait_for_codec(chip, 0, AC97_RESET, msecs_to_jiffies(750)) < 0) |
9349 |
+- if (!resume) { |
9350 |
+- dev_info(chip->card->dev, |
9351 |
+- "Primary AC'97 codec not found, assume SF64-PCR (tuner-only)\n"); |
9352 |
+- chip->tea575x_tuner = 3 | TUNER_ONLY; |
9353 |
+- goto __ac97_ok; |
9354 |
+- } |
9355 |
++ return wait_for_codec(chip, 0, AC97_RESET, msecs_to_jiffies(750)); |
9356 |
++} |
9357 |
++ |
9358 |
++static void snd_fm801_chip_multichannel_init(struct fm801 *chip) |
9359 |
++{ |
9360 |
++ unsigned short cmdw; |
9361 |
+ |
9362 |
+ if (chip->multichannel) { |
9363 |
+ if (chip->secondary_addr) { |
9364 |
+@@ -1134,8 +1128,11 @@ static int snd_fm801_chip_init(struct fm801 *chip, int resume) |
9365 |
+ /* cause timeout problems */ |
9366 |
+ wait_for_codec(chip, 0, AC97_VENDOR_ID1, msecs_to_jiffies(750)); |
9367 |
+ } |
9368 |
++} |
9369 |
+ |
9370 |
+- __ac97_ok: |
9371 |
++static void snd_fm801_chip_init(struct fm801 *chip) |
9372 |
++{ |
9373 |
++ unsigned short cmdw; |
9374 |
+ |
9375 |
+ /* init volume */ |
9376 |
+ fm801_writew(chip, PCM_VOL, 0x0808); |
9377 |
+@@ -1156,11 +1153,8 @@ static int snd_fm801_chip_init(struct fm801 *chip, int resume) |
9378 |
+ /* interrupt clear */ |
9379 |
+ fm801_writew(chip, IRQ_STATUS, |
9380 |
+ FM801_IRQ_PLAYBACK | FM801_IRQ_CAPTURE | FM801_IRQ_MPU); |
9381 |
+- |
9382 |
+- return 0; |
9383 |
+ } |
9384 |
+ |
9385 |
+- |
9386 |
+ static int snd_fm801_free(struct fm801 *chip) |
9387 |
+ { |
9388 |
+ unsigned short cmdw; |
9389 |
+@@ -1173,6 +1167,8 @@ static int snd_fm801_free(struct fm801 *chip) |
9390 |
+ cmdw |= 0x00c3; |
9391 |
+ fm801_writew(chip, IRQ_MASK, cmdw); |
9392 |
+ |
9393 |
++ devm_free_irq(&chip->pci->dev, chip->irq, chip); |
9394 |
++ |
9395 |
+ __end_hw: |
9396 |
+ #ifdef CONFIG_SND_FM801_TEA575X_BOOL |
9397 |
+ if (!(chip->tea575x_tuner & TUNER_DISABLED)) { |
9398 |
+@@ -1215,7 +1211,21 @@ static int snd_fm801_create(struct snd_card *card, |
9399 |
+ if ((err = pci_request_regions(pci, "FM801")) < 0) |
9400 |
+ return err; |
9401 |
+ chip->port = pci_resource_start(pci, 0); |
9402 |
+- if ((tea575x_tuner & TUNER_ONLY) == 0) { |
9403 |
++ |
9404 |
++ if (pci->revision >= 0xb1) /* FM801-AU */ |
9405 |
++ chip->multichannel = 1; |
9406 |
++ |
9407 |
++ if (!(chip->tea575x_tuner & TUNER_ONLY)) { |
9408 |
++ if (reset_codec(chip) < 0) { |
9409 |
++ dev_info(chip->card->dev, |
9410 |
++ "Primary AC'97 codec not found, assume SF64-PCR (tuner-only)\n"); |
9411 |
++ chip->tea575x_tuner = 3 | TUNER_ONLY; |
9412 |
++ } else { |
9413 |
++ snd_fm801_chip_multichannel_init(chip); |
9414 |
++ } |
9415 |
++ } |
9416 |
++ |
9417 |
++ if ((chip->tea575x_tuner & TUNER_ONLY) == 0) { |
9418 |
+ if (devm_request_irq(&pci->dev, pci->irq, snd_fm801_interrupt, |
9419 |
+ IRQF_SHARED, KBUILD_MODNAME, chip)) { |
9420 |
+ dev_err(card->dev, "unable to grab IRQ %d\n", pci->irq); |
9421 |
+@@ -1226,12 +1236,7 @@ static int snd_fm801_create(struct snd_card *card, |
9422 |
+ pci_set_master(pci); |
9423 |
+ } |
9424 |
+ |
9425 |
+- if (pci->revision >= 0xb1) /* FM801-AU */ |
9426 |
+- chip->multichannel = 1; |
9427 |
+- |
9428 |
+- snd_fm801_chip_init(chip, 0); |
9429 |
+- /* init might set tuner access method */ |
9430 |
+- tea575x_tuner = chip->tea575x_tuner; |
9431 |
++ snd_fm801_chip_init(chip); |
9432 |
+ |
9433 |
+ if ((err = snd_device_new(card, SNDRV_DEV_LOWLEVEL, chip, &ops)) < 0) { |
9434 |
+ snd_fm801_free(chip); |
9435 |
+@@ -1249,14 +1254,16 @@ static int snd_fm801_create(struct snd_card *card, |
9436 |
+ chip->tea.private_data = chip; |
9437 |
+ chip->tea.ops = &snd_fm801_tea_ops; |
9438 |
+ sprintf(chip->tea.bus_info, "PCI:%s", pci_name(pci)); |
9439 |
+- if ((tea575x_tuner & TUNER_TYPE_MASK) > 0 && |
9440 |
+- (tea575x_tuner & TUNER_TYPE_MASK) < 4) { |
9441 |
++ if ((chip->tea575x_tuner & TUNER_TYPE_MASK) > 0 && |
9442 |
++ (chip->tea575x_tuner & TUNER_TYPE_MASK) < 4) { |
9443 |
+ if (snd_tea575x_init(&chip->tea, THIS_MODULE)) { |
9444 |
+ dev_err(card->dev, "TEA575x radio not found\n"); |
9445 |
+ snd_fm801_free(chip); |
9446 |
+ return -ENODEV; |
9447 |
+ } |
9448 |
+- } else if ((tea575x_tuner & TUNER_TYPE_MASK) == 0) { |
9449 |
++ } else if ((chip->tea575x_tuner & TUNER_TYPE_MASK) == 0) { |
9450 |
++ unsigned int tuner_only = chip->tea575x_tuner & TUNER_ONLY; |
9451 |
++ |
9452 |
+ /* autodetect tuner connection */ |
9453 |
+ for (tea575x_tuner = 1; tea575x_tuner <= 3; tea575x_tuner++) { |
9454 |
+ chip->tea575x_tuner = tea575x_tuner; |
9455 |
+@@ -1271,6 +1278,8 @@ static int snd_fm801_create(struct snd_card *card, |
9456 |
+ dev_err(card->dev, "TEA575x radio not found\n"); |
9457 |
+ chip->tea575x_tuner = TUNER_DISABLED; |
9458 |
+ } |
9459 |
++ |
9460 |
++ chip->tea575x_tuner |= tuner_only; |
9461 |
+ } |
9462 |
+ if (!(chip->tea575x_tuner & TUNER_DISABLED)) { |
9463 |
+ strlcpy(chip->tea.card, get_tea575x_gpio(chip)->name, |
9464 |
+@@ -1389,7 +1398,13 @@ static int snd_fm801_resume(struct device *dev) |
9465 |
+ struct fm801 *chip = card->private_data; |
9466 |
+ int i; |
9467 |
+ |
9468 |
+- snd_fm801_chip_init(chip, 1); |
9469 |
++ if (chip->tea575x_tuner & TUNER_ONLY) { |
9470 |
++ snd_fm801_chip_init(chip); |
9471 |
++ } else { |
9472 |
++ reset_codec(chip); |
9473 |
++ snd_fm801_chip_multichannel_init(chip); |
9474 |
++ snd_fm801_chip_init(chip); |
9475 |
++ } |
9476 |
+ snd_ac97_resume(chip->ac97); |
9477 |
+ snd_ac97_resume(chip->ac97_sec); |
9478 |
+ for (i = 0; i < ARRAY_SIZE(saved_regs); i++) |
9479 |
+diff --git a/sound/pci/hda/hda_intel.c b/sound/pci/hda/hda_intel.c |
9480 |
+index da9f6749b3be..8dd6cf0b8939 100644 |
9481 |
+--- a/sound/pci/hda/hda_intel.c |
9482 |
++++ b/sound/pci/hda/hda_intel.c |
9483 |
+@@ -1977,9 +1977,10 @@ static const struct hdac_io_ops pci_hda_io_ops = { |
9484 |
+ * some HD-audio PCI entries are exposed without any codecs, and such devices |
9485 |
+ * should be ignored from the beginning. |
9486 |
+ */ |
9487 |
+-static const struct snd_pci_quirk driver_blacklist[] = { |
9488 |
+- SND_PCI_QUIRK(0x1462, 0xcb59, "MSI TRX40 Creator", 0), |
9489 |
+- SND_PCI_QUIRK(0x1462, 0xcb60, "MSI TRX40", 0), |
9490 |
++static const struct pci_device_id driver_blacklist[] = { |
9491 |
++ { PCI_DEVICE_SUB(0x1022, 0x1487, 0x1043, 0x874f) }, /* ASUS ROG Zenith II / Strix */ |
9492 |
++ { PCI_DEVICE_SUB(0x1022, 0x1487, 0x1462, 0xcb59) }, /* MSI TRX40 Creator */ |
9493 |
++ { PCI_DEVICE_SUB(0x1022, 0x1487, 0x1462, 0xcb60) }, /* MSI TRX40 */ |
9494 |
+ {} |
9495 |
+ }; |
9496 |
+ |
9497 |
+@@ -2002,7 +2003,7 @@ static int azx_probe(struct pci_dev *pci, |
9498 |
+ bool schedule_probe; |
9499 |
+ int err; |
9500 |
+ |
9501 |
+- if (snd_pci_quirk_lookup(pci, driver_blacklist)) { |
9502 |
++ if (pci_match_id(driver_blacklist, pci)) { |
9503 |
+ dev_info(&pci->dev, "Skipping the blacklisted device\n"); |
9504 |
+ return -ENODEV; |
9505 |
+ } |
9506 |
+diff --git a/sound/soc/fsl/fsl_ssi.c b/sound/soc/fsl/fsl_ssi.c |
9507 |
+index d46e9ad600b4..06736bea422e 100644 |
9508 |
+--- a/sound/soc/fsl/fsl_ssi.c |
9509 |
++++ b/sound/soc/fsl/fsl_ssi.c |
9510 |
+@@ -146,6 +146,7 @@ static bool fsl_ssi_volatile_reg(struct device *dev, unsigned int reg) |
9511 |
+ case CCSR_SSI_SRX1: |
9512 |
+ case CCSR_SSI_SISR: |
9513 |
+ case CCSR_SSI_SFCSR: |
9514 |
++ case CCSR_SSI_SACNT: |
9515 |
+ case CCSR_SSI_SACADD: |
9516 |
+ case CCSR_SSI_SACDAT: |
9517 |
+ case CCSR_SSI_SATAG: |
9518 |
+@@ -239,8 +240,9 @@ struct fsl_ssi_private { |
9519 |
+ unsigned int baudclk_streams; |
9520 |
+ unsigned int bitclk_freq; |
9521 |
+ |
9522 |
+- /*regcache for SFCSR*/ |
9523 |
++ /* regcache for volatile regs */ |
9524 |
+ u32 regcache_sfcsr; |
9525 |
++ u32 regcache_sacnt; |
9526 |
+ |
9527 |
+ /* DMA params */ |
9528 |
+ struct snd_dmaengine_dai_dma_data dma_params_tx; |
9529 |
+@@ -1597,6 +1599,8 @@ static int fsl_ssi_suspend(struct device *dev) |
9530 |
+ |
9531 |
+ regmap_read(regs, CCSR_SSI_SFCSR, |
9532 |
+ &ssi_private->regcache_sfcsr); |
9533 |
++ regmap_read(regs, CCSR_SSI_SACNT, |
9534 |
++ &ssi_private->regcache_sacnt); |
9535 |
+ |
9536 |
+ regcache_cache_only(regs, true); |
9537 |
+ regcache_mark_dirty(regs); |
9538 |
+@@ -1615,6 +1619,8 @@ static int fsl_ssi_resume(struct device *dev) |
9539 |
+ CCSR_SSI_SFCSR_RFWM1_MASK | CCSR_SSI_SFCSR_TFWM1_MASK | |
9540 |
+ CCSR_SSI_SFCSR_RFWM0_MASK | CCSR_SSI_SFCSR_TFWM0_MASK, |
9541 |
+ ssi_private->regcache_sfcsr); |
9542 |
++ regmap_write(regs, CCSR_SSI_SACNT, |
9543 |
++ ssi_private->regcache_sacnt); |
9544 |
+ |
9545 |
+ return regcache_sync(regs); |
9546 |
+ } |
9547 |
+diff --git a/sound/soc/intel/atom/sst/sst_stream.c b/sound/soc/intel/atom/sst/sst_stream.c |
9548 |
+index e83da42a8c03..c798f8d4ae43 100644 |
9549 |
+--- a/sound/soc/intel/atom/sst/sst_stream.c |
9550 |
++++ b/sound/soc/intel/atom/sst/sst_stream.c |
9551 |
+@@ -108,7 +108,7 @@ int sst_alloc_stream_mrfld(struct intel_sst_drv *sst_drv_ctx, void *params) |
9552 |
+ str_id, pipe_id); |
9553 |
+ ret = sst_prepare_and_post_msg(sst_drv_ctx, task_id, IPC_CMD, |
9554 |
+ IPC_IA_ALLOC_STREAM_MRFLD, pipe_id, sizeof(alloc_param), |
9555 |
+- &alloc_param, data, true, true, false, true); |
9556 |
++ &alloc_param, &data, true, true, false, true); |
9557 |
+ |
9558 |
+ if (ret < 0) { |
9559 |
+ dev_err(sst_drv_ctx->dev, "FW alloc failed ret %d\n", ret); |
9560 |
+diff --git a/sound/soc/tegra/tegra_alc5632.c b/sound/soc/tegra/tegra_alc5632.c |
9561 |
+index ba272e21a6fa..deb597f7c302 100644 |
9562 |
+--- a/sound/soc/tegra/tegra_alc5632.c |
9563 |
++++ b/sound/soc/tegra/tegra_alc5632.c |
9564 |
+@@ -101,12 +101,16 @@ static const struct snd_kcontrol_new tegra_alc5632_controls[] = { |
9565 |
+ |
9566 |
+ static int tegra_alc5632_asoc_init(struct snd_soc_pcm_runtime *rtd) |
9567 |
+ { |
9568 |
++ int ret; |
9569 |
+ struct tegra_alc5632 *machine = snd_soc_card_get_drvdata(rtd->card); |
9570 |
+ |
9571 |
+- snd_soc_card_jack_new(rtd->card, "Headset Jack", SND_JACK_HEADSET, |
9572 |
+- &tegra_alc5632_hs_jack, |
9573 |
+- tegra_alc5632_hs_jack_pins, |
9574 |
+- ARRAY_SIZE(tegra_alc5632_hs_jack_pins)); |
9575 |
++ ret = snd_soc_card_jack_new(rtd->card, "Headset Jack", |
9576 |
++ SND_JACK_HEADSET, |
9577 |
++ &tegra_alc5632_hs_jack, |
9578 |
++ tegra_alc5632_hs_jack_pins, |
9579 |
++ ARRAY_SIZE(tegra_alc5632_hs_jack_pins)); |
9580 |
++ if (ret) |
9581 |
++ return ret; |
9582 |
+ |
9583 |
+ if (gpio_is_valid(machine->gpio_hp_det)) { |
9584 |
+ tegra_alc5632_hp_jack_gpio.gpio = machine->gpio_hp_det; |
9585 |
+diff --git a/tools/perf/util/perf_regs.c b/tools/perf/util/perf_regs.c |
9586 |
+index 6b8eb13e14e4..c4023f22f287 100644 |
9587 |
+--- a/tools/perf/util/perf_regs.c |
9588 |
++++ b/tools/perf/util/perf_regs.c |
9589 |
+@@ -12,18 +12,18 @@ int perf_reg_value(u64 *valp, struct regs_dump *regs, int id) |
9590 |
+ int i, idx = 0; |
9591 |
+ u64 mask = regs->mask; |
9592 |
+ |
9593 |
+- if (regs->cache_mask & (1 << id)) |
9594 |
++ if (regs->cache_mask & (1ULL << id)) |
9595 |
+ goto out; |
9596 |
+ |
9597 |
+- if (!(mask & (1 << id))) |
9598 |
++ if (!(mask & (1ULL << id))) |
9599 |
+ return -EINVAL; |
9600 |
+ |
9601 |
+ for (i = 0; i < id; i++) { |
9602 |
+- if (mask & (1 << i)) |
9603 |
++ if (mask & (1ULL << i)) |
9604 |
+ idx++; |
9605 |
+ } |
9606 |
+ |
9607 |
+- regs->cache_mask |= (1 << id); |
9608 |
++ regs->cache_mask |= (1ULL << id); |
9609 |
+ regs->cache_regs[id] = regs->regs[idx]; |
9610 |
+ |
9611 |
+ out: |
9612 |
+diff --git a/tools/testing/selftests/ipc/msgque.c b/tools/testing/selftests/ipc/msgque.c |
9613 |
+index 1b2ce334bb3f..47c074d73e61 100644 |
9614 |
+--- a/tools/testing/selftests/ipc/msgque.c |
9615 |
++++ b/tools/testing/selftests/ipc/msgque.c |
9616 |
+@@ -135,7 +135,7 @@ int dump_queue(struct msgque_data *msgque) |
9617 |
+ for (kern_id = 0; kern_id < 256; kern_id++) { |
9618 |
+ ret = msgctl(kern_id, MSG_STAT, &ds); |
9619 |
+ if (ret < 0) { |
9620 |
+- if (errno == -EINVAL) |
9621 |
++ if (errno == EINVAL) |
9622 |
+ continue; |
9623 |
+ printf("Failed to get stats for IPC queue with id %d\n", |
9624 |
+ kern_id); |