Gentoo Archives: gentoo-commits

From: Mike Pagano <mpagano@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/linux-patches:5.5 commit in: /
Date: Wed, 01 Apr 2020 12:04:24
Message-Id: 1585742646.047e537c208a89730dd8039e340ac6fd3bc24076.mpagano@gentoo
1 commit: 047e537c208a89730dd8039e340ac6fd3bc24076
2 Author: Mike Pagano <mpagano <AT> gentoo <DOT> org>
3 AuthorDate: Wed Apr 1 12:04:06 2020 +0000
4 Commit: Mike Pagano <mpagano <AT> gentoo <DOT> org>
5 CommitDate: Wed Apr 1 12:04:06 2020 +0000
6 URL: https://gitweb.gentoo.org/proj/linux-patches.git/commit/?id=047e537c
7
8 Linux patch 5.5.14
9
10 Signed-off-by: Mike Pagano <mpagano <AT> gentoo.org>
11
12 0000_README | 4 +
13 1013_linux-5.5.14.patch | 8298 +++++++++++++++++++++++++++++++++++++++++++++++
14 2 files changed, 8302 insertions(+)
15
16 diff --git a/0000_README b/0000_README
17 index c561f7c..60b3027 100644
18 --- a/0000_README
19 +++ b/0000_README
20 @@ -95,6 +95,10 @@ Patch: 1012_linux-5.5.13.patch
21 From: http://www.kernel.org
22 Desc: Linux 5.5.13
23
24 +Patch: 1013_linux-5.5.14.patch
25 +From: http://www.kernel.org
26 +Desc: Linux 5.5.14
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/1013_linux-5.5.14.patch b/1013_linux-5.5.14.patch
33 new file mode 100644
34 index 0000000..eee6735
35 --- /dev/null
36 +++ b/1013_linux-5.5.14.patch
37 @@ -0,0 +1,8298 @@
38 +diff --git a/Makefile b/Makefile
39 +index d1574c99f83c..262892f82a15 100644
40 +--- a/Makefile
41 ++++ b/Makefile
42 +@@ -1,7 +1,7 @@
43 + # SPDX-License-Identifier: GPL-2.0
44 + VERSION = 5
45 + PATCHLEVEL = 5
46 +-SUBLEVEL = 13
47 ++SUBLEVEL = 14
48 + EXTRAVERSION =
49 + NAME = Kleptomaniac Octopus
50 +
51 +diff --git a/arch/arm/boot/dts/dra7.dtsi b/arch/arm/boot/dts/dra7.dtsi
52 +index c5af7530be7c..7601769e2053 100644
53 +--- a/arch/arm/boot/dts/dra7.dtsi
54 ++++ b/arch/arm/boot/dts/dra7.dtsi
55 +@@ -148,6 +148,7 @@
56 + #address-cells = <1>;
57 + #size-cells = <1>;
58 + ranges = <0x0 0x0 0x0 0xc0000000>;
59 ++ dma-ranges = <0x80000000 0x0 0x80000000 0x80000000>;
60 + ti,hwmods = "l3_main_1", "l3_main_2";
61 + reg = <0x0 0x44000000 0x0 0x1000000>,
62 + <0x0 0x45000000 0x0 0x1000>;
63 +diff --git a/arch/arm/boot/dts/omap5.dtsi b/arch/arm/boot/dts/omap5.dtsi
64 +index 1f6ad1debc90..08f61fa33eda 100644
65 +--- a/arch/arm/boot/dts/omap5.dtsi
66 ++++ b/arch/arm/boot/dts/omap5.dtsi
67 +@@ -143,6 +143,7 @@
68 + #address-cells = <1>;
69 + #size-cells = <1>;
70 + ranges = <0 0 0 0xc0000000>;
71 ++ dma-ranges = <0x80000000 0x0 0x80000000 0x80000000>;
72 + ti,hwmods = "l3_main_1", "l3_main_2", "l3_main_3";
73 + reg = <0 0x44000000 0 0x2000>,
74 + <0 0x44800000 0 0x3000>,
75 +diff --git a/arch/arm/boot/dts/sun8i-a83t-tbs-a711.dts b/arch/arm/boot/dts/sun8i-a83t-tbs-a711.dts
76 +index 2fd31a0a0b34..f781d330cff5 100644
77 +--- a/arch/arm/boot/dts/sun8i-a83t-tbs-a711.dts
78 ++++ b/arch/arm/boot/dts/sun8i-a83t-tbs-a711.dts
79 +@@ -498,7 +498,8 @@
80 + };
81 +
82 + &usbphy {
83 +- usb0_id_det-gpios = <&pio 7 11 GPIO_ACTIVE_HIGH>; /* PH11 */
84 ++ usb0_id_det-gpios = <&pio 7 11 (GPIO_ACTIVE_HIGH | GPIO_PULL_UP)>; /* PH11 */
85 ++ usb0_vbus_power-supply = <&usb_power_supply>;
86 + usb0_vbus-supply = <&reg_drivevbus>;
87 + usb1_vbus-supply = <&reg_vmain>;
88 + usb2_vbus-supply = <&reg_vmain>;
89 +diff --git a/arch/arm64/crypto/chacha-neon-glue.c b/arch/arm64/crypto/chacha-neon-glue.c
90 +index c1f9660d104c..37ca3e889848 100644
91 +--- a/arch/arm64/crypto/chacha-neon-glue.c
92 ++++ b/arch/arm64/crypto/chacha-neon-glue.c
93 +@@ -55,10 +55,10 @@ static void chacha_doneon(u32 *state, u8 *dst, const u8 *src,
94 + break;
95 + }
96 + chacha_4block_xor_neon(state, dst, src, nrounds, l);
97 +- bytes -= CHACHA_BLOCK_SIZE * 5;
98 +- src += CHACHA_BLOCK_SIZE * 5;
99 +- dst += CHACHA_BLOCK_SIZE * 5;
100 +- state[12] += 5;
101 ++ bytes -= l;
102 ++ src += l;
103 ++ dst += l;
104 ++ state[12] += DIV_ROUND_UP(l, CHACHA_BLOCK_SIZE);
105 + }
106 + }
107 +
108 +diff --git a/arch/x86/kvm/svm.c b/arch/x86/kvm/svm.c
109 +index 2b3d8feec313..a0b511360a0c 100644
110 +--- a/arch/x86/kvm/svm.c
111 ++++ b/arch/x86/kvm/svm.c
112 +@@ -1920,14 +1920,6 @@ static void sev_clflush_pages(struct page *pages[], unsigned long npages)
113 + static void __unregister_enc_region_locked(struct kvm *kvm,
114 + struct enc_region *region)
115 + {
116 +- /*
117 +- * The guest may change the memory encryption attribute from C=0 -> C=1
118 +- * or vice versa for this memory range. Lets make sure caches are
119 +- * flushed to ensure that guest data gets written into memory with
120 +- * correct C-bit.
121 +- */
122 +- sev_clflush_pages(region->pages, region->npages);
123 +-
124 + sev_unpin_memory(kvm, region->pages, region->npages);
125 + list_del(&region->list);
126 + kfree(region);
127 +@@ -1957,6 +1949,13 @@ static void sev_vm_destroy(struct kvm *kvm)
128 +
129 + mutex_lock(&kvm->lock);
130 +
131 ++ /*
132 ++ * Ensure that all guest tagged cache entries are flushed before
133 ++ * releasing the pages back to the system for use. CLFLUSH will
134 ++ * not do this, so issue a WBINVD.
135 ++ */
136 ++ wbinvd_on_all_cpus();
137 ++
138 + /*
139 + * if userspace was terminated before unregistering the memory regions
140 + * then lets unpin all the registered memory.
141 +@@ -7212,6 +7211,13 @@ static int svm_unregister_enc_region(struct kvm *kvm,
142 + goto failed;
143 + }
144 +
145 ++ /*
146 ++ * Ensure that all guest tagged cache entries are flushed before
147 ++ * releasing the pages back to the system for use. CLFLUSH will
148 ++ * not do this, so issue a WBINVD.
149 ++ */
150 ++ wbinvd_on_all_cpus();
151 ++
152 + __unregister_enc_region_locked(kvm, region);
153 +
154 + mutex_unlock(&kvm->lock);
155 +diff --git a/arch/x86/mm/ioremap.c b/arch/x86/mm/ioremap.c
156 +index e12cc7515ad7..644abb0d0650 100644
157 +--- a/arch/x86/mm/ioremap.c
158 ++++ b/arch/x86/mm/ioremap.c
159 +@@ -115,6 +115,9 @@ static void __ioremap_check_other(resource_size_t addr, struct ioremap_desc *des
160 + if (!sev_active())
161 + return;
162 +
163 ++ if (!IS_ENABLED(CONFIG_EFI))
164 ++ return;
165 ++
166 + if (efi_mem_type(addr) == EFI_RUNTIME_SERVICES_DATA)
167 + desc->flags |= IORES_MAP_ENCRYPTED;
168 + }
169 +diff --git a/arch/x86/net/bpf_jit_comp32.c b/arch/x86/net/bpf_jit_comp32.c
170 +index 393d251798c0..4d2a7a764602 100644
171 +--- a/arch/x86/net/bpf_jit_comp32.c
172 ++++ b/arch/x86/net/bpf_jit_comp32.c
173 +@@ -2039,10 +2039,12 @@ static int do_jit(struct bpf_prog *bpf_prog, int *addrs, u8 *image,
174 + }
175 + /* and dreg_lo,sreg_lo */
176 + EMIT2(0x23, add_2reg(0xC0, sreg_lo, dreg_lo));
177 +- /* and dreg_hi,sreg_hi */
178 +- EMIT2(0x23, add_2reg(0xC0, sreg_hi, dreg_hi));
179 +- /* or dreg_lo,dreg_hi */
180 +- EMIT2(0x09, add_2reg(0xC0, dreg_lo, dreg_hi));
181 ++ if (is_jmp64) {
182 ++ /* and dreg_hi,sreg_hi */
183 ++ EMIT2(0x23, add_2reg(0xC0, sreg_hi, dreg_hi));
184 ++ /* or dreg_lo,dreg_hi */
185 ++ EMIT2(0x09, add_2reg(0xC0, dreg_lo, dreg_hi));
186 ++ }
187 + goto emit_cond_jmp;
188 + }
189 + case BPF_JMP | BPF_JSET | BPF_K:
190 +diff --git a/drivers/ata/ahci.c b/drivers/ata/ahci.c
191 +index 11ea1aff40db..8c6f8c83dd6f 100644
192 +--- a/drivers/ata/ahci.c
193 ++++ b/drivers/ata/ahci.c
194 +@@ -401,6 +401,7 @@ static const struct pci_device_id ahci_pci_tbl[] = {
195 + { PCI_VDEVICE(INTEL, 0xa252), board_ahci }, /* Lewisburg RAID*/
196 + { PCI_VDEVICE(INTEL, 0xa256), board_ahci }, /* Lewisburg RAID*/
197 + { PCI_VDEVICE(INTEL, 0xa356), board_ahci }, /* Cannon Lake PCH-H RAID */
198 ++ { PCI_VDEVICE(INTEL, 0x06d7), board_ahci }, /* Comet Lake-H RAID */
199 + { PCI_VDEVICE(INTEL, 0x0f22), board_ahci_mobile }, /* Bay Trail AHCI */
200 + { PCI_VDEVICE(INTEL, 0x0f23), board_ahci_mobile }, /* Bay Trail AHCI */
201 + { PCI_VDEVICE(INTEL, 0x22a3), board_ahci_mobile }, /* Cherry Tr. AHCI */
202 +diff --git a/drivers/base/memory.c b/drivers/base/memory.c
203 +index 799b43191dea..b925f7d93036 100644
204 +--- a/drivers/base/memory.c
205 ++++ b/drivers/base/memory.c
206 +@@ -111,30 +111,13 @@ static ssize_t phys_index_show(struct device *dev,
207 + }
208 +
209 + /*
210 +- * Show whether the memory block is likely to be offlineable (or is already
211 +- * offline). Once offline, the memory block could be removed. The return
212 +- * value does, however, not indicate that there is a way to remove the
213 +- * memory block.
214 ++ * Legacy interface that we cannot remove. Always indicate "removable"
215 ++ * with CONFIG_MEMORY_HOTREMOVE - bad heuristic.
216 + */
217 + static ssize_t removable_show(struct device *dev, struct device_attribute *attr,
218 + char *buf)
219 + {
220 +- struct memory_block *mem = to_memory_block(dev);
221 +- unsigned long pfn;
222 +- int ret = 1, i;
223 +-
224 +- if (mem->state != MEM_ONLINE)
225 +- goto out;
226 +-
227 +- for (i = 0; i < sections_per_block; i++) {
228 +- if (!present_section_nr(mem->start_section_nr + i))
229 +- continue;
230 +- pfn = section_nr_to_pfn(mem->start_section_nr + i);
231 +- ret &= is_mem_section_removable(pfn, PAGES_PER_SECTION);
232 +- }
233 +-
234 +-out:
235 +- return sprintf(buf, "%d\n", ret);
236 ++ return sprintf(buf, "%d\n", (int)IS_ENABLED(CONFIG_MEMORY_HOTREMOVE));
237 + }
238 +
239 + /*
240 +diff --git a/drivers/clocksource/hyperv_timer.c b/drivers/clocksource/hyperv_timer.c
241 +index 287d8d58c21a..0d29b05d8889 100644
242 +--- a/drivers/clocksource/hyperv_timer.c
243 ++++ b/drivers/clocksource/hyperv_timer.c
244 +@@ -327,7 +327,8 @@ static u64 notrace read_hv_clock_tsc(struct clocksource *arg)
245 +
246 + static u64 read_hv_sched_clock_tsc(void)
247 + {
248 +- return read_hv_clock_tsc(NULL) - hv_sched_clock_offset;
249 ++ return (read_hv_clock_tsc(NULL) - hv_sched_clock_offset) *
250 ++ (NSEC_PER_SEC / HV_CLOCK_HZ);
251 + }
252 +
253 + static struct clocksource hyperv_cs_tsc = {
254 +@@ -352,7 +353,8 @@ static u64 notrace read_hv_clock_msr(struct clocksource *arg)
255 +
256 + static u64 read_hv_sched_clock_msr(void)
257 + {
258 +- return read_hv_clock_msr(NULL) - hv_sched_clock_offset;
259 ++ return (read_hv_clock_msr(NULL) - hv_sched_clock_offset) *
260 ++ (NSEC_PER_SEC / HV_CLOCK_HZ);
261 + }
262 +
263 + static struct clocksource hyperv_cs_msr = {
264 +diff --git a/drivers/gpio/gpiolib-acpi.c b/drivers/gpio/gpiolib-acpi.c
265 +index 31fee5e918b7..d1ef060a5873 100644
266 +--- a/drivers/gpio/gpiolib-acpi.c
267 ++++ b/drivers/gpio/gpiolib-acpi.c
268 +@@ -21,18 +21,21 @@
269 + #include "gpiolib.h"
270 + #include "gpiolib-acpi.h"
271 +
272 +-#define QUIRK_NO_EDGE_EVENTS_ON_BOOT 0x01l
273 +-#define QUIRK_NO_WAKEUP 0x02l
274 +-
275 + static int run_edge_events_on_boot = -1;
276 + module_param(run_edge_events_on_boot, int, 0444);
277 + MODULE_PARM_DESC(run_edge_events_on_boot,
278 + "Run edge _AEI event-handlers at boot: 0=no, 1=yes, -1=auto");
279 +
280 +-static int honor_wakeup = -1;
281 +-module_param(honor_wakeup, int, 0444);
282 +-MODULE_PARM_DESC(honor_wakeup,
283 +- "Honor the ACPI wake-capable flag: 0=no, 1=yes, -1=auto");
284 ++static char *ignore_wake;
285 ++module_param(ignore_wake, charp, 0444);
286 ++MODULE_PARM_DESC(ignore_wake,
287 ++ "controller@pin combos on which to ignore the ACPI wake flag "
288 ++ "ignore_wake=controller@pin[,controller@pin[,...]]");
289 ++
290 ++struct acpi_gpiolib_dmi_quirk {
291 ++ bool no_edge_events_on_boot;
292 ++ char *ignore_wake;
293 ++};
294 +
295 + /**
296 + * struct acpi_gpio_event - ACPI GPIO event handler data
297 +@@ -202,6 +205,57 @@ static void acpi_gpiochip_request_irqs(struct acpi_gpio_chip *acpi_gpio)
298 + acpi_gpiochip_request_irq(acpi_gpio, event);
299 + }
300 +
301 ++static bool acpi_gpio_in_ignore_list(const char *controller_in, int pin_in)
302 ++{
303 ++ const char *controller, *pin_str;
304 ++ int len, pin;
305 ++ char *endp;
306 ++
307 ++ controller = ignore_wake;
308 ++ while (controller) {
309 ++ pin_str = strchr(controller, '@');
310 ++ if (!pin_str)
311 ++ goto err;
312 ++
313 ++ len = pin_str - controller;
314 ++ if (len == strlen(controller_in) &&
315 ++ strncmp(controller, controller_in, len) == 0) {
316 ++ pin = simple_strtoul(pin_str + 1, &endp, 10);
317 ++ if (*endp != 0 && *endp != ',')
318 ++ goto err;
319 ++
320 ++ if (pin == pin_in)
321 ++ return true;
322 ++ }
323 ++
324 ++ controller = strchr(controller, ',');
325 ++ if (controller)
326 ++ controller++;
327 ++ }
328 ++
329 ++ return false;
330 ++err:
331 ++ pr_err_once("Error invalid value for gpiolib_acpi.ignore_wake: %s\n",
332 ++ ignore_wake);
333 ++ return false;
334 ++}
335 ++
336 ++static bool acpi_gpio_irq_is_wake(struct device *parent,
337 ++ struct acpi_resource_gpio *agpio)
338 ++{
339 ++ int pin = agpio->pin_table[0];
340 ++
341 ++ if (agpio->wake_capable != ACPI_WAKE_CAPABLE)
342 ++ return false;
343 ++
344 ++ if (acpi_gpio_in_ignore_list(dev_name(parent), pin)) {
345 ++ dev_info(parent, "Ignoring wakeup on pin %d\n", pin);
346 ++ return false;
347 ++ }
348 ++
349 ++ return true;
350 ++}
351 ++
352 + /* Always returns AE_OK so that we keep looping over the resources */
353 + static acpi_status acpi_gpiochip_alloc_event(struct acpi_resource *ares,
354 + void *context)
355 +@@ -289,7 +343,7 @@ static acpi_status acpi_gpiochip_alloc_event(struct acpi_resource *ares,
356 + event->handle = evt_handle;
357 + event->handler = handler;
358 + event->irq = irq;
359 +- event->irq_is_wake = honor_wakeup && agpio->wake_capable == ACPI_WAKE_CAPABLE;
360 ++ event->irq_is_wake = acpi_gpio_irq_is_wake(chip->parent, agpio);
361 + event->pin = pin;
362 + event->desc = desc;
363 +
364 +@@ -1328,7 +1382,9 @@ static const struct dmi_system_id gpiolib_acpi_quirks[] = {
365 + DMI_MATCH(DMI_SYS_VENDOR, "MINIX"),
366 + DMI_MATCH(DMI_PRODUCT_NAME, "Z83-4"),
367 + },
368 +- .driver_data = (void *)QUIRK_NO_EDGE_EVENTS_ON_BOOT,
369 ++ .driver_data = &(struct acpi_gpiolib_dmi_quirk) {
370 ++ .no_edge_events_on_boot = true,
371 ++ },
372 + },
373 + {
374 + /*
375 +@@ -1341,16 +1397,20 @@ static const struct dmi_system_id gpiolib_acpi_quirks[] = {
376 + DMI_MATCH(DMI_SYS_VENDOR, "Wortmann_AG"),
377 + DMI_MATCH(DMI_PRODUCT_NAME, "TERRA_PAD_1061"),
378 + },
379 +- .driver_data = (void *)QUIRK_NO_EDGE_EVENTS_ON_BOOT,
380 ++ .driver_data = &(struct acpi_gpiolib_dmi_quirk) {
381 ++ .no_edge_events_on_boot = true,
382 ++ },
383 + },
384 + {
385 + /*
386 +- * Various HP X2 10 Cherry Trail models use an external
387 +- * embedded-controller connected via I2C + an ACPI GPIO
388 +- * event handler. The embedded controller generates various
389 +- * spurious wakeup events when suspended. So disable wakeup
390 +- * for its handler (it uses the only ACPI GPIO event handler).
391 +- * This breaks wakeup when opening the lid, the user needs
392 ++ * HP X2 10 models with Cherry Trail SoC + TI PMIC use an
393 ++ * external embedded-controller connected via I2C + an ACPI GPIO
394 ++ * event handler on INT33FF:01 pin 0, causing spurious wakeups.
395 ++ * When suspending by closing the LID, the power to the USB
396 ++ * keyboard is turned off, causing INT0002 ACPI events to
397 ++ * trigger once the XHCI controller notices the keyboard is
398 ++ * gone. So INT0002 events cause spurious wakeups too. Ignoring
399 ++ * EC wakes breaks wakeup when opening the lid, the user needs
400 + * to press the power-button to wakeup the system. The
401 + * alternative is suspend simply not working, which is worse.
402 + */
403 +@@ -1358,33 +1418,46 @@ static const struct dmi_system_id gpiolib_acpi_quirks[] = {
404 + DMI_MATCH(DMI_SYS_VENDOR, "HP"),
405 + DMI_MATCH(DMI_PRODUCT_NAME, "HP x2 Detachable 10-p0XX"),
406 + },
407 +- .driver_data = (void *)QUIRK_NO_WAKEUP,
408 ++ .driver_data = &(struct acpi_gpiolib_dmi_quirk) {
409 ++ .ignore_wake = "INT33FF:01@0,INT0002:00@2",
410 ++ },
411 ++ },
412 ++ {
413 ++ /*
414 ++ * HP X2 10 models with Bay Trail SoC + AXP288 PMIC use an
415 ++ * external embedded-controller connected via I2C + an ACPI GPIO
416 ++ * event handler on INT33FC:02 pin 28, causing spurious wakeups.
417 ++ */
418 ++ .matches = {
419 ++ DMI_MATCH(DMI_SYS_VENDOR, "Hewlett-Packard"),
420 ++ DMI_MATCH(DMI_PRODUCT_NAME, "HP Pavilion x2 Detachable"),
421 ++ DMI_MATCH(DMI_BOARD_NAME, "815D"),
422 ++ },
423 ++ .driver_data = &(struct acpi_gpiolib_dmi_quirk) {
424 ++ .ignore_wake = "INT33FC:02@28",
425 ++ },
426 + },
427 + {} /* Terminating entry */
428 + };
429 +
430 + static int acpi_gpio_setup_params(void)
431 + {
432 ++ const struct acpi_gpiolib_dmi_quirk *quirk = NULL;
433 + const struct dmi_system_id *id;
434 +- long quirks = 0;
435 +
436 + id = dmi_first_match(gpiolib_acpi_quirks);
437 + if (id)
438 +- quirks = (long)id->driver_data;
439 ++ quirk = id->driver_data;
440 +
441 + if (run_edge_events_on_boot < 0) {
442 +- if (quirks & QUIRK_NO_EDGE_EVENTS_ON_BOOT)
443 ++ if (quirk && quirk->no_edge_events_on_boot)
444 + run_edge_events_on_boot = 0;
445 + else
446 + run_edge_events_on_boot = 1;
447 + }
448 +
449 +- if (honor_wakeup < 0) {
450 +- if (quirks & QUIRK_NO_WAKEUP)
451 +- honor_wakeup = 0;
452 +- else
453 +- honor_wakeup = 1;
454 +- }
455 ++ if (ignore_wake == NULL && quirk && quirk->ignore_wake)
456 ++ ignore_wake = quirk->ignore_wake;
457 +
458 + return 0;
459 + }
460 +diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c
461 +index 175c6363cf61..d5400d55746e 100644
462 +--- a/drivers/gpio/gpiolib.c
463 ++++ b/drivers/gpio/gpiolib.c
464 +@@ -2323,9 +2323,16 @@ static void gpiochip_irq_disable(struct irq_data *d)
465 + {
466 + struct gpio_chip *chip = irq_data_get_irq_chip_data(d);
467 +
468 ++ /*
469 ++ * Since we override .irq_disable() we need to mimic the
470 ++ * behaviour of __irq_disable() in irq/chip.c.
471 ++ * First call .irq_disable() if it exists, else mimic the
472 ++ * behaviour of mask_irq() which calls .irq_mask() if
473 ++ * it exists.
474 ++ */
475 + if (chip->irq.irq_disable)
476 + chip->irq.irq_disable(d);
477 +- else
478 ++ else if (chip->irq.chip->irq_mask)
479 + chip->irq.chip->irq_mask(d);
480 + gpiochip_disable_irq(chip, d->hwirq);
481 + }
482 +diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
483 +index 2616e2eafdeb..5c51ed3b926c 100644
484 +--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
485 ++++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
486 +@@ -973,7 +973,7 @@ static int amdgpu_ttm_tt_pin_userptr(struct ttm_tt *ttm)
487 + /* Map SG to device */
488 + r = -ENOMEM;
489 + nents = dma_map_sg(adev->dev, ttm->sg->sgl, ttm->sg->nents, direction);
490 +- if (nents != ttm->sg->nents)
491 ++ if (nents == 0)
492 + goto release_sg;
493 +
494 + /* convert SG to linear array of pages and dma addresses */
495 +diff --git a/drivers/gpu/drm/amd/amdgpu/soc15.c b/drivers/gpu/drm/amd/amdgpu/soc15.c
496 +index 624e223175c2..d6f4f825b439 100644
497 +--- a/drivers/gpu/drm/amd/amdgpu/soc15.c
498 ++++ b/drivers/gpu/drm/amd/amdgpu/soc15.c
499 +@@ -87,6 +87,13 @@
500 + #define HDP_MEM_POWER_CTRL__RC_MEM_POWER_CTRL_EN_MASK 0x00010000L
501 + #define HDP_MEM_POWER_CTRL__RC_MEM_POWER_LS_EN_MASK 0x00020000L
502 + #define mmHDP_MEM_POWER_CTRL_BASE_IDX 0
503 ++
504 ++/* for Vega20/arcturus regiter offset change */
505 ++#define mmROM_INDEX_VG20 0x00e4
506 ++#define mmROM_INDEX_VG20_BASE_IDX 0
507 ++#define mmROM_DATA_VG20 0x00e5
508 ++#define mmROM_DATA_VG20_BASE_IDX 0
509 ++
510 + /*
511 + * Indirect registers accessor
512 + */
513 +@@ -307,6 +314,8 @@ static bool soc15_read_bios_from_rom(struct amdgpu_device *adev,
514 + {
515 + u32 *dw_ptr;
516 + u32 i, length_dw;
517 ++ uint32_t rom_index_offset;
518 ++ uint32_t rom_data_offset;
519 +
520 + if (bios == NULL)
521 + return false;
522 +@@ -319,11 +328,23 @@ static bool soc15_read_bios_from_rom(struct amdgpu_device *adev,
523 + dw_ptr = (u32 *)bios;
524 + length_dw = ALIGN(length_bytes, 4) / 4;
525 +
526 ++ switch (adev->asic_type) {
527 ++ case CHIP_VEGA20:
528 ++ case CHIP_ARCTURUS:
529 ++ rom_index_offset = SOC15_REG_OFFSET(SMUIO, 0, mmROM_INDEX_VG20);
530 ++ rom_data_offset = SOC15_REG_OFFSET(SMUIO, 0, mmROM_DATA_VG20);
531 ++ break;
532 ++ default:
533 ++ rom_index_offset = SOC15_REG_OFFSET(SMUIO, 0, mmROM_INDEX);
534 ++ rom_data_offset = SOC15_REG_OFFSET(SMUIO, 0, mmROM_DATA);
535 ++ break;
536 ++ }
537 ++
538 + /* set rom index to 0 */
539 +- WREG32(SOC15_REG_OFFSET(SMUIO, 0, mmROM_INDEX), 0);
540 ++ WREG32(rom_index_offset, 0);
541 + /* read out the rom data */
542 + for (i = 0; i < length_dw; i++)
543 +- dw_ptr[i] = RREG32(SOC15_REG_OFFSET(SMUIO, 0, mmROM_DATA));
544 ++ dw_ptr[i] = RREG32(rom_data_offset);
545 +
546 + return true;
547 + }
548 +diff --git a/drivers/gpu/drm/amd/display/dc/dcn20/dcn20_resource.c b/drivers/gpu/drm/amd/display/dc/dcn20/dcn20_resource.c
549 +index 23ff2f1c75b5..41c4ee84f8bb 100644
550 +--- a/drivers/gpu/drm/amd/display/dc/dcn20/dcn20_resource.c
551 ++++ b/drivers/gpu/drm/amd/display/dc/dcn20/dcn20_resource.c
552 +@@ -337,6 +337,117 @@ struct _vcs_dpi_soc_bounding_box_st dcn2_0_soc = {
553 + .use_urgent_burst_bw = 0
554 + };
555 +
556 ++struct _vcs_dpi_soc_bounding_box_st dcn2_0_nv14_soc = {
557 ++ .clock_limits = {
558 ++ {
559 ++ .state = 0,
560 ++ .dcfclk_mhz = 560.0,
561 ++ .fabricclk_mhz = 560.0,
562 ++ .dispclk_mhz = 513.0,
563 ++ .dppclk_mhz = 513.0,
564 ++ .phyclk_mhz = 540.0,
565 ++ .socclk_mhz = 560.0,
566 ++ .dscclk_mhz = 171.0,
567 ++ .dram_speed_mts = 8960.0,
568 ++ },
569 ++ {
570 ++ .state = 1,
571 ++ .dcfclk_mhz = 694.0,
572 ++ .fabricclk_mhz = 694.0,
573 ++ .dispclk_mhz = 642.0,
574 ++ .dppclk_mhz = 642.0,
575 ++ .phyclk_mhz = 600.0,
576 ++ .socclk_mhz = 694.0,
577 ++ .dscclk_mhz = 214.0,
578 ++ .dram_speed_mts = 11104.0,
579 ++ },
580 ++ {
581 ++ .state = 2,
582 ++ .dcfclk_mhz = 875.0,
583 ++ .fabricclk_mhz = 875.0,
584 ++ .dispclk_mhz = 734.0,
585 ++ .dppclk_mhz = 734.0,
586 ++ .phyclk_mhz = 810.0,
587 ++ .socclk_mhz = 875.0,
588 ++ .dscclk_mhz = 245.0,
589 ++ .dram_speed_mts = 14000.0,
590 ++ },
591 ++ {
592 ++ .state = 3,
593 ++ .dcfclk_mhz = 1000.0,
594 ++ .fabricclk_mhz = 1000.0,
595 ++ .dispclk_mhz = 1100.0,
596 ++ .dppclk_mhz = 1100.0,
597 ++ .phyclk_mhz = 810.0,
598 ++ .socclk_mhz = 1000.0,
599 ++ .dscclk_mhz = 367.0,
600 ++ .dram_speed_mts = 16000.0,
601 ++ },
602 ++ {
603 ++ .state = 4,
604 ++ .dcfclk_mhz = 1200.0,
605 ++ .fabricclk_mhz = 1200.0,
606 ++ .dispclk_mhz = 1284.0,
607 ++ .dppclk_mhz = 1284.0,
608 ++ .phyclk_mhz = 810.0,
609 ++ .socclk_mhz = 1200.0,
610 ++ .dscclk_mhz = 428.0,
611 ++ .dram_speed_mts = 16000.0,
612 ++ },
613 ++ /*Extra state, no dispclk ramping*/
614 ++ {
615 ++ .state = 5,
616 ++ .dcfclk_mhz = 1200.0,
617 ++ .fabricclk_mhz = 1200.0,
618 ++ .dispclk_mhz = 1284.0,
619 ++ .dppclk_mhz = 1284.0,
620 ++ .phyclk_mhz = 810.0,
621 ++ .socclk_mhz = 1200.0,
622 ++ .dscclk_mhz = 428.0,
623 ++ .dram_speed_mts = 16000.0,
624 ++ },
625 ++ },
626 ++ .num_states = 5,
627 ++ .sr_exit_time_us = 8.6,
628 ++ .sr_enter_plus_exit_time_us = 10.9,
629 ++ .urgent_latency_us = 4.0,
630 ++ .urgent_latency_pixel_data_only_us = 4.0,
631 ++ .urgent_latency_pixel_mixed_with_vm_data_us = 4.0,
632 ++ .urgent_latency_vm_data_only_us = 4.0,
633 ++ .urgent_out_of_order_return_per_channel_pixel_only_bytes = 4096,
634 ++ .urgent_out_of_order_return_per_channel_pixel_and_vm_bytes = 4096,
635 ++ .urgent_out_of_order_return_per_channel_vm_only_bytes = 4096,
636 ++ .pct_ideal_dram_sdp_bw_after_urgent_pixel_only = 40.0,
637 ++ .pct_ideal_dram_sdp_bw_after_urgent_pixel_and_vm = 40.0,
638 ++ .pct_ideal_dram_sdp_bw_after_urgent_vm_only = 40.0,
639 ++ .max_avg_sdp_bw_use_normal_percent = 40.0,
640 ++ .max_avg_dram_bw_use_normal_percent = 40.0,
641 ++ .writeback_latency_us = 12.0,
642 ++ .ideal_dram_bw_after_urgent_percent = 40.0,
643 ++ .max_request_size_bytes = 256,
644 ++ .dram_channel_width_bytes = 2,
645 ++ .fabric_datapath_to_dcn_data_return_bytes = 64,
646 ++ .dcn_downspread_percent = 0.5,
647 ++ .downspread_percent = 0.38,
648 ++ .dram_page_open_time_ns = 50.0,
649 ++ .dram_rw_turnaround_time_ns = 17.5,
650 ++ .dram_return_buffer_per_channel_bytes = 8192,
651 ++ .round_trip_ping_latency_dcfclk_cycles = 131,
652 ++ .urgent_out_of_order_return_per_channel_bytes = 256,
653 ++ .channel_interleave_bytes = 256,
654 ++ .num_banks = 8,
655 ++ .num_chans = 8,
656 ++ .vmm_page_size_bytes = 4096,
657 ++ .dram_clock_change_latency_us = 404.0,
658 ++ .dummy_pstate_latency_us = 5.0,
659 ++ .writeback_dram_clock_change_latency_us = 23.0,
660 ++ .return_bus_width_bytes = 64,
661 ++ .dispclk_dppclk_vco_speed_mhz = 3850,
662 ++ .xfc_bus_transport_time_us = 20,
663 ++ .xfc_xbuf_latency_tolerance_us = 4,
664 ++ .use_urgent_burst_bw = 0
665 ++};
666 ++
667 + struct _vcs_dpi_soc_bounding_box_st dcn2_0_nv12_soc = { 0 };
668 +
669 + #ifndef mmDP0_DP_DPHY_INTERNAL_CTRL
670 +@@ -3282,6 +3393,9 @@ void dcn20_patch_bounding_box(struct dc *dc, struct _vcs_dpi_soc_bounding_box_st
671 + static struct _vcs_dpi_soc_bounding_box_st *get_asic_rev_soc_bb(
672 + uint32_t hw_internal_rev)
673 + {
674 ++ if (ASICREV_IS_NAVI14_M(hw_internal_rev))
675 ++ return &dcn2_0_nv14_soc;
676 ++
677 + if (ASICREV_IS_NAVI12_P(hw_internal_rev))
678 + return &dcn2_0_nv12_soc;
679 +
680 +diff --git a/drivers/gpu/drm/drm_prime.c b/drivers/gpu/drm/drm_prime.c
681 +index 0814211b0f3f..698f5e81591f 100644
682 +--- a/drivers/gpu/drm/drm_prime.c
683 ++++ b/drivers/gpu/drm/drm_prime.c
684 +@@ -964,7 +964,7 @@ int drm_prime_sg_to_page_addr_arrays(struct sg_table *sgt, struct page **pages,
685 +
686 + index = 0;
687 + for_each_sg(sgt->sgl, sg, sgt->nents, count) {
688 +- len = sg->length;
689 ++ len = sg_dma_len(sg);
690 + page = sg_page(sg);
691 + addr = sg_dma_address(sg);
692 +
693 +diff --git a/drivers/gpu/drm/exynos/exynos5433_drm_decon.c b/drivers/gpu/drm/exynos/exynos5433_drm_decon.c
694 +index 2d5cbfda3ca7..9c262daf5816 100644
695 +--- a/drivers/gpu/drm/exynos/exynos5433_drm_decon.c
696 ++++ b/drivers/gpu/drm/exynos/exynos5433_drm_decon.c
697 +@@ -55,6 +55,7 @@ static const char * const decon_clks_name[] = {
698 + struct decon_context {
699 + struct device *dev;
700 + struct drm_device *drm_dev;
701 ++ void *dma_priv;
702 + struct exynos_drm_crtc *crtc;
703 + struct exynos_drm_plane planes[WINDOWS_NR];
704 + struct exynos_drm_plane_config configs[WINDOWS_NR];
705 +@@ -644,7 +645,7 @@ static int decon_bind(struct device *dev, struct device *master, void *data)
706 +
707 + decon_clear_channels(ctx->crtc);
708 +
709 +- return exynos_drm_register_dma(drm_dev, dev);
710 ++ return exynos_drm_register_dma(drm_dev, dev, &ctx->dma_priv);
711 + }
712 +
713 + static void decon_unbind(struct device *dev, struct device *master, void *data)
714 +@@ -654,7 +655,7 @@ static void decon_unbind(struct device *dev, struct device *master, void *data)
715 + decon_disable(ctx->crtc);
716 +
717 + /* detach this sub driver from iommu mapping if supported. */
718 +- exynos_drm_unregister_dma(ctx->drm_dev, ctx->dev);
719 ++ exynos_drm_unregister_dma(ctx->drm_dev, ctx->dev, &ctx->dma_priv);
720 + }
721 +
722 + static const struct component_ops decon_component_ops = {
723 +diff --git a/drivers/gpu/drm/exynos/exynos7_drm_decon.c b/drivers/gpu/drm/exynos/exynos7_drm_decon.c
724 +index f0640950bd46..6fd40410dfd2 100644
725 +--- a/drivers/gpu/drm/exynos/exynos7_drm_decon.c
726 ++++ b/drivers/gpu/drm/exynos/exynos7_drm_decon.c
727 +@@ -40,6 +40,7 @@
728 + struct decon_context {
729 + struct device *dev;
730 + struct drm_device *drm_dev;
731 ++ void *dma_priv;
732 + struct exynos_drm_crtc *crtc;
733 + struct exynos_drm_plane planes[WINDOWS_NR];
734 + struct exynos_drm_plane_config configs[WINDOWS_NR];
735 +@@ -127,13 +128,13 @@ static int decon_ctx_initialize(struct decon_context *ctx,
736 +
737 + decon_clear_channels(ctx->crtc);
738 +
739 +- return exynos_drm_register_dma(drm_dev, ctx->dev);
740 ++ return exynos_drm_register_dma(drm_dev, ctx->dev, &ctx->dma_priv);
741 + }
742 +
743 + static void decon_ctx_remove(struct decon_context *ctx)
744 + {
745 + /* detach this sub driver from iommu mapping if supported. */
746 +- exynos_drm_unregister_dma(ctx->drm_dev, ctx->dev);
747 ++ exynos_drm_unregister_dma(ctx->drm_dev, ctx->dev, &ctx->dma_priv);
748 + }
749 +
750 + static u32 decon_calc_clkdiv(struct decon_context *ctx,
751 +diff --git a/drivers/gpu/drm/exynos/exynos_drm_dma.c b/drivers/gpu/drm/exynos/exynos_drm_dma.c
752 +index 9ebc02768847..619f81435c1b 100644
753 +--- a/drivers/gpu/drm/exynos/exynos_drm_dma.c
754 ++++ b/drivers/gpu/drm/exynos/exynos_drm_dma.c
755 +@@ -58,7 +58,7 @@ static inline void clear_dma_max_seg_size(struct device *dev)
756 + * mapping.
757 + */
758 + static int drm_iommu_attach_device(struct drm_device *drm_dev,
759 +- struct device *subdrv_dev)
760 ++ struct device *subdrv_dev, void **dma_priv)
761 + {
762 + struct exynos_drm_private *priv = drm_dev->dev_private;
763 + int ret;
764 +@@ -74,7 +74,14 @@ static int drm_iommu_attach_device(struct drm_device *drm_dev,
765 + return ret;
766 +
767 + if (IS_ENABLED(CONFIG_ARM_DMA_USE_IOMMU)) {
768 +- if (to_dma_iommu_mapping(subdrv_dev))
769 ++ /*
770 ++ * Keep the original DMA mapping of the sub-device and
771 ++ * restore it on Exynos DRM detach, otherwise the DMA
772 ++ * framework considers it as IOMMU-less during the next
773 ++ * probe (in case of deferred probe or modular build)
774 ++ */
775 ++ *dma_priv = to_dma_iommu_mapping(subdrv_dev);
776 ++ if (*dma_priv)
777 + arm_iommu_detach_device(subdrv_dev);
778 +
779 + ret = arm_iommu_attach_device(subdrv_dev, priv->mapping);
780 +@@ -98,19 +105,21 @@ static int drm_iommu_attach_device(struct drm_device *drm_dev,
781 + * mapping
782 + */
783 + static void drm_iommu_detach_device(struct drm_device *drm_dev,
784 +- struct device *subdrv_dev)
785 ++ struct device *subdrv_dev, void **dma_priv)
786 + {
787 + struct exynos_drm_private *priv = drm_dev->dev_private;
788 +
789 +- if (IS_ENABLED(CONFIG_ARM_DMA_USE_IOMMU))
790 ++ if (IS_ENABLED(CONFIG_ARM_DMA_USE_IOMMU)) {
791 + arm_iommu_detach_device(subdrv_dev);
792 +- else if (IS_ENABLED(CONFIG_IOMMU_DMA))
793 ++ arm_iommu_attach_device(subdrv_dev, *dma_priv);
794 ++ } else if (IS_ENABLED(CONFIG_IOMMU_DMA))
795 + iommu_detach_device(priv->mapping, subdrv_dev);
796 +
797 + clear_dma_max_seg_size(subdrv_dev);
798 + }
799 +
800 +-int exynos_drm_register_dma(struct drm_device *drm, struct device *dev)
801 ++int exynos_drm_register_dma(struct drm_device *drm, struct device *dev,
802 ++ void **dma_priv)
803 + {
804 + struct exynos_drm_private *priv = drm->dev_private;
805 +
806 +@@ -137,13 +146,14 @@ int exynos_drm_register_dma(struct drm_device *drm, struct device *dev)
807 + priv->mapping = mapping;
808 + }
809 +
810 +- return drm_iommu_attach_device(drm, dev);
811 ++ return drm_iommu_attach_device(drm, dev, dma_priv);
812 + }
813 +
814 +-void exynos_drm_unregister_dma(struct drm_device *drm, struct device *dev)
815 ++void exynos_drm_unregister_dma(struct drm_device *drm, struct device *dev,
816 ++ void **dma_priv)
817 + {
818 + if (IS_ENABLED(CONFIG_EXYNOS_IOMMU))
819 +- drm_iommu_detach_device(drm, dev);
820 ++ drm_iommu_detach_device(drm, dev, dma_priv);
821 + }
822 +
823 + void exynos_drm_cleanup_dma(struct drm_device *drm)
824 +diff --git a/drivers/gpu/drm/exynos/exynos_drm_drv.h b/drivers/gpu/drm/exynos/exynos_drm_drv.h
825 +index d4014ba592fd..735f436c857c 100644
826 +--- a/drivers/gpu/drm/exynos/exynos_drm_drv.h
827 ++++ b/drivers/gpu/drm/exynos/exynos_drm_drv.h
828 +@@ -223,8 +223,10 @@ static inline bool is_drm_iommu_supported(struct drm_device *drm_dev)
829 + return priv->mapping ? true : false;
830 + }
831 +
832 +-int exynos_drm_register_dma(struct drm_device *drm, struct device *dev);
833 +-void exynos_drm_unregister_dma(struct drm_device *drm, struct device *dev);
834 ++int exynos_drm_register_dma(struct drm_device *drm, struct device *dev,
835 ++ void **dma_priv);
836 ++void exynos_drm_unregister_dma(struct drm_device *drm, struct device *dev,
837 ++ void **dma_priv);
838 + void exynos_drm_cleanup_dma(struct drm_device *drm);
839 +
840 + #ifdef CONFIG_DRM_EXYNOS_DPI
841 +diff --git a/drivers/gpu/drm/exynos/exynos_drm_fimc.c b/drivers/gpu/drm/exynos/exynos_drm_fimc.c
842 +index 8ea2e1d77802..29ab8be8604c 100644
843 +--- a/drivers/gpu/drm/exynos/exynos_drm_fimc.c
844 ++++ b/drivers/gpu/drm/exynos/exynos_drm_fimc.c
845 +@@ -97,6 +97,7 @@ struct fimc_scaler {
846 + struct fimc_context {
847 + struct exynos_drm_ipp ipp;
848 + struct drm_device *drm_dev;
849 ++ void *dma_priv;
850 + struct device *dev;
851 + struct exynos_drm_ipp_task *task;
852 + struct exynos_drm_ipp_formats *formats;
853 +@@ -1133,7 +1134,7 @@ static int fimc_bind(struct device *dev, struct device *master, void *data)
854 +
855 + ctx->drm_dev = drm_dev;
856 + ipp->drm_dev = drm_dev;
857 +- exynos_drm_register_dma(drm_dev, dev);
858 ++ exynos_drm_register_dma(drm_dev, dev, &ctx->dma_priv);
859 +
860 + exynos_drm_ipp_register(dev, ipp, &ipp_funcs,
861 + DRM_EXYNOS_IPP_CAP_CROP | DRM_EXYNOS_IPP_CAP_ROTATE |
862 +@@ -1153,7 +1154,7 @@ static void fimc_unbind(struct device *dev, struct device *master,
863 + struct exynos_drm_ipp *ipp = &ctx->ipp;
864 +
865 + exynos_drm_ipp_unregister(dev, ipp);
866 +- exynos_drm_unregister_dma(drm_dev, dev);
867 ++ exynos_drm_unregister_dma(drm_dev, dev, &ctx->dma_priv);
868 + }
869 +
870 + static const struct component_ops fimc_component_ops = {
871 +diff --git a/drivers/gpu/drm/exynos/exynos_drm_fimd.c b/drivers/gpu/drm/exynos/exynos_drm_fimd.c
872 +index 8d0a929104e5..34e6b22173fa 100644
873 +--- a/drivers/gpu/drm/exynos/exynos_drm_fimd.c
874 ++++ b/drivers/gpu/drm/exynos/exynos_drm_fimd.c
875 +@@ -167,6 +167,7 @@ static struct fimd_driver_data exynos5420_fimd_driver_data = {
876 + struct fimd_context {
877 + struct device *dev;
878 + struct drm_device *drm_dev;
879 ++ void *dma_priv;
880 + struct exynos_drm_crtc *crtc;
881 + struct exynos_drm_plane planes[WINDOWS_NR];
882 + struct exynos_drm_plane_config configs[WINDOWS_NR];
883 +@@ -1090,7 +1091,7 @@ static int fimd_bind(struct device *dev, struct device *master, void *data)
884 + if (is_drm_iommu_supported(drm_dev))
885 + fimd_clear_channels(ctx->crtc);
886 +
887 +- return exynos_drm_register_dma(drm_dev, dev);
888 ++ return exynos_drm_register_dma(drm_dev, dev, &ctx->dma_priv);
889 + }
890 +
891 + static void fimd_unbind(struct device *dev, struct device *master,
892 +@@ -1100,7 +1101,7 @@ static void fimd_unbind(struct device *dev, struct device *master,
893 +
894 + fimd_disable(ctx->crtc);
895 +
896 +- exynos_drm_unregister_dma(ctx->drm_dev, ctx->dev);
897 ++ exynos_drm_unregister_dma(ctx->drm_dev, ctx->dev, &ctx->dma_priv);
898 +
899 + if (ctx->encoder)
900 + exynos_dpi_remove(ctx->encoder);
901 +diff --git a/drivers/gpu/drm/exynos/exynos_drm_g2d.c b/drivers/gpu/drm/exynos/exynos_drm_g2d.c
902 +index 2a3382d43bc9..fcee33a43aca 100644
903 +--- a/drivers/gpu/drm/exynos/exynos_drm_g2d.c
904 ++++ b/drivers/gpu/drm/exynos/exynos_drm_g2d.c
905 +@@ -232,6 +232,7 @@ struct g2d_runqueue_node {
906 +
907 + struct g2d_data {
908 + struct device *dev;
909 ++ void *dma_priv;
910 + struct clk *gate_clk;
911 + void __iomem *regs;
912 + int irq;
913 +@@ -1409,7 +1410,7 @@ static int g2d_bind(struct device *dev, struct device *master, void *data)
914 + return ret;
915 + }
916 +
917 +- ret = exynos_drm_register_dma(drm_dev, dev);
918 ++ ret = exynos_drm_register_dma(drm_dev, dev, &g2d->dma_priv);
919 + if (ret < 0) {
920 + dev_err(dev, "failed to enable iommu.\n");
921 + g2d_fini_cmdlist(g2d);
922 +@@ -1434,7 +1435,7 @@ static void g2d_unbind(struct device *dev, struct device *master, void *data)
923 + priv->g2d_dev = NULL;
924 +
925 + cancel_work_sync(&g2d->runqueue_work);
926 +- exynos_drm_unregister_dma(g2d->drm_dev, dev);
927 ++ exynos_drm_unregister_dma(g2d->drm_dev, dev, &g2d->dma_priv);
928 + }
929 +
930 + static const struct component_ops g2d_component_ops = {
931 +diff --git a/drivers/gpu/drm/exynos/exynos_drm_gsc.c b/drivers/gpu/drm/exynos/exynos_drm_gsc.c
932 +index 88b6fcaa20be..45e9aee8366a 100644
933 +--- a/drivers/gpu/drm/exynos/exynos_drm_gsc.c
934 ++++ b/drivers/gpu/drm/exynos/exynos_drm_gsc.c
935 +@@ -97,6 +97,7 @@ struct gsc_scaler {
936 + struct gsc_context {
937 + struct exynos_drm_ipp ipp;
938 + struct drm_device *drm_dev;
939 ++ void *dma_priv;
940 + struct device *dev;
941 + struct exynos_drm_ipp_task *task;
942 + struct exynos_drm_ipp_formats *formats;
943 +@@ -1169,7 +1170,7 @@ static int gsc_bind(struct device *dev, struct device *master, void *data)
944 +
945 + ctx->drm_dev = drm_dev;
946 + ctx->drm_dev = drm_dev;
947 +- exynos_drm_register_dma(drm_dev, dev);
948 ++ exynos_drm_register_dma(drm_dev, dev, &ctx->dma_priv);
949 +
950 + exynos_drm_ipp_register(dev, ipp, &ipp_funcs,
951 + DRM_EXYNOS_IPP_CAP_CROP | DRM_EXYNOS_IPP_CAP_ROTATE |
952 +@@ -1189,7 +1190,7 @@ static void gsc_unbind(struct device *dev, struct device *master,
953 + struct exynos_drm_ipp *ipp = &ctx->ipp;
954 +
955 + exynos_drm_ipp_unregister(dev, ipp);
956 +- exynos_drm_unregister_dma(drm_dev, dev);
957 ++ exynos_drm_unregister_dma(drm_dev, dev, &ctx->dma_priv);
958 + }
959 +
960 + static const struct component_ops gsc_component_ops = {
961 +diff --git a/drivers/gpu/drm/exynos/exynos_drm_rotator.c b/drivers/gpu/drm/exynos/exynos_drm_rotator.c
962 +index b98482990d1a..dafa87b82052 100644
963 +--- a/drivers/gpu/drm/exynos/exynos_drm_rotator.c
964 ++++ b/drivers/gpu/drm/exynos/exynos_drm_rotator.c
965 +@@ -56,6 +56,7 @@ struct rot_variant {
966 + struct rot_context {
967 + struct exynos_drm_ipp ipp;
968 + struct drm_device *drm_dev;
969 ++ void *dma_priv;
970 + struct device *dev;
971 + void __iomem *regs;
972 + struct clk *clock;
973 +@@ -243,7 +244,7 @@ static int rotator_bind(struct device *dev, struct device *master, void *data)
974 +
975 + rot->drm_dev = drm_dev;
976 + ipp->drm_dev = drm_dev;
977 +- exynos_drm_register_dma(drm_dev, dev);
978 ++ exynos_drm_register_dma(drm_dev, dev, &rot->dma_priv);
979 +
980 + exynos_drm_ipp_register(dev, ipp, &ipp_funcs,
981 + DRM_EXYNOS_IPP_CAP_CROP | DRM_EXYNOS_IPP_CAP_ROTATE,
982 +@@ -261,7 +262,7 @@ static void rotator_unbind(struct device *dev, struct device *master,
983 + struct exynos_drm_ipp *ipp = &rot->ipp;
984 +
985 + exynos_drm_ipp_unregister(dev, ipp);
986 +- exynos_drm_unregister_dma(rot->drm_dev, rot->dev);
987 ++ exynos_drm_unregister_dma(rot->drm_dev, rot->dev, &rot->dma_priv);
988 + }
989 +
990 + static const struct component_ops rotator_component_ops = {
991 +diff --git a/drivers/gpu/drm/exynos/exynos_drm_scaler.c b/drivers/gpu/drm/exynos/exynos_drm_scaler.c
992 +index 497973e9b2c5..93c43c8d914e 100644
993 +--- a/drivers/gpu/drm/exynos/exynos_drm_scaler.c
994 ++++ b/drivers/gpu/drm/exynos/exynos_drm_scaler.c
995 +@@ -39,6 +39,7 @@ struct scaler_data {
996 + struct scaler_context {
997 + struct exynos_drm_ipp ipp;
998 + struct drm_device *drm_dev;
999 ++ void *dma_priv;
1000 + struct device *dev;
1001 + void __iomem *regs;
1002 + struct clk *clock[SCALER_MAX_CLK];
1003 +@@ -450,7 +451,7 @@ static int scaler_bind(struct device *dev, struct device *master, void *data)
1004 +
1005 + scaler->drm_dev = drm_dev;
1006 + ipp->drm_dev = drm_dev;
1007 +- exynos_drm_register_dma(drm_dev, dev);
1008 ++ exynos_drm_register_dma(drm_dev, dev, &scaler->dma_priv);
1009 +
1010 + exynos_drm_ipp_register(dev, ipp, &ipp_funcs,
1011 + DRM_EXYNOS_IPP_CAP_CROP | DRM_EXYNOS_IPP_CAP_ROTATE |
1012 +@@ -470,7 +471,8 @@ static void scaler_unbind(struct device *dev, struct device *master,
1013 + struct exynos_drm_ipp *ipp = &scaler->ipp;
1014 +
1015 + exynos_drm_ipp_unregister(dev, ipp);
1016 +- exynos_drm_unregister_dma(scaler->drm_dev, scaler->dev);
1017 ++ exynos_drm_unregister_dma(scaler->drm_dev, scaler->dev,
1018 ++ &scaler->dma_priv);
1019 + }
1020 +
1021 + static const struct component_ops scaler_component_ops = {
1022 +diff --git a/drivers/gpu/drm/exynos/exynos_mixer.c b/drivers/gpu/drm/exynos/exynos_mixer.c
1023 +index 6cfdb95fef2f..57e5e6057752 100644
1024 +--- a/drivers/gpu/drm/exynos/exynos_mixer.c
1025 ++++ b/drivers/gpu/drm/exynos/exynos_mixer.c
1026 +@@ -94,6 +94,7 @@ struct mixer_context {
1027 + struct platform_device *pdev;
1028 + struct device *dev;
1029 + struct drm_device *drm_dev;
1030 ++ void *dma_priv;
1031 + struct exynos_drm_crtc *crtc;
1032 + struct exynos_drm_plane planes[MIXER_WIN_NR];
1033 + unsigned long flags;
1034 +@@ -894,12 +895,14 @@ static int mixer_initialize(struct mixer_context *mixer_ctx,
1035 + }
1036 + }
1037 +
1038 +- return exynos_drm_register_dma(drm_dev, mixer_ctx->dev);
1039 ++ return exynos_drm_register_dma(drm_dev, mixer_ctx->dev,
1040 ++ &mixer_ctx->dma_priv);
1041 + }
1042 +
1043 + static void mixer_ctx_remove(struct mixer_context *mixer_ctx)
1044 + {
1045 +- exynos_drm_unregister_dma(mixer_ctx->drm_dev, mixer_ctx->dev);
1046 ++ exynos_drm_unregister_dma(mixer_ctx->drm_dev, mixer_ctx->dev,
1047 ++ &mixer_ctx->dma_priv);
1048 + }
1049 +
1050 + static int mixer_enable_vblank(struct exynos_drm_crtc *crtc)
1051 +diff --git a/drivers/gpu/drm/radeon/radeon_ttm.c b/drivers/gpu/drm/radeon/radeon_ttm.c
1052 +index 098bc9f40b98..ce822fd6f611 100644
1053 +--- a/drivers/gpu/drm/radeon/radeon_ttm.c
1054 ++++ b/drivers/gpu/drm/radeon/radeon_ttm.c
1055 +@@ -528,7 +528,7 @@ static int radeon_ttm_tt_pin_userptr(struct ttm_tt *ttm)
1056 +
1057 + r = -ENOMEM;
1058 + nents = dma_map_sg(rdev->dev, ttm->sg->sgl, ttm->sg->nents, direction);
1059 +- if (nents != ttm->sg->nents)
1060 ++ if (nents == 0)
1061 + goto release_sg;
1062 +
1063 + drm_prime_sg_to_page_addr_arrays(ttm->sg, ttm->pages,
1064 +diff --git a/drivers/i2c/busses/i2c-hix5hd2.c b/drivers/i2c/busses/i2c-hix5hd2.c
1065 +index 8497c7a95dd4..224f830f77f9 100644
1066 +--- a/drivers/i2c/busses/i2c-hix5hd2.c
1067 ++++ b/drivers/i2c/busses/i2c-hix5hd2.c
1068 +@@ -477,6 +477,7 @@ static int hix5hd2_i2c_remove(struct platform_device *pdev)
1069 + i2c_del_adapter(&priv->adap);
1070 + pm_runtime_disable(priv->dev);
1071 + pm_runtime_set_suspended(priv->dev);
1072 ++ clk_disable_unprepare(priv->clk);
1073 +
1074 + return 0;
1075 + }
1076 +diff --git a/drivers/i2c/busses/i2c-nvidia-gpu.c b/drivers/i2c/busses/i2c-nvidia-gpu.c
1077 +index 5a1235fd86bb..32cd62188a3d 100644
1078 +--- a/drivers/i2c/busses/i2c-nvidia-gpu.c
1079 ++++ b/drivers/i2c/busses/i2c-nvidia-gpu.c
1080 +@@ -8,6 +8,7 @@
1081 + #include <linux/delay.h>
1082 + #include <linux/i2c.h>
1083 + #include <linux/interrupt.h>
1084 ++#include <linux/iopoll.h>
1085 + #include <linux/module.h>
1086 + #include <linux/pci.h>
1087 + #include <linux/platform_device.h>
1088 +@@ -75,20 +76,15 @@ static void gpu_enable_i2c_bus(struct gpu_i2c_dev *i2cd)
1089 +
1090 + static int gpu_i2c_check_status(struct gpu_i2c_dev *i2cd)
1091 + {
1092 +- unsigned long target = jiffies + msecs_to_jiffies(1000);
1093 + u32 val;
1094 ++ int ret;
1095 +
1096 +- do {
1097 +- val = readl(i2cd->regs + I2C_MST_CNTL);
1098 +- if (!(val & I2C_MST_CNTL_CYCLE_TRIGGER))
1099 +- break;
1100 +- if ((val & I2C_MST_CNTL_STATUS) !=
1101 +- I2C_MST_CNTL_STATUS_BUS_BUSY)
1102 +- break;
1103 +- usleep_range(500, 600);
1104 +- } while (time_is_after_jiffies(target));
1105 +-
1106 +- if (time_is_before_jiffies(target)) {
1107 ++ ret = readl_poll_timeout(i2cd->regs + I2C_MST_CNTL, val,
1108 ++ !(val & I2C_MST_CNTL_CYCLE_TRIGGER) ||
1109 ++ (val & I2C_MST_CNTL_STATUS) != I2C_MST_CNTL_STATUS_BUS_BUSY,
1110 ++ 500, 1000 * USEC_PER_MSEC);
1111 ++
1112 ++ if (ret) {
1113 + dev_err(i2cd->dev, "i2c timeout error %x\n", val);
1114 + return -ETIMEDOUT;
1115 + }
1116 +diff --git a/drivers/infiniband/core/device.c b/drivers/infiniband/core/device.c
1117 +index c38b2b0b078a..6463f3751a4b 100644
1118 +--- a/drivers/infiniband/core/device.c
1119 ++++ b/drivers/infiniband/core/device.c
1120 +@@ -896,7 +896,9 @@ static int add_one_compat_dev(struct ib_device *device,
1121 + cdev->dev.parent = device->dev.parent;
1122 + rdma_init_coredev(cdev, device, read_pnet(&rnet->net));
1123 + cdev->dev.release = compatdev_release;
1124 +- dev_set_name(&cdev->dev, "%s", dev_name(&device->dev));
1125 ++ ret = dev_set_name(&cdev->dev, "%s", dev_name(&device->dev));
1126 ++ if (ret)
1127 ++ goto add_err;
1128 +
1129 + ret = device_add(&cdev->dev);
1130 + if (ret)
1131 +diff --git a/drivers/infiniband/core/nldev.c b/drivers/infiniband/core/nldev.c
1132 +index ba76709897bb..42e9b5f41a40 100644
1133 +--- a/drivers/infiniband/core/nldev.c
1134 ++++ b/drivers/infiniband/core/nldev.c
1135 +@@ -917,6 +917,10 @@ static int nldev_set_doit(struct sk_buff *skb, struct nlmsghdr *nlh,
1136 +
1137 + nla_strlcpy(name, tb[RDMA_NLDEV_ATTR_DEV_NAME],
1138 + IB_DEVICE_NAME_MAX);
1139 ++ if (strlen(name) == 0) {
1140 ++ err = -EINVAL;
1141 ++ goto done;
1142 ++ }
1143 + err = ib_device_rename(device, name);
1144 + goto done;
1145 + }
1146 +@@ -1513,7 +1517,7 @@ static int nldev_newlink(struct sk_buff *skb, struct nlmsghdr *nlh,
1147 +
1148 + nla_strlcpy(ibdev_name, tb[RDMA_NLDEV_ATTR_DEV_NAME],
1149 + sizeof(ibdev_name));
1150 +- if (strchr(ibdev_name, '%'))
1151 ++ if (strchr(ibdev_name, '%') || strlen(ibdev_name) == 0)
1152 + return -EINVAL;
1153 +
1154 + nla_strlcpy(type, tb[RDMA_NLDEV_ATTR_LINK_TYPE], sizeof(type));
1155 +diff --git a/drivers/infiniband/core/security.c b/drivers/infiniband/core/security.c
1156 +index 2d5608315dc8..75e7ec017836 100644
1157 +--- a/drivers/infiniband/core/security.c
1158 ++++ b/drivers/infiniband/core/security.c
1159 +@@ -349,16 +349,11 @@ static struct ib_ports_pkeys *get_new_pps(const struct ib_qp *qp,
1160 + else if (qp_pps)
1161 + new_pps->main.pkey_index = qp_pps->main.pkey_index;
1162 +
1163 +- if ((qp_attr_mask & IB_QP_PKEY_INDEX) && (qp_attr_mask & IB_QP_PORT))
1164 ++ if (((qp_attr_mask & IB_QP_PKEY_INDEX) &&
1165 ++ (qp_attr_mask & IB_QP_PORT)) ||
1166 ++ (qp_pps && qp_pps->main.state != IB_PORT_PKEY_NOT_VALID))
1167 + new_pps->main.state = IB_PORT_PKEY_VALID;
1168 +
1169 +- if (!(qp_attr_mask & (IB_QP_PKEY_INDEX | IB_QP_PORT)) && qp_pps) {
1170 +- new_pps->main.port_num = qp_pps->main.port_num;
1171 +- new_pps->main.pkey_index = qp_pps->main.pkey_index;
1172 +- if (qp_pps->main.state != IB_PORT_PKEY_NOT_VALID)
1173 +- new_pps->main.state = IB_PORT_PKEY_VALID;
1174 +- }
1175 +-
1176 + if (qp_attr_mask & IB_QP_ALT_PATH) {
1177 + new_pps->alt.port_num = qp_attr->alt_port_num;
1178 + new_pps->alt.pkey_index = qp_attr->alt_pkey_index;
1179 +diff --git a/drivers/infiniband/core/umem_odp.c b/drivers/infiniband/core/umem_odp.c
1180 +index eb22cb4f26b4..74332fb7c435 100644
1181 +--- a/drivers/infiniband/core/umem_odp.c
1182 ++++ b/drivers/infiniband/core/umem_odp.c
1183 +@@ -290,8 +290,8 @@ void ib_umem_odp_release(struct ib_umem_odp *umem_odp)
1184 + mmu_interval_notifier_remove(&umem_odp->notifier);
1185 + kvfree(umem_odp->dma_list);
1186 + kvfree(umem_odp->page_list);
1187 +- put_pid(umem_odp->tgid);
1188 + }
1189 ++ put_pid(umem_odp->tgid);
1190 + kfree(umem_odp);
1191 + }
1192 + EXPORT_SYMBOL(ib_umem_odp_release);
1193 +diff --git a/drivers/infiniband/core/user_mad.c b/drivers/infiniband/core/user_mad.c
1194 +index 1235ffb2389b..da229eab5903 100644
1195 +--- a/drivers/infiniband/core/user_mad.c
1196 ++++ b/drivers/infiniband/core/user_mad.c
1197 +@@ -1129,17 +1129,30 @@ static const struct file_operations umad_sm_fops = {
1198 + .llseek = no_llseek,
1199 + };
1200 +
1201 ++static struct ib_umad_port *get_port(struct ib_device *ibdev,
1202 ++ struct ib_umad_device *umad_dev,
1203 ++ unsigned int port)
1204 ++{
1205 ++ if (!umad_dev)
1206 ++ return ERR_PTR(-EOPNOTSUPP);
1207 ++ if (!rdma_is_port_valid(ibdev, port))
1208 ++ return ERR_PTR(-EINVAL);
1209 ++ if (!rdma_cap_ib_mad(ibdev, port))
1210 ++ return ERR_PTR(-EOPNOTSUPP);
1211 ++
1212 ++ return &umad_dev->ports[port - rdma_start_port(ibdev)];
1213 ++}
1214 ++
1215 + static int ib_umad_get_nl_info(struct ib_device *ibdev, void *client_data,
1216 + struct ib_client_nl_info *res)
1217 + {
1218 +- struct ib_umad_device *umad_dev = client_data;
1219 ++ struct ib_umad_port *port = get_port(ibdev, client_data, res->port);
1220 +
1221 +- if (!rdma_is_port_valid(ibdev, res->port))
1222 +- return -EINVAL;
1223 ++ if (IS_ERR(port))
1224 ++ return PTR_ERR(port);
1225 +
1226 + res->abi = IB_USER_MAD_ABI_VERSION;
1227 +- res->cdev = &umad_dev->ports[res->port - rdma_start_port(ibdev)].dev;
1228 +-
1229 ++ res->cdev = &port->dev;
1230 + return 0;
1231 + }
1232 +
1233 +@@ -1154,15 +1167,13 @@ MODULE_ALIAS_RDMA_CLIENT("umad");
1234 + static int ib_issm_get_nl_info(struct ib_device *ibdev, void *client_data,
1235 + struct ib_client_nl_info *res)
1236 + {
1237 +- struct ib_umad_device *umad_dev =
1238 +- ib_get_client_data(ibdev, &umad_client);
1239 ++ struct ib_umad_port *port = get_port(ibdev, client_data, res->port);
1240 +
1241 +- if (!rdma_is_port_valid(ibdev, res->port))
1242 +- return -EINVAL;
1243 ++ if (IS_ERR(port))
1244 ++ return PTR_ERR(port);
1245 +
1246 + res->abi = IB_USER_MAD_ABI_VERSION;
1247 +- res->cdev = &umad_dev->ports[res->port - rdma_start_port(ibdev)].sm_dev;
1248 +-
1249 ++ res->cdev = &port->sm_dev;
1250 + return 0;
1251 + }
1252 +
1253 +diff --git a/drivers/infiniband/hw/mlx5/cq.c b/drivers/infiniband/hw/mlx5/cq.c
1254 +index dd8d24ee8e1d..2554e0c697ac 100644
1255 +--- a/drivers/infiniband/hw/mlx5/cq.c
1256 ++++ b/drivers/infiniband/hw/mlx5/cq.c
1257 +@@ -330,6 +330,22 @@ static void mlx5_handle_error_cqe(struct mlx5_ib_dev *dev,
1258 + dump_cqe(dev, cqe);
1259 + }
1260 +
1261 ++static void handle_atomics(struct mlx5_ib_qp *qp, struct mlx5_cqe64 *cqe64,
1262 ++ u16 tail, u16 head)
1263 ++{
1264 ++ u16 idx;
1265 ++
1266 ++ do {
1267 ++ idx = tail & (qp->sq.wqe_cnt - 1);
1268 ++ if (idx == head)
1269 ++ break;
1270 ++
1271 ++ tail = qp->sq.w_list[idx].next;
1272 ++ } while (1);
1273 ++ tail = qp->sq.w_list[idx].next;
1274 ++ qp->sq.last_poll = tail;
1275 ++}
1276 ++
1277 + static void free_cq_buf(struct mlx5_ib_dev *dev, struct mlx5_ib_cq_buf *buf)
1278 + {
1279 + mlx5_frag_buf_free(dev->mdev, &buf->frag_buf);
1280 +@@ -368,7 +384,7 @@ static void get_sig_err_item(struct mlx5_sig_err_cqe *cqe,
1281 + }
1282 +
1283 + static void sw_comp(struct mlx5_ib_qp *qp, int num_entries, struct ib_wc *wc,
1284 +- int *npolled, int is_send)
1285 ++ int *npolled, bool is_send)
1286 + {
1287 + struct mlx5_ib_wq *wq;
1288 + unsigned int cur;
1289 +@@ -383,10 +399,16 @@ static void sw_comp(struct mlx5_ib_qp *qp, int num_entries, struct ib_wc *wc,
1290 + return;
1291 +
1292 + for (i = 0; i < cur && np < num_entries; i++) {
1293 +- wc->wr_id = wq->wrid[wq->tail & (wq->wqe_cnt - 1)];
1294 ++ unsigned int idx;
1295 ++
1296 ++ idx = (is_send) ? wq->last_poll : wq->tail;
1297 ++ idx &= (wq->wqe_cnt - 1);
1298 ++ wc->wr_id = wq->wrid[idx];
1299 + wc->status = IB_WC_WR_FLUSH_ERR;
1300 + wc->vendor_err = MLX5_CQE_SYNDROME_WR_FLUSH_ERR;
1301 + wq->tail++;
1302 ++ if (is_send)
1303 ++ wq->last_poll = wq->w_list[idx].next;
1304 + np++;
1305 + wc->qp = &qp->ibqp;
1306 + wc++;
1307 +@@ -473,6 +495,7 @@ repoll:
1308 + wqe_ctr = be16_to_cpu(cqe64->wqe_counter);
1309 + idx = wqe_ctr & (wq->wqe_cnt - 1);
1310 + handle_good_req(wc, cqe64, wq, idx);
1311 ++ handle_atomics(*cur_qp, cqe64, wq->last_poll, idx);
1312 + wc->wr_id = wq->wrid[idx];
1313 + wq->tail = wq->wqe_head[idx] + 1;
1314 + wc->status = IB_WC_SUCCESS;
1315 +diff --git a/drivers/infiniband/hw/mlx5/main.c b/drivers/infiniband/hw/mlx5/main.c
1316 +index 760630c7aae7..f3c73dc40078 100644
1317 +--- a/drivers/infiniband/hw/mlx5/main.c
1318 ++++ b/drivers/infiniband/hw/mlx5/main.c
1319 +@@ -5666,9 +5666,10 @@ mlx5_ib_counter_alloc_stats(struct rdma_counter *counter)
1320 + const struct mlx5_ib_counters *cnts =
1321 + get_counters(dev, counter->port - 1);
1322 +
1323 +- /* Q counters are in the beginning of all counters */
1324 + return rdma_alloc_hw_stats_struct(cnts->names,
1325 +- cnts->num_q_counters,
1326 ++ cnts->num_q_counters +
1327 ++ cnts->num_cong_counters +
1328 ++ cnts->num_ext_ppcnt_counters,
1329 + RDMA_HW_STATS_DEFAULT_LIFESPAN);
1330 + }
1331 +
1332 +diff --git a/drivers/infiniband/hw/mlx5/mlx5_ib.h b/drivers/infiniband/hw/mlx5/mlx5_ib.h
1333 +index b3561e4c44e8..c2f639864094 100644
1334 +--- a/drivers/infiniband/hw/mlx5/mlx5_ib.h
1335 ++++ b/drivers/infiniband/hw/mlx5/mlx5_ib.h
1336 +@@ -282,6 +282,7 @@ struct mlx5_ib_wq {
1337 + unsigned head;
1338 + unsigned tail;
1339 + u16 cur_post;
1340 ++ u16 last_poll;
1341 + void *cur_edge;
1342 + };
1343 +
1344 +diff --git a/drivers/infiniband/hw/mlx5/qp.c b/drivers/infiniband/hw/mlx5/qp.c
1345 +index 89ba2f6cd815..c8fca27a1ff4 100644
1346 +--- a/drivers/infiniband/hw/mlx5/qp.c
1347 ++++ b/drivers/infiniband/hw/mlx5/qp.c
1348 +@@ -3728,6 +3728,7 @@ static int __mlx5_ib_modify_qp(struct ib_qp *ibqp,
1349 + qp->sq.cur_post = 0;
1350 + if (qp->sq.wqe_cnt)
1351 + qp->sq.cur_edge = get_sq_edge(&qp->sq, 0);
1352 ++ qp->sq.last_poll = 0;
1353 + qp->db.db[MLX5_RCV_DBR] = 0;
1354 + qp->db.db[MLX5_SND_DBR] = 0;
1355 + }
1356 +@@ -6157,6 +6158,10 @@ struct ib_wq *mlx5_ib_create_wq(struct ib_pd *pd,
1357 + if (udata->outlen && udata->outlen < min_resp_len)
1358 + return ERR_PTR(-EINVAL);
1359 +
1360 ++ if (!capable(CAP_SYS_RAWIO) &&
1361 ++ init_attr->create_flags & IB_WQ_FLAGS_DELAY_DROP)
1362 ++ return ERR_PTR(-EPERM);
1363 ++
1364 + dev = to_mdev(pd->device);
1365 + switch (init_attr->wq_type) {
1366 + case IB_WQT_RQ:
1367 +diff --git a/drivers/infiniband/sw/rdmavt/cq.c b/drivers/infiniband/sw/rdmavt/cq.c
1368 +index 13d7f66eadab..5724cbbe38b1 100644
1369 +--- a/drivers/infiniband/sw/rdmavt/cq.c
1370 ++++ b/drivers/infiniband/sw/rdmavt/cq.c
1371 +@@ -327,7 +327,7 @@ void rvt_destroy_cq(struct ib_cq *ibcq, struct ib_udata *udata)
1372 + if (cq->ip)
1373 + kref_put(&cq->ip->ref, rvt_release_mmap_info);
1374 + else
1375 +- vfree(cq->queue);
1376 ++ vfree(cq->kqueue);
1377 + }
1378 +
1379 + /**
1380 +diff --git a/drivers/input/input.c b/drivers/input/input.c
1381 +index ee6c3234df36..e2eb9b9b8363 100644
1382 +--- a/drivers/input/input.c
1383 ++++ b/drivers/input/input.c
1384 +@@ -190,6 +190,7 @@ static void input_repeat_key(struct timer_list *t)
1385 + input_value_sync
1386 + };
1387 +
1388 ++ input_set_timestamp(dev, ktime_get());
1389 + input_pass_values(dev, vals, ARRAY_SIZE(vals));
1390 +
1391 + if (dev->rep[REP_PERIOD])
1392 +diff --git a/drivers/input/mouse/synaptics.c b/drivers/input/mouse/synaptics.c
1393 +index 2c666fb34625..4d2036209b45 100644
1394 +--- a/drivers/input/mouse/synaptics.c
1395 ++++ b/drivers/input/mouse/synaptics.c
1396 +@@ -186,6 +186,7 @@ static const char * const smbus_pnp_ids[] = {
1397 + "SYN3052", /* HP EliteBook 840 G4 */
1398 + "SYN3221", /* HP 15-ay000 */
1399 + "SYN323d", /* HP Spectre X360 13-w013dx */
1400 ++ "SYN3257", /* HP Envy 13-ad105ng */
1401 + NULL
1402 + };
1403 +
1404 +diff --git a/drivers/input/touchscreen/raydium_i2c_ts.c b/drivers/input/touchscreen/raydium_i2c_ts.c
1405 +index 6ed9f22e6401..fe245439adee 100644
1406 +--- a/drivers/input/touchscreen/raydium_i2c_ts.c
1407 ++++ b/drivers/input/touchscreen/raydium_i2c_ts.c
1408 +@@ -432,7 +432,7 @@ static int raydium_i2c_write_object(struct i2c_client *client,
1409 + return 0;
1410 + }
1411 +
1412 +-static bool raydium_i2c_boot_trigger(struct i2c_client *client)
1413 ++static int raydium_i2c_boot_trigger(struct i2c_client *client)
1414 + {
1415 + static const u8 cmd[7][6] = {
1416 + { 0x08, 0x0C, 0x09, 0x00, 0x50, 0xD7 },
1417 +@@ -457,10 +457,10 @@ static bool raydium_i2c_boot_trigger(struct i2c_client *client)
1418 + }
1419 + }
1420 +
1421 +- return false;
1422 ++ return 0;
1423 + }
1424 +
1425 +-static bool raydium_i2c_fw_trigger(struct i2c_client *client)
1426 ++static int raydium_i2c_fw_trigger(struct i2c_client *client)
1427 + {
1428 + static const u8 cmd[5][11] = {
1429 + { 0, 0x09, 0x71, 0x0C, 0x09, 0x00, 0x50, 0xD7, 0, 0, 0 },
1430 +@@ -483,7 +483,7 @@ static bool raydium_i2c_fw_trigger(struct i2c_client *client)
1431 + }
1432 + }
1433 +
1434 +- return false;
1435 ++ return 0;
1436 + }
1437 +
1438 + static int raydium_i2c_check_path(struct i2c_client *client)
1439 +diff --git a/drivers/iommu/dmar.c b/drivers/iommu/dmar.c
1440 +index 93f8e646cb0b..f7a86652a984 100644
1441 +--- a/drivers/iommu/dmar.c
1442 ++++ b/drivers/iommu/dmar.c
1443 +@@ -371,7 +371,8 @@ dmar_find_dmaru(struct acpi_dmar_hardware_unit *drhd)
1444 + {
1445 + struct dmar_drhd_unit *dmaru;
1446 +
1447 +- list_for_each_entry_rcu(dmaru, &dmar_drhd_units, list)
1448 ++ list_for_each_entry_rcu(dmaru, &dmar_drhd_units, list,
1449 ++ dmar_rcu_check())
1450 + if (dmaru->segment == drhd->segment &&
1451 + dmaru->reg_base_addr == drhd->address)
1452 + return dmaru;
1453 +diff --git a/drivers/iommu/intel-iommu-debugfs.c b/drivers/iommu/intel-iommu-debugfs.c
1454 +index 471f05d452e0..bdf095e9dbe0 100644
1455 +--- a/drivers/iommu/intel-iommu-debugfs.c
1456 ++++ b/drivers/iommu/intel-iommu-debugfs.c
1457 +@@ -32,38 +32,42 @@ struct iommu_regset {
1458 +
1459 + #define IOMMU_REGSET_ENTRY(_reg_) \
1460 + { DMAR_##_reg_##_REG, __stringify(_reg_) }
1461 +-static const struct iommu_regset iommu_regs[] = {
1462 ++
1463 ++static const struct iommu_regset iommu_regs_32[] = {
1464 + IOMMU_REGSET_ENTRY(VER),
1465 +- IOMMU_REGSET_ENTRY(CAP),
1466 +- IOMMU_REGSET_ENTRY(ECAP),
1467 + IOMMU_REGSET_ENTRY(GCMD),
1468 + IOMMU_REGSET_ENTRY(GSTS),
1469 +- IOMMU_REGSET_ENTRY(RTADDR),
1470 +- IOMMU_REGSET_ENTRY(CCMD),
1471 + IOMMU_REGSET_ENTRY(FSTS),
1472 + IOMMU_REGSET_ENTRY(FECTL),
1473 + IOMMU_REGSET_ENTRY(FEDATA),
1474 + IOMMU_REGSET_ENTRY(FEADDR),
1475 + IOMMU_REGSET_ENTRY(FEUADDR),
1476 +- IOMMU_REGSET_ENTRY(AFLOG),
1477 + IOMMU_REGSET_ENTRY(PMEN),
1478 + IOMMU_REGSET_ENTRY(PLMBASE),
1479 + IOMMU_REGSET_ENTRY(PLMLIMIT),
1480 ++ IOMMU_REGSET_ENTRY(ICS),
1481 ++ IOMMU_REGSET_ENTRY(PRS),
1482 ++ IOMMU_REGSET_ENTRY(PECTL),
1483 ++ IOMMU_REGSET_ENTRY(PEDATA),
1484 ++ IOMMU_REGSET_ENTRY(PEADDR),
1485 ++ IOMMU_REGSET_ENTRY(PEUADDR),
1486 ++};
1487 ++
1488 ++static const struct iommu_regset iommu_regs_64[] = {
1489 ++ IOMMU_REGSET_ENTRY(CAP),
1490 ++ IOMMU_REGSET_ENTRY(ECAP),
1491 ++ IOMMU_REGSET_ENTRY(RTADDR),
1492 ++ IOMMU_REGSET_ENTRY(CCMD),
1493 ++ IOMMU_REGSET_ENTRY(AFLOG),
1494 + IOMMU_REGSET_ENTRY(PHMBASE),
1495 + IOMMU_REGSET_ENTRY(PHMLIMIT),
1496 + IOMMU_REGSET_ENTRY(IQH),
1497 + IOMMU_REGSET_ENTRY(IQT),
1498 + IOMMU_REGSET_ENTRY(IQA),
1499 +- IOMMU_REGSET_ENTRY(ICS),
1500 + IOMMU_REGSET_ENTRY(IRTA),
1501 + IOMMU_REGSET_ENTRY(PQH),
1502 + IOMMU_REGSET_ENTRY(PQT),
1503 + IOMMU_REGSET_ENTRY(PQA),
1504 +- IOMMU_REGSET_ENTRY(PRS),
1505 +- IOMMU_REGSET_ENTRY(PECTL),
1506 +- IOMMU_REGSET_ENTRY(PEDATA),
1507 +- IOMMU_REGSET_ENTRY(PEADDR),
1508 +- IOMMU_REGSET_ENTRY(PEUADDR),
1509 + IOMMU_REGSET_ENTRY(MTRRCAP),
1510 + IOMMU_REGSET_ENTRY(MTRRDEF),
1511 + IOMMU_REGSET_ENTRY(MTRR_FIX64K_00000),
1512 +@@ -126,10 +130,16 @@ static int iommu_regset_show(struct seq_file *m, void *unused)
1513 + * by adding the offset to the pointer (virtual address).
1514 + */
1515 + raw_spin_lock_irqsave(&iommu->register_lock, flag);
1516 +- for (i = 0 ; i < ARRAY_SIZE(iommu_regs); i++) {
1517 +- value = dmar_readq(iommu->reg + iommu_regs[i].offset);
1518 ++ for (i = 0 ; i < ARRAY_SIZE(iommu_regs_32); i++) {
1519 ++ value = dmar_readl(iommu->reg + iommu_regs_32[i].offset);
1520 ++ seq_printf(m, "%-16s\t0x%02x\t\t0x%016llx\n",
1521 ++ iommu_regs_32[i].regs, iommu_regs_32[i].offset,
1522 ++ value);
1523 ++ }
1524 ++ for (i = 0 ; i < ARRAY_SIZE(iommu_regs_64); i++) {
1525 ++ value = dmar_readq(iommu->reg + iommu_regs_64[i].offset);
1526 + seq_printf(m, "%-16s\t0x%02x\t\t0x%016llx\n",
1527 +- iommu_regs[i].regs, iommu_regs[i].offset,
1528 ++ iommu_regs_64[i].regs, iommu_regs_64[i].offset,
1529 + value);
1530 + }
1531 + raw_spin_unlock_irqrestore(&iommu->register_lock, flag);
1532 +@@ -271,9 +281,16 @@ static int dmar_translation_struct_show(struct seq_file *m, void *unused)
1533 + {
1534 + struct dmar_drhd_unit *drhd;
1535 + struct intel_iommu *iommu;
1536 ++ u32 sts;
1537 +
1538 + rcu_read_lock();
1539 + for_each_active_iommu(iommu, drhd) {
1540 ++ sts = dmar_readl(iommu->reg + DMAR_GSTS_REG);
1541 ++ if (!(sts & DMA_GSTS_TES)) {
1542 ++ seq_printf(m, "DMA Remapping is not enabled on %s\n",
1543 ++ iommu->name);
1544 ++ continue;
1545 ++ }
1546 + root_tbl_walk(m, iommu);
1547 + seq_putc(m, '\n');
1548 + }
1549 +@@ -343,6 +360,7 @@ static int ir_translation_struct_show(struct seq_file *m, void *unused)
1550 + struct dmar_drhd_unit *drhd;
1551 + struct intel_iommu *iommu;
1552 + u64 irta;
1553 ++ u32 sts;
1554 +
1555 + rcu_read_lock();
1556 + for_each_active_iommu(iommu, drhd) {
1557 +@@ -352,7 +370,8 @@ static int ir_translation_struct_show(struct seq_file *m, void *unused)
1558 + seq_printf(m, "Remapped Interrupt supported on IOMMU: %s\n",
1559 + iommu->name);
1560 +
1561 +- if (iommu->ir_table) {
1562 ++ sts = dmar_readl(iommu->reg + DMAR_GSTS_REG);
1563 ++ if (iommu->ir_table && (sts & DMA_GSTS_IRES)) {
1564 + irta = virt_to_phys(iommu->ir_table->base);
1565 + seq_printf(m, " IR table address:%llx\n", irta);
1566 + ir_tbl_remap_entry_show(m, iommu);
1567 +diff --git a/drivers/iommu/intel-iommu.c b/drivers/iommu/intel-iommu.c
1568 +index 10176d8ea3e6..7f31775e9b55 100644
1569 +--- a/drivers/iommu/intel-iommu.c
1570 ++++ b/drivers/iommu/intel-iommu.c
1571 +@@ -5005,6 +5005,9 @@ int __init intel_iommu_init(void)
1572 +
1573 + down_write(&dmar_global_lock);
1574 +
1575 ++ if (!no_iommu)
1576 ++ intel_iommu_debugfs_init();
1577 ++
1578 + if (no_iommu || dmar_disabled) {
1579 + /*
1580 + * We exit the function here to ensure IOMMU's remapping and
1581 +@@ -5100,7 +5103,6 @@ int __init intel_iommu_init(void)
1582 + pr_info("Intel(R) Virtualization Technology for Directed I/O\n");
1583 +
1584 + intel_iommu_enabled = 1;
1585 +- intel_iommu_debugfs_init();
1586 +
1587 + return 0;
1588 +
1589 +diff --git a/drivers/media/usb/b2c2/flexcop-usb.c b/drivers/media/usb/b2c2/flexcop-usb.c
1590 +index 039963a7765b..198ddfb8d2b1 100644
1591 +--- a/drivers/media/usb/b2c2/flexcop-usb.c
1592 ++++ b/drivers/media/usb/b2c2/flexcop-usb.c
1593 +@@ -511,6 +511,9 @@ static int flexcop_usb_init(struct flexcop_usb *fc_usb)
1594 + return ret;
1595 + }
1596 +
1597 ++ if (fc_usb->uintf->cur_altsetting->desc.bNumEndpoints < 1)
1598 ++ return -ENODEV;
1599 ++
1600 + switch (fc_usb->udev->speed) {
1601 + case USB_SPEED_LOW:
1602 + err("cannot handle USB speed because it is too slow.");
1603 +@@ -544,9 +547,6 @@ static int flexcop_usb_probe(struct usb_interface *intf,
1604 + struct flexcop_device *fc = NULL;
1605 + int ret;
1606 +
1607 +- if (intf->cur_altsetting->desc.bNumEndpoints < 1)
1608 +- return -ENODEV;
1609 +-
1610 + if ((fc = flexcop_device_kmalloc(sizeof(struct flexcop_usb))) == NULL) {
1611 + err("out of memory\n");
1612 + return -ENOMEM;
1613 +diff --git a/drivers/media/usb/dvb-usb/dib0700_core.c b/drivers/media/usb/dvb-usb/dib0700_core.c
1614 +index e53c58ab6488..ef62dd6c5ae4 100644
1615 +--- a/drivers/media/usb/dvb-usb/dib0700_core.c
1616 ++++ b/drivers/media/usb/dvb-usb/dib0700_core.c
1617 +@@ -818,7 +818,7 @@ int dib0700_rc_setup(struct dvb_usb_device *d, struct usb_interface *intf)
1618 +
1619 + /* Starting in firmware 1.20, the RC info is provided on a bulk pipe */
1620 +
1621 +- if (intf->altsetting[0].desc.bNumEndpoints < rc_ep + 1)
1622 ++ if (intf->cur_altsetting->desc.bNumEndpoints < rc_ep + 1)
1623 + return -ENODEV;
1624 +
1625 + purb = usb_alloc_urb(0, GFP_KERNEL);
1626 +@@ -838,7 +838,7 @@ int dib0700_rc_setup(struct dvb_usb_device *d, struct usb_interface *intf)
1627 + * Some devices like the Hauppauge NovaTD model 52009 use an interrupt
1628 + * endpoint, while others use a bulk one.
1629 + */
1630 +- e = &intf->altsetting[0].endpoint[rc_ep].desc;
1631 ++ e = &intf->cur_altsetting->endpoint[rc_ep].desc;
1632 + if (usb_endpoint_dir_in(e)) {
1633 + if (usb_endpoint_xfer_bulk(e)) {
1634 + pipe = usb_rcvbulkpipe(d->udev, rc_ep);
1635 +diff --git a/drivers/media/usb/gspca/ov519.c b/drivers/media/usb/gspca/ov519.c
1636 +index f417dfc0b872..0afe70a3f9a2 100644
1637 +--- a/drivers/media/usb/gspca/ov519.c
1638 ++++ b/drivers/media/usb/gspca/ov519.c
1639 +@@ -3477,6 +3477,11 @@ static void ov511_mode_init_regs(struct sd *sd)
1640 + return;
1641 + }
1642 +
1643 ++ if (alt->desc.bNumEndpoints < 1) {
1644 ++ sd->gspca_dev.usb_err = -ENODEV;
1645 ++ return;
1646 ++ }
1647 ++
1648 + packet_size = le16_to_cpu(alt->endpoint[0].desc.wMaxPacketSize);
1649 + reg_w(sd, R51x_FIFO_PSIZE, packet_size >> 5);
1650 +
1651 +@@ -3603,6 +3608,11 @@ static void ov518_mode_init_regs(struct sd *sd)
1652 + return;
1653 + }
1654 +
1655 ++ if (alt->desc.bNumEndpoints < 1) {
1656 ++ sd->gspca_dev.usb_err = -ENODEV;
1657 ++ return;
1658 ++ }
1659 ++
1660 + packet_size = le16_to_cpu(alt->endpoint[0].desc.wMaxPacketSize);
1661 + ov518_reg_w32(sd, R51x_FIFO_PSIZE, packet_size & ~7, 2);
1662 +
1663 +diff --git a/drivers/media/usb/gspca/stv06xx/stv06xx.c b/drivers/media/usb/gspca/stv06xx/stv06xx.c
1664 +index 79653d409951..95673fc0a99c 100644
1665 +--- a/drivers/media/usb/gspca/stv06xx/stv06xx.c
1666 ++++ b/drivers/media/usb/gspca/stv06xx/stv06xx.c
1667 +@@ -282,6 +282,9 @@ static int stv06xx_start(struct gspca_dev *gspca_dev)
1668 + return -EIO;
1669 + }
1670 +
1671 ++ if (alt->desc.bNumEndpoints < 1)
1672 ++ return -ENODEV;
1673 ++
1674 + packet_size = le16_to_cpu(alt->endpoint[0].desc.wMaxPacketSize);
1675 + err = stv06xx_write_bridge(sd, STV_ISO_SIZE_L, packet_size);
1676 + if (err < 0)
1677 +@@ -306,11 +309,21 @@ out:
1678 +
1679 + static int stv06xx_isoc_init(struct gspca_dev *gspca_dev)
1680 + {
1681 ++ struct usb_interface_cache *intfc;
1682 + struct usb_host_interface *alt;
1683 + struct sd *sd = (struct sd *) gspca_dev;
1684 +
1685 ++ intfc = gspca_dev->dev->actconfig->intf_cache[0];
1686 ++
1687 ++ if (intfc->num_altsetting < 2)
1688 ++ return -ENODEV;
1689 ++
1690 ++ alt = &intfc->altsetting[1];
1691 ++
1692 ++ if (alt->desc.bNumEndpoints < 1)
1693 ++ return -ENODEV;
1694 ++
1695 + /* Start isoc bandwidth "negotiation" at max isoc bandwidth */
1696 +- alt = &gspca_dev->dev->actconfig->intf_cache[0]->altsetting[1];
1697 + alt->endpoint[0].desc.wMaxPacketSize =
1698 + cpu_to_le16(sd->sensor->max_packet_size[gspca_dev->curr_mode]);
1699 +
1700 +@@ -323,6 +336,10 @@ static int stv06xx_isoc_nego(struct gspca_dev *gspca_dev)
1701 + struct usb_host_interface *alt;
1702 + struct sd *sd = (struct sd *) gspca_dev;
1703 +
1704 ++ /*
1705 ++ * Existence of altsetting and endpoint was verified in
1706 ++ * stv06xx_isoc_init()
1707 ++ */
1708 + alt = &gspca_dev->dev->actconfig->intf_cache[0]->altsetting[1];
1709 + packet_size = le16_to_cpu(alt->endpoint[0].desc.wMaxPacketSize);
1710 + min_packet_size = sd->sensor->min_packet_size[gspca_dev->curr_mode];
1711 +diff --git a/drivers/media/usb/gspca/stv06xx/stv06xx_pb0100.c b/drivers/media/usb/gspca/stv06xx/stv06xx_pb0100.c
1712 +index 6d1007715ff7..ae382b3b5f7f 100644
1713 +--- a/drivers/media/usb/gspca/stv06xx/stv06xx_pb0100.c
1714 ++++ b/drivers/media/usb/gspca/stv06xx/stv06xx_pb0100.c
1715 +@@ -185,6 +185,10 @@ static int pb0100_start(struct sd *sd)
1716 + alt = usb_altnum_to_altsetting(intf, sd->gspca_dev.alt);
1717 + if (!alt)
1718 + return -ENODEV;
1719 ++
1720 ++ if (alt->desc.bNumEndpoints < 1)
1721 ++ return -ENODEV;
1722 ++
1723 + packet_size = le16_to_cpu(alt->endpoint[0].desc.wMaxPacketSize);
1724 +
1725 + /* If we don't have enough bandwidth use a lower framerate */
1726 +diff --git a/drivers/media/usb/gspca/xirlink_cit.c b/drivers/media/usb/gspca/xirlink_cit.c
1727 +index 934a90bd78c2..c579b100f066 100644
1728 +--- a/drivers/media/usb/gspca/xirlink_cit.c
1729 ++++ b/drivers/media/usb/gspca/xirlink_cit.c
1730 +@@ -1442,6 +1442,9 @@ static int cit_get_packet_size(struct gspca_dev *gspca_dev)
1731 + return -EIO;
1732 + }
1733 +
1734 ++ if (alt->desc.bNumEndpoints < 1)
1735 ++ return -ENODEV;
1736 ++
1737 + return le16_to_cpu(alt->endpoint[0].desc.wMaxPacketSize);
1738 + }
1739 +
1740 +@@ -2626,6 +2629,7 @@ static int sd_start(struct gspca_dev *gspca_dev)
1741 +
1742 + static int sd_isoc_init(struct gspca_dev *gspca_dev)
1743 + {
1744 ++ struct usb_interface_cache *intfc;
1745 + struct usb_host_interface *alt;
1746 + int max_packet_size;
1747 +
1748 +@@ -2641,8 +2645,17 @@ static int sd_isoc_init(struct gspca_dev *gspca_dev)
1749 + break;
1750 + }
1751 +
1752 ++ intfc = gspca_dev->dev->actconfig->intf_cache[0];
1753 ++
1754 ++ if (intfc->num_altsetting < 2)
1755 ++ return -ENODEV;
1756 ++
1757 ++ alt = &intfc->altsetting[1];
1758 ++
1759 ++ if (alt->desc.bNumEndpoints < 1)
1760 ++ return -ENODEV;
1761 ++
1762 + /* Start isoc bandwidth "negotiation" at max isoc bandwidth */
1763 +- alt = &gspca_dev->dev->actconfig->intf_cache[0]->altsetting[1];
1764 + alt->endpoint[0].desc.wMaxPacketSize = cpu_to_le16(max_packet_size);
1765 +
1766 + return 0;
1767 +@@ -2665,6 +2678,9 @@ static int sd_isoc_nego(struct gspca_dev *gspca_dev)
1768 + break;
1769 + }
1770 +
1771 ++ /*
1772 ++ * Existence of altsetting and endpoint was verified in sd_isoc_init()
1773 ++ */
1774 + alt = &gspca_dev->dev->actconfig->intf_cache[0]->altsetting[1];
1775 + packet_size = le16_to_cpu(alt->endpoint[0].desc.wMaxPacketSize);
1776 + if (packet_size <= min_packet_size)
1777 +diff --git a/drivers/media/usb/usbtv/usbtv-core.c b/drivers/media/usb/usbtv/usbtv-core.c
1778 +index 5095c380b2c1..ee9c656d121f 100644
1779 +--- a/drivers/media/usb/usbtv/usbtv-core.c
1780 ++++ b/drivers/media/usb/usbtv/usbtv-core.c
1781 +@@ -56,7 +56,7 @@ int usbtv_set_regs(struct usbtv *usbtv, const u16 regs[][2], int size)
1782 +
1783 + ret = usb_control_msg(usbtv->udev, pipe, USBTV_REQUEST_REG,
1784 + USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_DEVICE,
1785 +- value, index, NULL, 0, 0);
1786 ++ value, index, NULL, 0, USB_CTRL_GET_TIMEOUT);
1787 + if (ret < 0)
1788 + return ret;
1789 + }
1790 +diff --git a/drivers/media/usb/usbtv/usbtv-video.c b/drivers/media/usb/usbtv/usbtv-video.c
1791 +index 3d9284a09ee5..b249f037900c 100644
1792 +--- a/drivers/media/usb/usbtv/usbtv-video.c
1793 ++++ b/drivers/media/usb/usbtv/usbtv-video.c
1794 +@@ -800,7 +800,8 @@ static int usbtv_s_ctrl(struct v4l2_ctrl *ctrl)
1795 + ret = usb_control_msg(usbtv->udev,
1796 + usb_rcvctrlpipe(usbtv->udev, 0), USBTV_CONTROL_REG,
1797 + USB_DIR_IN | USB_TYPE_VENDOR | USB_RECIP_DEVICE,
1798 +- 0, USBTV_BASE + 0x0244, (void *)data, 3, 0);
1799 ++ 0, USBTV_BASE + 0x0244, (void *)data, 3,
1800 ++ USB_CTRL_GET_TIMEOUT);
1801 + if (ret < 0)
1802 + goto error;
1803 + }
1804 +@@ -851,7 +852,7 @@ static int usbtv_s_ctrl(struct v4l2_ctrl *ctrl)
1805 + ret = usb_control_msg(usbtv->udev, usb_sndctrlpipe(usbtv->udev, 0),
1806 + USBTV_CONTROL_REG,
1807 + USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_DEVICE,
1808 +- 0, index, (void *)data, size, 0);
1809 ++ 0, index, (void *)data, size, USB_CTRL_SET_TIMEOUT);
1810 +
1811 + error:
1812 + if (ret < 0)
1813 +diff --git a/drivers/media/v4l2-core/v4l2-device.c b/drivers/media/v4l2-core/v4l2-device.c
1814 +index 63d6b147b21e..41da73ce2e98 100644
1815 +--- a/drivers/media/v4l2-core/v4l2-device.c
1816 ++++ b/drivers/media/v4l2-core/v4l2-device.c
1817 +@@ -179,6 +179,7 @@ static void v4l2_subdev_release(struct v4l2_subdev *sd)
1818 +
1819 + if (sd->internal_ops && sd->internal_ops->release)
1820 + sd->internal_ops->release(sd);
1821 ++ sd->devnode = NULL;
1822 + module_put(owner);
1823 + }
1824 +
1825 +diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c
1826 +index abf8f5eb0a1c..26644b7ec13e 100644
1827 +--- a/drivers/mmc/core/core.c
1828 ++++ b/drivers/mmc/core/core.c
1829 +@@ -1732,8 +1732,11 @@ static int mmc_do_erase(struct mmc_card *card, unsigned int from,
1830 + * the erase operation does not exceed the max_busy_timeout, we should
1831 + * use R1B response. Or we need to prevent the host from doing hw busy
1832 + * detection, which is done by converting to a R1 response instead.
1833 ++ * Note, some hosts requires R1B, which also means they are on their own
1834 ++ * when it comes to deal with the busy timeout.
1835 + */
1836 +- if (card->host->max_busy_timeout &&
1837 ++ if (!(card->host->caps & MMC_CAP_NEED_RSP_BUSY) &&
1838 ++ card->host->max_busy_timeout &&
1839 + busy_timeout > card->host->max_busy_timeout) {
1840 + cmd.flags = MMC_RSP_SPI_R1 | MMC_RSP_R1 | MMC_CMD_AC;
1841 + } else {
1842 +diff --git a/drivers/mmc/core/mmc.c b/drivers/mmc/core/mmc.c
1843 +index f6912ded652d..de14b5845f52 100644
1844 +--- a/drivers/mmc/core/mmc.c
1845 ++++ b/drivers/mmc/core/mmc.c
1846 +@@ -1910,9 +1910,12 @@ static int mmc_sleep(struct mmc_host *host)
1847 + * If the max_busy_timeout of the host is specified, validate it against
1848 + * the sleep cmd timeout. A failure means we need to prevent the host
1849 + * from doing hw busy detection, which is done by converting to a R1
1850 +- * response instead of a R1B.
1851 ++ * response instead of a R1B. Note, some hosts requires R1B, which also
1852 ++ * means they are on their own when it comes to deal with the busy
1853 ++ * timeout.
1854 + */
1855 +- if (host->max_busy_timeout && (timeout_ms > host->max_busy_timeout)) {
1856 ++ if (!(host->caps & MMC_CAP_NEED_RSP_BUSY) && host->max_busy_timeout &&
1857 ++ (timeout_ms > host->max_busy_timeout)) {
1858 + cmd.flags = MMC_RSP_R1 | MMC_CMD_AC;
1859 + } else {
1860 + cmd.flags = MMC_RSP_R1B | MMC_CMD_AC;
1861 +diff --git a/drivers/mmc/core/mmc_ops.c b/drivers/mmc/core/mmc_ops.c
1862 +index 09113b9ad679..18a7afb2a5b2 100644
1863 +--- a/drivers/mmc/core/mmc_ops.c
1864 ++++ b/drivers/mmc/core/mmc_ops.c
1865 +@@ -538,10 +538,12 @@ int __mmc_switch(struct mmc_card *card, u8 set, u8 index, u8 value,
1866 + * If the cmd timeout and the max_busy_timeout of the host are both
1867 + * specified, let's validate them. A failure means we need to prevent
1868 + * the host from doing hw busy detection, which is done by converting
1869 +- * to a R1 response instead of a R1B.
1870 ++ * to a R1 response instead of a R1B. Note, some hosts requires R1B,
1871 ++ * which also means they are on their own when it comes to deal with the
1872 ++ * busy timeout.
1873 + */
1874 +- if (timeout_ms && host->max_busy_timeout &&
1875 +- (timeout_ms > host->max_busy_timeout))
1876 ++ if (!(host->caps & MMC_CAP_NEED_RSP_BUSY) && timeout_ms &&
1877 ++ host->max_busy_timeout && (timeout_ms > host->max_busy_timeout))
1878 + use_r1b_resp = false;
1879 +
1880 + cmd.opcode = MMC_SWITCH;
1881 +diff --git a/drivers/mmc/host/sdhci-omap.c b/drivers/mmc/host/sdhci-omap.c
1882 +index 083e7e053c95..d3135249b2e4 100644
1883 +--- a/drivers/mmc/host/sdhci-omap.c
1884 ++++ b/drivers/mmc/host/sdhci-omap.c
1885 +@@ -1134,6 +1134,9 @@ static int sdhci_omap_probe(struct platform_device *pdev)
1886 + host->mmc_host_ops.execute_tuning = sdhci_omap_execute_tuning;
1887 + host->mmc_host_ops.enable_sdio_irq = sdhci_omap_enable_sdio_irq;
1888 +
1889 ++ /* R1B responses is required to properly manage HW busy detection. */
1890 ++ mmc->caps |= MMC_CAP_NEED_RSP_BUSY;
1891 ++
1892 + ret = sdhci_setup_host(host);
1893 + if (ret)
1894 + goto err_put_sync;
1895 +diff --git a/drivers/mmc/host/sdhci-tegra.c b/drivers/mmc/host/sdhci-tegra.c
1896 +index 403ac44a7378..a25c3a4d3f6c 100644
1897 +--- a/drivers/mmc/host/sdhci-tegra.c
1898 ++++ b/drivers/mmc/host/sdhci-tegra.c
1899 +@@ -1552,6 +1552,9 @@ static int sdhci_tegra_probe(struct platform_device *pdev)
1900 + if (tegra_host->soc_data->nvquirks & NVQUIRK_ENABLE_DDR50)
1901 + host->mmc->caps |= MMC_CAP_1_8V_DDR;
1902 +
1903 ++ /* R1B responses is required to properly manage HW busy detection. */
1904 ++ host->mmc->caps |= MMC_CAP_NEED_RSP_BUSY;
1905 ++
1906 + tegra_sdhci_parse_dt(host);
1907 +
1908 + tegra_host->power_gpio = devm_gpiod_get_optional(&pdev->dev, "power",
1909 +diff --git a/drivers/net/Kconfig b/drivers/net/Kconfig
1910 +index d02f12a5254e..e148bbd9e783 100644
1911 +--- a/drivers/net/Kconfig
1912 ++++ b/drivers/net/Kconfig
1913 +@@ -106,6 +106,7 @@ config NET_FC
1914 + config IFB
1915 + tristate "Intermediate Functional Block support"
1916 + depends on NET_CLS_ACT
1917 ++ select NET_REDIRECT
1918 + ---help---
1919 + This is an intermediate driver that allows sharing of
1920 + resources.
1921 +diff --git a/drivers/net/can/slcan.c b/drivers/net/can/slcan.c
1922 +index 2f5c287eac95..a3664281a33f 100644
1923 +--- a/drivers/net/can/slcan.c
1924 ++++ b/drivers/net/can/slcan.c
1925 +@@ -625,7 +625,10 @@ err_free_chan:
1926 + tty->disc_data = NULL;
1927 + clear_bit(SLF_INUSE, &sl->flags);
1928 + slc_free_netdev(sl->dev);
1929 ++ /* do not call free_netdev before rtnl_unlock */
1930 ++ rtnl_unlock();
1931 + free_netdev(sl->dev);
1932 ++ return err;
1933 +
1934 + err_exit:
1935 + rtnl_unlock();
1936 +diff --git a/drivers/net/dsa/mt7530.c b/drivers/net/dsa/mt7530.c
1937 +index ed1ec10ec62b..60a8a68567ba 100644
1938 +--- a/drivers/net/dsa/mt7530.c
1939 ++++ b/drivers/net/dsa/mt7530.c
1940 +@@ -566,7 +566,7 @@ mt7530_mib_reset(struct dsa_switch *ds)
1941 + static void
1942 + mt7530_port_set_status(struct mt7530_priv *priv, int port, int enable)
1943 + {
1944 +- u32 mask = PMCR_TX_EN | PMCR_RX_EN;
1945 ++ u32 mask = PMCR_TX_EN | PMCR_RX_EN | PMCR_FORCE_LNK;
1946 +
1947 + if (enable)
1948 + mt7530_set(priv, MT7530_PMCR_P(port), mask);
1949 +@@ -1443,7 +1443,7 @@ static void mt7530_phylink_mac_config(struct dsa_switch *ds, int port,
1950 + mcr_new &= ~(PMCR_FORCE_SPEED_1000 | PMCR_FORCE_SPEED_100 |
1951 + PMCR_FORCE_FDX | PMCR_TX_FC_EN | PMCR_RX_FC_EN);
1952 + mcr_new |= PMCR_IFG_XMIT(1) | PMCR_MAC_MODE | PMCR_BACKOFF_EN |
1953 +- PMCR_BACKPR_EN | PMCR_FORCE_MODE | PMCR_FORCE_LNK;
1954 ++ PMCR_BACKPR_EN | PMCR_FORCE_MODE;
1955 +
1956 + /* Are we connected to external phy */
1957 + if (port == 5 && dsa_is_user_port(ds, 5))
1958 +diff --git a/drivers/net/ethernet/amazon/ena/ena_netdev.c b/drivers/net/ethernet/amazon/ena/ena_netdev.c
1959 +index 1c1a41bd11da..7646f98f6a64 100644
1960 +--- a/drivers/net/ethernet/amazon/ena/ena_netdev.c
1961 ++++ b/drivers/net/ethernet/amazon/ena/ena_netdev.c
1962 +@@ -532,13 +532,9 @@ static int ena_refill_rx_bufs(struct ena_ring *rx_ring, u32 num)
1963 + struct ena_rx_buffer *rx_info;
1964 +
1965 + req_id = rx_ring->free_ids[next_to_use];
1966 +- rc = validate_rx_req_id(rx_ring, req_id);
1967 +- if (unlikely(rc < 0))
1968 +- break;
1969 +
1970 + rx_info = &rx_ring->rx_buffer_info[req_id];
1971 +
1972 +-
1973 + rc = ena_alloc_rx_page(rx_ring, rx_info,
1974 + GFP_ATOMIC | __GFP_COMP);
1975 + if (unlikely(rc < 0)) {
1976 +@@ -868,9 +864,15 @@ static struct sk_buff *ena_rx_skb(struct ena_ring *rx_ring,
1977 + struct ena_rx_buffer *rx_info;
1978 + u16 len, req_id, buf = 0;
1979 + void *va;
1980 ++ int rc;
1981 +
1982 + len = ena_bufs[buf].len;
1983 + req_id = ena_bufs[buf].req_id;
1984 ++
1985 ++ rc = validate_rx_req_id(rx_ring, req_id);
1986 ++ if (unlikely(rc < 0))
1987 ++ return NULL;
1988 ++
1989 + rx_info = &rx_ring->rx_buffer_info[req_id];
1990 +
1991 + if (unlikely(!rx_info->page)) {
1992 +@@ -943,6 +945,11 @@ static struct sk_buff *ena_rx_skb(struct ena_ring *rx_ring,
1993 + buf++;
1994 + len = ena_bufs[buf].len;
1995 + req_id = ena_bufs[buf].req_id;
1996 ++
1997 ++ rc = validate_rx_req_id(rx_ring, req_id);
1998 ++ if (unlikely(rc < 0))
1999 ++ return NULL;
2000 ++
2001 + rx_info = &rx_ring->rx_buffer_info[req_id];
2002 + } while (1);
2003 +
2004 +@@ -1346,7 +1353,7 @@ static int ena_enable_msix(struct ena_adapter *adapter)
2005 + }
2006 +
2007 + /* Reserved the max msix vectors we might need */
2008 +- msix_vecs = ENA_MAX_MSIX_VEC(adapter->num_io_queues);
2009 ++ msix_vecs = ENA_MAX_MSIX_VEC(adapter->max_num_io_queues);
2010 + netif_dbg(adapter, probe, adapter->netdev,
2011 + "trying to enable MSI-X, vectors %d\n", msix_vecs);
2012 +
2013 +@@ -1444,6 +1451,7 @@ static int ena_request_mgmnt_irq(struct ena_adapter *adapter)
2014 +
2015 + static int ena_request_io_irq(struct ena_adapter *adapter)
2016 + {
2017 ++ u32 io_queue_count = adapter->num_io_queues;
2018 + unsigned long flags = 0;
2019 + struct ena_irq *irq;
2020 + int rc = 0, i, k;
2021 +@@ -1454,7 +1462,7 @@ static int ena_request_io_irq(struct ena_adapter *adapter)
2022 + return -EINVAL;
2023 + }
2024 +
2025 +- for (i = ENA_IO_IRQ_FIRST_IDX; i < adapter->msix_vecs; i++) {
2026 ++ for (i = ENA_IO_IRQ_FIRST_IDX; i < ENA_MAX_MSIX_VEC(io_queue_count); i++) {
2027 + irq = &adapter->irq_tbl[i];
2028 + rc = request_irq(irq->vector, irq->handler, flags, irq->name,
2029 + irq->data);
2030 +@@ -1495,6 +1503,7 @@ static void ena_free_mgmnt_irq(struct ena_adapter *adapter)
2031 +
2032 + static void ena_free_io_irq(struct ena_adapter *adapter)
2033 + {
2034 ++ u32 io_queue_count = adapter->num_io_queues;
2035 + struct ena_irq *irq;
2036 + int i;
2037 +
2038 +@@ -1505,7 +1514,7 @@ static void ena_free_io_irq(struct ena_adapter *adapter)
2039 + }
2040 + #endif /* CONFIG_RFS_ACCEL */
2041 +
2042 +- for (i = ENA_IO_IRQ_FIRST_IDX; i < adapter->msix_vecs; i++) {
2043 ++ for (i = ENA_IO_IRQ_FIRST_IDX; i < ENA_MAX_MSIX_VEC(io_queue_count); i++) {
2044 + irq = &adapter->irq_tbl[i];
2045 + irq_set_affinity_hint(irq->vector, NULL);
2046 + free_irq(irq->vector, irq->data);
2047 +@@ -1520,12 +1529,13 @@ static void ena_disable_msix(struct ena_adapter *adapter)
2048 +
2049 + static void ena_disable_io_intr_sync(struct ena_adapter *adapter)
2050 + {
2051 ++ u32 io_queue_count = adapter->num_io_queues;
2052 + int i;
2053 +
2054 + if (!netif_running(adapter->netdev))
2055 + return;
2056 +
2057 +- for (i = ENA_IO_IRQ_FIRST_IDX; i < adapter->msix_vecs; i++)
2058 ++ for (i = ENA_IO_IRQ_FIRST_IDX; i < ENA_MAX_MSIX_VEC(io_queue_count); i++)
2059 + synchronize_irq(adapter->irq_tbl[i].vector);
2060 + }
2061 +
2062 +@@ -2822,6 +2832,7 @@ static int ena_restore_device(struct ena_adapter *adapter)
2063 + netif_carrier_on(adapter->netdev);
2064 +
2065 + mod_timer(&adapter->timer_service, round_jiffies(jiffies + HZ));
2066 ++ adapter->last_keep_alive_jiffies = jiffies;
2067 + dev_err(&pdev->dev,
2068 + "Device reset completed successfully, Driver info: %s\n",
2069 + version);
2070 +@@ -3662,13 +3673,15 @@ err_disable_device:
2071 +
2072 + /*****************************************************************************/
2073 +
2074 +-/* ena_remove - Device Removal Routine
2075 ++/* __ena_shutoff - Helper used in both PCI remove/shutdown routines
2076 + * @pdev: PCI device information struct
2077 ++ * @shutdown: Is it a shutdown operation? If false, means it is a removal
2078 + *
2079 +- * ena_remove is called by the PCI subsystem to alert the driver
2080 +- * that it should release a PCI device.
2081 ++ * __ena_shutoff is a helper routine that does the real work on shutdown and
2082 ++ * removal paths; the difference between those paths is with regards to whether
2083 ++ * dettach or unregister the netdevice.
2084 + */
2085 +-static void ena_remove(struct pci_dev *pdev)
2086 ++static void __ena_shutoff(struct pci_dev *pdev, bool shutdown)
2087 + {
2088 + struct ena_adapter *adapter = pci_get_drvdata(pdev);
2089 + struct ena_com_dev *ena_dev;
2090 +@@ -3687,13 +3700,17 @@ static void ena_remove(struct pci_dev *pdev)
2091 +
2092 + cancel_work_sync(&adapter->reset_task);
2093 +
2094 +- rtnl_lock();
2095 ++ rtnl_lock(); /* lock released inside the below if-else block */
2096 + ena_destroy_device(adapter, true);
2097 +- rtnl_unlock();
2098 +-
2099 +- unregister_netdev(netdev);
2100 +-
2101 +- free_netdev(netdev);
2102 ++ if (shutdown) {
2103 ++ netif_device_detach(netdev);
2104 ++ dev_close(netdev);
2105 ++ rtnl_unlock();
2106 ++ } else {
2107 ++ rtnl_unlock();
2108 ++ unregister_netdev(netdev);
2109 ++ free_netdev(netdev);
2110 ++ }
2111 +
2112 + ena_com_rss_destroy(ena_dev);
2113 +
2114 +@@ -3708,6 +3725,30 @@ static void ena_remove(struct pci_dev *pdev)
2115 + vfree(ena_dev);
2116 + }
2117 +
2118 ++/* ena_remove - Device Removal Routine
2119 ++ * @pdev: PCI device information struct
2120 ++ *
2121 ++ * ena_remove is called by the PCI subsystem to alert the driver
2122 ++ * that it should release a PCI device.
2123 ++ */
2124 ++
2125 ++static void ena_remove(struct pci_dev *pdev)
2126 ++{
2127 ++ __ena_shutoff(pdev, false);
2128 ++}
2129 ++
2130 ++/* ena_shutdown - Device Shutdown Routine
2131 ++ * @pdev: PCI device information struct
2132 ++ *
2133 ++ * ena_shutdown is called by the PCI subsystem to alert the driver that
2134 ++ * a shutdown/reboot (or kexec) is happening and device must be disabled.
2135 ++ */
2136 ++
2137 ++static void ena_shutdown(struct pci_dev *pdev)
2138 ++{
2139 ++ __ena_shutoff(pdev, true);
2140 ++}
2141 ++
2142 + #ifdef CONFIG_PM
2143 + /* ena_suspend - PM suspend callback
2144 + * @pdev: PCI device information struct
2145 +@@ -3757,6 +3798,7 @@ static struct pci_driver ena_pci_driver = {
2146 + .id_table = ena_pci_tbl,
2147 + .probe = ena_probe,
2148 + .remove = ena_remove,
2149 ++ .shutdown = ena_shutdown,
2150 + #ifdef CONFIG_PM
2151 + .suspend = ena_suspend,
2152 + .resume = ena_resume,
2153 +diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt.c b/drivers/net/ethernet/broadcom/bnxt/bnxt.c
2154 +index 05da27a64d55..b92c47518665 100644
2155 +--- a/drivers/net/ethernet/broadcom/bnxt/bnxt.c
2156 ++++ b/drivers/net/ethernet/broadcom/bnxt/bnxt.c
2157 +@@ -6880,12 +6880,12 @@ skip_rdma:
2158 + }
2159 + ena |= FUNC_BACKING_STORE_CFG_REQ_DFLT_ENABLES;
2160 + rc = bnxt_hwrm_func_backing_store_cfg(bp, ena);
2161 +- if (rc)
2162 ++ if (rc) {
2163 + netdev_err(bp->dev, "Failed configuring context mem, rc = %d.\n",
2164 + rc);
2165 +- else
2166 +- ctx->flags |= BNXT_CTX_FLAG_INITED;
2167 +-
2168 ++ return rc;
2169 ++ }
2170 ++ ctx->flags |= BNXT_CTX_FLAG_INITED;
2171 + return 0;
2172 + }
2173 +
2174 +@@ -7406,14 +7406,22 @@ static int bnxt_hwrm_port_qstats_ext(struct bnxt *bp)
2175 + pri2cos = &resp2->pri0_cos_queue_id;
2176 + for (i = 0; i < 8; i++) {
2177 + u8 queue_id = pri2cos[i];
2178 ++ u8 queue_idx;
2179 +
2180 ++ /* Per port queue IDs start from 0, 10, 20, etc */
2181 ++ queue_idx = queue_id % 10;
2182 ++ if (queue_idx > BNXT_MAX_QUEUE) {
2183 ++ bp->pri2cos_valid = false;
2184 ++ goto qstats_done;
2185 ++ }
2186 + for (j = 0; j < bp->max_q; j++) {
2187 + if (bp->q_ids[j] == queue_id)
2188 +- bp->pri2cos[i] = j;
2189 ++ bp->pri2cos_idx[i] = queue_idx;
2190 + }
2191 + }
2192 + bp->pri2cos_valid = 1;
2193 + }
2194 ++qstats_done:
2195 + mutex_unlock(&bp->hwrm_cmd_lock);
2196 + return rc;
2197 + }
2198 +@@ -11658,6 +11666,10 @@ static int bnxt_set_dflt_rings(struct bnxt *bp, bool sh)
2199 + bp->rx_nr_rings++;
2200 + bp->cp_nr_rings++;
2201 + }
2202 ++ if (rc) {
2203 ++ bp->tx_nr_rings = 0;
2204 ++ bp->rx_nr_rings = 0;
2205 ++ }
2206 + return rc;
2207 + }
2208 +
2209 +@@ -11951,12 +11963,12 @@ init_err_pci_clean:
2210 + bnxt_hwrm_func_drv_unrgtr(bp);
2211 + bnxt_free_hwrm_short_cmd_req(bp);
2212 + bnxt_free_hwrm_resources(bp);
2213 +- bnxt_free_ctx_mem(bp);
2214 +- kfree(bp->ctx);
2215 +- bp->ctx = NULL;
2216 + kfree(bp->fw_health);
2217 + bp->fw_health = NULL;
2218 + bnxt_cleanup_pci(bp);
2219 ++ bnxt_free_ctx_mem(bp);
2220 ++ kfree(bp->ctx);
2221 ++ bp->ctx = NULL;
2222 +
2223 + init_err_free:
2224 + free_netdev(dev);
2225 +diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt.h b/drivers/net/ethernet/broadcom/bnxt/bnxt.h
2226 +index f14335433a64..c67707c1a969 100644
2227 +--- a/drivers/net/ethernet/broadcom/bnxt/bnxt.h
2228 ++++ b/drivers/net/ethernet/broadcom/bnxt/bnxt.h
2229 +@@ -1714,7 +1714,7 @@ struct bnxt {
2230 + u16 fw_rx_stats_ext_size;
2231 + u16 fw_tx_stats_ext_size;
2232 + u16 hw_ring_stats_size;
2233 +- u8 pri2cos[8];
2234 ++ u8 pri2cos_idx[8];
2235 + u8 pri2cos_valid;
2236 +
2237 + u16 hwrm_max_req_len;
2238 +diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt_dcb.c b/drivers/net/ethernet/broadcom/bnxt/bnxt_dcb.c
2239 +index fb6f30d0d1d0..b1511bcffb1b 100644
2240 +--- a/drivers/net/ethernet/broadcom/bnxt/bnxt_dcb.c
2241 ++++ b/drivers/net/ethernet/broadcom/bnxt/bnxt_dcb.c
2242 +@@ -479,24 +479,26 @@ static int bnxt_dcbnl_ieee_getets(struct net_device *dev, struct ieee_ets *ets)
2243 + {
2244 + struct bnxt *bp = netdev_priv(dev);
2245 + struct ieee_ets *my_ets = bp->ieee_ets;
2246 ++ int rc;
2247 +
2248 + ets->ets_cap = bp->max_tc;
2249 +
2250 + if (!my_ets) {
2251 +- int rc;
2252 +-
2253 + if (bp->dcbx_cap & DCB_CAP_DCBX_HOST)
2254 + return 0;
2255 +
2256 + my_ets = kzalloc(sizeof(*my_ets), GFP_KERNEL);
2257 + if (!my_ets)
2258 +- return 0;
2259 ++ return -ENOMEM;
2260 + rc = bnxt_hwrm_queue_cos2bw_qcfg(bp, my_ets);
2261 + if (rc)
2262 +- return 0;
2263 ++ goto error;
2264 + rc = bnxt_hwrm_queue_pri2cos_qcfg(bp, my_ets);
2265 + if (rc)
2266 +- return 0;
2267 ++ goto error;
2268 ++
2269 ++ /* cache result */
2270 ++ bp->ieee_ets = my_ets;
2271 + }
2272 +
2273 + ets->cbs = my_ets->cbs;
2274 +@@ -505,6 +507,9 @@ static int bnxt_dcbnl_ieee_getets(struct net_device *dev, struct ieee_ets *ets)
2275 + memcpy(ets->tc_tsa, my_ets->tc_tsa, sizeof(ets->tc_tsa));
2276 + memcpy(ets->prio_tc, my_ets->prio_tc, sizeof(ets->prio_tc));
2277 + return 0;
2278 ++error:
2279 ++ kfree(my_ets);
2280 ++ return rc;
2281 + }
2282 +
2283 + static int bnxt_dcbnl_ieee_setets(struct net_device *dev, struct ieee_ets *ets)
2284 +diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c b/drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c
2285 +index 972383aefc2b..7946807c99b8 100644
2286 +--- a/drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c
2287 ++++ b/drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c
2288 +@@ -589,25 +589,25 @@ skip_ring_stats:
2289 + if (bp->pri2cos_valid) {
2290 + for (i = 0; i < 8; i++, j++) {
2291 + long n = bnxt_rx_bytes_pri_arr[i].base_off +
2292 +- bp->pri2cos[i];
2293 ++ bp->pri2cos_idx[i];
2294 +
2295 + buf[j] = le64_to_cpu(*(rx_port_stats_ext + n));
2296 + }
2297 + for (i = 0; i < 8; i++, j++) {
2298 + long n = bnxt_rx_pkts_pri_arr[i].base_off +
2299 +- bp->pri2cos[i];
2300 ++ bp->pri2cos_idx[i];
2301 +
2302 + buf[j] = le64_to_cpu(*(rx_port_stats_ext + n));
2303 + }
2304 + for (i = 0; i < 8; i++, j++) {
2305 + long n = bnxt_tx_bytes_pri_arr[i].base_off +
2306 +- bp->pri2cos[i];
2307 ++ bp->pri2cos_idx[i];
2308 +
2309 + buf[j] = le64_to_cpu(*(tx_port_stats_ext + n));
2310 + }
2311 + for (i = 0; i < 8; i++, j++) {
2312 + long n = bnxt_tx_pkts_pri_arr[i].base_off +
2313 +- bp->pri2cos[i];
2314 ++ bp->pri2cos_idx[i];
2315 +
2316 + buf[j] = le64_to_cpu(*(tx_port_stats_ext + n));
2317 + }
2318 +diff --git a/drivers/net/ethernet/broadcom/genet/bcmgenet.c b/drivers/net/ethernet/broadcom/genet/bcmgenet.c
2319 +index 0a8624be44a9..98cb15d85ee8 100644
2320 +--- a/drivers/net/ethernet/broadcom/genet/bcmgenet.c
2321 ++++ b/drivers/net/ethernet/broadcom/genet/bcmgenet.c
2322 +@@ -1972,6 +1972,8 @@ static void umac_enable_set(struct bcmgenet_priv *priv, u32 mask, bool enable)
2323 + u32 reg;
2324 +
2325 + reg = bcmgenet_umac_readl(priv, UMAC_CMD);
2326 ++ if (reg & CMD_SW_RESET)
2327 ++ return;
2328 + if (enable)
2329 + reg |= mask;
2330 + else
2331 +@@ -1991,11 +1993,9 @@ static void reset_umac(struct bcmgenet_priv *priv)
2332 + bcmgenet_rbuf_ctrl_set(priv, 0);
2333 + udelay(10);
2334 +
2335 +- /* disable MAC while updating its registers */
2336 +- bcmgenet_umac_writel(priv, 0, UMAC_CMD);
2337 +-
2338 +- /* issue soft reset with (rg)mii loopback to ensure a stable rxclk */
2339 +- bcmgenet_umac_writel(priv, CMD_SW_RESET | CMD_LCL_LOOP_EN, UMAC_CMD);
2340 ++ /* issue soft reset and disable MAC while updating its registers */
2341 ++ bcmgenet_umac_writel(priv, CMD_SW_RESET, UMAC_CMD);
2342 ++ udelay(2);
2343 + }
2344 +
2345 + static void bcmgenet_intr_disable(struct bcmgenet_priv *priv)
2346 +diff --git a/drivers/net/ethernet/broadcom/genet/bcmgenet_wol.c b/drivers/net/ethernet/broadcom/genet/bcmgenet_wol.c
2347 +index ea20d94bd050..c9a43695b182 100644
2348 +--- a/drivers/net/ethernet/broadcom/genet/bcmgenet_wol.c
2349 ++++ b/drivers/net/ethernet/broadcom/genet/bcmgenet_wol.c
2350 +@@ -132,8 +132,12 @@ int bcmgenet_wol_power_down_cfg(struct bcmgenet_priv *priv,
2351 + return -EINVAL;
2352 + }
2353 +
2354 +- /* disable RX */
2355 ++ /* Can't suspend with WoL if MAC is still in reset */
2356 + reg = bcmgenet_umac_readl(priv, UMAC_CMD);
2357 ++ if (reg & CMD_SW_RESET)
2358 ++ reg &= ~CMD_SW_RESET;
2359 ++
2360 ++ /* disable RX */
2361 + reg &= ~CMD_RX_EN;
2362 + bcmgenet_umac_writel(priv, reg, UMAC_CMD);
2363 + mdelay(10);
2364 +diff --git a/drivers/net/ethernet/broadcom/genet/bcmmii.c b/drivers/net/ethernet/broadcom/genet/bcmmii.c
2365 +index 10244941a7a6..b5930f80039d 100644
2366 +--- a/drivers/net/ethernet/broadcom/genet/bcmmii.c
2367 ++++ b/drivers/net/ethernet/broadcom/genet/bcmmii.c
2368 +@@ -95,6 +95,12 @@ void bcmgenet_mii_setup(struct net_device *dev)
2369 + CMD_HD_EN |
2370 + CMD_RX_PAUSE_IGNORE | CMD_TX_PAUSE_IGNORE);
2371 + reg |= cmd_bits;
2372 ++ if (reg & CMD_SW_RESET) {
2373 ++ reg &= ~CMD_SW_RESET;
2374 ++ bcmgenet_umac_writel(priv, reg, UMAC_CMD);
2375 ++ udelay(2);
2376 ++ reg |= CMD_TX_EN | CMD_RX_EN;
2377 ++ }
2378 + bcmgenet_umac_writel(priv, reg, UMAC_CMD);
2379 + } else {
2380 + /* done if nothing has changed */
2381 +@@ -181,38 +187,8 @@ int bcmgenet_mii_config(struct net_device *dev, bool init)
2382 + const char *phy_name = NULL;
2383 + u32 id_mode_dis = 0;
2384 + u32 port_ctrl;
2385 +- int bmcr = -1;
2386 +- int ret;
2387 + u32 reg;
2388 +
2389 +- /* MAC clocking workaround during reset of umac state machines */
2390 +- reg = bcmgenet_umac_readl(priv, UMAC_CMD);
2391 +- if (reg & CMD_SW_RESET) {
2392 +- /* An MII PHY must be isolated to prevent TXC contention */
2393 +- if (priv->phy_interface == PHY_INTERFACE_MODE_MII) {
2394 +- ret = phy_read(phydev, MII_BMCR);
2395 +- if (ret >= 0) {
2396 +- bmcr = ret;
2397 +- ret = phy_write(phydev, MII_BMCR,
2398 +- bmcr | BMCR_ISOLATE);
2399 +- }
2400 +- if (ret) {
2401 +- netdev_err(dev, "failed to isolate PHY\n");
2402 +- return ret;
2403 +- }
2404 +- }
2405 +- /* Switch MAC clocking to RGMII generated clock */
2406 +- bcmgenet_sys_writel(priv, PORT_MODE_EXT_GPHY, SYS_PORT_CTRL);
2407 +- /* Ensure 5 clks with Rx disabled
2408 +- * followed by 5 clks with Reset asserted
2409 +- */
2410 +- udelay(4);
2411 +- reg &= ~(CMD_SW_RESET | CMD_LCL_LOOP_EN);
2412 +- bcmgenet_umac_writel(priv, reg, UMAC_CMD);
2413 +- /* Ensure 5 more clocks before Rx is enabled */
2414 +- udelay(2);
2415 +- }
2416 +-
2417 + switch (priv->phy_interface) {
2418 + case PHY_INTERFACE_MODE_INTERNAL:
2419 + phy_name = "internal PHY";
2420 +@@ -282,10 +258,6 @@ int bcmgenet_mii_config(struct net_device *dev, bool init)
2421 +
2422 + bcmgenet_sys_writel(priv, port_ctrl, SYS_PORT_CTRL);
2423 +
2424 +- /* Restore the MII PHY after isolation */
2425 +- if (bmcr >= 0)
2426 +- phy_write(phydev, MII_BMCR, bmcr);
2427 +-
2428 + priv->ext_phy = !priv->internal_phy &&
2429 + (priv->phy_interface != PHY_INTERFACE_MODE_MOCA);
2430 +
2431 +diff --git a/drivers/net/ethernet/chelsio/cxgb4/sge.c b/drivers/net/ethernet/chelsio/cxgb4/sge.c
2432 +index 97cda501e7e8..cab3d17e0e1a 100644
2433 +--- a/drivers/net/ethernet/chelsio/cxgb4/sge.c
2434 ++++ b/drivers/net/ethernet/chelsio/cxgb4/sge.c
2435 +@@ -1307,8 +1307,9 @@ static inline void *write_tso_wr(struct adapter *adap, struct sk_buff *skb,
2436 + int t4_sge_eth_txq_egress_update(struct adapter *adap, struct sge_eth_txq *eq,
2437 + int maxreclaim)
2438 + {
2439 ++ unsigned int reclaimed, hw_cidx;
2440 + struct sge_txq *q = &eq->q;
2441 +- unsigned int reclaimed;
2442 ++ int hw_in_use;
2443 +
2444 + if (!q->in_use || !__netif_tx_trylock(eq->txq))
2445 + return 0;
2446 +@@ -1316,12 +1317,17 @@ int t4_sge_eth_txq_egress_update(struct adapter *adap, struct sge_eth_txq *eq,
2447 + /* Reclaim pending completed TX Descriptors. */
2448 + reclaimed = reclaim_completed_tx(adap, &eq->q, maxreclaim, true);
2449 +
2450 ++ hw_cidx = ntohs(READ_ONCE(q->stat->cidx));
2451 ++ hw_in_use = q->pidx - hw_cidx;
2452 ++ if (hw_in_use < 0)
2453 ++ hw_in_use += q->size;
2454 ++
2455 + /* If the TX Queue is currently stopped and there's now more than half
2456 + * the queue available, restart it. Otherwise bail out since the rest
2457 + * of what we want do here is with the possibility of shipping any
2458 + * currently buffered Coalesced TX Work Request.
2459 + */
2460 +- if (netif_tx_queue_stopped(eq->txq) && txq_avail(q) > (q->size / 2)) {
2461 ++ if (netif_tx_queue_stopped(eq->txq) && hw_in_use < (q->size / 2)) {
2462 + netif_tx_wake_queue(eq->txq);
2463 + eq->q.restarts++;
2464 + }
2465 +@@ -1486,16 +1492,7 @@ static netdev_tx_t cxgb4_eth_xmit(struct sk_buff *skb, struct net_device *dev)
2466 + * has opened up.
2467 + */
2468 + eth_txq_stop(q);
2469 +-
2470 +- /* If we're using the SGE Doorbell Queue Timer facility, we
2471 +- * don't need to ask the Firmware to send us Egress Queue CIDX
2472 +- * Updates: the Hardware will do this automatically. And
2473 +- * since we send the Ingress Queue CIDX Updates to the
2474 +- * corresponding Ethernet Response Queue, we'll get them very
2475 +- * quickly.
2476 +- */
2477 +- if (!q->dbqt)
2478 +- wr_mid |= FW_WR_EQUEQ_F | FW_WR_EQUIQ_F;
2479 ++ wr_mid |= FW_WR_EQUEQ_F | FW_WR_EQUIQ_F;
2480 + }
2481 +
2482 + wr = (void *)&q->q.desc[q->q.pidx];
2483 +@@ -1805,16 +1802,7 @@ static netdev_tx_t cxgb4_vf_eth_xmit(struct sk_buff *skb,
2484 + * has opened up.
2485 + */
2486 + eth_txq_stop(txq);
2487 +-
2488 +- /* If we're using the SGE Doorbell Queue Timer facility, we
2489 +- * don't need to ask the Firmware to send us Egress Queue CIDX
2490 +- * Updates: the Hardware will do this automatically. And
2491 +- * since we send the Ingress Queue CIDX Updates to the
2492 +- * corresponding Ethernet Response Queue, we'll get them very
2493 +- * quickly.
2494 +- */
2495 +- if (!txq->dbqt)
2496 +- wr_mid |= FW_WR_EQUEQ_F | FW_WR_EQUIQ_F;
2497 ++ wr_mid |= FW_WR_EQUEQ_F | FW_WR_EQUIQ_F;
2498 + }
2499 +
2500 + /* Start filling in our Work Request. Note that we do _not_ handle
2501 +@@ -3370,26 +3358,6 @@ static void t4_tx_completion_handler(struct sge_rspq *rspq,
2502 + }
2503 +
2504 + txq = &s->ethtxq[pi->first_qset + rspq->idx];
2505 +-
2506 +- /* We've got the Hardware Consumer Index Update in the Egress Update
2507 +- * message. If we're using the SGE Doorbell Queue Timer mechanism,
2508 +- * these Egress Update messages will be our sole CIDX Updates we get
2509 +- * since we don't want to chew up PCIe bandwidth for both Ingress
2510 +- * Messages and Status Page writes. However, The code which manages
2511 +- * reclaiming successfully DMA'ed TX Work Requests uses the CIDX value
2512 +- * stored in the Status Page at the end of the TX Queue. It's easiest
2513 +- * to simply copy the CIDX Update value from the Egress Update message
2514 +- * to the Status Page. Also note that no Endian issues need to be
2515 +- * considered here since both are Big Endian and we're just copying
2516 +- * bytes consistently ...
2517 +- */
2518 +- if (txq->dbqt) {
2519 +- struct cpl_sge_egr_update *egr;
2520 +-
2521 +- egr = (struct cpl_sge_egr_update *)rsp;
2522 +- WRITE_ONCE(txq->q.stat->cidx, egr->cidx);
2523 +- }
2524 +-
2525 + t4_sge_eth_txq_egress_update(adapter, txq, -1);
2526 + }
2527 +
2528 +diff --git a/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c b/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c
2529 +index 36e2e28fa6e3..1e8dcae5f4b4 100644
2530 +--- a/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c
2531 ++++ b/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c
2532 +@@ -2845,9 +2845,7 @@ static inline u16 dpaa_get_headroom(struct dpaa_buffer_layout *bl)
2533 + headroom = (u16)(bl->priv_data_size + DPAA_PARSE_RESULTS_SIZE +
2534 + DPAA_TIME_STAMP_SIZE + DPAA_HASH_RESULTS_SIZE);
2535 +
2536 +- return DPAA_FD_DATA_ALIGNMENT ? ALIGN(headroom,
2537 +- DPAA_FD_DATA_ALIGNMENT) :
2538 +- headroom;
2539 ++ return ALIGN(headroom, DPAA_FD_DATA_ALIGNMENT);
2540 + }
2541 +
2542 + static int dpaa_eth_probe(struct platform_device *pdev)
2543 +diff --git a/drivers/net/ethernet/ibm/ibmvnic.c b/drivers/net/ethernet/ibm/ibmvnic.c
2544 +index 830791ab4619..3c7295056c85 100644
2545 +--- a/drivers/net/ethernet/ibm/ibmvnic.c
2546 ++++ b/drivers/net/ethernet/ibm/ibmvnic.c
2547 +@@ -2142,6 +2142,8 @@ static void __ibmvnic_reset(struct work_struct *work)
2548 + {
2549 + struct ibmvnic_rwi *rwi;
2550 + struct ibmvnic_adapter *adapter;
2551 ++ bool saved_state = false;
2552 ++ unsigned long flags;
2553 + u32 reset_state;
2554 + int rc = 0;
2555 +
2556 +@@ -2153,17 +2155,25 @@ static void __ibmvnic_reset(struct work_struct *work)
2557 + return;
2558 + }
2559 +
2560 +- reset_state = adapter->state;
2561 +-
2562 + rwi = get_next_rwi(adapter);
2563 + while (rwi) {
2564 ++ spin_lock_irqsave(&adapter->state_lock, flags);
2565 ++
2566 + if (adapter->state == VNIC_REMOVING ||
2567 + adapter->state == VNIC_REMOVED) {
2568 ++ spin_unlock_irqrestore(&adapter->state_lock, flags);
2569 + kfree(rwi);
2570 + rc = EBUSY;
2571 + break;
2572 + }
2573 +
2574 ++ if (!saved_state) {
2575 ++ reset_state = adapter->state;
2576 ++ adapter->state = VNIC_RESETTING;
2577 ++ saved_state = true;
2578 ++ }
2579 ++ spin_unlock_irqrestore(&adapter->state_lock, flags);
2580 ++
2581 + if (rwi->reset_reason == VNIC_RESET_CHANGE_PARAM) {
2582 + /* CHANGE_PARAM requestor holds rtnl_lock */
2583 + rc = do_change_param_reset(adapter, rwi, reset_state);
2584 +@@ -5091,6 +5101,7 @@ static int ibmvnic_probe(struct vio_dev *dev, const struct vio_device_id *id)
2585 + __ibmvnic_delayed_reset);
2586 + INIT_LIST_HEAD(&adapter->rwi_list);
2587 + spin_lock_init(&adapter->rwi_lock);
2588 ++ spin_lock_init(&adapter->state_lock);
2589 + mutex_init(&adapter->fw_lock);
2590 + init_completion(&adapter->init_done);
2591 + init_completion(&adapter->fw_done);
2592 +@@ -5163,8 +5174,17 @@ static int ibmvnic_remove(struct vio_dev *dev)
2593 + {
2594 + struct net_device *netdev = dev_get_drvdata(&dev->dev);
2595 + struct ibmvnic_adapter *adapter = netdev_priv(netdev);
2596 ++ unsigned long flags;
2597 ++
2598 ++ spin_lock_irqsave(&adapter->state_lock, flags);
2599 ++ if (adapter->state == VNIC_RESETTING) {
2600 ++ spin_unlock_irqrestore(&adapter->state_lock, flags);
2601 ++ return -EBUSY;
2602 ++ }
2603 +
2604 + adapter->state = VNIC_REMOVING;
2605 ++ spin_unlock_irqrestore(&adapter->state_lock, flags);
2606 ++
2607 + rtnl_lock();
2608 + unregister_netdevice(netdev);
2609 +
2610 +diff --git a/drivers/net/ethernet/ibm/ibmvnic.h b/drivers/net/ethernet/ibm/ibmvnic.h
2611 +index 60eccaf91b12..f8416e1d4cf0 100644
2612 +--- a/drivers/net/ethernet/ibm/ibmvnic.h
2613 ++++ b/drivers/net/ethernet/ibm/ibmvnic.h
2614 +@@ -941,7 +941,8 @@ enum vnic_state {VNIC_PROBING = 1,
2615 + VNIC_CLOSING,
2616 + VNIC_CLOSED,
2617 + VNIC_REMOVING,
2618 +- VNIC_REMOVED};
2619 ++ VNIC_REMOVED,
2620 ++ VNIC_RESETTING};
2621 +
2622 + enum ibmvnic_reset_reason {VNIC_RESET_FAILOVER = 1,
2623 + VNIC_RESET_MOBILITY,
2624 +@@ -1090,4 +1091,7 @@ struct ibmvnic_adapter {
2625 +
2626 + struct ibmvnic_tunables desired;
2627 + struct ibmvnic_tunables fallback;
2628 ++
2629 ++ /* Used for serializatin of state field */
2630 ++ spinlock_t state_lock;
2631 + };
2632 +diff --git a/drivers/net/ethernet/marvell/mvneta.c b/drivers/net/ethernet/marvell/mvneta.c
2633 +index e540f78e38a3..29d715945b3a 100644
2634 +--- a/drivers/net/ethernet/marvell/mvneta.c
2635 ++++ b/drivers/net/ethernet/marvell/mvneta.c
2636 +@@ -3036,11 +3036,10 @@ static int mvneta_poll(struct napi_struct *napi, int budget)
2637 + /* For the case where the last mvneta_poll did not process all
2638 + * RX packets
2639 + */
2640 +- rx_queue = fls(((cause_rx_tx >> 8) & 0xff));
2641 +-
2642 + cause_rx_tx |= pp->neta_armada3700 ? pp->cause_rx_tx :
2643 + port->cause_rx_tx;
2644 +
2645 ++ rx_queue = fls(((cause_rx_tx >> 8) & 0xff));
2646 + if (rx_queue) {
2647 + rx_queue = rx_queue - 1;
2648 + if (pp->bm_priv)
2649 +diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en.h b/drivers/net/ethernet/mellanox/mlx5/core/en.h
2650 +index 9c8427698238..55ceabf077b2 100644
2651 +--- a/drivers/net/ethernet/mellanox/mlx5/core/en.h
2652 ++++ b/drivers/net/ethernet/mellanox/mlx5/core/en.h
2653 +@@ -371,6 +371,7 @@ enum {
2654 +
2655 + struct mlx5e_sq_wqe_info {
2656 + u8 opcode;
2657 ++ u8 num_wqebbs;
2658 +
2659 + /* Auxiliary data for different opcodes. */
2660 + union {
2661 +@@ -1058,6 +1059,7 @@ int mlx5e_modify_rq_state(struct mlx5e_rq *rq, int curr_state, int next_state);
2662 + void mlx5e_activate_rq(struct mlx5e_rq *rq);
2663 + void mlx5e_deactivate_rq(struct mlx5e_rq *rq);
2664 + void mlx5e_free_rx_descs(struct mlx5e_rq *rq);
2665 ++void mlx5e_free_rx_in_progress_descs(struct mlx5e_rq *rq);
2666 + void mlx5e_activate_icosq(struct mlx5e_icosq *icosq);
2667 + void mlx5e_deactivate_icosq(struct mlx5e_icosq *icosq);
2668 +
2669 +diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en/health.h b/drivers/net/ethernet/mellanox/mlx5/core/en/health.h
2670 +index d3693fa547ac..e54f70d9af22 100644
2671 +--- a/drivers/net/ethernet/mellanox/mlx5/core/en/health.h
2672 ++++ b/drivers/net/ethernet/mellanox/mlx5/core/en/health.h
2673 +@@ -10,8 +10,7 @@
2674 +
2675 + static inline bool cqe_syndrome_needs_recover(u8 syndrome)
2676 + {
2677 +- return syndrome == MLX5_CQE_SYNDROME_LOCAL_LENGTH_ERR ||
2678 +- syndrome == MLX5_CQE_SYNDROME_LOCAL_QP_OP_ERR ||
2679 ++ return syndrome == MLX5_CQE_SYNDROME_LOCAL_QP_OP_ERR ||
2680 + syndrome == MLX5_CQE_SYNDROME_LOCAL_PROT_ERR ||
2681 + syndrome == MLX5_CQE_SYNDROME_WR_FLUSH_ERR;
2682 + }
2683 +diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en/reporter_rx.c b/drivers/net/ethernet/mellanox/mlx5/core/en/reporter_rx.c
2684 +index 6c72b592315b..a01e2de2488f 100644
2685 +--- a/drivers/net/ethernet/mellanox/mlx5/core/en/reporter_rx.c
2686 ++++ b/drivers/net/ethernet/mellanox/mlx5/core/en/reporter_rx.c
2687 +@@ -90,7 +90,7 @@ static int mlx5e_rx_reporter_err_icosq_cqe_recover(void *ctx)
2688 + goto out;
2689 +
2690 + mlx5e_reset_icosq_cc_pc(icosq);
2691 +- mlx5e_free_rx_descs(rq);
2692 ++ mlx5e_free_rx_in_progress_descs(rq);
2693 + clear_bit(MLX5E_SQ_STATE_RECOVERING, &icosq->state);
2694 + mlx5e_activate_icosq(icosq);
2695 + mlx5e_activate_rq(rq);
2696 +diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en/txrx.h b/drivers/net/ethernet/mellanox/mlx5/core/en/txrx.h
2697 +index a226277b0980..f07b1399744e 100644
2698 +--- a/drivers/net/ethernet/mellanox/mlx5/core/en/txrx.h
2699 ++++ b/drivers/net/ethernet/mellanox/mlx5/core/en/txrx.h
2700 +@@ -181,10 +181,12 @@ mlx5e_tx_dma_unmap(struct device *pdev, struct mlx5e_sq_dma *dma)
2701 +
2702 + static inline void mlx5e_rqwq_reset(struct mlx5e_rq *rq)
2703 + {
2704 +- if (rq->wq_type == MLX5_WQ_TYPE_LINKED_LIST_STRIDING_RQ)
2705 ++ if (rq->wq_type == MLX5_WQ_TYPE_LINKED_LIST_STRIDING_RQ) {
2706 + mlx5_wq_ll_reset(&rq->mpwqe.wq);
2707 +- else
2708 ++ rq->mpwqe.actual_wq_head = 0;
2709 ++ } else {
2710 + mlx5_wq_cyc_reset(&rq->wqe.wq);
2711 ++ }
2712 + }
2713 +
2714 + /* SW parser related functions */
2715 +diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_accel/ktls_tx.c b/drivers/net/ethernet/mellanox/mlx5/core/en_accel/ktls_tx.c
2716 +index f260dd96873b..52a56622034a 100644
2717 +--- a/drivers/net/ethernet/mellanox/mlx5/core/en_accel/ktls_tx.c
2718 ++++ b/drivers/net/ethernet/mellanox/mlx5/core/en_accel/ktls_tx.c
2719 +@@ -218,7 +218,7 @@ tx_sync_info_get(struct mlx5e_ktls_offload_context_tx *priv_tx,
2720 + * this packet was already acknowledged and its record info
2721 + * was released.
2722 + */
2723 +- ends_before = before(tcp_seq + datalen, tls_record_start_seq(record));
2724 ++ ends_before = before(tcp_seq + datalen - 1, tls_record_start_seq(record));
2725 +
2726 + if (unlikely(tls_record_is_start_marker(record))) {
2727 + ret = ends_before ? MLX5E_KTLS_SYNC_SKIP_NO_DATA : MLX5E_KTLS_SYNC_FAIL;
2728 +diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
2729 +index 5d9cfac67236..67fe002dfade 100644
2730 +--- a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
2731 ++++ b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
2732 +@@ -822,6 +822,29 @@ int mlx5e_wait_for_min_rx_wqes(struct mlx5e_rq *rq, int wait_time)
2733 + return -ETIMEDOUT;
2734 + }
2735 +
2736 ++void mlx5e_free_rx_in_progress_descs(struct mlx5e_rq *rq)
2737 ++{
2738 ++ struct mlx5_wq_ll *wq;
2739 ++ u16 head;
2740 ++ int i;
2741 ++
2742 ++ if (rq->wq_type != MLX5_WQ_TYPE_LINKED_LIST_STRIDING_RQ)
2743 ++ return;
2744 ++
2745 ++ wq = &rq->mpwqe.wq;
2746 ++ head = wq->head;
2747 ++
2748 ++ /* Outstanding UMR WQEs (in progress) start at wq->head */
2749 ++ for (i = 0; i < rq->mpwqe.umr_in_progress; i++) {
2750 ++ rq->dealloc_wqe(rq, head);
2751 ++ head = mlx5_wq_ll_get_wqe_next_ix(wq, head);
2752 ++ }
2753 ++
2754 ++ rq->mpwqe.actual_wq_head = wq->head;
2755 ++ rq->mpwqe.umr_in_progress = 0;
2756 ++ rq->mpwqe.umr_completed = 0;
2757 ++}
2758 ++
2759 + void mlx5e_free_rx_descs(struct mlx5e_rq *rq)
2760 + {
2761 + __be16 wqe_ix_be;
2762 +@@ -829,14 +852,8 @@ void mlx5e_free_rx_descs(struct mlx5e_rq *rq)
2763 +
2764 + if (rq->wq_type == MLX5_WQ_TYPE_LINKED_LIST_STRIDING_RQ) {
2765 + struct mlx5_wq_ll *wq = &rq->mpwqe.wq;
2766 +- u16 head = wq->head;
2767 +- int i;
2768 +
2769 +- /* Outstanding UMR WQEs (in progress) start at wq->head */
2770 +- for (i = 0; i < rq->mpwqe.umr_in_progress; i++) {
2771 +- rq->dealloc_wqe(rq, head);
2772 +- head = mlx5_wq_ll_get_wqe_next_ix(wq, head);
2773 +- }
2774 ++ mlx5e_free_rx_in_progress_descs(rq);
2775 +
2776 + while (!mlx5_wq_ll_is_empty(wq)) {
2777 + struct mlx5e_rx_wqe_ll *wqe;
2778 +diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_rx.c b/drivers/net/ethernet/mellanox/mlx5/core/en_rx.c
2779 +index 1c3ab69cbd96..312d4692425b 100644
2780 +--- a/drivers/net/ethernet/mellanox/mlx5/core/en_rx.c
2781 ++++ b/drivers/net/ethernet/mellanox/mlx5/core/en_rx.c
2782 +@@ -477,6 +477,7 @@ static inline void mlx5e_fill_icosq_frag_edge(struct mlx5e_icosq *sq,
2783 + /* fill sq frag edge with nops to avoid wqe wrapping two pages */
2784 + for (; wi < edge_wi; wi++) {
2785 + wi->opcode = MLX5_OPCODE_NOP;
2786 ++ wi->num_wqebbs = 1;
2787 + mlx5e_post_nop(wq, sq->sqn, &sq->pc);
2788 + }
2789 + }
2790 +@@ -525,6 +526,7 @@ static int mlx5e_alloc_rx_mpwqe(struct mlx5e_rq *rq, u16 ix)
2791 + umr_wqe->uctrl.xlt_offset = cpu_to_be16(xlt_offset);
2792 +
2793 + sq->db.ico_wqe[pi].opcode = MLX5_OPCODE_UMR;
2794 ++ sq->db.ico_wqe[pi].num_wqebbs = MLX5E_UMR_WQEBBS;
2795 + sq->db.ico_wqe[pi].umr.rq = rq;
2796 + sq->pc += MLX5E_UMR_WQEBBS;
2797 +
2798 +@@ -621,6 +623,7 @@ void mlx5e_poll_ico_cq(struct mlx5e_cq *cq)
2799 +
2800 + ci = mlx5_wq_cyc_ctr2ix(&sq->wq, sqcc);
2801 + wi = &sq->db.ico_wqe[ci];
2802 ++ sqcc += wi->num_wqebbs;
2803 +
2804 + if (last_wqe && unlikely(get_cqe_opcode(cqe) != MLX5_CQE_REQ)) {
2805 + netdev_WARN_ONCE(cq->channel->netdev,
2806 +@@ -631,16 +634,12 @@ void mlx5e_poll_ico_cq(struct mlx5e_cq *cq)
2807 + break;
2808 + }
2809 +
2810 +- if (likely(wi->opcode == MLX5_OPCODE_UMR)) {
2811 +- sqcc += MLX5E_UMR_WQEBBS;
2812 ++ if (likely(wi->opcode == MLX5_OPCODE_UMR))
2813 + wi->umr.rq->mpwqe.umr_completed++;
2814 +- } else if (likely(wi->opcode == MLX5_OPCODE_NOP)) {
2815 +- sqcc++;
2816 +- } else {
2817 ++ else if (unlikely(wi->opcode != MLX5_OPCODE_NOP))
2818 + netdev_WARN_ONCE(cq->channel->netdev,
2819 + "Bad OPCODE in ICOSQ WQE info: 0x%x\n",
2820 + wi->opcode);
2821 +- }
2822 +
2823 + } while (!last_wqe);
2824 +
2825 +diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c b/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c
2826 +index 7e32b9e3667c..d4bad2a444e2 100644
2827 +--- a/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c
2828 ++++ b/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c
2829 +@@ -2432,10 +2432,11 @@ static int offload_pedit_fields(struct pedit_headers_action *hdrs,
2830 + continue;
2831 +
2832 + if (f->field_bsize == 32) {
2833 +- mask_be32 = *(__be32 *)&mask;
2834 ++ mask_be32 = (__be32)mask;
2835 + mask = (__force unsigned long)cpu_to_le32(be32_to_cpu(mask_be32));
2836 + } else if (f->field_bsize == 16) {
2837 +- mask_be16 = *(__be16 *)&mask;
2838 ++ mask_be32 = (__be32)mask;
2839 ++ mask_be16 = *(__be16 *)&mask_be32;
2840 + mask = (__force unsigned long)cpu_to_le16(be16_to_cpu(mask_be16));
2841 + }
2842 +
2843 +diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_txrx.c b/drivers/net/ethernet/mellanox/mlx5/core/en_txrx.c
2844 +index 257a7c9f7a14..800d34ed8a96 100644
2845 +--- a/drivers/net/ethernet/mellanox/mlx5/core/en_txrx.c
2846 ++++ b/drivers/net/ethernet/mellanox/mlx5/core/en_txrx.c
2847 +@@ -78,6 +78,7 @@ void mlx5e_trigger_irq(struct mlx5e_icosq *sq)
2848 + u16 pi = mlx5_wq_cyc_ctr2ix(wq, sq->pc);
2849 +
2850 + sq->db.ico_wqe[pi].opcode = MLX5_OPCODE_NOP;
2851 ++ sq->db.ico_wqe[pi].num_wqebbs = 1;
2852 + nopwqe = mlx5e_post_nop(wq, sq->sqn, &sq->pc);
2853 + mlx5e_notify_hw(wq, sq->pc, sq->uar_map, &nopwqe->ctrl);
2854 + }
2855 +diff --git a/drivers/net/ethernet/mellanox/mlx5/core/steering/dr_action.c b/drivers/net/ethernet/mellanox/mlx5/core/steering/dr_action.c
2856 +index 004c56c2fc0c..b2dfa2b5366f 100644
2857 +--- a/drivers/net/ethernet/mellanox/mlx5/core/steering/dr_action.c
2858 ++++ b/drivers/net/ethernet/mellanox/mlx5/core/steering/dr_action.c
2859 +@@ -930,7 +930,6 @@ static int dr_actions_l2_rewrite(struct mlx5dr_domain *dmn,
2860 +
2861 + action->rewrite.data = (void *)ops;
2862 + action->rewrite.num_of_actions = i;
2863 +- action->rewrite.chunk->byte_size = i * sizeof(*ops);
2864 +
2865 + ret = mlx5dr_send_postsend_action(dmn, action);
2866 + if (ret) {
2867 +diff --git a/drivers/net/ethernet/mellanox/mlx5/core/steering/dr_send.c b/drivers/net/ethernet/mellanox/mlx5/core/steering/dr_send.c
2868 +index c7f10d4f8f8d..095ec7b1399d 100644
2869 +--- a/drivers/net/ethernet/mellanox/mlx5/core/steering/dr_send.c
2870 ++++ b/drivers/net/ethernet/mellanox/mlx5/core/steering/dr_send.c
2871 +@@ -558,7 +558,8 @@ int mlx5dr_send_postsend_action(struct mlx5dr_domain *dmn,
2872 + int ret;
2873 +
2874 + send_info.write.addr = (uintptr_t)action->rewrite.data;
2875 +- send_info.write.length = action->rewrite.chunk->byte_size;
2876 ++ send_info.write.length = action->rewrite.num_of_actions *
2877 ++ DR_MODIFY_ACTION_SIZE;
2878 + send_info.write.lkey = 0;
2879 + send_info.remote_addr = action->rewrite.chunk->mr_addr;
2880 + send_info.rkey = action->rewrite.chunk->rkey;
2881 +diff --git a/drivers/net/ethernet/mellanox/mlx5/core/vport.c b/drivers/net/ethernet/mellanox/mlx5/core/vport.c
2882 +index 1faac31f74d0..23f879da9104 100644
2883 +--- a/drivers/net/ethernet/mellanox/mlx5/core/vport.c
2884 ++++ b/drivers/net/ethernet/mellanox/mlx5/core/vport.c
2885 +@@ -1071,6 +1071,9 @@ int mlx5_core_modify_hca_vport_context(struct mlx5_core_dev *dev,
2886 + MLX5_SET64(hca_vport_context, ctx, port_guid, req->port_guid);
2887 + if (req->field_select & MLX5_HCA_VPORT_SEL_NODE_GUID)
2888 + MLX5_SET64(hca_vport_context, ctx, node_guid, req->node_guid);
2889 ++ MLX5_SET(hca_vport_context, ctx, cap_mask1, req->cap_mask1);
2890 ++ MLX5_SET(hca_vport_context, ctx, cap_mask1_field_select,
2891 ++ req->cap_mask1_perm);
2892 + err = mlx5_cmd_exec(dev, in, in_sz, out, sizeof(out));
2893 + ex:
2894 + kfree(in);
2895 +diff --git a/drivers/net/ethernet/mellanox/mlxsw/pci.c b/drivers/net/ethernet/mellanox/mlxsw/pci.c
2896 +index 914c33e46fb4..e9ded1a6e131 100644
2897 +--- a/drivers/net/ethernet/mellanox/mlxsw/pci.c
2898 ++++ b/drivers/net/ethernet/mellanox/mlxsw/pci.c
2899 +@@ -1322,36 +1322,64 @@ static void mlxsw_pci_mbox_free(struct mlxsw_pci *mlxsw_pci,
2900 + mbox->mapaddr);
2901 + }
2902 +
2903 +-static int mlxsw_pci_sw_reset(struct mlxsw_pci *mlxsw_pci,
2904 +- const struct pci_device_id *id)
2905 ++static int mlxsw_pci_sys_ready_wait(struct mlxsw_pci *mlxsw_pci,
2906 ++ const struct pci_device_id *id,
2907 ++ u32 *p_sys_status)
2908 + {
2909 + unsigned long end;
2910 +- char mrsr_pl[MLXSW_REG_MRSR_LEN];
2911 +- int err;
2912 ++ u32 val;
2913 +
2914 +- mlxsw_reg_mrsr_pack(mrsr_pl);
2915 +- err = mlxsw_reg_write(mlxsw_pci->core, MLXSW_REG(mrsr), mrsr_pl);
2916 +- if (err)
2917 +- return err;
2918 + if (id->device == PCI_DEVICE_ID_MELLANOX_SWITCHX2) {
2919 + msleep(MLXSW_PCI_SW_RESET_TIMEOUT_MSECS);
2920 + return 0;
2921 + }
2922 +
2923 +- /* We must wait for the HW to become responsive once again. */
2924 ++ /* We must wait for the HW to become responsive. */
2925 + msleep(MLXSW_PCI_SW_RESET_WAIT_MSECS);
2926 +
2927 + end = jiffies + msecs_to_jiffies(MLXSW_PCI_SW_RESET_TIMEOUT_MSECS);
2928 + do {
2929 +- u32 val = mlxsw_pci_read32(mlxsw_pci, FW_READY);
2930 +-
2931 ++ val = mlxsw_pci_read32(mlxsw_pci, FW_READY);
2932 + if ((val & MLXSW_PCI_FW_READY_MASK) == MLXSW_PCI_FW_READY_MAGIC)
2933 + return 0;
2934 + cond_resched();
2935 + } while (time_before(jiffies, end));
2936 ++
2937 ++ *p_sys_status = val & MLXSW_PCI_FW_READY_MASK;
2938 ++
2939 + return -EBUSY;
2940 + }
2941 +
2942 ++static int mlxsw_pci_sw_reset(struct mlxsw_pci *mlxsw_pci,
2943 ++ const struct pci_device_id *id)
2944 ++{
2945 ++ struct pci_dev *pdev = mlxsw_pci->pdev;
2946 ++ char mrsr_pl[MLXSW_REG_MRSR_LEN];
2947 ++ u32 sys_status;
2948 ++ int err;
2949 ++
2950 ++ err = mlxsw_pci_sys_ready_wait(mlxsw_pci, id, &sys_status);
2951 ++ if (err) {
2952 ++ dev_err(&pdev->dev, "Failed to reach system ready status before reset. Status is 0x%x\n",
2953 ++ sys_status);
2954 ++ return err;
2955 ++ }
2956 ++
2957 ++ mlxsw_reg_mrsr_pack(mrsr_pl);
2958 ++ err = mlxsw_reg_write(mlxsw_pci->core, MLXSW_REG(mrsr), mrsr_pl);
2959 ++ if (err)
2960 ++ return err;
2961 ++
2962 ++ err = mlxsw_pci_sys_ready_wait(mlxsw_pci, id, &sys_status);
2963 ++ if (err) {
2964 ++ dev_err(&pdev->dev, "Failed to reach system ready status after reset. Status is 0x%x\n",
2965 ++ sys_status);
2966 ++ return err;
2967 ++ }
2968 ++
2969 ++ return 0;
2970 ++}
2971 ++
2972 + static int mlxsw_pci_alloc_irq_vectors(struct mlxsw_pci *mlxsw_pci)
2973 + {
2974 + int err;
2975 +diff --git a/drivers/net/ethernet/mellanox/mlxsw/spectrum_mr.c b/drivers/net/ethernet/mellanox/mlxsw/spectrum_mr.c
2976 +index 54275624718b..336e5ecc68f8 100644
2977 +--- a/drivers/net/ethernet/mellanox/mlxsw/spectrum_mr.c
2978 ++++ b/drivers/net/ethernet/mellanox/mlxsw/spectrum_mr.c
2979 +@@ -637,12 +637,12 @@ static int mlxsw_sp_mr_vif_resolve(struct mlxsw_sp_mr_table *mr_table,
2980 + return 0;
2981 +
2982 + err_erif_unresolve:
2983 +- list_for_each_entry_from_reverse(erve, &mr_vif->route_evif_list,
2984 +- vif_node)
2985 ++ list_for_each_entry_continue_reverse(erve, &mr_vif->route_evif_list,
2986 ++ vif_node)
2987 + mlxsw_sp_mr_route_evif_unresolve(mr_table, erve);
2988 + err_irif_unresolve:
2989 +- list_for_each_entry_from_reverse(irve, &mr_vif->route_ivif_list,
2990 +- vif_node)
2991 ++ list_for_each_entry_continue_reverse(irve, &mr_vif->route_ivif_list,
2992 ++ vif_node)
2993 + mlxsw_sp_mr_route_ivif_unresolve(mr_table, irve);
2994 + mr_vif->rif = NULL;
2995 + return err;
2996 +diff --git a/drivers/net/ethernet/realtek/r8169_main.c b/drivers/net/ethernet/realtek/r8169_main.c
2997 +index 2d2d22f86dc6..cab63828643a 100644
2998 +--- a/drivers/net/ethernet/realtek/r8169_main.c
2999 ++++ b/drivers/net/ethernet/realtek/r8169_main.c
3000 +@@ -6579,7 +6579,7 @@ static int rtl_alloc_irq(struct rtl8169_private *tp)
3001 + RTL_W8(tp, Config2, RTL_R8(tp, Config2) & ~MSIEnable);
3002 + rtl_lock_config_regs(tp);
3003 + /* fall through */
3004 +- case RTL_GIGA_MAC_VER_07 ... RTL_GIGA_MAC_VER_24:
3005 ++ case RTL_GIGA_MAC_VER_07 ... RTL_GIGA_MAC_VER_17:
3006 + flags = PCI_IRQ_LEGACY;
3007 + break;
3008 + default:
3009 +@@ -6670,6 +6670,13 @@ static int r8169_mdio_register(struct rtl8169_private *tp)
3010 + if (!tp->phydev) {
3011 + mdiobus_unregister(new_bus);
3012 + return -ENODEV;
3013 ++ } else if (!tp->phydev->drv) {
3014 ++ /* Most chip versions fail with the genphy driver.
3015 ++ * Therefore ensure that the dedicated PHY driver is loaded.
3016 ++ */
3017 ++ dev_err(&pdev->dev, "realtek.ko not loaded, maybe it needs to be added to initramfs?\n");
3018 ++ mdiobus_unregister(new_bus);
3019 ++ return -EUNATCH;
3020 + }
3021 +
3022 + /* PHY will be woken up in rtl_open() */
3023 +@@ -6831,15 +6838,6 @@ static int rtl_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
3024 + int chipset, region;
3025 + int jumbo_max, rc;
3026 +
3027 +- /* Some tools for creating an initramfs don't consider softdeps, then
3028 +- * r8169.ko may be in initramfs, but realtek.ko not. Then the generic
3029 +- * PHY driver is used that doesn't work with most chip versions.
3030 +- */
3031 +- if (!driver_find("RTL8201CP Ethernet", &mdio_bus_type)) {
3032 +- dev_err(&pdev->dev, "realtek.ko not loaded, maybe it needs to be added to initramfs?\n");
3033 +- return -ENOENT;
3034 +- }
3035 +-
3036 + dev = devm_alloc_etherdev(&pdev->dev, sizeof (*tp));
3037 + if (!dev)
3038 + return -ENOMEM;
3039 +diff --git a/drivers/net/ethernet/samsung/sxgbe/sxgbe_main.c b/drivers/net/ethernet/samsung/sxgbe/sxgbe_main.c
3040 +index 52ed111d98f4..15e3f668218b 100644
3041 +--- a/drivers/net/ethernet/samsung/sxgbe/sxgbe_main.c
3042 ++++ b/drivers/net/ethernet/samsung/sxgbe/sxgbe_main.c
3043 +@@ -2279,7 +2279,7 @@ static int __init sxgbe_cmdline_opt(char *str)
3044 + if (!str || !*str)
3045 + return -EINVAL;
3046 + while ((opt = strsep(&str, ",")) != NULL) {
3047 +- if (!strncmp(opt, "eee_timer:", 6)) {
3048 ++ if (!strncmp(opt, "eee_timer:", 10)) {
3049 + if (kstrtoint(opt + 10, 0, &eee_timer))
3050 + goto err;
3051 + }
3052 +diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c
3053 +index dc50ba13a746..2d5573b3dee1 100644
3054 +--- a/drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c
3055 ++++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c
3056 +@@ -1411,7 +1411,7 @@ static int rk_gmac_probe(struct platform_device *pdev)
3057 +
3058 + ret = rk_gmac_clk_init(plat_dat);
3059 + if (ret)
3060 +- return ret;
3061 ++ goto err_remove_config_dt;
3062 +
3063 + ret = rk_gmac_powerup(plat_dat->bsp_priv);
3064 + if (ret)
3065 +diff --git a/drivers/net/geneve.c b/drivers/net/geneve.c
3066 +index 75757e9954ba..09f279c0182b 100644
3067 +--- a/drivers/net/geneve.c
3068 ++++ b/drivers/net/geneve.c
3069 +@@ -1845,8 +1845,6 @@ static void geneve_destroy_tunnels(struct net *net, struct list_head *head)
3070 + if (!net_eq(dev_net(geneve->dev), net))
3071 + unregister_netdevice_queue(geneve->dev, head);
3072 + }
3073 +-
3074 +- WARN_ON_ONCE(!list_empty(&gn->sock_list));
3075 + }
3076 +
3077 + static void __net_exit geneve_exit_batch_net(struct list_head *net_list)
3078 +@@ -1861,6 +1859,12 @@ static void __net_exit geneve_exit_batch_net(struct list_head *net_list)
3079 + /* unregister the devices gathered above */
3080 + unregister_netdevice_many(&list);
3081 + rtnl_unlock();
3082 ++
3083 ++ list_for_each_entry(net, net_list, exit_list) {
3084 ++ const struct geneve_net *gn = net_generic(net, geneve_net_id);
3085 ++
3086 ++ WARN_ON_ONCE(!list_empty(&gn->sock_list));
3087 ++ }
3088 + }
3089 +
3090 + static struct pernet_operations geneve_net_ops = {
3091 +diff --git a/drivers/net/ifb.c b/drivers/net/ifb.c
3092 +index 242b9b0943f8..7fe306e76281 100644
3093 +--- a/drivers/net/ifb.c
3094 ++++ b/drivers/net/ifb.c
3095 +@@ -75,7 +75,7 @@ static void ifb_ri_tasklet(unsigned long _txp)
3096 + }
3097 +
3098 + while ((skb = __skb_dequeue(&txp->tq)) != NULL) {
3099 +- skb->tc_redirected = 0;
3100 ++ skb->redirected = 0;
3101 + skb->tc_skip_classify = 1;
3102 +
3103 + u64_stats_update_begin(&txp->tsync);
3104 +@@ -96,7 +96,7 @@ static void ifb_ri_tasklet(unsigned long _txp)
3105 + rcu_read_unlock();
3106 + skb->skb_iif = txp->dev->ifindex;
3107 +
3108 +- if (!skb->tc_from_ingress) {
3109 ++ if (!skb->from_ingress) {
3110 + dev_queue_xmit(skb);
3111 + } else {
3112 + skb_pull_rcsum(skb, skb->mac_len);
3113 +@@ -243,7 +243,7 @@ static netdev_tx_t ifb_xmit(struct sk_buff *skb, struct net_device *dev)
3114 + txp->rx_bytes += skb->len;
3115 + u64_stats_update_end(&txp->rsync);
3116 +
3117 +- if (!skb->tc_redirected || !skb->skb_iif) {
3118 ++ if (!skb->redirected || !skb->skb_iif) {
3119 + dev_kfree_skb(skb);
3120 + dev->stats.rx_dropped++;
3121 + return NETDEV_TX_OK;
3122 +diff --git a/drivers/net/macsec.c b/drivers/net/macsec.c
3123 +index 57ef24546e96..7644aaa68489 100644
3124 +--- a/drivers/net/macsec.c
3125 ++++ b/drivers/net/macsec.c
3126 +@@ -16,6 +16,7 @@
3127 + #include <net/genetlink.h>
3128 + #include <net/sock.h>
3129 + #include <net/gro_cells.h>
3130 ++#include <linux/if_arp.h>
3131 +
3132 + #include <uapi/linux/if_macsec.h>
3133 +
3134 +@@ -3236,6 +3237,8 @@ static int macsec_newlink(struct net *net, struct net_device *dev,
3135 + real_dev = __dev_get_by_index(net, nla_get_u32(tb[IFLA_LINK]));
3136 + if (!real_dev)
3137 + return -ENODEV;
3138 ++ if (real_dev->type != ARPHRD_ETHER)
3139 ++ return -EINVAL;
3140 +
3141 + dev->priv_flags |= IFF_MACSEC;
3142 +
3143 +diff --git a/drivers/net/phy/dp83867.c b/drivers/net/phy/dp83867.c
3144 +index 01cf71358359..84621a58fa56 100644
3145 +--- a/drivers/net/phy/dp83867.c
3146 ++++ b/drivers/net/phy/dp83867.c
3147 +@@ -28,7 +28,8 @@
3148 + #define DP83867_CTRL 0x1f
3149 +
3150 + /* Extended Registers */
3151 +-#define DP83867_CFG4 0x0031
3152 ++#define DP83867_FLD_THR_CFG 0x002e
3153 ++#define DP83867_CFG4 0x0031
3154 + #define DP83867_CFG4_SGMII_ANEG_MASK (BIT(5) | BIT(6))
3155 + #define DP83867_CFG4_SGMII_ANEG_TIMER_11MS (3 << 5)
3156 + #define DP83867_CFG4_SGMII_ANEG_TIMER_800US (2 << 5)
3157 +@@ -91,6 +92,7 @@
3158 + #define DP83867_STRAP_STS2_CLK_SKEW_RX_MASK GENMASK(2, 0)
3159 + #define DP83867_STRAP_STS2_CLK_SKEW_RX_SHIFT 0
3160 + #define DP83867_STRAP_STS2_CLK_SKEW_NONE BIT(2)
3161 ++#define DP83867_STRAP_STS2_STRAP_FLD BIT(10)
3162 +
3163 + /* PHY CTRL bits */
3164 + #define DP83867_PHYCR_FIFO_DEPTH_SHIFT 14
3165 +@@ -123,6 +125,9 @@
3166 + /* CFG4 bits */
3167 + #define DP83867_CFG4_PORT_MIRROR_EN BIT(0)
3168 +
3169 ++/* FLD_THR_CFG */
3170 ++#define DP83867_FLD_THR_CFG_ENERGY_LOST_THR_MASK 0x7
3171 ++
3172 + enum {
3173 + DP83867_PORT_MIRROING_KEEP,
3174 + DP83867_PORT_MIRROING_EN,
3175 +@@ -459,6 +464,20 @@ static int dp83867_config_init(struct phy_device *phydev)
3176 + phy_clear_bits_mmd(phydev, DP83867_DEVADDR, DP83867_CFG4,
3177 + BIT(7));
3178 +
3179 ++ bs = phy_read_mmd(phydev, DP83867_DEVADDR, DP83867_STRAP_STS2);
3180 ++ if (bs & DP83867_STRAP_STS2_STRAP_FLD) {
3181 ++ /* When using strap to enable FLD, the ENERGY_LOST_FLD_THR will
3182 ++ * be set to 0x2. This may causes the PHY link to be unstable -
3183 ++ * the default value 0x1 need to be restored.
3184 ++ */
3185 ++ ret = phy_modify_mmd(phydev, DP83867_DEVADDR,
3186 ++ DP83867_FLD_THR_CFG,
3187 ++ DP83867_FLD_THR_CFG_ENERGY_LOST_THR_MASK,
3188 ++ 0x1);
3189 ++ if (ret)
3190 ++ return ret;
3191 ++ }
3192 ++
3193 + if (phy_interface_is_rgmii(phydev)) {
3194 + val = phy_read(phydev, MII_DP83867_PHYCTRL);
3195 + if (val < 0)
3196 +diff --git a/drivers/net/phy/mdio-bcm-unimac.c b/drivers/net/phy/mdio-bcm-unimac.c
3197 +index 4a28fb29adaa..fbd36891ee64 100644
3198 +--- a/drivers/net/phy/mdio-bcm-unimac.c
3199 ++++ b/drivers/net/phy/mdio-bcm-unimac.c
3200 +@@ -242,11 +242,9 @@ static int unimac_mdio_probe(struct platform_device *pdev)
3201 + return -ENOMEM;
3202 + }
3203 +
3204 +- priv->clk = devm_clk_get(&pdev->dev, NULL);
3205 +- if (PTR_ERR(priv->clk) == -EPROBE_DEFER)
3206 ++ priv->clk = devm_clk_get_optional(&pdev->dev, NULL);
3207 ++ if (IS_ERR(priv->clk))
3208 + return PTR_ERR(priv->clk);
3209 +- else
3210 +- priv->clk = NULL;
3211 +
3212 + ret = clk_prepare_enable(priv->clk);
3213 + if (ret)
3214 +diff --git a/drivers/net/phy/mdio-mux-bcm-iproc.c b/drivers/net/phy/mdio-mux-bcm-iproc.c
3215 +index 88d409e48c1f..aad6809ebe39 100644
3216 +--- a/drivers/net/phy/mdio-mux-bcm-iproc.c
3217 ++++ b/drivers/net/phy/mdio-mux-bcm-iproc.c
3218 +@@ -288,8 +288,13 @@ static int mdio_mux_iproc_suspend(struct device *dev)
3219 + static int mdio_mux_iproc_resume(struct device *dev)
3220 + {
3221 + struct iproc_mdiomux_desc *md = dev_get_drvdata(dev);
3222 ++ int rc;
3223 +
3224 +- clk_prepare_enable(md->core_clk);
3225 ++ rc = clk_prepare_enable(md->core_clk);
3226 ++ if (rc) {
3227 ++ dev_err(md->dev, "failed to enable core clk\n");
3228 ++ return rc;
3229 ++ }
3230 + mdio_mux_iproc_config(md);
3231 +
3232 + return 0;
3233 +diff --git a/drivers/net/usb/qmi_wwan.c b/drivers/net/usb/qmi_wwan.c
3234 +index 5754bb6ca0ee..6c738a271257 100644
3235 +--- a/drivers/net/usb/qmi_wwan.c
3236 ++++ b/drivers/net/usb/qmi_wwan.c
3237 +@@ -1210,6 +1210,7 @@ static const struct usb_device_id products[] = {
3238 + {QMI_FIXED_INTF(0x1435, 0xd182, 5)}, /* Wistron NeWeb D18 */
3239 + {QMI_FIXED_INTF(0x1435, 0xd191, 4)}, /* Wistron NeWeb D19Q1 */
3240 + {QMI_QUIRK_SET_DTR(0x1508, 0x1001, 4)}, /* Fibocom NL668 series */
3241 ++ {QMI_FIXED_INTF(0x1690, 0x7588, 4)}, /* ASKEY WWHC050 */
3242 + {QMI_FIXED_INTF(0x16d8, 0x6003, 0)}, /* CMOTech 6003 */
3243 + {QMI_FIXED_INTF(0x16d8, 0x6007, 0)}, /* CMOTech CHE-628S */
3244 + {QMI_FIXED_INTF(0x16d8, 0x6008, 0)}, /* CMOTech CMU-301 */
3245 +diff --git a/drivers/net/veth.c b/drivers/net/veth.c
3246 +index a552df37a347..bad9e03cd32e 100644
3247 +--- a/drivers/net/veth.c
3248 ++++ b/drivers/net/veth.c
3249 +@@ -328,7 +328,7 @@ static void veth_get_stats64(struct net_device *dev,
3250 + rcu_read_lock();
3251 + peer = rcu_dereference(priv->peer);
3252 + if (peer) {
3253 +- tot->rx_dropped += veth_stats_tx(peer, &packets, &bytes);
3254 ++ veth_stats_tx(peer, &packets, &bytes);
3255 + tot->rx_bytes += bytes;
3256 + tot->rx_packets += packets;
3257 +
3258 +diff --git a/drivers/net/vxlan.c b/drivers/net/vxlan.c
3259 +index 1c5159dcc720..8b986079d650 100644
3260 +--- a/drivers/net/vxlan.c
3261 ++++ b/drivers/net/vxlan.c
3262 +@@ -2778,10 +2778,19 @@ static void vxlan_vs_add_dev(struct vxlan_sock *vs, struct vxlan_dev *vxlan,
3263 + /* Setup stats when device is created */
3264 + static int vxlan_init(struct net_device *dev)
3265 + {
3266 ++ struct vxlan_dev *vxlan = netdev_priv(dev);
3267 ++ int err;
3268 ++
3269 + dev->tstats = netdev_alloc_pcpu_stats(struct pcpu_sw_netstats);
3270 + if (!dev->tstats)
3271 + return -ENOMEM;
3272 +
3273 ++ err = gro_cells_init(&vxlan->gro_cells, dev);
3274 ++ if (err) {
3275 ++ free_percpu(dev->tstats);
3276 ++ return err;
3277 ++ }
3278 ++
3279 + return 0;
3280 + }
3281 +
3282 +@@ -3042,8 +3051,6 @@ static void vxlan_setup(struct net_device *dev)
3283 +
3284 + vxlan->dev = dev;
3285 +
3286 +- gro_cells_init(&vxlan->gro_cells, dev);
3287 +-
3288 + for (h = 0; h < FDB_HASH_SIZE; ++h) {
3289 + spin_lock_init(&vxlan->hash_lock[h]);
3290 + INIT_HLIST_HEAD(&vxlan->fdb_head[h]);
3291 +diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8188ee/trx.h b/drivers/net/wireless/realtek/rtlwifi/rtl8188ee/trx.h
3292 +index 917729807514..e17f70b4d199 100644
3293 +--- a/drivers/net/wireless/realtek/rtlwifi/rtl8188ee/trx.h
3294 ++++ b/drivers/net/wireless/realtek/rtlwifi/rtl8188ee/trx.h
3295 +@@ -561,6 +561,7 @@ static inline void clear_pci_tx_desc_content(__le32 *__pdesc, int _size)
3296 + rxmcs == DESC92C_RATE11M)
3297 +
3298 + struct phy_status_rpt {
3299 ++ u8 padding[2];
3300 + u8 ch_corr[2];
3301 + u8 cck_sig_qual_ofdm_pwdb_all;
3302 + u8 cck_agc_rpt_ofdm_cfosho_a;
3303 +diff --git a/drivers/nfc/fdp/fdp.c b/drivers/nfc/fdp/fdp.c
3304 +index 0cc9ac856fe2..ed2123129e0e 100644
3305 +--- a/drivers/nfc/fdp/fdp.c
3306 ++++ b/drivers/nfc/fdp/fdp.c
3307 +@@ -184,7 +184,7 @@ static int fdp_nci_send_patch(struct nci_dev *ndev, u8 conn_id, u8 type)
3308 + const struct firmware *fw;
3309 + struct sk_buff *skb;
3310 + unsigned long len;
3311 +- u8 max_size, payload_size;
3312 ++ int max_size, payload_size;
3313 + int rc = 0;
3314 +
3315 + if ((type == NCI_PATCH_TYPE_OTP && !info->otp_patch) ||
3316 +@@ -207,8 +207,7 @@ static int fdp_nci_send_patch(struct nci_dev *ndev, u8 conn_id, u8 type)
3317 +
3318 + while (len) {
3319 +
3320 +- payload_size = min_t(unsigned long, (unsigned long) max_size,
3321 +- len);
3322 ++ payload_size = min_t(unsigned long, max_size, len);
3323 +
3324 + skb = nci_skb_alloc(ndev, (NCI_CTRL_HDR_SIZE + payload_size),
3325 + GFP_KERNEL);
3326 +diff --git a/drivers/of/of_mdio.c b/drivers/of/of_mdio.c
3327 +index fc757ef6eadc..a27234c58ec5 100644
3328 +--- a/drivers/of/of_mdio.c
3329 ++++ b/drivers/of/of_mdio.c
3330 +@@ -269,6 +269,7 @@ int of_mdiobus_register(struct mii_bus *mdio, struct device_node *np)
3331 + rc = of_mdiobus_register_phy(mdio, child, addr);
3332 + if (rc && rc != -ENODEV)
3333 + goto unregister;
3334 ++ break;
3335 + }
3336 + }
3337 + }
3338 +diff --git a/drivers/scsi/ipr.c b/drivers/scsi/ipr.c
3339 +index 079c04bc448a..7a57b61f0340 100644
3340 +--- a/drivers/scsi/ipr.c
3341 ++++ b/drivers/scsi/ipr.c
3342 +@@ -9947,6 +9947,7 @@ static void ipr_init_ioa_cfg(struct ipr_ioa_cfg *ioa_cfg,
3343 + ioa_cfg->max_devs_supported = ipr_max_devs;
3344 +
3345 + if (ioa_cfg->sis64) {
3346 ++ host->max_channel = IPR_MAX_SIS64_BUSES;
3347 + host->max_id = IPR_MAX_SIS64_TARGETS_PER_BUS;
3348 + host->max_lun = IPR_MAX_SIS64_LUNS_PER_TARGET;
3349 + if (ipr_max_devs > IPR_MAX_SIS64_DEVS)
3350 +@@ -9955,6 +9956,7 @@ static void ipr_init_ioa_cfg(struct ipr_ioa_cfg *ioa_cfg,
3351 + + ((sizeof(struct ipr_config_table_entry64)
3352 + * ioa_cfg->max_devs_supported)));
3353 + } else {
3354 ++ host->max_channel = IPR_VSET_BUS;
3355 + host->max_id = IPR_MAX_NUM_TARGETS_PER_BUS;
3356 + host->max_lun = IPR_MAX_NUM_LUNS_PER_TARGET;
3357 + if (ipr_max_devs > IPR_MAX_PHYSICAL_DEVS)
3358 +@@ -9964,7 +9966,6 @@ static void ipr_init_ioa_cfg(struct ipr_ioa_cfg *ioa_cfg,
3359 + * ioa_cfg->max_devs_supported)));
3360 + }
3361 +
3362 +- host->max_channel = IPR_VSET_BUS;
3363 + host->unique_id = host->host_no;
3364 + host->max_cmd_len = IPR_MAX_CDB_LEN;
3365 + host->can_queue = ioa_cfg->max_cmds;
3366 +diff --git a/drivers/scsi/ipr.h b/drivers/scsi/ipr.h
3367 +index a67baeb36d1f..b97aa9ac2ffe 100644
3368 +--- a/drivers/scsi/ipr.h
3369 ++++ b/drivers/scsi/ipr.h
3370 +@@ -1300,6 +1300,7 @@ struct ipr_resource_entry {
3371 + #define IPR_ARRAY_VIRTUAL_BUS 0x1
3372 + #define IPR_VSET_VIRTUAL_BUS 0x2
3373 + #define IPR_IOAFP_VIRTUAL_BUS 0x3
3374 ++#define IPR_MAX_SIS64_BUSES 0x4
3375 +
3376 + #define IPR_GET_RES_PHYS_LOC(res) \
3377 + (((res)->bus << 24) | ((res)->target << 8) | (res)->lun)
3378 +diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c
3379 +index 902b649fc8ef..a63ff2887ebf 100644
3380 +--- a/drivers/scsi/sd.c
3381 ++++ b/drivers/scsi/sd.c
3382 +@@ -3181,9 +3181,11 @@ static int sd_revalidate_disk(struct gendisk *disk)
3383 + if (sd_validate_opt_xfer_size(sdkp, dev_max)) {
3384 + q->limits.io_opt = logical_to_bytes(sdp, sdkp->opt_xfer_blocks);
3385 + rw_max = logical_to_sectors(sdp, sdkp->opt_xfer_blocks);
3386 +- } else
3387 ++ } else {
3388 ++ q->limits.io_opt = 0;
3389 + rw_max = min_not_zero(logical_to_sectors(sdp, dev_max),
3390 + (sector_t)BLK_DEF_MAX_SECTORS);
3391 ++ }
3392 +
3393 + /* Do not exceed controller limit */
3394 + rw_max = min(rw_max, queue_max_hw_sectors(q));
3395 +diff --git a/drivers/soc/samsung/exynos-chipid.c b/drivers/soc/samsung/exynos-chipid.c
3396 +index b89c26a71c6e..1814f44c7d70 100644
3397 +--- a/drivers/soc/samsung/exynos-chipid.c
3398 ++++ b/drivers/soc/samsung/exynos-chipid.c
3399 +@@ -59,7 +59,7 @@ static int __init exynos_chipid_early_init(void)
3400 + syscon = of_find_compatible_node(NULL, NULL,
3401 + "samsung,exynos4210-chipid");
3402 + if (!syscon)
3403 +- return ENODEV;
3404 ++ return -ENODEV;
3405 +
3406 + regmap = device_node_to_regmap(syscon);
3407 + of_node_put(syscon);
3408 +diff --git a/drivers/staging/kpc2000/kpc2000/core.c b/drivers/staging/kpc2000/kpc2000/core.c
3409 +index 0a23727d0dc3..871441658f0e 100644
3410 +--- a/drivers/staging/kpc2000/kpc2000/core.c
3411 ++++ b/drivers/staging/kpc2000/kpc2000/core.c
3412 +@@ -110,10 +110,10 @@ static ssize_t cpld_reconfigure(struct device *dev,
3413 + const char *buf, size_t count)
3414 + {
3415 + struct kp2000_device *pcard = dev_get_drvdata(dev);
3416 +- long wr_val;
3417 ++ unsigned long wr_val;
3418 + int rv;
3419 +
3420 +- rv = kstrtol(buf, 0, &wr_val);
3421 ++ rv = kstrtoul(buf, 0, &wr_val);
3422 + if (rv < 0)
3423 + return rv;
3424 + if (wr_val > 7)
3425 +diff --git a/drivers/staging/rtl8188eu/os_dep/usb_intf.c b/drivers/staging/rtl8188eu/os_dep/usb_intf.c
3426 +index 845c8817281c..f7f09c0d273f 100644
3427 +--- a/drivers/staging/rtl8188eu/os_dep/usb_intf.c
3428 ++++ b/drivers/staging/rtl8188eu/os_dep/usb_intf.c
3429 +@@ -32,6 +32,7 @@ static const struct usb_device_id rtw_usb_id_tbl[] = {
3430 + /****** 8188EUS ********/
3431 + {USB_DEVICE(0x056e, 0x4008)}, /* Elecom WDC-150SU2M */
3432 + {USB_DEVICE(0x07b8, 0x8179)}, /* Abocom - Abocom */
3433 ++ {USB_DEVICE(0x0B05, 0x18F0)}, /* ASUS USB-N10 Nano B1 */
3434 + {USB_DEVICE(0x2001, 0x330F)}, /* DLink DWA-125 REV D1 */
3435 + {USB_DEVICE(0x2001, 0x3310)}, /* Dlink DWA-123 REV D1 */
3436 + {USB_DEVICE(0x2001, 0x3311)}, /* DLink GO-USB-N150 REV B1 */
3437 +diff --git a/drivers/staging/wfx/Documentation/devicetree/bindings/net/wireless/siliabs,wfx.txt b/drivers/staging/wfx/Documentation/devicetree/bindings/net/wireless/siliabs,wfx.txt
3438 +index 26de6762b942..52f97673da1e 100644
3439 +--- a/drivers/staging/wfx/Documentation/devicetree/bindings/net/wireless/siliabs,wfx.txt
3440 ++++ b/drivers/staging/wfx/Documentation/devicetree/bindings/net/wireless/siliabs,wfx.txt
3441 +@@ -6,7 +6,7 @@ SPI
3442 + You have to declare the WFxxx chip in your device tree.
3443 +
3444 + Required properties:
3445 +- - compatible: Should be "silabs,wfx-spi"
3446 ++ - compatible: Should be "silabs,wf200"
3447 + - reg: Chip select address of device
3448 + - spi-max-frequency: Maximum SPI clocking speed of device in Hz
3449 + - interrupts-extended: Should contain interrupt line (interrupt-parent +
3450 +@@ -15,6 +15,7 @@ Required properties:
3451 + Optional properties:
3452 + - reset-gpios: phandle of gpio that will be used to reset chip during probe.
3453 + Without this property, you may encounter issues with warm boot.
3454 ++ (Legacy: when compatible == "silabs,wfx-spi", the gpio is inverted.)
3455 +
3456 + Please consult Documentation/devicetree/bindings/spi/spi-bus.txt for optional
3457 + SPI connection related properties,
3458 +@@ -23,12 +24,12 @@ Example:
3459 +
3460 + &spi1 {
3461 + wfx {
3462 +- compatible = "silabs,wfx-spi";
3463 ++ compatible = "silabs,wf200";
3464 + pinctrl-names = "default";
3465 + pinctrl-0 = <&wfx_irq &wfx_gpios>;
3466 + interrupts-extended = <&gpio 16 IRQ_TYPE_EDGE_RISING>;
3467 + wakeup-gpios = <&gpio 12 GPIO_ACTIVE_HIGH>;
3468 +- reset-gpios = <&gpio 13 GPIO_ACTIVE_HIGH>;
3469 ++ reset-gpios = <&gpio 13 GPIO_ACTIVE_LOW>;
3470 + reg = <0>;
3471 + spi-max-frequency = <42000000>;
3472 + };
3473 +diff --git a/drivers/staging/wfx/bus_sdio.c b/drivers/staging/wfx/bus_sdio.c
3474 +index f8901164c206..5450bd5e1b5d 100644
3475 +--- a/drivers/staging/wfx/bus_sdio.c
3476 ++++ b/drivers/staging/wfx/bus_sdio.c
3477 +@@ -200,25 +200,23 @@ static int wfx_sdio_probe(struct sdio_func *func,
3478 + if (ret)
3479 + goto err0;
3480 +
3481 +- ret = wfx_sdio_irq_subscribe(bus);
3482 +- if (ret)
3483 +- goto err1;
3484 +-
3485 + bus->core = wfx_init_common(&func->dev, &wfx_sdio_pdata,
3486 + &wfx_sdio_hwbus_ops, bus);
3487 + if (!bus->core) {
3488 + ret = -EIO;
3489 +- goto err2;
3490 ++ goto err1;
3491 + }
3492 +
3493 ++ ret = wfx_sdio_irq_subscribe(bus);
3494 ++ if (ret)
3495 ++ goto err1;
3496 ++
3497 + ret = wfx_probe(bus->core);
3498 + if (ret)
3499 +- goto err3;
3500 ++ goto err2;
3501 +
3502 + return 0;
3503 +
3504 +-err3:
3505 +- wfx_free_common(bus->core);
3506 + err2:
3507 + wfx_sdio_irq_unsubscribe(bus);
3508 + err1:
3509 +@@ -234,7 +232,6 @@ static void wfx_sdio_remove(struct sdio_func *func)
3510 + struct wfx_sdio_priv *bus = sdio_get_drvdata(func);
3511 +
3512 + wfx_release(bus->core);
3513 +- wfx_free_common(bus->core);
3514 + wfx_sdio_irq_unsubscribe(bus);
3515 + sdio_claim_host(func);
3516 + sdio_disable_func(func);
3517 +diff --git a/drivers/staging/wfx/bus_spi.c b/drivers/staging/wfx/bus_spi.c
3518 +index ab0cda1e124f..29a8556c3dcd 100644
3519 +--- a/drivers/staging/wfx/bus_spi.c
3520 ++++ b/drivers/staging/wfx/bus_spi.c
3521 +@@ -27,6 +27,8 @@ MODULE_PARM_DESC(gpio_reset, "gpio number for reset. -1 for none.");
3522 + #define SET_WRITE 0x7FFF /* usage: and operation */
3523 + #define SET_READ 0x8000 /* usage: or operation */
3524 +
3525 ++#define WFX_RESET_INVERTED 1
3526 ++
3527 + static const struct wfx_platform_data wfx_spi_pdata = {
3528 + .file_fw = "wfm_wf200",
3529 + .file_pds = "wf200.pds",
3530 +@@ -152,6 +154,11 @@ static void wfx_spi_request_rx(struct work_struct *work)
3531 + wfx_bh_request_rx(bus->core);
3532 + }
3533 +
3534 ++static void wfx_flush_irq_work(void *w)
3535 ++{
3536 ++ flush_work(w);
3537 ++}
3538 ++
3539 + static size_t wfx_spi_align_size(void *priv, size_t size)
3540 + {
3541 + // Most of SPI controllers avoid DMA if buffer size is not 32bit aligned
3542 +@@ -199,28 +206,31 @@ static int wfx_spi_probe(struct spi_device *func)
3543 + if (!bus->gpio_reset) {
3544 + dev_warn(&func->dev, "try to load firmware anyway\n");
3545 + } else {
3546 +- gpiod_set_value(bus->gpio_reset, 0);
3547 +- udelay(100);
3548 ++ if (spi_get_device_id(func)->driver_data & WFX_RESET_INVERTED)
3549 ++ gpiod_toggle_active_low(bus->gpio_reset);
3550 + gpiod_set_value(bus->gpio_reset, 1);
3551 ++ udelay(100);
3552 ++ gpiod_set_value(bus->gpio_reset, 0);
3553 + udelay(2000);
3554 + }
3555 +
3556 +- ret = devm_request_irq(&func->dev, func->irq, wfx_spi_irq_handler,
3557 +- IRQF_TRIGGER_RISING, "wfx", bus);
3558 +- if (ret)
3559 +- return ret;
3560 +-
3561 + INIT_WORK(&bus->request_rx, wfx_spi_request_rx);
3562 + bus->core = wfx_init_common(&func->dev, &wfx_spi_pdata,
3563 + &wfx_spi_hwbus_ops, bus);
3564 + if (!bus->core)
3565 + return -EIO;
3566 +
3567 +- ret = wfx_probe(bus->core);
3568 ++ ret = devm_add_action_or_reset(&func->dev, wfx_flush_irq_work,
3569 ++ &bus->request_rx);
3570 + if (ret)
3571 +- wfx_free_common(bus->core);
3572 ++ return ret;
3573 +
3574 +- return ret;
3575 ++ ret = devm_request_irq(&func->dev, func->irq, wfx_spi_irq_handler,
3576 ++ IRQF_TRIGGER_RISING, "wfx", bus);
3577 ++ if (ret)
3578 ++ return ret;
3579 ++
3580 ++ return wfx_probe(bus->core);
3581 + }
3582 +
3583 + /* Disconnect Function to be called by SPI stack when device is disconnected */
3584 +@@ -229,11 +239,6 @@ static int wfx_spi_disconnect(struct spi_device *func)
3585 + struct wfx_spi_priv *bus = spi_get_drvdata(func);
3586 +
3587 + wfx_release(bus->core);
3588 +- wfx_free_common(bus->core);
3589 +- // A few IRQ will be sent during device release. Hopefully, no IRQ
3590 +- // should happen after wdev/wvif are released.
3591 +- devm_free_irq(&func->dev, func->irq, bus);
3592 +- flush_work(&bus->request_rx);
3593 + return 0;
3594 + }
3595 +
3596 +@@ -243,14 +248,16 @@ static int wfx_spi_disconnect(struct spi_device *func)
3597 + * stripped.
3598 + */
3599 + static const struct spi_device_id wfx_spi_id[] = {
3600 +- { "wfx-spi", 0 },
3601 ++ { "wfx-spi", WFX_RESET_INVERTED },
3602 ++ { "wf200", 0 },
3603 + { },
3604 + };
3605 + MODULE_DEVICE_TABLE(spi, wfx_spi_id);
3606 +
3607 + #ifdef CONFIG_OF
3608 + static const struct of_device_id wfx_spi_of_match[] = {
3609 +- { .compatible = "silabs,wfx-spi" },
3610 ++ { .compatible = "silabs,wfx-spi", .data = (void *)WFX_RESET_INVERTED },
3611 ++ { .compatible = "silabs,wf200" },
3612 + { },
3613 + };
3614 + MODULE_DEVICE_TABLE(of, wfx_spi_of_match);
3615 +diff --git a/drivers/staging/wfx/main.c b/drivers/staging/wfx/main.c
3616 +index 3b47b6c21ea1..600195b9d730 100644
3617 +--- a/drivers/staging/wfx/main.c
3618 ++++ b/drivers/staging/wfx/main.c
3619 +@@ -261,6 +261,16 @@ static int wfx_send_pdata_pds(struct wfx_dev *wdev)
3620 + return ret;
3621 + }
3622 +
3623 ++static void wfx_free_common(void *data)
3624 ++{
3625 ++ struct wfx_dev *wdev = data;
3626 ++
3627 ++ mutex_destroy(&wdev->rx_stats_lock);
3628 ++ mutex_destroy(&wdev->conf_mutex);
3629 ++ wfx_tx_queues_deinit(wdev);
3630 ++ ieee80211_free_hw(wdev->hw);
3631 ++}
3632 ++
3633 + struct wfx_dev *wfx_init_common(struct device *dev,
3634 + const struct wfx_platform_data *pdata,
3635 + const struct hwbus_ops *hwbus_ops,
3636 +@@ -326,15 +336,10 @@ struct wfx_dev *wfx_init_common(struct device *dev,
3637 + wfx_init_hif_cmd(&wdev->hif_cmd);
3638 + wfx_tx_queues_init(wdev);
3639 +
3640 +- return wdev;
3641 +-}
3642 ++ if (devm_add_action_or_reset(dev, wfx_free_common, wdev))
3643 ++ return NULL;
3644 +
3645 +-void wfx_free_common(struct wfx_dev *wdev)
3646 +-{
3647 +- mutex_destroy(&wdev->rx_stats_lock);
3648 +- mutex_destroy(&wdev->conf_mutex);
3649 +- wfx_tx_queues_deinit(wdev);
3650 +- ieee80211_free_hw(wdev->hw);
3651 ++ return wdev;
3652 + }
3653 +
3654 + int wfx_probe(struct wfx_dev *wdev)
3655 +diff --git a/drivers/staging/wfx/main.h b/drivers/staging/wfx/main.h
3656 +index 875f8c227803..9c9410072def 100644
3657 +--- a/drivers/staging/wfx/main.h
3658 ++++ b/drivers/staging/wfx/main.h
3659 +@@ -34,7 +34,6 @@ struct wfx_dev *wfx_init_common(struct device *dev,
3660 + const struct wfx_platform_data *pdata,
3661 + const struct hwbus_ops *hwbus_ops,
3662 + void *hwbus_priv);
3663 +-void wfx_free_common(struct wfx_dev *wdev);
3664 +
3665 + int wfx_probe(struct wfx_dev *wdev);
3666 + void wfx_release(struct wfx_dev *wdev);
3667 +diff --git a/drivers/staging/wfx/queue.c b/drivers/staging/wfx/queue.c
3668 +index 680fed31cefb..937a5599a69a 100644
3669 +--- a/drivers/staging/wfx/queue.c
3670 ++++ b/drivers/staging/wfx/queue.c
3671 +@@ -132,12 +132,12 @@ static void wfx_tx_queue_clear(struct wfx_dev *wdev, struct wfx_queue *queue,
3672 + spin_lock_bh(&queue->queue.lock);
3673 + while ((item = __skb_dequeue(&queue->queue)) != NULL)
3674 + skb_queue_head(gc_list, item);
3675 +- spin_lock_bh(&stats->pending.lock);
3676 ++ spin_lock_nested(&stats->pending.lock, 1);
3677 + for (i = 0; i < ARRAY_SIZE(stats->link_map_cache); ++i) {
3678 + stats->link_map_cache[i] -= queue->link_map_cache[i];
3679 + queue->link_map_cache[i] = 0;
3680 + }
3681 +- spin_unlock_bh(&stats->pending.lock);
3682 ++ spin_unlock(&stats->pending.lock);
3683 + spin_unlock_bh(&queue->queue.lock);
3684 + }
3685 +
3686 +@@ -213,9 +213,9 @@ void wfx_tx_queue_put(struct wfx_dev *wdev, struct wfx_queue *queue,
3687 +
3688 + ++queue->link_map_cache[tx_priv->link_id];
3689 +
3690 +- spin_lock_bh(&stats->pending.lock);
3691 ++ spin_lock_nested(&stats->pending.lock, 1);
3692 + ++stats->link_map_cache[tx_priv->link_id];
3693 +- spin_unlock_bh(&stats->pending.lock);
3694 ++ spin_unlock(&stats->pending.lock);
3695 + spin_unlock_bh(&queue->queue.lock);
3696 + }
3697 +
3698 +@@ -244,11 +244,11 @@ static struct sk_buff *wfx_tx_queue_get(struct wfx_dev *wdev,
3699 + __skb_unlink(skb, &queue->queue);
3700 + --queue->link_map_cache[tx_priv->link_id];
3701 +
3702 +- spin_lock_bh(&stats->pending.lock);
3703 ++ spin_lock_nested(&stats->pending.lock, 1);
3704 + __skb_queue_tail(&stats->pending, skb);
3705 + if (!--stats->link_map_cache[tx_priv->link_id])
3706 + wakeup_stats = true;
3707 +- spin_unlock_bh(&stats->pending.lock);
3708 ++ spin_unlock(&stats->pending.lock);
3709 + }
3710 + spin_unlock_bh(&queue->queue.lock);
3711 + if (wakeup_stats)
3712 +@@ -266,10 +266,10 @@ int wfx_pending_requeue(struct wfx_dev *wdev, struct sk_buff *skb)
3713 + spin_lock_bh(&queue->queue.lock);
3714 + ++queue->link_map_cache[tx_priv->link_id];
3715 +
3716 +- spin_lock_bh(&stats->pending.lock);
3717 ++ spin_lock_nested(&stats->pending.lock, 1);
3718 + ++stats->link_map_cache[tx_priv->link_id];
3719 + __skb_unlink(skb, &stats->pending);
3720 +- spin_unlock_bh(&stats->pending.lock);
3721 ++ spin_unlock(&stats->pending.lock);
3722 + __skb_queue_tail(&queue->queue, skb);
3723 + spin_unlock_bh(&queue->queue.lock);
3724 + return 0;
3725 +diff --git a/drivers/staging/wlan-ng/hfa384x_usb.c b/drivers/staging/wlan-ng/hfa384x_usb.c
3726 +index b71756ab0394..7fe64fcd385d 100644
3727 +--- a/drivers/staging/wlan-ng/hfa384x_usb.c
3728 ++++ b/drivers/staging/wlan-ng/hfa384x_usb.c
3729 +@@ -3372,6 +3372,8 @@ static void hfa384x_int_rxmonitor(struct wlandevice *wlandev,
3730 + WLAN_HDR_A4_LEN + WLAN_DATA_MAXLEN + WLAN_CRC_LEN)) {
3731 + pr_debug("overlen frm: len=%zd\n",
3732 + skblen - sizeof(struct p80211_caphdr));
3733 ++
3734 ++ return;
3735 + }
3736 +
3737 + skb = dev_alloc_skb(skblen);
3738 +diff --git a/drivers/staging/wlan-ng/prism2usb.c b/drivers/staging/wlan-ng/prism2usb.c
3739 +index 352556f6870a..4689b2170e4f 100644
3740 +--- a/drivers/staging/wlan-ng/prism2usb.c
3741 ++++ b/drivers/staging/wlan-ng/prism2usb.c
3742 +@@ -180,6 +180,7 @@ static void prism2sta_disconnect_usb(struct usb_interface *interface)
3743 +
3744 + cancel_work_sync(&hw->link_bh);
3745 + cancel_work_sync(&hw->commsqual_bh);
3746 ++ cancel_work_sync(&hw->usb_work);
3747 +
3748 + /* Now we complete any outstanding commands
3749 + * and tell everyone who is waiting for their
3750 +diff --git a/drivers/usb/class/cdc-acm.c b/drivers/usb/class/cdc-acm.c
3751 +index 47f09a6ce7bd..84d6f7df09a4 100644
3752 +--- a/drivers/usb/class/cdc-acm.c
3753 ++++ b/drivers/usb/class/cdc-acm.c
3754 +@@ -923,16 +923,16 @@ static int set_serial_info(struct tty_struct *tty, struct serial_struct *ss)
3755 +
3756 + mutex_lock(&acm->port.mutex);
3757 +
3758 +- if ((ss->close_delay != old_close_delay) ||
3759 +- (ss->closing_wait != old_closing_wait)) {
3760 +- if (!capable(CAP_SYS_ADMIN))
3761 ++ if (!capable(CAP_SYS_ADMIN)) {
3762 ++ if ((ss->close_delay != old_close_delay) ||
3763 ++ (ss->closing_wait != old_closing_wait))
3764 + retval = -EPERM;
3765 +- else {
3766 +- acm->port.close_delay = close_delay;
3767 +- acm->port.closing_wait = closing_wait;
3768 +- }
3769 +- } else
3770 +- retval = -EOPNOTSUPP;
3771 ++ else
3772 ++ retval = -EOPNOTSUPP;
3773 ++ } else {
3774 ++ acm->port.close_delay = close_delay;
3775 ++ acm->port.closing_wait = closing_wait;
3776 ++ }
3777 +
3778 + mutex_unlock(&acm->port.mutex);
3779 + return retval;
3780 +diff --git a/drivers/usb/musb/musb_host.c b/drivers/usb/musb/musb_host.c
3781 +index 5a44b70372d9..fa9922c0c910 100644
3782 +--- a/drivers/usb/musb/musb_host.c
3783 ++++ b/drivers/usb/musb/musb_host.c
3784 +@@ -1462,10 +1462,7 @@ done:
3785 + * We need to map sg if the transfer_buffer is
3786 + * NULL.
3787 + */
3788 +- if (!urb->transfer_buffer)
3789 +- qh->use_sg = true;
3790 +-
3791 +- if (qh->use_sg) {
3792 ++ if (!urb->transfer_buffer) {
3793 + /* sg_miter_start is already done in musb_ep_program */
3794 + if (!sg_miter_next(&qh->sg_miter)) {
3795 + dev_err(musb->controller, "error: sg list empty\n");
3796 +@@ -1473,9 +1470,8 @@ done:
3797 + status = -EINVAL;
3798 + goto done;
3799 + }
3800 +- urb->transfer_buffer = qh->sg_miter.addr;
3801 + length = min_t(u32, length, qh->sg_miter.length);
3802 +- musb_write_fifo(hw_ep, length, urb->transfer_buffer);
3803 ++ musb_write_fifo(hw_ep, length, qh->sg_miter.addr);
3804 + qh->sg_miter.consumed = length;
3805 + sg_miter_stop(&qh->sg_miter);
3806 + } else {
3807 +@@ -1484,11 +1480,6 @@ done:
3808 +
3809 + qh->segsize = length;
3810 +
3811 +- if (qh->use_sg) {
3812 +- if (offset + length >= urb->transfer_buffer_length)
3813 +- qh->use_sg = false;
3814 +- }
3815 +-
3816 + musb_ep_select(mbase, epnum);
3817 + musb_writew(epio, MUSB_TXCSR,
3818 + MUSB_TXCSR_H_WZC_BITS | MUSB_TXCSR_TXPKTRDY);
3819 +@@ -2003,8 +1994,10 @@ finish:
3820 + urb->actual_length += xfer_len;
3821 + qh->offset += xfer_len;
3822 + if (done) {
3823 +- if (qh->use_sg)
3824 ++ if (qh->use_sg) {
3825 + qh->use_sg = false;
3826 ++ urb->transfer_buffer = NULL;
3827 ++ }
3828 +
3829 + if (urb->status == -EINPROGRESS)
3830 + urb->status = status;
3831 +diff --git a/drivers/usb/serial/io_edgeport.c b/drivers/usb/serial/io_edgeport.c
3832 +index 5737add6a2a4..4cca0b836f43 100644
3833 +--- a/drivers/usb/serial/io_edgeport.c
3834 ++++ b/drivers/usb/serial/io_edgeport.c
3835 +@@ -710,7 +710,7 @@ static void edge_interrupt_callback(struct urb *urb)
3836 + /* grab the txcredits for the ports if available */
3837 + position = 2;
3838 + portNumber = 0;
3839 +- while ((position < length) &&
3840 ++ while ((position < length - 1) &&
3841 + (portNumber < edge_serial->serial->num_ports)) {
3842 + txCredits = data[position] | (data[position+1] << 8);
3843 + if (txCredits) {
3844 +diff --git a/drivers/usb/serial/option.c b/drivers/usb/serial/option.c
3845 +index 0b5dcf973d94..8bfffca3e4ae 100644
3846 +--- a/drivers/usb/serial/option.c
3847 ++++ b/drivers/usb/serial/option.c
3848 +@@ -1992,8 +1992,14 @@ static const struct usb_device_id option_ids[] = {
3849 + { USB_DEVICE_AND_INTERFACE_INFO(0x07d1, 0x3e01, 0xff, 0xff, 0xff) }, /* D-Link DWM-152/C1 */
3850 + { USB_DEVICE_AND_INTERFACE_INFO(0x07d1, 0x3e02, 0xff, 0xff, 0xff) }, /* D-Link DWM-156/C1 */
3851 + { USB_DEVICE_AND_INTERFACE_INFO(0x07d1, 0x7e11, 0xff, 0xff, 0xff) }, /* D-Link DWM-156/A3 */
3852 ++ { USB_DEVICE_INTERFACE_CLASS(0x1435, 0xd191, 0xff), /* Wistron Neweb D19Q1 */
3853 ++ .driver_info = RSVD(1) | RSVD(4) },
3854 ++ { USB_DEVICE_INTERFACE_CLASS(0x1690, 0x7588, 0xff), /* ASKEY WWHC050 */
3855 ++ .driver_info = RSVD(1) | RSVD(4) },
3856 + { USB_DEVICE_INTERFACE_CLASS(0x2020, 0x2031, 0xff), /* Olicard 600 */
3857 + .driver_info = RSVD(4) },
3858 ++ { USB_DEVICE_INTERFACE_CLASS(0x2020, 0x2033, 0xff), /* BroadMobi BM806U */
3859 ++ .driver_info = RSVD(4) },
3860 + { USB_DEVICE_INTERFACE_CLASS(0x2020, 0x2060, 0xff), /* BroadMobi BM818 */
3861 + .driver_info = RSVD(4) },
3862 + { USB_DEVICE_INTERFACE_CLASS(0x2020, 0x4000, 0xff) }, /* OLICARD300 - MT6225 */
3863 +diff --git a/fs/afs/cmservice.c b/fs/afs/cmservice.c
3864 +index ff3994a6be23..6765949b3aab 100644
3865 +--- a/fs/afs/cmservice.c
3866 ++++ b/fs/afs/cmservice.c
3867 +@@ -243,6 +243,17 @@ static void afs_cm_destructor(struct afs_call *call)
3868 + call->buffer = NULL;
3869 + }
3870 +
3871 ++/*
3872 ++ * Abort a service call from within an action function.
3873 ++ */
3874 ++static void afs_abort_service_call(struct afs_call *call, u32 abort_code, int error,
3875 ++ const char *why)
3876 ++{
3877 ++ rxrpc_kernel_abort_call(call->net->socket, call->rxcall,
3878 ++ abort_code, error, why);
3879 ++ afs_set_call_complete(call, error, 0);
3880 ++}
3881 ++
3882 + /*
3883 + * The server supplied a list of callbacks that it wanted to break.
3884 + */
3885 +@@ -510,8 +521,7 @@ static void SRXAFSCB_ProbeUuid(struct work_struct *work)
3886 + if (memcmp(r, &call->net->uuid, sizeof(call->net->uuid)) == 0)
3887 + afs_send_empty_reply(call);
3888 + else
3889 +- rxrpc_kernel_abort_call(call->net->socket, call->rxcall,
3890 +- 1, 1, "K-1");
3891 ++ afs_abort_service_call(call, 1, 1, "K-1");
3892 +
3893 + afs_put_call(call);
3894 + _leave("");
3895 +diff --git a/fs/afs/fs_probe.c b/fs/afs/fs_probe.c
3896 +index cfe62b154f68..e1b9ed679045 100644
3897 +--- a/fs/afs/fs_probe.c
3898 ++++ b/fs/afs/fs_probe.c
3899 +@@ -145,6 +145,7 @@ static int afs_do_probe_fileserver(struct afs_net *net,
3900 + read_lock(&server->fs_lock);
3901 + ac.alist = rcu_dereference_protected(server->addresses,
3902 + lockdep_is_held(&server->fs_lock));
3903 ++ afs_get_addrlist(ac.alist);
3904 + read_unlock(&server->fs_lock);
3905 +
3906 + atomic_set(&server->probe_outstanding, ac.alist->nr_addrs);
3907 +@@ -163,6 +164,7 @@ static int afs_do_probe_fileserver(struct afs_net *net,
3908 +
3909 + if (!in_progress)
3910 + afs_fs_probe_done(server);
3911 ++ afs_put_addrlist(ac.alist);
3912 + return in_progress;
3913 + }
3914 +
3915 +diff --git a/fs/afs/internal.h b/fs/afs/internal.h
3916 +index 1d81fc4c3058..52de2112e1b1 100644
3917 +--- a/fs/afs/internal.h
3918 ++++ b/fs/afs/internal.h
3919 +@@ -154,7 +154,7 @@ struct afs_call {
3920 + };
3921 + unsigned char unmarshall; /* unmarshalling phase */
3922 + unsigned char addr_ix; /* Address in ->alist */
3923 +- bool incoming; /* T if incoming call */
3924 ++ bool drop_ref; /* T if need to drop ref for incoming call */
3925 + bool send_pages; /* T if data from mapping should be sent */
3926 + bool need_attention; /* T if RxRPC poked us */
3927 + bool async; /* T if asynchronous */
3928 +@@ -1209,8 +1209,16 @@ static inline void afs_set_call_complete(struct afs_call *call,
3929 + ok = true;
3930 + }
3931 + spin_unlock_bh(&call->state_lock);
3932 +- if (ok)
3933 ++ if (ok) {
3934 + trace_afs_call_done(call);
3935 ++
3936 ++ /* Asynchronous calls have two refs to release - one from the alloc and
3937 ++ * one queued with the work item - and we can't just deallocate the
3938 ++ * call because the work item may be queued again.
3939 ++ */
3940 ++ if (call->drop_ref)
3941 ++ afs_put_call(call);
3942 ++ }
3943 + }
3944 +
3945 + /*
3946 +diff --git a/fs/afs/rxrpc.c b/fs/afs/rxrpc.c
3947 +index 58d396592250..27a879eaa5a4 100644
3948 +--- a/fs/afs/rxrpc.c
3949 ++++ b/fs/afs/rxrpc.c
3950 +@@ -18,7 +18,6 @@ struct workqueue_struct *afs_async_calls;
3951 +
3952 + static void afs_wake_up_call_waiter(struct sock *, struct rxrpc_call *, unsigned long);
3953 + static void afs_wake_up_async_call(struct sock *, struct rxrpc_call *, unsigned long);
3954 +-static void afs_delete_async_call(struct work_struct *);
3955 + static void afs_process_async_call(struct work_struct *);
3956 + static void afs_rx_new_call(struct sock *, struct rxrpc_call *, unsigned long);
3957 + static void afs_rx_discard_new_call(struct rxrpc_call *, unsigned long);
3958 +@@ -169,7 +168,7 @@ void afs_put_call(struct afs_call *call)
3959 + int n = atomic_dec_return(&call->usage);
3960 + int o = atomic_read(&net->nr_outstanding_calls);
3961 +
3962 +- trace_afs_call(call, afs_call_trace_put, n + 1, o,
3963 ++ trace_afs_call(call, afs_call_trace_put, n, o,
3964 + __builtin_return_address(0));
3965 +
3966 + ASSERTCMP(n, >=, 0);
3967 +@@ -402,8 +401,10 @@ void afs_make_call(struct afs_addr_cursor *ac, struct afs_call *call, gfp_t gfp)
3968 + /* If the call is going to be asynchronous, we need an extra ref for
3969 + * the call to hold itself so the caller need not hang on to its ref.
3970 + */
3971 +- if (call->async)
3972 ++ if (call->async) {
3973 + afs_get_call(call, afs_call_trace_get);
3974 ++ call->drop_ref = true;
3975 ++ }
3976 +
3977 + /* create a call */
3978 + rxcall = rxrpc_kernel_begin_call(call->net->socket, srx, call->key,
3979 +@@ -584,8 +585,6 @@ static void afs_deliver_to_call(struct afs_call *call)
3980 + done:
3981 + if (call->type->done)
3982 + call->type->done(call);
3983 +- if (state == AFS_CALL_COMPLETE && call->incoming)
3984 +- afs_put_call(call);
3985 + out:
3986 + _leave("");
3987 + return;
3988 +@@ -604,11 +603,7 @@ call_complete:
3989 + long afs_wait_for_call_to_complete(struct afs_call *call,
3990 + struct afs_addr_cursor *ac)
3991 + {
3992 +- signed long rtt2, timeout;
3993 + long ret;
3994 +- bool stalled = false;
3995 +- u64 rtt;
3996 +- u32 life, last_life;
3997 + bool rxrpc_complete = false;
3998 +
3999 + DECLARE_WAITQUEUE(myself, current);
4000 +@@ -619,14 +614,6 @@ long afs_wait_for_call_to_complete(struct afs_call *call,
4001 + if (ret < 0)
4002 + goto out;
4003 +
4004 +- rtt = rxrpc_kernel_get_rtt(call->net->socket, call->rxcall);
4005 +- rtt2 = nsecs_to_jiffies64(rtt) * 2;
4006 +- if (rtt2 < 2)
4007 +- rtt2 = 2;
4008 +-
4009 +- timeout = rtt2;
4010 +- rxrpc_kernel_check_life(call->net->socket, call->rxcall, &last_life);
4011 +-
4012 + add_wait_queue(&call->waitq, &myself);
4013 + for (;;) {
4014 + set_current_state(TASK_UNINTERRUPTIBLE);
4015 +@@ -637,37 +624,19 @@ long afs_wait_for_call_to_complete(struct afs_call *call,
4016 + call->need_attention = false;
4017 + __set_current_state(TASK_RUNNING);
4018 + afs_deliver_to_call(call);
4019 +- timeout = rtt2;
4020 + continue;
4021 + }
4022 +
4023 + if (afs_check_call_state(call, AFS_CALL_COMPLETE))
4024 + break;
4025 +
4026 +- if (!rxrpc_kernel_check_life(call->net->socket, call->rxcall, &life)) {
4027 ++ if (!rxrpc_kernel_check_life(call->net->socket, call->rxcall)) {
4028 + /* rxrpc terminated the call. */
4029 + rxrpc_complete = true;
4030 + break;
4031 + }
4032 +
4033 +- if (call->intr && timeout == 0 &&
4034 +- life == last_life && signal_pending(current)) {
4035 +- if (stalled)
4036 +- break;
4037 +- __set_current_state(TASK_RUNNING);
4038 +- rxrpc_kernel_probe_life(call->net->socket, call->rxcall);
4039 +- timeout = rtt2;
4040 +- stalled = true;
4041 +- continue;
4042 +- }
4043 +-
4044 +- if (life != last_life) {
4045 +- timeout = rtt2;
4046 +- last_life = life;
4047 +- stalled = false;
4048 +- }
4049 +-
4050 +- timeout = schedule_timeout(timeout);
4051 ++ schedule();
4052 + }
4053 +
4054 + remove_wait_queue(&call->waitq, &myself);
4055 +@@ -735,7 +704,7 @@ static void afs_wake_up_async_call(struct sock *sk, struct rxrpc_call *rxcall,
4056 +
4057 + u = atomic_fetch_add_unless(&call->usage, 1, 0);
4058 + if (u != 0) {
4059 +- trace_afs_call(call, afs_call_trace_wake, u,
4060 ++ trace_afs_call(call, afs_call_trace_wake, u + 1,
4061 + atomic_read(&call->net->nr_outstanding_calls),
4062 + __builtin_return_address(0));
4063 +
4064 +@@ -744,21 +713,6 @@ static void afs_wake_up_async_call(struct sock *sk, struct rxrpc_call *rxcall,
4065 + }
4066 + }
4067 +
4068 +-/*
4069 +- * Delete an asynchronous call. The work item carries a ref to the call struct
4070 +- * that we need to release.
4071 +- */
4072 +-static void afs_delete_async_call(struct work_struct *work)
4073 +-{
4074 +- struct afs_call *call = container_of(work, struct afs_call, async_work);
4075 +-
4076 +- _enter("");
4077 +-
4078 +- afs_put_call(call);
4079 +-
4080 +- _leave("");
4081 +-}
4082 +-
4083 + /*
4084 + * Perform I/O processing on an asynchronous call. The work item carries a ref
4085 + * to the call struct that we either need to release or to pass on.
4086 +@@ -774,16 +728,6 @@ static void afs_process_async_call(struct work_struct *work)
4087 + afs_deliver_to_call(call);
4088 + }
4089 +
4090 +- if (call->state == AFS_CALL_COMPLETE) {
4091 +- /* We have two refs to release - one from the alloc and one
4092 +- * queued with the work item - and we can't just deallocate the
4093 +- * call because the work item may be queued again.
4094 +- */
4095 +- call->async_work.func = afs_delete_async_call;
4096 +- if (!queue_work(afs_async_calls, &call->async_work))
4097 +- afs_put_call(call);
4098 +- }
4099 +-
4100 + afs_put_call(call);
4101 + _leave("");
4102 + }
4103 +@@ -810,6 +754,7 @@ void afs_charge_preallocation(struct work_struct *work)
4104 + if (!call)
4105 + break;
4106 +
4107 ++ call->drop_ref = true;
4108 + call->async = true;
4109 + call->state = AFS_CALL_SV_AWAIT_OP_ID;
4110 + init_waitqueue_head(&call->waitq);
4111 +diff --git a/fs/ceph/file.c b/fs/ceph/file.c
4112 +index cd09e63d682b..ce54a1b12819 100644
4113 +--- a/fs/ceph/file.c
4114 ++++ b/fs/ceph/file.c
4115 +@@ -1415,10 +1415,13 @@ static ssize_t ceph_write_iter(struct kiocb *iocb, struct iov_iter *from)
4116 + struct inode *inode = file_inode(file);
4117 + struct ceph_inode_info *ci = ceph_inode(inode);
4118 + struct ceph_fs_client *fsc = ceph_inode_to_client(inode);
4119 ++ struct ceph_osd_client *osdc = &fsc->client->osdc;
4120 + struct ceph_cap_flush *prealloc_cf;
4121 + ssize_t count, written = 0;
4122 + int err, want, got;
4123 + bool direct_lock = false;
4124 ++ u32 map_flags;
4125 ++ u64 pool_flags;
4126 + loff_t pos;
4127 + loff_t limit = max(i_size_read(inode), fsc->max_file_size);
4128 +
4129 +@@ -1481,8 +1484,12 @@ retry_snap:
4130 + goto out;
4131 + }
4132 +
4133 +- /* FIXME: not complete since it doesn't account for being at quota */
4134 +- if (ceph_osdmap_flag(&fsc->client->osdc, CEPH_OSDMAP_FULL)) {
4135 ++ down_read(&osdc->lock);
4136 ++ map_flags = osdc->osdmap->flags;
4137 ++ pool_flags = ceph_pg_pool_flags(osdc->osdmap, ci->i_layout.pool_id);
4138 ++ up_read(&osdc->lock);
4139 ++ if ((map_flags & CEPH_OSDMAP_FULL) ||
4140 ++ (pool_flags & CEPH_POOL_FLAG_FULL)) {
4141 + err = -ENOSPC;
4142 + goto out;
4143 + }
4144 +@@ -1575,7 +1582,8 @@ retry_snap:
4145 + }
4146 +
4147 + if (written >= 0) {
4148 +- if (ceph_osdmap_flag(&fsc->client->osdc, CEPH_OSDMAP_NEARFULL))
4149 ++ if ((map_flags & CEPH_OSDMAP_NEARFULL) ||
4150 ++ (pool_flags & CEPH_POOL_FLAG_NEARFULL))
4151 + iocb->ki_flags |= IOCB_DSYNC;
4152 + written = generic_write_sync(iocb, written);
4153 + }
4154 +diff --git a/fs/ceph/snap.c b/fs/ceph/snap.c
4155 +index ccfcc66aaf44..923be9399b21 100644
4156 +--- a/fs/ceph/snap.c
4157 ++++ b/fs/ceph/snap.c
4158 +@@ -1155,5 +1155,6 @@ void ceph_cleanup_snapid_map(struct ceph_mds_client *mdsc)
4159 + pr_err("snapid map %llx -> %x still in use\n",
4160 + sm->snap, sm->dev);
4161 + }
4162 ++ kfree(sm);
4163 + }
4164 + }
4165 +diff --git a/fs/libfs.c b/fs/libfs.c
4166 +index 1463b038ffc4..5fd9cc0e2ac9 100644
4167 +--- a/fs/libfs.c
4168 ++++ b/fs/libfs.c
4169 +@@ -821,7 +821,7 @@ int simple_attr_open(struct inode *inode, struct file *file,
4170 + {
4171 + struct simple_attr *attr;
4172 +
4173 +- attr = kmalloc(sizeof(*attr), GFP_KERNEL);
4174 ++ attr = kzalloc(sizeof(*attr), GFP_KERNEL);
4175 + if (!attr)
4176 + return -ENOMEM;
4177 +
4178 +@@ -861,9 +861,11 @@ ssize_t simple_attr_read(struct file *file, char __user *buf,
4179 + if (ret)
4180 + return ret;
4181 +
4182 +- if (*ppos) { /* continued read */
4183 ++ if (*ppos && attr->get_buf[0]) {
4184 ++ /* continued read */
4185 + size = strlen(attr->get_buf);
4186 +- } else { /* first read */
4187 ++ } else {
4188 ++ /* first read */
4189 + u64 val;
4190 + ret = attr->get(attr->data, &val);
4191 + if (ret)
4192 +diff --git a/fs/nfs/client.c b/fs/nfs/client.c
4193 +index 02110a30a49e..a851339defeb 100644
4194 +--- a/fs/nfs/client.c
4195 ++++ b/fs/nfs/client.c
4196 +@@ -153,6 +153,7 @@ struct nfs_client *nfs_alloc_client(const struct nfs_client_initdata *cl_init)
4197 + if ((clp = kzalloc(sizeof(*clp), GFP_KERNEL)) == NULL)
4198 + goto error_0;
4199 +
4200 ++ clp->cl_minorversion = cl_init->minorversion;
4201 + clp->cl_nfs_mod = cl_init->nfs_mod;
4202 + if (!try_module_get(clp->cl_nfs_mod->owner))
4203 + goto error_dealloc;
4204 +diff --git a/fs/nfs/fscache.c b/fs/nfs/fscache.c
4205 +index 3800ab6f08fa..a6dcc2151e77 100644
4206 +--- a/fs/nfs/fscache.c
4207 ++++ b/fs/nfs/fscache.c
4208 +@@ -31,6 +31,7 @@ static DEFINE_SPINLOCK(nfs_fscache_keys_lock);
4209 + struct nfs_server_key {
4210 + struct {
4211 + uint16_t nfsversion; /* NFS protocol version */
4212 ++ uint32_t minorversion; /* NFSv4 minor version */
4213 + uint16_t family; /* address family */
4214 + __be16 port; /* IP port */
4215 + } hdr;
4216 +@@ -55,6 +56,7 @@ void nfs_fscache_get_client_cookie(struct nfs_client *clp)
4217 +
4218 + memset(&key, 0, sizeof(key));
4219 + key.hdr.nfsversion = clp->rpc_ops->version;
4220 ++ key.hdr.minorversion = clp->cl_minorversion;
4221 + key.hdr.family = clp->cl_addr.ss_family;
4222 +
4223 + switch (clp->cl_addr.ss_family) {
4224 +diff --git a/fs/nfs/nfs4client.c b/fs/nfs/nfs4client.c
4225 +index 460d6251c405..2c274fea8093 100644
4226 +--- a/fs/nfs/nfs4client.c
4227 ++++ b/fs/nfs/nfs4client.c
4228 +@@ -216,7 +216,6 @@ struct nfs_client *nfs4_alloc_client(const struct nfs_client_initdata *cl_init)
4229 + INIT_LIST_HEAD(&clp->cl_ds_clients);
4230 + rpc_init_wait_queue(&clp->cl_rpcwaitq, "NFS client");
4231 + clp->cl_state = 1 << NFS4CLNT_LEASE_EXPIRED;
4232 +- clp->cl_minorversion = cl_init->minorversion;
4233 + clp->cl_mvops = nfs_v4_minor_ops[cl_init->minorversion];
4234 + clp->cl_mig_gen = 1;
4235 + #if IS_ENABLED(CONFIG_NFS_V4_1)
4236 +diff --git a/include/linux/ceph/osdmap.h b/include/linux/ceph/osdmap.h
4237 +index e081b56f1c1d..5e601975745f 100644
4238 +--- a/include/linux/ceph/osdmap.h
4239 ++++ b/include/linux/ceph/osdmap.h
4240 +@@ -37,6 +37,9 @@ int ceph_spg_compare(const struct ceph_spg *lhs, const struct ceph_spg *rhs);
4241 + #define CEPH_POOL_FLAG_HASHPSPOOL (1ULL << 0) /* hash pg seed and pool id
4242 + together */
4243 + #define CEPH_POOL_FLAG_FULL (1ULL << 1) /* pool is full */
4244 ++#define CEPH_POOL_FLAG_FULL_QUOTA (1ULL << 10) /* pool ran out of quota,
4245 ++ will set FULL too */
4246 ++#define CEPH_POOL_FLAG_NEARFULL (1ULL << 11) /* pool is nearfull */
4247 +
4248 + struct ceph_pg_pool_info {
4249 + struct rb_node node;
4250 +@@ -304,5 +307,6 @@ extern struct ceph_pg_pool_info *ceph_pg_pool_by_id(struct ceph_osdmap *map,
4251 +
4252 + extern const char *ceph_pg_pool_name_by_id(struct ceph_osdmap *map, u64 id);
4253 + extern int ceph_pg_poolid_by_name(struct ceph_osdmap *map, const char *name);
4254 ++u64 ceph_pg_pool_flags(struct ceph_osdmap *map, u64 id);
4255 +
4256 + #endif
4257 +diff --git a/include/linux/ceph/rados.h b/include/linux/ceph/rados.h
4258 +index 3eb0e55665b4..c004bced9b91 100644
4259 +--- a/include/linux/ceph/rados.h
4260 ++++ b/include/linux/ceph/rados.h
4261 +@@ -143,8 +143,10 @@ extern const char *ceph_osd_state_name(int s);
4262 + /*
4263 + * osd map flag bits
4264 + */
4265 +-#define CEPH_OSDMAP_NEARFULL (1<<0) /* sync writes (near ENOSPC) */
4266 +-#define CEPH_OSDMAP_FULL (1<<1) /* no data writes (ENOSPC) */
4267 ++#define CEPH_OSDMAP_NEARFULL (1<<0) /* sync writes (near ENOSPC),
4268 ++ not set since ~luminous */
4269 ++#define CEPH_OSDMAP_FULL (1<<1) /* no data writes (ENOSPC),
4270 ++ not set since ~luminous */
4271 + #define CEPH_OSDMAP_PAUSERD (1<<2) /* pause all reads */
4272 + #define CEPH_OSDMAP_PAUSEWR (1<<3) /* pause all writes */
4273 + #define CEPH_OSDMAP_PAUSEREC (1<<4) /* pause recovery */
4274 +diff --git a/include/linux/dmar.h b/include/linux/dmar.h
4275 +index 712be8bc6a7c..d7bf029df737 100644
4276 +--- a/include/linux/dmar.h
4277 ++++ b/include/linux/dmar.h
4278 +@@ -74,11 +74,13 @@ extern struct list_head dmar_drhd_units;
4279 + dmar_rcu_check())
4280 +
4281 + #define for_each_active_drhd_unit(drhd) \
4282 +- list_for_each_entry_rcu(drhd, &dmar_drhd_units, list) \
4283 ++ list_for_each_entry_rcu(drhd, &dmar_drhd_units, list, \
4284 ++ dmar_rcu_check()) \
4285 + if (drhd->ignored) {} else
4286 +
4287 + #define for_each_active_iommu(i, drhd) \
4288 +- list_for_each_entry_rcu(drhd, &dmar_drhd_units, list) \
4289 ++ list_for_each_entry_rcu(drhd, &dmar_drhd_units, list, \
4290 ++ dmar_rcu_check()) \
4291 + if (i=drhd->iommu, drhd->ignored) {} else
4292 +
4293 + #define for_each_iommu(i, drhd) \
4294 +diff --git a/include/linux/dsa/8021q.h b/include/linux/dsa/8021q.h
4295 +index 0aa803c451a3..c620d9139c28 100644
4296 +--- a/include/linux/dsa/8021q.h
4297 ++++ b/include/linux/dsa/8021q.h
4298 +@@ -28,8 +28,6 @@ int dsa_8021q_rx_switch_id(u16 vid);
4299 +
4300 + int dsa_8021q_rx_source_port(u16 vid);
4301 +
4302 +-struct sk_buff *dsa_8021q_remove_header(struct sk_buff *skb);
4303 +-
4304 + #else
4305 +
4306 + int dsa_port_setup_8021q_tagging(struct dsa_switch *ds, int index,
4307 +@@ -64,11 +62,6 @@ int dsa_8021q_rx_source_port(u16 vid)
4308 + return 0;
4309 + }
4310 +
4311 +-struct sk_buff *dsa_8021q_remove_header(struct sk_buff *skb)
4312 +-{
4313 +- return NULL;
4314 +-}
4315 +-
4316 + #endif /* IS_ENABLED(CONFIG_NET_DSA_TAG_8021Q) */
4317 +
4318 + #endif /* _NET_DSA_8021Q_H */
4319 +diff --git a/include/linux/ieee80211.h b/include/linux/ieee80211.h
4320 +index 7d3f2ced92d1..73c66a3a33ae 100644
4321 +--- a/include/linux/ieee80211.h
4322 ++++ b/include/linux/ieee80211.h
4323 +@@ -2102,14 +2102,14 @@ ieee80211_he_spr_size(const u8 *he_spr_ie)
4324 + {
4325 + struct ieee80211_he_spr *he_spr = (void *)he_spr_ie;
4326 + u8 spr_len = sizeof(struct ieee80211_he_spr);
4327 +- u32 he_spr_params;
4328 ++ u8 he_spr_params;
4329 +
4330 + /* Make sure the input is not NULL */
4331 + if (!he_spr_ie)
4332 + return 0;
4333 +
4334 + /* Calc required length */
4335 +- he_spr_params = le32_to_cpu(he_spr->he_sr_control);
4336 ++ he_spr_params = he_spr->he_sr_control;
4337 + if (he_spr_params & IEEE80211_HE_SPR_NON_SRG_OFFSET_PRESENT)
4338 + spr_len++;
4339 + if (he_spr_params & IEEE80211_HE_SPR_SRG_INFORMATION_PRESENT)
4340 +diff --git a/include/linux/intel-iommu.h b/include/linux/intel-iommu.h
4341 +index 6d8bf4bdf240..1e5dad8b8e59 100644
4342 +--- a/include/linux/intel-iommu.h
4343 ++++ b/include/linux/intel-iommu.h
4344 +@@ -120,6 +120,8 @@
4345 +
4346 + #define dmar_readq(a) readq(a)
4347 + #define dmar_writeq(a,v) writeq(v,a)
4348 ++#define dmar_readl(a) readl(a)
4349 ++#define dmar_writel(a, v) writel(v, a)
4350 +
4351 + #define DMAR_VER_MAJOR(v) (((v) & 0xf0) >> 4)
4352 + #define DMAR_VER_MINOR(v) ((v) & 0x0f)
4353 +diff --git a/include/linux/memcontrol.h b/include/linux/memcontrol.h
4354 +index a7a0a1a5c8d5..e9ba01336d4e 100644
4355 +--- a/include/linux/memcontrol.h
4356 ++++ b/include/linux/memcontrol.h
4357 +@@ -695,6 +695,7 @@ static inline unsigned long lruvec_page_state_local(struct lruvec *lruvec,
4358 + void __mod_lruvec_state(struct lruvec *lruvec, enum node_stat_item idx,
4359 + int val);
4360 + void __mod_lruvec_slab_state(void *p, enum node_stat_item idx, int val);
4361 ++void mod_memcg_obj_state(void *p, int idx, int val);
4362 +
4363 + static inline void mod_lruvec_state(struct lruvec *lruvec,
4364 + enum node_stat_item idx, int val)
4365 +@@ -1123,6 +1124,10 @@ static inline void __mod_lruvec_slab_state(void *p, enum node_stat_item idx,
4366 + __mod_node_page_state(page_pgdat(page), idx, val);
4367 + }
4368 +
4369 ++static inline void mod_memcg_obj_state(void *p, int idx, int val)
4370 ++{
4371 ++}
4372 ++
4373 + static inline
4374 + unsigned long mem_cgroup_soft_limit_reclaim(pg_data_t *pgdat, int order,
4375 + gfp_t gfp_mask,
4376 +@@ -1427,6 +1432,8 @@ static inline int memcg_cache_id(struct mem_cgroup *memcg)
4377 + return memcg ? memcg->kmemcg_id : -1;
4378 + }
4379 +
4380 ++struct mem_cgroup *mem_cgroup_from_obj(void *p);
4381 ++
4382 + #else
4383 +
4384 + static inline int memcg_kmem_charge(struct page *page, gfp_t gfp, int order)
4385 +@@ -1468,6 +1475,11 @@ static inline void memcg_put_cache_ids(void)
4386 + {
4387 + }
4388 +
4389 ++static inline struct mem_cgroup *mem_cgroup_from_obj(void *p)
4390 ++{
4391 ++ return NULL;
4392 ++}
4393 ++
4394 + #endif /* CONFIG_MEMCG_KMEM */
4395 +
4396 + #endif /* _LINUX_MEMCONTROL_H */
4397 +diff --git a/include/linux/mmc/host.h b/include/linux/mmc/host.h
4398 +index ba703384bea0..4c5eb3aa8e72 100644
4399 +--- a/include/linux/mmc/host.h
4400 ++++ b/include/linux/mmc/host.h
4401 +@@ -333,6 +333,7 @@ struct mmc_host {
4402 + MMC_CAP_UHS_SDR50 | MMC_CAP_UHS_SDR104 | \
4403 + MMC_CAP_UHS_DDR50)
4404 + #define MMC_CAP_SYNC_RUNTIME_PM (1 << 21) /* Synced runtime PM suspends. */
4405 ++#define MMC_CAP_NEED_RSP_BUSY (1 << 22) /* Commands with R1B can't use R1. */
4406 + #define MMC_CAP_DRIVER_TYPE_A (1 << 23) /* Host supports Driver Type A */
4407 + #define MMC_CAP_DRIVER_TYPE_C (1 << 24) /* Host supports Driver Type C */
4408 + #define MMC_CAP_DRIVER_TYPE_D (1 << 25) /* Host supports Driver Type D */
4409 +diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h
4410 +index e9133bcf0544..f0553ed6f4c6 100644
4411 +--- a/include/linux/skbuff.h
4412 ++++ b/include/linux/skbuff.h
4413 +@@ -634,8 +634,8 @@ typedef unsigned char *sk_buff_data_t;
4414 + * @offload_l3_fwd_mark: Packet was L3-forwarded in hardware
4415 + * @tc_skip_classify: do not classify packet. set by IFB device
4416 + * @tc_at_ingress: used within tc_classify to distinguish in/egress
4417 +- * @tc_redirected: packet was redirected by a tc action
4418 +- * @tc_from_ingress: if tc_redirected, tc_at_ingress at time of redirect
4419 ++ * @redirected: packet was redirected by packet classifier
4420 ++ * @from_ingress: packet was redirected from the ingress path
4421 + * @peeked: this packet has been seen already, so stats have been
4422 + * done for it, don't do them again
4423 + * @nf_trace: netfilter packet trace flag
4424 +@@ -816,8 +816,10 @@ struct sk_buff {
4425 + #ifdef CONFIG_NET_CLS_ACT
4426 + __u8 tc_skip_classify:1;
4427 + __u8 tc_at_ingress:1;
4428 +- __u8 tc_redirected:1;
4429 +- __u8 tc_from_ingress:1;
4430 ++#endif
4431 ++#ifdef CONFIG_NET_REDIRECT
4432 ++ __u8 redirected:1;
4433 ++ __u8 from_ingress:1;
4434 + #endif
4435 + #ifdef CONFIG_TLS_DEVICE
4436 + __u8 decrypted:1;
4437 +@@ -4517,5 +4519,31 @@ static inline __wsum lco_csum(struct sk_buff *skb)
4438 + return csum_partial(l4_hdr, csum_start - l4_hdr, partial);
4439 + }
4440 +
4441 ++static inline bool skb_is_redirected(const struct sk_buff *skb)
4442 ++{
4443 ++#ifdef CONFIG_NET_REDIRECT
4444 ++ return skb->redirected;
4445 ++#else
4446 ++ return false;
4447 ++#endif
4448 ++}
4449 ++
4450 ++static inline void skb_set_redirected(struct sk_buff *skb, bool from_ingress)
4451 ++{
4452 ++#ifdef CONFIG_NET_REDIRECT
4453 ++ skb->redirected = 1;
4454 ++ skb->from_ingress = from_ingress;
4455 ++ if (skb->from_ingress)
4456 ++ skb->tstamp = 0;
4457 ++#endif
4458 ++}
4459 ++
4460 ++static inline void skb_reset_redirect(struct sk_buff *skb)
4461 ++{
4462 ++#ifdef CONFIG_NET_REDIRECT
4463 ++ skb->redirected = 0;
4464 ++#endif
4465 ++}
4466 ++
4467 + #endif /* __KERNEL__ */
4468 + #endif /* _LINUX_SKBUFF_H */
4469 +diff --git a/include/net/af_rxrpc.h b/include/net/af_rxrpc.h
4470 +index 1abae3c340a5..299240df79e4 100644
4471 +--- a/include/net/af_rxrpc.h
4472 ++++ b/include/net/af_rxrpc.h
4473 +@@ -58,9 +58,7 @@ int rxrpc_kernel_charge_accept(struct socket *, rxrpc_notify_rx_t,
4474 + rxrpc_user_attach_call_t, unsigned long, gfp_t,
4475 + unsigned int);
4476 + void rxrpc_kernel_set_tx_length(struct socket *, struct rxrpc_call *, s64);
4477 +-bool rxrpc_kernel_check_life(const struct socket *, const struct rxrpc_call *,
4478 +- u32 *);
4479 +-void rxrpc_kernel_probe_life(struct socket *, struct rxrpc_call *);
4480 ++bool rxrpc_kernel_check_life(const struct socket *, const struct rxrpc_call *);
4481 + u32 rxrpc_kernel_get_epoch(struct socket *, struct rxrpc_call *);
4482 + bool rxrpc_kernel_get_reply_time(struct socket *, struct rxrpc_call *,
4483 + ktime_t *);
4484 +diff --git a/include/net/sch_generic.h b/include/net/sch_generic.h
4485 +index 151208704ed2..c30f914867e6 100644
4486 +--- a/include/net/sch_generic.h
4487 ++++ b/include/net/sch_generic.h
4488 +@@ -675,22 +675,6 @@ void __qdisc_calculate_pkt_len(struct sk_buff *skb,
4489 + const struct qdisc_size_table *stab);
4490 + int skb_do_redirect(struct sk_buff *);
4491 +
4492 +-static inline void skb_reset_tc(struct sk_buff *skb)
4493 +-{
4494 +-#ifdef CONFIG_NET_CLS_ACT
4495 +- skb->tc_redirected = 0;
4496 +-#endif
4497 +-}
4498 +-
4499 +-static inline bool skb_is_tc_redirected(const struct sk_buff *skb)
4500 +-{
4501 +-#ifdef CONFIG_NET_CLS_ACT
4502 +- return skb->tc_redirected;
4503 +-#else
4504 +- return false;
4505 +-#endif
4506 +-}
4507 +-
4508 + static inline bool skb_at_tc_ingress(const struct sk_buff *skb)
4509 + {
4510 + #ifdef CONFIG_NET_CLS_ACT
4511 +diff --git a/include/trace/events/afs.h b/include/trace/events/afs.h
4512 +index 564ba1b5cf57..c612cabbc378 100644
4513 +--- a/include/trace/events/afs.h
4514 ++++ b/include/trace/events/afs.h
4515 +@@ -233,7 +233,7 @@ enum afs_cb_break_reason {
4516 + EM(afs_call_trace_get, "GET ") \
4517 + EM(afs_call_trace_put, "PUT ") \
4518 + EM(afs_call_trace_wake, "WAKE ") \
4519 +- E_(afs_call_trace_work, "WORK ")
4520 ++ E_(afs_call_trace_work, "QUEUE")
4521 +
4522 + #define afs_server_traces \
4523 + EM(afs_server_trace_alloc, "ALLOC ") \
4524 +diff --git a/include/uapi/linux/serio.h b/include/uapi/linux/serio.h
4525 +index 50e991952c97..ed2a96f43ce4 100644
4526 +--- a/include/uapi/linux/serio.h
4527 ++++ b/include/uapi/linux/serio.h
4528 +@@ -9,7 +9,7 @@
4529 + #ifndef _UAPI_SERIO_H
4530 + #define _UAPI_SERIO_H
4531 +
4532 +-
4533 ++#include <linux/const.h>
4534 + #include <linux/ioctl.h>
4535 +
4536 + #define SPIOCSTYPE _IOW('q', 0x01, unsigned long)
4537 +@@ -18,10 +18,10 @@
4538 + /*
4539 + * bit masks for use in "interrupt" flags (3rd argument)
4540 + */
4541 +-#define SERIO_TIMEOUT BIT(0)
4542 +-#define SERIO_PARITY BIT(1)
4543 +-#define SERIO_FRAME BIT(2)
4544 +-#define SERIO_OOB_DATA BIT(3)
4545 ++#define SERIO_TIMEOUT _BITUL(0)
4546 ++#define SERIO_PARITY _BITUL(1)
4547 ++#define SERIO_FRAME _BITUL(2)
4548 ++#define SERIO_OOB_DATA _BITUL(3)
4549 +
4550 + /*
4551 + * Serio types
4552 +diff --git a/kernel/bpf/btf.c b/kernel/bpf/btf.c
4553 +index ed2075884724..9bf372120e12 100644
4554 +--- a/kernel/bpf/btf.c
4555 ++++ b/kernel/bpf/btf.c
4556 +@@ -2383,7 +2383,7 @@ static int btf_enum_check_member(struct btf_verifier_env *env,
4557 +
4558 + struct_size = struct_type->size;
4559 + bytes_offset = BITS_ROUNDDOWN_BYTES(struct_bits_off);
4560 +- if (struct_size - bytes_offset < sizeof(int)) {
4561 ++ if (struct_size - bytes_offset < member_type->size) {
4562 + btf_verifier_log_member(env, struct_type, member,
4563 + "Member exceeds struct_size");
4564 + return -EINVAL;
4565 +diff --git a/kernel/bpf/cgroup.c b/kernel/bpf/cgroup.c
4566 +index 9e43b72eb619..bee1ecb399be 100644
4567 +--- a/kernel/bpf/cgroup.c
4568 ++++ b/kernel/bpf/cgroup.c
4569 +@@ -228,6 +228,9 @@ cleanup:
4570 + for (i = 0; i < NR; i++)
4571 + bpf_prog_array_free(arrays[i]);
4572 +
4573 ++ for (p = cgroup_parent(cgrp); p; p = cgroup_parent(p))
4574 ++ cgroup_bpf_put(p);
4575 ++
4576 + percpu_ref_exit(&cgrp->bpf.refcnt);
4577 +
4578 + return -ENOMEM;
4579 +@@ -300,8 +303,8 @@ int __cgroup_bpf_attach(struct cgroup *cgrp, struct bpf_prog *prog,
4580 + {
4581 + struct list_head *progs = &cgrp->bpf.progs[type];
4582 + struct bpf_prog *old_prog = NULL;
4583 +- struct bpf_cgroup_storage *storage[MAX_BPF_CGROUP_STORAGE_TYPE],
4584 +- *old_storage[MAX_BPF_CGROUP_STORAGE_TYPE] = {NULL};
4585 ++ struct bpf_cgroup_storage *storage[MAX_BPF_CGROUP_STORAGE_TYPE] = {};
4586 ++ struct bpf_cgroup_storage *old_storage[MAX_BPF_CGROUP_STORAGE_TYPE] = {};
4587 + enum bpf_cgroup_storage_type stype;
4588 + struct bpf_prog_list *pl;
4589 + bool pl_was_allocated;
4590 +diff --git a/kernel/bpf/verifier.c b/kernel/bpf/verifier.c
4591 +index 7d530ce8719d..79f38a281390 100644
4592 +--- a/kernel/bpf/verifier.c
4593 ++++ b/kernel/bpf/verifier.c
4594 +@@ -1034,17 +1034,6 @@ static void __reg_bound_offset(struct bpf_reg_state *reg)
4595 + reg->umax_value));
4596 + }
4597 +
4598 +-static void __reg_bound_offset32(struct bpf_reg_state *reg)
4599 +-{
4600 +- u64 mask = 0xffffFFFF;
4601 +- struct tnum range = tnum_range(reg->umin_value & mask,
4602 +- reg->umax_value & mask);
4603 +- struct tnum lo32 = tnum_cast(reg->var_off, 4);
4604 +- struct tnum hi32 = tnum_lshift(tnum_rshift(reg->var_off, 32), 32);
4605 +-
4606 +- reg->var_off = tnum_or(hi32, tnum_intersect(lo32, range));
4607 +-}
4608 +-
4609 + /* Reset the min/max bounds of a register */
4610 + static void __mark_reg_unbounded(struct bpf_reg_state *reg)
4611 + {
4612 +@@ -5677,10 +5666,6 @@ static void reg_set_min_max(struct bpf_reg_state *true_reg,
4613 + /* We might have learned some bits from the bounds. */
4614 + __reg_bound_offset(false_reg);
4615 + __reg_bound_offset(true_reg);
4616 +- if (is_jmp32) {
4617 +- __reg_bound_offset32(false_reg);
4618 +- __reg_bound_offset32(true_reg);
4619 +- }
4620 + /* Intersecting with the old var_off might have improved our bounds
4621 + * slightly. e.g. if umax was 0x7f...f and var_off was (0; 0xf...fc),
4622 + * then new var_off is (0; 0x7f...fc) which improves our umax.
4623 +@@ -5790,10 +5775,6 @@ static void reg_set_min_max_inv(struct bpf_reg_state *true_reg,
4624 + /* We might have learned some bits from the bounds. */
4625 + __reg_bound_offset(false_reg);
4626 + __reg_bound_offset(true_reg);
4627 +- if (is_jmp32) {
4628 +- __reg_bound_offset32(false_reg);
4629 +- __reg_bound_offset32(true_reg);
4630 +- }
4631 + /* Intersecting with the old var_off might have improved our bounds
4632 + * slightly. e.g. if umax was 0x7f...f and var_off was (0; 0xf...fc),
4633 + * then new var_off is (0; 0x7f...fc) which improves our umax.
4634 +diff --git a/kernel/cgroup/cgroup-v1.c b/kernel/cgroup/cgroup-v1.c
4635 +index 09f3a413f6f8..a1fbf500d0af 100644
4636 +--- a/kernel/cgroup/cgroup-v1.c
4637 ++++ b/kernel/cgroup/cgroup-v1.c
4638 +@@ -473,6 +473,7 @@ static void *cgroup_pidlist_next(struct seq_file *s, void *v, loff_t *pos)
4639 + */
4640 + p++;
4641 + if (p >= end) {
4642 ++ (*pos)++;
4643 + return NULL;
4644 + } else {
4645 + *pos = *p;
4646 +@@ -784,7 +785,7 @@ void cgroup1_release_agent(struct work_struct *work)
4647 +
4648 + pathbuf = kmalloc(PATH_MAX, GFP_KERNEL);
4649 + agentbuf = kstrdup(cgrp->root->release_agent_path, GFP_KERNEL);
4650 +- if (!pathbuf || !agentbuf)
4651 ++ if (!pathbuf || !agentbuf || !strlen(agentbuf))
4652 + goto out;
4653 +
4654 + spin_lock_irq(&css_set_lock);
4655 +diff --git a/kernel/fork.c b/kernel/fork.c
4656 +index 080809560072..183a6722dfe2 100644
4657 +--- a/kernel/fork.c
4658 ++++ b/kernel/fork.c
4659 +@@ -397,8 +397,8 @@ static void account_kernel_stack(struct task_struct *tsk, int account)
4660 + mod_zone_page_state(page_zone(first_page), NR_KERNEL_STACK_KB,
4661 + THREAD_SIZE / 1024 * account);
4662 +
4663 +- mod_memcg_page_state(first_page, MEMCG_KERNEL_STACK_KB,
4664 +- account * (THREAD_SIZE / 1024));
4665 ++ mod_memcg_obj_state(stack, MEMCG_KERNEL_STACK_KB,
4666 ++ account * (THREAD_SIZE / 1024));
4667 + }
4668 + }
4669 +
4670 +diff --git a/kernel/irq/manage.c b/kernel/irq/manage.c
4671 +index 55b080101a20..b304c17d53a3 100644
4672 +--- a/kernel/irq/manage.c
4673 ++++ b/kernel/irq/manage.c
4674 +@@ -284,7 +284,11 @@ int irq_set_affinity_locked(struct irq_data *data, const struct cpumask *mask,
4675 +
4676 + if (desc->affinity_notify) {
4677 + kref_get(&desc->affinity_notify->kref);
4678 +- schedule_work(&desc->affinity_notify->work);
4679 ++ if (!schedule_work(&desc->affinity_notify->work)) {
4680 ++ /* Work was already scheduled, drop our extra ref */
4681 ++ kref_put(&desc->affinity_notify->kref,
4682 ++ desc->affinity_notify->release);
4683 ++ }
4684 + }
4685 + irqd_set(data, IRQD_AFFINITY_SET);
4686 +
4687 +@@ -384,7 +388,10 @@ irq_set_affinity_notifier(unsigned int irq, struct irq_affinity_notify *notify)
4688 + raw_spin_unlock_irqrestore(&desc->lock, flags);
4689 +
4690 + if (old_notify) {
4691 +- cancel_work_sync(&old_notify->work);
4692 ++ if (cancel_work_sync(&old_notify->work)) {
4693 ++ /* Pending work had a ref, put that one too */
4694 ++ kref_put(&old_notify->kref, old_notify->release);
4695 ++ }
4696 + kref_put(&old_notify->kref, old_notify->release);
4697 + }
4698 +
4699 +diff --git a/lib/crypto/chacha20poly1305-selftest.c b/lib/crypto/chacha20poly1305-selftest.c
4700 +index 465de46dbdef..fa43deda2660 100644
4701 +--- a/lib/crypto/chacha20poly1305-selftest.c
4702 ++++ b/lib/crypto/chacha20poly1305-selftest.c
4703 +@@ -4,6 +4,7 @@
4704 + */
4705 +
4706 + #include <crypto/chacha20poly1305.h>
4707 ++#include <crypto/chacha.h>
4708 + #include <crypto/poly1305.h>
4709 +
4710 + #include <asm/unaligned.h>
4711 +@@ -1926,6 +1927,1104 @@ static const u8 enc_key012[] __initconst = {
4712 + 0x65, 0x91, 0x6e, 0x2a, 0x79, 0x22, 0xda, 0x64
4713 + };
4714 +
4715 ++/* wycheproof - rfc7539 */
4716 ++static const u8 enc_input013[] __initconst = {
4717 ++ 0x4c, 0x61, 0x64, 0x69, 0x65, 0x73, 0x20, 0x61,
4718 ++ 0x6e, 0x64, 0x20, 0x47, 0x65, 0x6e, 0x74, 0x6c,
4719 ++ 0x65, 0x6d, 0x65, 0x6e, 0x20, 0x6f, 0x66, 0x20,
4720 ++ 0x74, 0x68, 0x65, 0x20, 0x63, 0x6c, 0x61, 0x73,
4721 ++ 0x73, 0x20, 0x6f, 0x66, 0x20, 0x27, 0x39, 0x39,
4722 ++ 0x3a, 0x20, 0x49, 0x66, 0x20, 0x49, 0x20, 0x63,
4723 ++ 0x6f, 0x75, 0x6c, 0x64, 0x20, 0x6f, 0x66, 0x66,
4724 ++ 0x65, 0x72, 0x20, 0x79, 0x6f, 0x75, 0x20, 0x6f,
4725 ++ 0x6e, 0x6c, 0x79, 0x20, 0x6f, 0x6e, 0x65, 0x20,
4726 ++ 0x74, 0x69, 0x70, 0x20, 0x66, 0x6f, 0x72, 0x20,
4727 ++ 0x74, 0x68, 0x65, 0x20, 0x66, 0x75, 0x74, 0x75,
4728 ++ 0x72, 0x65, 0x2c, 0x20, 0x73, 0x75, 0x6e, 0x73,
4729 ++ 0x63, 0x72, 0x65, 0x65, 0x6e, 0x20, 0x77, 0x6f,
4730 ++ 0x75, 0x6c, 0x64, 0x20, 0x62, 0x65, 0x20, 0x69,
4731 ++ 0x74, 0x2e
4732 ++};
4733 ++static const u8 enc_output013[] __initconst = {
4734 ++ 0xd3, 0x1a, 0x8d, 0x34, 0x64, 0x8e, 0x60, 0xdb,
4735 ++ 0x7b, 0x86, 0xaf, 0xbc, 0x53, 0xef, 0x7e, 0xc2,
4736 ++ 0xa4, 0xad, 0xed, 0x51, 0x29, 0x6e, 0x08, 0xfe,
4737 ++ 0xa9, 0xe2, 0xb5, 0xa7, 0x36, 0xee, 0x62, 0xd6,
4738 ++ 0x3d, 0xbe, 0xa4, 0x5e, 0x8c, 0xa9, 0x67, 0x12,
4739 ++ 0x82, 0xfa, 0xfb, 0x69, 0xda, 0x92, 0x72, 0x8b,
4740 ++ 0x1a, 0x71, 0xde, 0x0a, 0x9e, 0x06, 0x0b, 0x29,
4741 ++ 0x05, 0xd6, 0xa5, 0xb6, 0x7e, 0xcd, 0x3b, 0x36,
4742 ++ 0x92, 0xdd, 0xbd, 0x7f, 0x2d, 0x77, 0x8b, 0x8c,
4743 ++ 0x98, 0x03, 0xae, 0xe3, 0x28, 0x09, 0x1b, 0x58,
4744 ++ 0xfa, 0xb3, 0x24, 0xe4, 0xfa, 0xd6, 0x75, 0x94,
4745 ++ 0x55, 0x85, 0x80, 0x8b, 0x48, 0x31, 0xd7, 0xbc,
4746 ++ 0x3f, 0xf4, 0xde, 0xf0, 0x8e, 0x4b, 0x7a, 0x9d,
4747 ++ 0xe5, 0x76, 0xd2, 0x65, 0x86, 0xce, 0xc6, 0x4b,
4748 ++ 0x61, 0x16, 0x1a, 0xe1, 0x0b, 0x59, 0x4f, 0x09,
4749 ++ 0xe2, 0x6a, 0x7e, 0x90, 0x2e, 0xcb, 0xd0, 0x60,
4750 ++ 0x06, 0x91
4751 ++};
4752 ++static const u8 enc_assoc013[] __initconst = {
4753 ++ 0x50, 0x51, 0x52, 0x53, 0xc0, 0xc1, 0xc2, 0xc3,
4754 ++ 0xc4, 0xc5, 0xc6, 0xc7
4755 ++};
4756 ++static const u8 enc_nonce013[] __initconst = {
4757 ++ 0x07, 0x00, 0x00, 0x00, 0x40, 0x41, 0x42, 0x43,
4758 ++ 0x44, 0x45, 0x46, 0x47
4759 ++};
4760 ++static const u8 enc_key013[] __initconst = {
4761 ++ 0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87,
4762 ++ 0x88, 0x89, 0x8a, 0x8b, 0x8c, 0x8d, 0x8e, 0x8f,
4763 ++ 0x90, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97,
4764 ++ 0x98, 0x99, 0x9a, 0x9b, 0x9c, 0x9d, 0x9e, 0x9f
4765 ++};
4766 ++
4767 ++/* wycheproof - misc */
4768 ++static const u8 enc_input014[] __initconst = { };
4769 ++static const u8 enc_output014[] __initconst = {
4770 ++ 0x76, 0xac, 0xb3, 0x42, 0xcf, 0x31, 0x66, 0xa5,
4771 ++ 0xb6, 0x3c, 0x0c, 0x0e, 0xa1, 0x38, 0x3c, 0x8d
4772 ++};
4773 ++static const u8 enc_assoc014[] __initconst = { };
4774 ++static const u8 enc_nonce014[] __initconst = {
4775 ++ 0x4d, 0xa5, 0xbf, 0x8d, 0xfd, 0x58, 0x52, 0xc1,
4776 ++ 0xea, 0x12, 0x37, 0x9d
4777 ++};
4778 ++static const u8 enc_key014[] __initconst = {
4779 ++ 0x80, 0xba, 0x31, 0x92, 0xc8, 0x03, 0xce, 0x96,
4780 ++ 0x5e, 0xa3, 0x71, 0xd5, 0xff, 0x07, 0x3c, 0xf0,
4781 ++ 0xf4, 0x3b, 0x6a, 0x2a, 0xb5, 0x76, 0xb2, 0x08,
4782 ++ 0x42, 0x6e, 0x11, 0x40, 0x9c, 0x09, 0xb9, 0xb0
4783 ++};
4784 ++
4785 ++/* wycheproof - misc */
4786 ++static const u8 enc_input015[] __initconst = { };
4787 ++static const u8 enc_output015[] __initconst = {
4788 ++ 0x90, 0x6f, 0xa6, 0x28, 0x4b, 0x52, 0xf8, 0x7b,
4789 ++ 0x73, 0x59, 0xcb, 0xaa, 0x75, 0x63, 0xc7, 0x09
4790 ++};
4791 ++static const u8 enc_assoc015[] __initconst = {
4792 ++ 0xbd, 0x50, 0x67, 0x64, 0xf2, 0xd2, 0xc4, 0x10
4793 ++};
4794 ++static const u8 enc_nonce015[] __initconst = {
4795 ++ 0xa9, 0x2e, 0xf0, 0xac, 0x99, 0x1d, 0xd5, 0x16,
4796 ++ 0xa3, 0xc6, 0xf6, 0x89
4797 ++};
4798 ++static const u8 enc_key015[] __initconst = {
4799 ++ 0x7a, 0x4c, 0xd7, 0x59, 0x17, 0x2e, 0x02, 0xeb,
4800 ++ 0x20, 0x4d, 0xb2, 0xc3, 0xf5, 0xc7, 0x46, 0x22,
4801 ++ 0x7d, 0xf5, 0x84, 0xfc, 0x13, 0x45, 0x19, 0x63,
4802 ++ 0x91, 0xdb, 0xb9, 0x57, 0x7a, 0x25, 0x07, 0x42
4803 ++};
4804 ++
4805 ++/* wycheproof - misc */
4806 ++static const u8 enc_input016[] __initconst = {
4807 ++ 0x2a
4808 ++};
4809 ++static const u8 enc_output016[] __initconst = {
4810 ++ 0x3a, 0xca, 0xc2, 0x7d, 0xec, 0x09, 0x68, 0x80,
4811 ++ 0x1e, 0x9f, 0x6e, 0xde, 0xd6, 0x9d, 0x80, 0x75,
4812 ++ 0x22
4813 ++};
4814 ++static const u8 enc_assoc016[] __initconst = { };
4815 ++static const u8 enc_nonce016[] __initconst = {
4816 ++ 0x99, 0xe2, 0x3e, 0xc4, 0x89, 0x85, 0xbc, 0xcd,
4817 ++ 0xee, 0xab, 0x60, 0xf1
4818 ++};
4819 ++static const u8 enc_key016[] __initconst = {
4820 ++ 0xcc, 0x56, 0xb6, 0x80, 0x55, 0x2e, 0xb7, 0x50,
4821 ++ 0x08, 0xf5, 0x48, 0x4b, 0x4c, 0xb8, 0x03, 0xfa,
4822 ++ 0x50, 0x63, 0xeb, 0xd6, 0xea, 0xb9, 0x1f, 0x6a,
4823 ++ 0xb6, 0xae, 0xf4, 0x91, 0x6a, 0x76, 0x62, 0x73
4824 ++};
4825 ++
4826 ++/* wycheproof - misc */
4827 ++static const u8 enc_input017[] __initconst = {
4828 ++ 0x51
4829 ++};
4830 ++static const u8 enc_output017[] __initconst = {
4831 ++ 0xc4, 0x16, 0x83, 0x10, 0xca, 0x45, 0xb1, 0xf7,
4832 ++ 0xc6, 0x6c, 0xad, 0x4e, 0x99, 0xe4, 0x3f, 0x72,
4833 ++ 0xb9
4834 ++};
4835 ++static const u8 enc_assoc017[] __initconst = {
4836 ++ 0x91, 0xca, 0x6c, 0x59, 0x2c, 0xbc, 0xca, 0x53
4837 ++};
4838 ++static const u8 enc_nonce017[] __initconst = {
4839 ++ 0xab, 0x0d, 0xca, 0x71, 0x6e, 0xe0, 0x51, 0xd2,
4840 ++ 0x78, 0x2f, 0x44, 0x03
4841 ++};
4842 ++static const u8 enc_key017[] __initconst = {
4843 ++ 0x46, 0xf0, 0x25, 0x49, 0x65, 0xf7, 0x69, 0xd5,
4844 ++ 0x2b, 0xdb, 0x4a, 0x70, 0xb4, 0x43, 0x19, 0x9f,
4845 ++ 0x8e, 0xf2, 0x07, 0x52, 0x0d, 0x12, 0x20, 0xc5,
4846 ++ 0x5e, 0x4b, 0x70, 0xf0, 0xfd, 0xa6, 0x20, 0xee
4847 ++};
4848 ++
4849 ++/* wycheproof - misc */
4850 ++static const u8 enc_input018[] __initconst = {
4851 ++ 0x5c, 0x60
4852 ++};
4853 ++static const u8 enc_output018[] __initconst = {
4854 ++ 0x4d, 0x13, 0x91, 0xe8, 0xb6, 0x1e, 0xfb, 0x39,
4855 ++ 0xc1, 0x22, 0x19, 0x54, 0x53, 0x07, 0x7b, 0x22,
4856 ++ 0xe5, 0xe2
4857 ++};
4858 ++static const u8 enc_assoc018[] __initconst = { };
4859 ++static const u8 enc_nonce018[] __initconst = {
4860 ++ 0x46, 0x1a, 0xf1, 0x22, 0xe9, 0xf2, 0xe0, 0x34,
4861 ++ 0x7e, 0x03, 0xf2, 0xdb
4862 ++};
4863 ++static const u8 enc_key018[] __initconst = {
4864 ++ 0x2f, 0x7f, 0x7e, 0x4f, 0x59, 0x2b, 0xb3, 0x89,
4865 ++ 0x19, 0x49, 0x89, 0x74, 0x35, 0x07, 0xbf, 0x3e,
4866 ++ 0xe9, 0xcb, 0xde, 0x17, 0x86, 0xb6, 0x69, 0x5f,
4867 ++ 0xe6, 0xc0, 0x25, 0xfd, 0x9b, 0xa4, 0xc1, 0x00
4868 ++};
4869 ++
4870 ++/* wycheproof - misc */
4871 ++static const u8 enc_input019[] __initconst = {
4872 ++ 0xdd, 0xf2
4873 ++};
4874 ++static const u8 enc_output019[] __initconst = {
4875 ++ 0xb6, 0x0d, 0xea, 0xd0, 0xfd, 0x46, 0x97, 0xec,
4876 ++ 0x2e, 0x55, 0x58, 0x23, 0x77, 0x19, 0xd0, 0x24,
4877 ++ 0x37, 0xa2
4878 ++};
4879 ++static const u8 enc_assoc019[] __initconst = {
4880 ++ 0x88, 0x36, 0x4f, 0xc8, 0x06, 0x05, 0x18, 0xbf
4881 ++};
4882 ++static const u8 enc_nonce019[] __initconst = {
4883 ++ 0x61, 0x54, 0x6b, 0xa5, 0xf1, 0x72, 0x05, 0x90,
4884 ++ 0xb6, 0x04, 0x0a, 0xc6
4885 ++};
4886 ++static const u8 enc_key019[] __initconst = {
4887 ++ 0xc8, 0x83, 0x3d, 0xce, 0x5e, 0xa9, 0xf2, 0x48,
4888 ++ 0xaa, 0x20, 0x30, 0xea, 0xcf, 0xe7, 0x2b, 0xff,
4889 ++ 0xe6, 0x9a, 0x62, 0x0c, 0xaf, 0x79, 0x33, 0x44,
4890 ++ 0xe5, 0x71, 0x8f, 0xe0, 0xd7, 0xab, 0x1a, 0x58
4891 ++};
4892 ++
4893 ++/* wycheproof - misc */
4894 ++static const u8 enc_input020[] __initconst = {
4895 ++ 0xab, 0x85, 0xe9, 0xc1, 0x57, 0x17, 0x31
4896 ++};
4897 ++static const u8 enc_output020[] __initconst = {
4898 ++ 0x5d, 0xfe, 0x34, 0x40, 0xdb, 0xb3, 0xc3, 0xed,
4899 ++ 0x7a, 0x43, 0x4e, 0x26, 0x02, 0xd3, 0x94, 0x28,
4900 ++ 0x1e, 0x0a, 0xfa, 0x9f, 0xb7, 0xaa, 0x42
4901 ++};
4902 ++static const u8 enc_assoc020[] __initconst = { };
4903 ++static const u8 enc_nonce020[] __initconst = {
4904 ++ 0x3c, 0x4e, 0x65, 0x4d, 0x66, 0x3f, 0xa4, 0x59,
4905 ++ 0x6d, 0xc5, 0x5b, 0xb7
4906 ++};
4907 ++static const u8 enc_key020[] __initconst = {
4908 ++ 0x55, 0x56, 0x81, 0x58, 0xd3, 0xa6, 0x48, 0x3f,
4909 ++ 0x1f, 0x70, 0x21, 0xea, 0xb6, 0x9b, 0x70, 0x3f,
4910 ++ 0x61, 0x42, 0x51, 0xca, 0xdc, 0x1a, 0xf5, 0xd3,
4911 ++ 0x4a, 0x37, 0x4f, 0xdb, 0xfc, 0x5a, 0xda, 0xc7
4912 ++};
4913 ++
4914 ++/* wycheproof - misc */
4915 ++static const u8 enc_input021[] __initconst = {
4916 ++ 0x4e, 0xe5, 0xcd, 0xa2, 0x0d, 0x42, 0x90
4917 ++};
4918 ++static const u8 enc_output021[] __initconst = {
4919 ++ 0x4b, 0xd4, 0x72, 0x12, 0x94, 0x1c, 0xe3, 0x18,
4920 ++ 0x5f, 0x14, 0x08, 0xee, 0x7f, 0xbf, 0x18, 0xf5,
4921 ++ 0xab, 0xad, 0x6e, 0x22, 0x53, 0xa1, 0xba
4922 ++};
4923 ++static const u8 enc_assoc021[] __initconst = {
4924 ++ 0x84, 0xe4, 0x6b, 0xe8, 0xc0, 0x91, 0x90, 0x53
4925 ++};
4926 ++static const u8 enc_nonce021[] __initconst = {
4927 ++ 0x58, 0x38, 0x93, 0x75, 0xc6, 0x9e, 0xe3, 0x98,
4928 ++ 0xde, 0x94, 0x83, 0x96
4929 ++};
4930 ++static const u8 enc_key021[] __initconst = {
4931 ++ 0xe3, 0xc0, 0x9e, 0x7f, 0xab, 0x1a, 0xef, 0xb5,
4932 ++ 0x16, 0xda, 0x6a, 0x33, 0x02, 0x2a, 0x1d, 0xd4,
4933 ++ 0xeb, 0x27, 0x2c, 0x80, 0xd5, 0x40, 0xc5, 0xda,
4934 ++ 0x52, 0xa7, 0x30, 0xf3, 0x4d, 0x84, 0x0d, 0x7f
4935 ++};
4936 ++
4937 ++/* wycheproof - misc */
4938 ++static const u8 enc_input022[] __initconst = {
4939 ++ 0xbe, 0x33, 0x08, 0xf7, 0x2a, 0x2c, 0x6a, 0xed
4940 ++};
4941 ++static const u8 enc_output022[] __initconst = {
4942 ++ 0x8e, 0x94, 0x39, 0xa5, 0x6e, 0xee, 0xc8, 0x17,
4943 ++ 0xfb, 0xe8, 0xa6, 0xed, 0x8f, 0xab, 0xb1, 0x93,
4944 ++ 0x75, 0x39, 0xdd, 0x6c, 0x00, 0xe9, 0x00, 0x21
4945 ++};
4946 ++static const u8 enc_assoc022[] __initconst = { };
4947 ++static const u8 enc_nonce022[] __initconst = {
4948 ++ 0x4f, 0x07, 0xaf, 0xed, 0xfd, 0xc3, 0xb6, 0xc2,
4949 ++ 0x36, 0x18, 0x23, 0xd3
4950 ++};
4951 ++static const u8 enc_key022[] __initconst = {
4952 ++ 0x51, 0xe4, 0xbf, 0x2b, 0xad, 0x92, 0xb7, 0xaf,
4953 ++ 0xf1, 0xa4, 0xbc, 0x05, 0x55, 0x0b, 0xa8, 0x1d,
4954 ++ 0xf4, 0xb9, 0x6f, 0xab, 0xf4, 0x1c, 0x12, 0xc7,
4955 ++ 0xb0, 0x0e, 0x60, 0xe4, 0x8d, 0xb7, 0xe1, 0x52
4956 ++};
4957 ++
4958 ++/* wycheproof - misc */
4959 ++static const u8 enc_input023[] __initconst = {
4960 ++ 0xa4, 0xc9, 0xc2, 0x80, 0x1b, 0x71, 0xf7, 0xdf
4961 ++};
4962 ++static const u8 enc_output023[] __initconst = {
4963 ++ 0xb9, 0xb9, 0x10, 0x43, 0x3a, 0xf0, 0x52, 0xb0,
4964 ++ 0x45, 0x30, 0xf5, 0x1a, 0xee, 0xe0, 0x24, 0xe0,
4965 ++ 0xa4, 0x45, 0xa6, 0x32, 0x8f, 0xa6, 0x7a, 0x18
4966 ++};
4967 ++static const u8 enc_assoc023[] __initconst = {
4968 ++ 0x66, 0xc0, 0xae, 0x70, 0x07, 0x6c, 0xb1, 0x4d
4969 ++};
4970 ++static const u8 enc_nonce023[] __initconst = {
4971 ++ 0xb4, 0xea, 0x66, 0x6e, 0xe1, 0x19, 0x56, 0x33,
4972 ++ 0x66, 0x48, 0x4a, 0x78
4973 ++};
4974 ++static const u8 enc_key023[] __initconst = {
4975 ++ 0x11, 0x31, 0xc1, 0x41, 0x85, 0x77, 0xa0, 0x54,
4976 ++ 0xde, 0x7a, 0x4a, 0xc5, 0x51, 0x95, 0x0f, 0x1a,
4977 ++ 0x05, 0x3f, 0x9a, 0xe4, 0x6e, 0x5b, 0x75, 0xfe,
4978 ++ 0x4a, 0xbd, 0x56, 0x08, 0xd7, 0xcd, 0xda, 0xdd
4979 ++};
4980 ++
4981 ++/* wycheproof - misc */
4982 ++static const u8 enc_input024[] __initconst = {
4983 ++ 0x42, 0xba, 0xae, 0x59, 0x78, 0xfe, 0xaf, 0x5c,
4984 ++ 0x36, 0x8d, 0x14, 0xe0
4985 ++};
4986 ++static const u8 enc_output024[] __initconst = {
4987 ++ 0xff, 0x7d, 0xc2, 0x03, 0xb2, 0x6c, 0x46, 0x7a,
4988 ++ 0x6b, 0x50, 0xdb, 0x33, 0x57, 0x8c, 0x0f, 0x27,
4989 ++ 0x58, 0xc2, 0xe1, 0x4e, 0x36, 0xd4, 0xfc, 0x10,
4990 ++ 0x6d, 0xcb, 0x29, 0xb4
4991 ++};
4992 ++static const u8 enc_assoc024[] __initconst = { };
4993 ++static const u8 enc_nonce024[] __initconst = {
4994 ++ 0x9a, 0x59, 0xfc, 0xe2, 0x6d, 0xf0, 0x00, 0x5e,
4995 ++ 0x07, 0x53, 0x86, 0x56
4996 ++};
4997 ++static const u8 enc_key024[] __initconst = {
4998 ++ 0x99, 0xb6, 0x2b, 0xd5, 0xaf, 0xbe, 0x3f, 0xb0,
4999 ++ 0x15, 0xbd, 0xe9, 0x3f, 0x0a, 0xbf, 0x48, 0x39,
5000 ++ 0x57, 0xa1, 0xc3, 0xeb, 0x3c, 0xa5, 0x9c, 0xb5,
5001 ++ 0x0b, 0x39, 0xf7, 0xf8, 0xa9, 0xcc, 0x51, 0xbe
5002 ++};
5003 ++
5004 ++/* wycheproof - misc */
5005 ++static const u8 enc_input025[] __initconst = {
5006 ++ 0xfd, 0xc8, 0x5b, 0x94, 0xa4, 0xb2, 0xa6, 0xb7,
5007 ++ 0x59, 0xb1, 0xa0, 0xda
5008 ++};
5009 ++static const u8 enc_output025[] __initconst = {
5010 ++ 0x9f, 0x88, 0x16, 0xde, 0x09, 0x94, 0xe9, 0x38,
5011 ++ 0xd9, 0xe5, 0x3f, 0x95, 0xd0, 0x86, 0xfc, 0x6c,
5012 ++ 0x9d, 0x8f, 0xa9, 0x15, 0xfd, 0x84, 0x23, 0xa7,
5013 ++ 0xcf, 0x05, 0x07, 0x2f
5014 ++};
5015 ++static const u8 enc_assoc025[] __initconst = {
5016 ++ 0xa5, 0x06, 0xe1, 0xa5, 0xc6, 0x90, 0x93, 0xf9
5017 ++};
5018 ++static const u8 enc_nonce025[] __initconst = {
5019 ++ 0x58, 0xdb, 0xd4, 0xad, 0x2c, 0x4a, 0xd3, 0x5d,
5020 ++ 0xd9, 0x06, 0xe9, 0xce
5021 ++};
5022 ++static const u8 enc_key025[] __initconst = {
5023 ++ 0x85, 0xf3, 0x5b, 0x62, 0x82, 0xcf, 0xf4, 0x40,
5024 ++ 0xbc, 0x10, 0x20, 0xc8, 0x13, 0x6f, 0xf2, 0x70,
5025 ++ 0x31, 0x11, 0x0f, 0xa6, 0x3e, 0xc1, 0x6f, 0x1e,
5026 ++ 0x82, 0x51, 0x18, 0xb0, 0x06, 0xb9, 0x12, 0x57
5027 ++};
5028 ++
5029 ++/* wycheproof - misc */
5030 ++static const u8 enc_input026[] __initconst = {
5031 ++ 0x51, 0xf8, 0xc1, 0xf7, 0x31, 0xea, 0x14, 0xac,
5032 ++ 0xdb, 0x21, 0x0a, 0x6d, 0x97, 0x3e, 0x07
5033 ++};
5034 ++static const u8 enc_output026[] __initconst = {
5035 ++ 0x0b, 0x29, 0x63, 0x8e, 0x1f, 0xbd, 0xd6, 0xdf,
5036 ++ 0x53, 0x97, 0x0b, 0xe2, 0x21, 0x00, 0x42, 0x2a,
5037 ++ 0x91, 0x34, 0x08, 0x7d, 0x67, 0xa4, 0x6e, 0x79,
5038 ++ 0x17, 0x8d, 0x0a, 0x93, 0xf5, 0xe1, 0xd2
5039 ++};
5040 ++static const u8 enc_assoc026[] __initconst = { };
5041 ++static const u8 enc_nonce026[] __initconst = {
5042 ++ 0x68, 0xab, 0x7f, 0xdb, 0xf6, 0x19, 0x01, 0xda,
5043 ++ 0xd4, 0x61, 0xd2, 0x3c
5044 ++};
5045 ++static const u8 enc_key026[] __initconst = {
5046 ++ 0x67, 0x11, 0x96, 0x27, 0xbd, 0x98, 0x8e, 0xda,
5047 ++ 0x90, 0x62, 0x19, 0xe0, 0x8c, 0x0d, 0x0d, 0x77,
5048 ++ 0x9a, 0x07, 0xd2, 0x08, 0xce, 0x8a, 0x4f, 0xe0,
5049 ++ 0x70, 0x9a, 0xf7, 0x55, 0xee, 0xec, 0x6d, 0xcb
5050 ++};
5051 ++
5052 ++/* wycheproof - misc */
5053 ++static const u8 enc_input027[] __initconst = {
5054 ++ 0x97, 0x46, 0x9d, 0xa6, 0x67, 0xd6, 0x11, 0x0f,
5055 ++ 0x9c, 0xbd, 0xa1, 0xd1, 0xa2, 0x06, 0x73
5056 ++};
5057 ++static const u8 enc_output027[] __initconst = {
5058 ++ 0x32, 0xdb, 0x66, 0xc4, 0xa3, 0x81, 0x9d, 0x81,
5059 ++ 0x55, 0x74, 0x55, 0xe5, 0x98, 0x0f, 0xed, 0xfe,
5060 ++ 0xae, 0x30, 0xde, 0xc9, 0x4e, 0x6a, 0xd3, 0xa9,
5061 ++ 0xee, 0xa0, 0x6a, 0x0d, 0x70, 0x39, 0x17
5062 ++};
5063 ++static const u8 enc_assoc027[] __initconst = {
5064 ++ 0x64, 0x53, 0xa5, 0x33, 0x84, 0x63, 0x22, 0x12
5065 ++};
5066 ++static const u8 enc_nonce027[] __initconst = {
5067 ++ 0xd9, 0x5b, 0x32, 0x43, 0xaf, 0xae, 0xf7, 0x14,
5068 ++ 0xc5, 0x03, 0x5b, 0x6a
5069 ++};
5070 ++static const u8 enc_key027[] __initconst = {
5071 ++ 0xe6, 0xf1, 0x11, 0x8d, 0x41, 0xe4, 0xb4, 0x3f,
5072 ++ 0xb5, 0x82, 0x21, 0xb7, 0xed, 0x79, 0x67, 0x38,
5073 ++ 0x34, 0xe0, 0xd8, 0xac, 0x5c, 0x4f, 0xa6, 0x0b,
5074 ++ 0xbc, 0x8b, 0xc4, 0x89, 0x3a, 0x58, 0x89, 0x4d
5075 ++};
5076 ++
5077 ++/* wycheproof - misc */
5078 ++static const u8 enc_input028[] __initconst = {
5079 ++ 0x54, 0x9b, 0x36, 0x5a, 0xf9, 0x13, 0xf3, 0xb0,
5080 ++ 0x81, 0x13, 0x1c, 0xcb, 0x6b, 0x82, 0x55, 0x88
5081 ++};
5082 ++static const u8 enc_output028[] __initconst = {
5083 ++ 0xe9, 0x11, 0x0e, 0x9f, 0x56, 0xab, 0x3c, 0xa4,
5084 ++ 0x83, 0x50, 0x0c, 0xea, 0xba, 0xb6, 0x7a, 0x13,
5085 ++ 0x83, 0x6c, 0xca, 0xbf, 0x15, 0xa6, 0xa2, 0x2a,
5086 ++ 0x51, 0xc1, 0x07, 0x1c, 0xfa, 0x68, 0xfa, 0x0c
5087 ++};
5088 ++static const u8 enc_assoc028[] __initconst = { };
5089 ++static const u8 enc_nonce028[] __initconst = {
5090 ++ 0x2f, 0xcb, 0x1b, 0x38, 0xa9, 0x9e, 0x71, 0xb8,
5091 ++ 0x47, 0x40, 0xad, 0x9b
5092 ++};
5093 ++static const u8 enc_key028[] __initconst = {
5094 ++ 0x59, 0xd4, 0xea, 0xfb, 0x4d, 0xe0, 0xcf, 0xc7,
5095 ++ 0xd3, 0xdb, 0x99, 0xa8, 0xf5, 0x4b, 0x15, 0xd7,
5096 ++ 0xb3, 0x9f, 0x0a, 0xcc, 0x8d, 0xa6, 0x97, 0x63,
5097 ++ 0xb0, 0x19, 0xc1, 0x69, 0x9f, 0x87, 0x67, 0x4a
5098 ++};
5099 ++
5100 ++/* wycheproof - misc */
5101 ++static const u8 enc_input029[] __initconst = {
5102 ++ 0x55, 0xa4, 0x65, 0x64, 0x4f, 0x5b, 0x65, 0x09,
5103 ++ 0x28, 0xcb, 0xee, 0x7c, 0x06, 0x32, 0x14, 0xd6
5104 ++};
5105 ++static const u8 enc_output029[] __initconst = {
5106 ++ 0xe4, 0xb1, 0x13, 0xcb, 0x77, 0x59, 0x45, 0xf3,
5107 ++ 0xd3, 0xa8, 0xae, 0x9e, 0xc1, 0x41, 0xc0, 0x0c,
5108 ++ 0x7c, 0x43, 0xf1, 0x6c, 0xe0, 0x96, 0xd0, 0xdc,
5109 ++ 0x27, 0xc9, 0x58, 0x49, 0xdc, 0x38, 0x3b, 0x7d
5110 ++};
5111 ++static const u8 enc_assoc029[] __initconst = {
5112 ++ 0x03, 0x45, 0x85, 0x62, 0x1a, 0xf8, 0xd7, 0xff
5113 ++};
5114 ++static const u8 enc_nonce029[] __initconst = {
5115 ++ 0x11, 0x8a, 0x69, 0x64, 0xc2, 0xd3, 0xe3, 0x80,
5116 ++ 0x07, 0x1f, 0x52, 0x66
5117 ++};
5118 ++static const u8 enc_key029[] __initconst = {
5119 ++ 0xb9, 0x07, 0xa4, 0x50, 0x75, 0x51, 0x3f, 0xe8,
5120 ++ 0xa8, 0x01, 0x9e, 0xde, 0xe3, 0xf2, 0x59, 0x14,
5121 ++ 0x87, 0xb2, 0xa0, 0x30, 0xb0, 0x3c, 0x6e, 0x1d,
5122 ++ 0x77, 0x1c, 0x86, 0x25, 0x71, 0xd2, 0xea, 0x1e
5123 ++};
5124 ++
5125 ++/* wycheproof - misc */
5126 ++static const u8 enc_input030[] __initconst = {
5127 ++ 0x3f, 0xf1, 0x51, 0x4b, 0x1c, 0x50, 0x39, 0x15,
5128 ++ 0x91, 0x8f, 0x0c, 0x0c, 0x31, 0x09, 0x4a, 0x6e,
5129 ++ 0x1f
5130 ++};
5131 ++static const u8 enc_output030[] __initconst = {
5132 ++ 0x02, 0xcc, 0x3a, 0xcb, 0x5e, 0xe1, 0xfc, 0xdd,
5133 ++ 0x12, 0xa0, 0x3b, 0xb8, 0x57, 0x97, 0x64, 0x74,
5134 ++ 0xd3, 0xd8, 0x3b, 0x74, 0x63, 0xa2, 0xc3, 0x80,
5135 ++ 0x0f, 0xe9, 0x58, 0xc2, 0x8e, 0xaa, 0x29, 0x08,
5136 ++ 0x13
5137 ++};
5138 ++static const u8 enc_assoc030[] __initconst = { };
5139 ++static const u8 enc_nonce030[] __initconst = {
5140 ++ 0x45, 0xaa, 0xa3, 0xe5, 0xd1, 0x6d, 0x2d, 0x42,
5141 ++ 0xdc, 0x03, 0x44, 0x5d
5142 ++};
5143 ++static const u8 enc_key030[] __initconst = {
5144 ++ 0x3b, 0x24, 0x58, 0xd8, 0x17, 0x6e, 0x16, 0x21,
5145 ++ 0xc0, 0xcc, 0x24, 0xc0, 0xc0, 0xe2, 0x4c, 0x1e,
5146 ++ 0x80, 0xd7, 0x2f, 0x7e, 0xe9, 0x14, 0x9a, 0x4b,
5147 ++ 0x16, 0x61, 0x76, 0x62, 0x96, 0x16, 0xd0, 0x11
5148 ++};
5149 ++
5150 ++/* wycheproof - misc */
5151 ++static const u8 enc_input031[] __initconst = {
5152 ++ 0x63, 0x85, 0x8c, 0xa3, 0xe2, 0xce, 0x69, 0x88,
5153 ++ 0x7b, 0x57, 0x8a, 0x3c, 0x16, 0x7b, 0x42, 0x1c,
5154 ++ 0x9c
5155 ++};
5156 ++static const u8 enc_output031[] __initconst = {
5157 ++ 0x35, 0x76, 0x64, 0x88, 0xd2, 0xbc, 0x7c, 0x2b,
5158 ++ 0x8d, 0x17, 0xcb, 0xbb, 0x9a, 0xbf, 0xad, 0x9e,
5159 ++ 0x6d, 0x1f, 0x39, 0x1e, 0x65, 0x7b, 0x27, 0x38,
5160 ++ 0xdd, 0xa0, 0x84, 0x48, 0xcb, 0xa2, 0x81, 0x1c,
5161 ++ 0xeb
5162 ++};
5163 ++static const u8 enc_assoc031[] __initconst = {
5164 ++ 0x9a, 0xaf, 0x29, 0x9e, 0xee, 0xa7, 0x8f, 0x79
5165 ++};
5166 ++static const u8 enc_nonce031[] __initconst = {
5167 ++ 0xf0, 0x38, 0x4f, 0xb8, 0x76, 0x12, 0x14, 0x10,
5168 ++ 0x63, 0x3d, 0x99, 0x3d
5169 ++};
5170 ++static const u8 enc_key031[] __initconst = {
5171 ++ 0xf6, 0x0c, 0x6a, 0x1b, 0x62, 0x57, 0x25, 0xf7,
5172 ++ 0x6c, 0x70, 0x37, 0xb4, 0x8f, 0xe3, 0x57, 0x7f,
5173 ++ 0xa7, 0xf7, 0xb8, 0x7b, 0x1b, 0xd5, 0xa9, 0x82,
5174 ++ 0x17, 0x6d, 0x18, 0x23, 0x06, 0xff, 0xb8, 0x70
5175 ++};
5176 ++
5177 ++/* wycheproof - misc */
5178 ++static const u8 enc_input032[] __initconst = {
5179 ++ 0x10, 0xf1, 0xec, 0xf9, 0xc6, 0x05, 0x84, 0x66,
5180 ++ 0x5d, 0x9a, 0xe5, 0xef, 0xe2, 0x79, 0xe7, 0xf7,
5181 ++ 0x37, 0x7e, 0xea, 0x69, 0x16, 0xd2, 0xb1, 0x11
5182 ++};
5183 ++static const u8 enc_output032[] __initconst = {
5184 ++ 0x42, 0xf2, 0x6c, 0x56, 0xcb, 0x4b, 0xe2, 0x1d,
5185 ++ 0x9d, 0x8d, 0x0c, 0x80, 0xfc, 0x99, 0xdd, 0xe0,
5186 ++ 0x0d, 0x75, 0xf3, 0x80, 0x74, 0xbf, 0xe7, 0x64,
5187 ++ 0x54, 0xaa, 0x7e, 0x13, 0xd4, 0x8f, 0xff, 0x7d,
5188 ++ 0x75, 0x57, 0x03, 0x94, 0x57, 0x04, 0x0a, 0x3a
5189 ++};
5190 ++static const u8 enc_assoc032[] __initconst = { };
5191 ++static const u8 enc_nonce032[] __initconst = {
5192 ++ 0xe6, 0xb1, 0xad, 0xf2, 0xfd, 0x58, 0xa8, 0x76,
5193 ++ 0x2c, 0x65, 0xf3, 0x1b
5194 ++};
5195 ++static const u8 enc_key032[] __initconst = {
5196 ++ 0x02, 0x12, 0xa8, 0xde, 0x50, 0x07, 0xed, 0x87,
5197 ++ 0xb3, 0x3f, 0x1a, 0x70, 0x90, 0xb6, 0x11, 0x4f,
5198 ++ 0x9e, 0x08, 0xce, 0xfd, 0x96, 0x07, 0xf2, 0xc2,
5199 ++ 0x76, 0xbd, 0xcf, 0xdb, 0xc5, 0xce, 0x9c, 0xd7
5200 ++};
5201 ++
5202 ++/* wycheproof - misc */
5203 ++static const u8 enc_input033[] __initconst = {
5204 ++ 0x92, 0x22, 0xf9, 0x01, 0x8e, 0x54, 0xfd, 0x6d,
5205 ++ 0xe1, 0x20, 0x08, 0x06, 0xa9, 0xee, 0x8e, 0x4c,
5206 ++ 0xc9, 0x04, 0xd2, 0x9f, 0x25, 0xcb, 0xa1, 0x93
5207 ++};
5208 ++static const u8 enc_output033[] __initconst = {
5209 ++ 0x12, 0x30, 0x32, 0x43, 0x7b, 0x4b, 0xfd, 0x69,
5210 ++ 0x20, 0xe8, 0xf7, 0xe7, 0xe0, 0x08, 0x7a, 0xe4,
5211 ++ 0x88, 0x9e, 0xbe, 0x7a, 0x0a, 0xd0, 0xe9, 0x00,
5212 ++ 0x3c, 0xf6, 0x8f, 0x17, 0x95, 0x50, 0xda, 0x63,
5213 ++ 0xd3, 0xb9, 0x6c, 0x2d, 0x55, 0x41, 0x18, 0x65
5214 ++};
5215 ++static const u8 enc_assoc033[] __initconst = {
5216 ++ 0x3e, 0x8b, 0xc5, 0xad, 0xe1, 0x82, 0xff, 0x08
5217 ++};
5218 ++static const u8 enc_nonce033[] __initconst = {
5219 ++ 0x6b, 0x28, 0x2e, 0xbe, 0xcc, 0x54, 0x1b, 0xcd,
5220 ++ 0x78, 0x34, 0xed, 0x55
5221 ++};
5222 ++static const u8 enc_key033[] __initconst = {
5223 ++ 0xc5, 0xbc, 0x09, 0x56, 0x56, 0x46, 0xe7, 0xed,
5224 ++ 0xda, 0x95, 0x4f, 0x1f, 0x73, 0x92, 0x23, 0xda,
5225 ++ 0xda, 0x20, 0xb9, 0x5c, 0x44, 0xab, 0x03, 0x3d,
5226 ++ 0x0f, 0xae, 0x4b, 0x02, 0x83, 0xd1, 0x8b, 0xe3
5227 ++};
5228 ++
5229 ++/* wycheproof - misc */
5230 ++static const u8 enc_input034[] __initconst = {
5231 ++ 0xb0, 0x53, 0x99, 0x92, 0x86, 0xa2, 0x82, 0x4f,
5232 ++ 0x42, 0xcc, 0x8c, 0x20, 0x3a, 0xb2, 0x4e, 0x2c,
5233 ++ 0x97, 0xa6, 0x85, 0xad, 0xcc, 0x2a, 0xd3, 0x26,
5234 ++ 0x62, 0x55, 0x8e, 0x55, 0xa5, 0xc7, 0x29
5235 ++};
5236 ++static const u8 enc_output034[] __initconst = {
5237 ++ 0x45, 0xc7, 0xd6, 0xb5, 0x3a, 0xca, 0xd4, 0xab,
5238 ++ 0xb6, 0x88, 0x76, 0xa6, 0xe9, 0x6a, 0x48, 0xfb,
5239 ++ 0x59, 0x52, 0x4d, 0x2c, 0x92, 0xc9, 0xd8, 0xa1,
5240 ++ 0x89, 0xc9, 0xfd, 0x2d, 0xb9, 0x17, 0x46, 0x56,
5241 ++ 0x6d, 0x3c, 0xa1, 0x0e, 0x31, 0x1b, 0x69, 0x5f,
5242 ++ 0x3e, 0xae, 0x15, 0x51, 0x65, 0x24, 0x93
5243 ++};
5244 ++static const u8 enc_assoc034[] __initconst = { };
5245 ++static const u8 enc_nonce034[] __initconst = {
5246 ++ 0x04, 0xa9, 0xbe, 0x03, 0x50, 0x8a, 0x5f, 0x31,
5247 ++ 0x37, 0x1a, 0x6f, 0xd2
5248 ++};
5249 ++static const u8 enc_key034[] __initconst = {
5250 ++ 0x2e, 0xb5, 0x1c, 0x46, 0x9a, 0xa8, 0xeb, 0x9e,
5251 ++ 0x6c, 0x54, 0xa8, 0x34, 0x9b, 0xae, 0x50, 0xa2,
5252 ++ 0x0f, 0x0e, 0x38, 0x27, 0x11, 0xbb, 0xa1, 0x15,
5253 ++ 0x2c, 0x42, 0x4f, 0x03, 0xb6, 0x67, 0x1d, 0x71
5254 ++};
5255 ++
5256 ++/* wycheproof - misc */
5257 ++static const u8 enc_input035[] __initconst = {
5258 ++ 0xf4, 0x52, 0x06, 0xab, 0xc2, 0x55, 0x52, 0xb2,
5259 ++ 0xab, 0xc9, 0xab, 0x7f, 0xa2, 0x43, 0x03, 0x5f,
5260 ++ 0xed, 0xaa, 0xdd, 0xc3, 0xb2, 0x29, 0x39, 0x56,
5261 ++ 0xf1, 0xea, 0x6e, 0x71, 0x56, 0xe7, 0xeb
5262 ++};
5263 ++static const u8 enc_output035[] __initconst = {
5264 ++ 0x46, 0xa8, 0x0c, 0x41, 0x87, 0x02, 0x47, 0x20,
5265 ++ 0x08, 0x46, 0x27, 0x58, 0x00, 0x80, 0xdd, 0xe5,
5266 ++ 0xa3, 0xf4, 0xa1, 0x10, 0x93, 0xa7, 0x07, 0x6e,
5267 ++ 0xd6, 0xf3, 0xd3, 0x26, 0xbc, 0x7b, 0x70, 0x53,
5268 ++ 0x4d, 0x4a, 0xa2, 0x83, 0x5a, 0x52, 0xe7, 0x2d,
5269 ++ 0x14, 0xdf, 0x0e, 0x4f, 0x47, 0xf2, 0x5f
5270 ++};
5271 ++static const u8 enc_assoc035[] __initconst = {
5272 ++ 0x37, 0x46, 0x18, 0xa0, 0x6e, 0xa9, 0x8a, 0x48
5273 ++};
5274 ++static const u8 enc_nonce035[] __initconst = {
5275 ++ 0x47, 0x0a, 0x33, 0x9e, 0xcb, 0x32, 0x19, 0xb8,
5276 ++ 0xb8, 0x1a, 0x1f, 0x8b
5277 ++};
5278 ++static const u8 enc_key035[] __initconst = {
5279 ++ 0x7f, 0x5b, 0x74, 0xc0, 0x7e, 0xd1, 0xb4, 0x0f,
5280 ++ 0xd1, 0x43, 0x58, 0xfe, 0x2f, 0xf2, 0xa7, 0x40,
5281 ++ 0xc1, 0x16, 0xc7, 0x70, 0x65, 0x10, 0xe6, 0xa4,
5282 ++ 0x37, 0xf1, 0x9e, 0xa4, 0x99, 0x11, 0xce, 0xc4
5283 ++};
5284 ++
5285 ++/* wycheproof - misc */
5286 ++static const u8 enc_input036[] __initconst = {
5287 ++ 0xb9, 0xc5, 0x54, 0xcb, 0xc3, 0x6a, 0xc1, 0x8a,
5288 ++ 0xe8, 0x97, 0xdf, 0x7b, 0xee, 0xca, 0xc1, 0xdb,
5289 ++ 0xeb, 0x4e, 0xaf, 0xa1, 0x56, 0xbb, 0x60, 0xce,
5290 ++ 0x2e, 0x5d, 0x48, 0xf0, 0x57, 0x15, 0xe6, 0x78
5291 ++};
5292 ++static const u8 enc_output036[] __initconst = {
5293 ++ 0xea, 0x29, 0xaf, 0xa4, 0x9d, 0x36, 0xe8, 0x76,
5294 ++ 0x0f, 0x5f, 0xe1, 0x97, 0x23, 0xb9, 0x81, 0x1e,
5295 ++ 0xd5, 0xd5, 0x19, 0x93, 0x4a, 0x44, 0x0f, 0x50,
5296 ++ 0x81, 0xac, 0x43, 0x0b, 0x95, 0x3b, 0x0e, 0x21,
5297 ++ 0x22, 0x25, 0x41, 0xaf, 0x46, 0xb8, 0x65, 0x33,
5298 ++ 0xc6, 0xb6, 0x8d, 0x2f, 0xf1, 0x08, 0xa7, 0xea
5299 ++};
5300 ++static const u8 enc_assoc036[] __initconst = { };
5301 ++static const u8 enc_nonce036[] __initconst = {
5302 ++ 0x72, 0xcf, 0xd9, 0x0e, 0xf3, 0x02, 0x6c, 0xa2,
5303 ++ 0x2b, 0x7e, 0x6e, 0x6a
5304 ++};
5305 ++static const u8 enc_key036[] __initconst = {
5306 ++ 0xe1, 0x73, 0x1d, 0x58, 0x54, 0xe1, 0xb7, 0x0c,
5307 ++ 0xb3, 0xff, 0xe8, 0xb7, 0x86, 0xa2, 0xb3, 0xeb,
5308 ++ 0xf0, 0x99, 0x43, 0x70, 0x95, 0x47, 0x57, 0xb9,
5309 ++ 0xdc, 0x8c, 0x7b, 0xc5, 0x35, 0x46, 0x34, 0xa3
5310 ++};
5311 ++
5312 ++/* wycheproof - misc */
5313 ++static const u8 enc_input037[] __initconst = {
5314 ++ 0x6b, 0x26, 0x04, 0x99, 0x6c, 0xd3, 0x0c, 0x14,
5315 ++ 0xa1, 0x3a, 0x52, 0x57, 0xed, 0x6c, 0xff, 0xd3,
5316 ++ 0xbc, 0x5e, 0x29, 0xd6, 0xb9, 0x7e, 0xb1, 0x79,
5317 ++ 0x9e, 0xb3, 0x35, 0xe2, 0x81, 0xea, 0x45, 0x1e
5318 ++};
5319 ++static const u8 enc_output037[] __initconst = {
5320 ++ 0x6d, 0xad, 0x63, 0x78, 0x97, 0x54, 0x4d, 0x8b,
5321 ++ 0xf6, 0xbe, 0x95, 0x07, 0xed, 0x4d, 0x1b, 0xb2,
5322 ++ 0xe9, 0x54, 0xbc, 0x42, 0x7e, 0x5d, 0xe7, 0x29,
5323 ++ 0xda, 0xf5, 0x07, 0x62, 0x84, 0x6f, 0xf2, 0xf4,
5324 ++ 0x7b, 0x99, 0x7d, 0x93, 0xc9, 0x82, 0x18, 0x9d,
5325 ++ 0x70, 0x95, 0xdc, 0x79, 0x4c, 0x74, 0x62, 0x32
5326 ++};
5327 ++static const u8 enc_assoc037[] __initconst = {
5328 ++ 0x23, 0x33, 0xe5, 0xce, 0x0f, 0x93, 0xb0, 0x59
5329 ++};
5330 ++static const u8 enc_nonce037[] __initconst = {
5331 ++ 0x26, 0x28, 0x80, 0xd4, 0x75, 0xf3, 0xda, 0xc5,
5332 ++ 0x34, 0x0d, 0xd1, 0xb8
5333 ++};
5334 ++static const u8 enc_key037[] __initconst = {
5335 ++ 0x27, 0xd8, 0x60, 0x63, 0x1b, 0x04, 0x85, 0xa4,
5336 ++ 0x10, 0x70, 0x2f, 0xea, 0x61, 0xbc, 0x87, 0x3f,
5337 ++ 0x34, 0x42, 0x26, 0x0c, 0xad, 0xed, 0x4a, 0xbd,
5338 ++ 0xe2, 0x5b, 0x78, 0x6a, 0x2d, 0x97, 0xf1, 0x45
5339 ++};
5340 ++
5341 ++/* wycheproof - misc */
5342 ++static const u8 enc_input038[] __initconst = {
5343 ++ 0x97, 0x3d, 0x0c, 0x75, 0x38, 0x26, 0xba, 0xe4,
5344 ++ 0x66, 0xcf, 0x9a, 0xbb, 0x34, 0x93, 0x15, 0x2e,
5345 ++ 0x9d, 0xe7, 0x81, 0x9e, 0x2b, 0xd0, 0xc7, 0x11,
5346 ++ 0x71, 0x34, 0x6b, 0x4d, 0x2c, 0xeb, 0xf8, 0x04,
5347 ++ 0x1a, 0xa3, 0xce, 0xdc, 0x0d, 0xfd, 0x7b, 0x46,
5348 ++ 0x7e, 0x26, 0x22, 0x8b, 0xc8, 0x6c, 0x9a
5349 ++};
5350 ++static const u8 enc_output038[] __initconst = {
5351 ++ 0xfb, 0xa7, 0x8a, 0xe4, 0xf9, 0xd8, 0x08, 0xa6,
5352 ++ 0x2e, 0x3d, 0xa4, 0x0b, 0xe2, 0xcb, 0x77, 0x00,
5353 ++ 0xc3, 0x61, 0x3d, 0x9e, 0xb2, 0xc5, 0x29, 0xc6,
5354 ++ 0x52, 0xe7, 0x6a, 0x43, 0x2c, 0x65, 0x8d, 0x27,
5355 ++ 0x09, 0x5f, 0x0e, 0xb8, 0xf9, 0x40, 0xc3, 0x24,
5356 ++ 0x98, 0x1e, 0xa9, 0x35, 0xe5, 0x07, 0xf9, 0x8f,
5357 ++ 0x04, 0x69, 0x56, 0xdb, 0x3a, 0x51, 0x29, 0x08,
5358 ++ 0xbd, 0x7a, 0xfc, 0x8f, 0x2a, 0xb0, 0xa9
5359 ++};
5360 ++static const u8 enc_assoc038[] __initconst = { };
5361 ++static const u8 enc_nonce038[] __initconst = {
5362 ++ 0xe7, 0x4a, 0x51, 0x5e, 0x7e, 0x21, 0x02, 0xb9,
5363 ++ 0x0b, 0xef, 0x55, 0xd2
5364 ++};
5365 ++static const u8 enc_key038[] __initconst = {
5366 ++ 0xcf, 0x0d, 0x40, 0xa4, 0x64, 0x4e, 0x5f, 0x51,
5367 ++ 0x81, 0x51, 0x65, 0xd5, 0x30, 0x1b, 0x22, 0x63,
5368 ++ 0x1f, 0x45, 0x44, 0xc4, 0x9a, 0x18, 0x78, 0xe3,
5369 ++ 0xa0, 0xa5, 0xe8, 0xe1, 0xaa, 0xe0, 0xf2, 0x64
5370 ++};
5371 ++
5372 ++/* wycheproof - misc */
5373 ++static const u8 enc_input039[] __initconst = {
5374 ++ 0xa9, 0x89, 0x95, 0x50, 0x4d, 0xf1, 0x6f, 0x74,
5375 ++ 0x8b, 0xfb, 0x77, 0x85, 0xff, 0x91, 0xee, 0xb3,
5376 ++ 0xb6, 0x60, 0xea, 0x9e, 0xd3, 0x45, 0x0c, 0x3d,
5377 ++ 0x5e, 0x7b, 0x0e, 0x79, 0xef, 0x65, 0x36, 0x59,
5378 ++ 0xa9, 0x97, 0x8d, 0x75, 0x54, 0x2e, 0xf9, 0x1c,
5379 ++ 0x45, 0x67, 0x62, 0x21, 0x56, 0x40, 0xb9
5380 ++};
5381 ++static const u8 enc_output039[] __initconst = {
5382 ++ 0xa1, 0xff, 0xed, 0x80, 0x76, 0x18, 0x29, 0xec,
5383 ++ 0xce, 0x24, 0x2e, 0x0e, 0x88, 0xb1, 0x38, 0x04,
5384 ++ 0x90, 0x16, 0xbc, 0xa0, 0x18, 0xda, 0x2b, 0x6e,
5385 ++ 0x19, 0x98, 0x6b, 0x3e, 0x31, 0x8c, 0xae, 0x8d,
5386 ++ 0x80, 0x61, 0x98, 0xfb, 0x4c, 0x52, 0x7c, 0xc3,
5387 ++ 0x93, 0x50, 0xeb, 0xdd, 0xea, 0xc5, 0x73, 0xc4,
5388 ++ 0xcb, 0xf0, 0xbe, 0xfd, 0xa0, 0xb7, 0x02, 0x42,
5389 ++ 0xc6, 0x40, 0xd7, 0xcd, 0x02, 0xd7, 0xa3
5390 ++};
5391 ++static const u8 enc_assoc039[] __initconst = {
5392 ++ 0xb3, 0xe4, 0x06, 0x46, 0x83, 0xb0, 0x2d, 0x84
5393 ++};
5394 ++static const u8 enc_nonce039[] __initconst = {
5395 ++ 0xd4, 0xd8, 0x07, 0x34, 0x16, 0x83, 0x82, 0x5b,
5396 ++ 0x31, 0xcd, 0x4d, 0x95
5397 ++};
5398 ++static const u8 enc_key039[] __initconst = {
5399 ++ 0x6c, 0xbf, 0xd7, 0x1c, 0x64, 0x5d, 0x18, 0x4c,
5400 ++ 0xf5, 0xd2, 0x3c, 0x40, 0x2b, 0xdb, 0x0d, 0x25,
5401 ++ 0xec, 0x54, 0x89, 0x8c, 0x8a, 0x02, 0x73, 0xd4,
5402 ++ 0x2e, 0xb5, 0xbe, 0x10, 0x9f, 0xdc, 0xb2, 0xac
5403 ++};
5404 ++
5405 ++/* wycheproof - misc */
5406 ++static const u8 enc_input040[] __initconst = {
5407 ++ 0xd0, 0x96, 0x80, 0x31, 0x81, 0xbe, 0xef, 0x9e,
5408 ++ 0x00, 0x8f, 0xf8, 0x5d, 0x5d, 0xdc, 0x38, 0xdd,
5409 ++ 0xac, 0xf0, 0xf0, 0x9e, 0xe5, 0xf7, 0xe0, 0x7f,
5410 ++ 0x1e, 0x40, 0x79, 0xcb, 0x64, 0xd0, 0xdc, 0x8f,
5411 ++ 0x5e, 0x67, 0x11, 0xcd, 0x49, 0x21, 0xa7, 0x88,
5412 ++ 0x7d, 0xe7, 0x6e, 0x26, 0x78, 0xfd, 0xc6, 0x76,
5413 ++ 0x18, 0xf1, 0x18, 0x55, 0x86, 0xbf, 0xea, 0x9d,
5414 ++ 0x4c, 0x68, 0x5d, 0x50, 0xe4, 0xbb, 0x9a, 0x82
5415 ++};
5416 ++static const u8 enc_output040[] __initconst = {
5417 ++ 0x9a, 0x4e, 0xf2, 0x2b, 0x18, 0x16, 0x77, 0xb5,
5418 ++ 0x75, 0x5c, 0x08, 0xf7, 0x47, 0xc0, 0xf8, 0xd8,
5419 ++ 0xe8, 0xd4, 0xc1, 0x8a, 0x9c, 0xc2, 0x40, 0x5c,
5420 ++ 0x12, 0xbb, 0x51, 0xbb, 0x18, 0x72, 0xc8, 0xe8,
5421 ++ 0xb8, 0x77, 0x67, 0x8b, 0xec, 0x44, 0x2c, 0xfc,
5422 ++ 0xbb, 0x0f, 0xf4, 0x64, 0xa6, 0x4b, 0x74, 0x33,
5423 ++ 0x2c, 0xf0, 0x72, 0x89, 0x8c, 0x7e, 0x0e, 0xdd,
5424 ++ 0xf6, 0x23, 0x2e, 0xa6, 0xe2, 0x7e, 0xfe, 0x50,
5425 ++ 0x9f, 0xf3, 0x42, 0x7a, 0x0f, 0x32, 0xfa, 0x56,
5426 ++ 0x6d, 0x9c, 0xa0, 0xa7, 0x8a, 0xef, 0xc0, 0x13
5427 ++};
5428 ++static const u8 enc_assoc040[] __initconst = { };
5429 ++static const u8 enc_nonce040[] __initconst = {
5430 ++ 0xd6, 0x10, 0x40, 0xa3, 0x13, 0xed, 0x49, 0x28,
5431 ++ 0x23, 0xcc, 0x06, 0x5b
5432 ++};
5433 ++static const u8 enc_key040[] __initconst = {
5434 ++ 0x5b, 0x1d, 0x10, 0x35, 0xc0, 0xb1, 0x7e, 0xe0,
5435 ++ 0xb0, 0x44, 0x47, 0x67, 0xf8, 0x0a, 0x25, 0xb8,
5436 ++ 0xc1, 0xb7, 0x41, 0xf4, 0xb5, 0x0a, 0x4d, 0x30,
5437 ++ 0x52, 0x22, 0x6b, 0xaa, 0x1c, 0x6f, 0xb7, 0x01
5438 ++};
5439 ++
5440 ++/* wycheproof - misc */
5441 ++static const u8 enc_input041[] __initconst = {
5442 ++ 0x94, 0xee, 0x16, 0x6d, 0x6d, 0x6e, 0xcf, 0x88,
5443 ++ 0x32, 0x43, 0x71, 0x36, 0xb4, 0xae, 0x80, 0x5d,
5444 ++ 0x42, 0x88, 0x64, 0x35, 0x95, 0x86, 0xd9, 0x19,
5445 ++ 0x3a, 0x25, 0x01, 0x62, 0x93, 0xed, 0xba, 0x44,
5446 ++ 0x3c, 0x58, 0xe0, 0x7e, 0x7b, 0x71, 0x95, 0xec,
5447 ++ 0x5b, 0xd8, 0x45, 0x82, 0xa9, 0xd5, 0x6c, 0x8d,
5448 ++ 0x4a, 0x10, 0x8c, 0x7d, 0x7c, 0xe3, 0x4e, 0x6c,
5449 ++ 0x6f, 0x8e, 0xa1, 0xbe, 0xc0, 0x56, 0x73, 0x17
5450 ++};
5451 ++static const u8 enc_output041[] __initconst = {
5452 ++ 0x5f, 0xbb, 0xde, 0xcc, 0x34, 0xbe, 0x20, 0x16,
5453 ++ 0x14, 0xf6, 0x36, 0x03, 0x1e, 0xeb, 0x42, 0xf1,
5454 ++ 0xca, 0xce, 0x3c, 0x79, 0xa1, 0x2c, 0xff, 0xd8,
5455 ++ 0x71, 0xee, 0x8e, 0x73, 0x82, 0x0c, 0x82, 0x97,
5456 ++ 0x49, 0xf1, 0xab, 0xb4, 0x29, 0x43, 0x67, 0x84,
5457 ++ 0x9f, 0xb6, 0xc2, 0xaa, 0x56, 0xbd, 0xa8, 0xa3,
5458 ++ 0x07, 0x8f, 0x72, 0x3d, 0x7c, 0x1c, 0x85, 0x20,
5459 ++ 0x24, 0xb0, 0x17, 0xb5, 0x89, 0x73, 0xfb, 0x1e,
5460 ++ 0x09, 0x26, 0x3d, 0xa7, 0xb4, 0xcb, 0x92, 0x14,
5461 ++ 0x52, 0xf9, 0x7d, 0xca, 0x40, 0xf5, 0x80, 0xec
5462 ++};
5463 ++static const u8 enc_assoc041[] __initconst = {
5464 ++ 0x71, 0x93, 0xf6, 0x23, 0x66, 0x33, 0x21, 0xa2
5465 ++};
5466 ++static const u8 enc_nonce041[] __initconst = {
5467 ++ 0xd3, 0x1c, 0x21, 0xab, 0xa1, 0x75, 0xb7, 0x0d,
5468 ++ 0xe4, 0xeb, 0xb1, 0x9c
5469 ++};
5470 ++static const u8 enc_key041[] __initconst = {
5471 ++ 0x97, 0xd6, 0x35, 0xc4, 0xf4, 0x75, 0x74, 0xd9,
5472 ++ 0x99, 0x8a, 0x90, 0x87, 0x5d, 0xa1, 0xd3, 0xa2,
5473 ++ 0x84, 0xb7, 0x55, 0xb2, 0xd3, 0x92, 0x97, 0xa5,
5474 ++ 0x72, 0x52, 0x35, 0x19, 0x0e, 0x10, 0xa9, 0x7e
5475 ++};
5476 ++
5477 ++/* wycheproof - misc */
5478 ++static const u8 enc_input042[] __initconst = {
5479 ++ 0xb4, 0x29, 0xeb, 0x80, 0xfb, 0x8f, 0xe8, 0xba,
5480 ++ 0xed, 0xa0, 0xc8, 0x5b, 0x9c, 0x33, 0x34, 0x58,
5481 ++ 0xe7, 0xc2, 0x99, 0x2e, 0x55, 0x84, 0x75, 0x06,
5482 ++ 0x9d, 0x12, 0xd4, 0x5c, 0x22, 0x21, 0x75, 0x64,
5483 ++ 0x12, 0x15, 0x88, 0x03, 0x22, 0x97, 0xef, 0xf5,
5484 ++ 0x67, 0x83, 0x74, 0x2a, 0x5f, 0xc2, 0x2d, 0x74,
5485 ++ 0x10, 0xff, 0xb2, 0x9d, 0x66, 0x09, 0x86, 0x61,
5486 ++ 0xd7, 0x6f, 0x12, 0x6c, 0x3c, 0x27, 0x68, 0x9e,
5487 ++ 0x43, 0xb3, 0x72, 0x67, 0xca, 0xc5, 0xa3, 0xa6,
5488 ++ 0xd3, 0xab, 0x49, 0xe3, 0x91, 0xda, 0x29, 0xcd,
5489 ++ 0x30, 0x54, 0xa5, 0x69, 0x2e, 0x28, 0x07, 0xe4,
5490 ++ 0xc3, 0xea, 0x46, 0xc8, 0x76, 0x1d, 0x50, 0xf5,
5491 ++ 0x92
5492 ++};
5493 ++static const u8 enc_output042[] __initconst = {
5494 ++ 0xd0, 0x10, 0x2f, 0x6c, 0x25, 0x8b, 0xf4, 0x97,
5495 ++ 0x42, 0xce, 0xc3, 0x4c, 0xf2, 0xd0, 0xfe, 0xdf,
5496 ++ 0x23, 0xd1, 0x05, 0xfb, 0x4c, 0x84, 0xcf, 0x98,
5497 ++ 0x51, 0x5e, 0x1b, 0xc9, 0xa6, 0x4f, 0x8a, 0xd5,
5498 ++ 0xbe, 0x8f, 0x07, 0x21, 0xbd, 0xe5, 0x06, 0x45,
5499 ++ 0xd0, 0x00, 0x83, 0xc3, 0xa2, 0x63, 0xa3, 0x10,
5500 ++ 0x53, 0xb7, 0x60, 0x24, 0x5f, 0x52, 0xae, 0x28,
5501 ++ 0x66, 0xa5, 0xec, 0x83, 0xb1, 0x9f, 0x61, 0xbe,
5502 ++ 0x1d, 0x30, 0xd5, 0xc5, 0xd9, 0xfe, 0xcc, 0x4c,
5503 ++ 0xbb, 0xe0, 0x8f, 0xd3, 0x85, 0x81, 0x3a, 0x2a,
5504 ++ 0xa3, 0x9a, 0x00, 0xff, 0x9c, 0x10, 0xf7, 0xf2,
5505 ++ 0x37, 0x02, 0xad, 0xd1, 0xe4, 0xb2, 0xff, 0xa3,
5506 ++ 0x1c, 0x41, 0x86, 0x5f, 0xc7, 0x1d, 0xe1, 0x2b,
5507 ++ 0x19, 0x61, 0x21, 0x27, 0xce, 0x49, 0x99, 0x3b,
5508 ++ 0xb0
5509 ++};
5510 ++static const u8 enc_assoc042[] __initconst = { };
5511 ++static const u8 enc_nonce042[] __initconst = {
5512 ++ 0x17, 0xc8, 0x6a, 0x8a, 0xbb, 0xb7, 0xe0, 0x03,
5513 ++ 0xac, 0xde, 0x27, 0x99
5514 ++};
5515 ++static const u8 enc_key042[] __initconst = {
5516 ++ 0xfe, 0x6e, 0x55, 0xbd, 0xae, 0xd1, 0xf7, 0x28,
5517 ++ 0x4c, 0xa5, 0xfc, 0x0f, 0x8c, 0x5f, 0x2b, 0x8d,
5518 ++ 0xf5, 0x6d, 0xc0, 0xf4, 0x9e, 0x8c, 0xa6, 0x6a,
5519 ++ 0x41, 0x99, 0x5e, 0x78, 0x33, 0x51, 0xf9, 0x01
5520 ++};
5521 ++
5522 ++/* wycheproof - misc */
5523 ++static const u8 enc_input043[] __initconst = {
5524 ++ 0xce, 0xb5, 0x34, 0xce, 0x50, 0xdc, 0x23, 0xff,
5525 ++ 0x63, 0x8a, 0xce, 0x3e, 0xf6, 0x3a, 0xb2, 0xcc,
5526 ++ 0x29, 0x73, 0xee, 0xad, 0xa8, 0x07, 0x85, 0xfc,
5527 ++ 0x16, 0x5d, 0x06, 0xc2, 0xf5, 0x10, 0x0f, 0xf5,
5528 ++ 0xe8, 0xab, 0x28, 0x82, 0xc4, 0x75, 0xaf, 0xcd,
5529 ++ 0x05, 0xcc, 0xd4, 0x9f, 0x2e, 0x7d, 0x8f, 0x55,
5530 ++ 0xef, 0x3a, 0x72, 0xe3, 0xdc, 0x51, 0xd6, 0x85,
5531 ++ 0x2b, 0x8e, 0x6b, 0x9e, 0x7a, 0xec, 0xe5, 0x7b,
5532 ++ 0xe6, 0x55, 0x6b, 0x0b, 0x6d, 0x94, 0x13, 0xe3,
5533 ++ 0x3f, 0xc5, 0xfc, 0x24, 0xa9, 0xa2, 0x05, 0xad,
5534 ++ 0x59, 0x57, 0x4b, 0xb3, 0x9d, 0x94, 0x4a, 0x92,
5535 ++ 0xdc, 0x47, 0x97, 0x0d, 0x84, 0xa6, 0xad, 0x31,
5536 ++ 0x76
5537 ++};
5538 ++static const u8 enc_output043[] __initconst = {
5539 ++ 0x75, 0x45, 0x39, 0x1b, 0x51, 0xde, 0x01, 0xd5,
5540 ++ 0xc5, 0x3d, 0xfa, 0xca, 0x77, 0x79, 0x09, 0x06,
5541 ++ 0x3e, 0x58, 0xed, 0xee, 0x4b, 0xb1, 0x22, 0x7e,
5542 ++ 0x71, 0x10, 0xac, 0x4d, 0x26, 0x20, 0xc2, 0xae,
5543 ++ 0xc2, 0xf8, 0x48, 0xf5, 0x6d, 0xee, 0xb0, 0x37,
5544 ++ 0xa8, 0xdc, 0xed, 0x75, 0xaf, 0xa8, 0xa6, 0xc8,
5545 ++ 0x90, 0xe2, 0xde, 0xe4, 0x2f, 0x95, 0x0b, 0xb3,
5546 ++ 0x3d, 0x9e, 0x24, 0x24, 0xd0, 0x8a, 0x50, 0x5d,
5547 ++ 0x89, 0x95, 0x63, 0x97, 0x3e, 0xd3, 0x88, 0x70,
5548 ++ 0xf3, 0xde, 0x6e, 0xe2, 0xad, 0xc7, 0xfe, 0x07,
5549 ++ 0x2c, 0x36, 0x6c, 0x14, 0xe2, 0xcf, 0x7c, 0xa6,
5550 ++ 0x2f, 0xb3, 0xd3, 0x6b, 0xee, 0x11, 0x68, 0x54,
5551 ++ 0x61, 0xb7, 0x0d, 0x44, 0xef, 0x8c, 0x66, 0xc5,
5552 ++ 0xc7, 0xbb, 0xf1, 0x0d, 0xca, 0xdd, 0x7f, 0xac,
5553 ++ 0xf6
5554 ++};
5555 ++static const u8 enc_assoc043[] __initconst = {
5556 ++ 0xa1, 0x1c, 0x40, 0xb6, 0x03, 0x76, 0x73, 0x30
5557 ++};
5558 ++static const u8 enc_nonce043[] __initconst = {
5559 ++ 0x46, 0x36, 0x2f, 0x45, 0xd6, 0x37, 0x9e, 0x63,
5560 ++ 0xe5, 0x22, 0x94, 0x60
5561 ++};
5562 ++static const u8 enc_key043[] __initconst = {
5563 ++ 0xaa, 0xbc, 0x06, 0x34, 0x74, 0xe6, 0x5c, 0x4c,
5564 ++ 0x3e, 0x9b, 0xdc, 0x48, 0x0d, 0xea, 0x97, 0xb4,
5565 ++ 0x51, 0x10, 0xc8, 0x61, 0x88, 0x46, 0xff, 0x6b,
5566 ++ 0x15, 0xbd, 0xd2, 0xa4, 0xa5, 0x68, 0x2c, 0x4e
5567 ++};
5568 ++
5569 ++/* wycheproof - misc */
5570 ++static const u8 enc_input044[] __initconst = {
5571 ++ 0xe5, 0xcc, 0xaa, 0x44, 0x1b, 0xc8, 0x14, 0x68,
5572 ++ 0x8f, 0x8f, 0x6e, 0x8f, 0x28, 0xb5, 0x00, 0xb2
5573 ++};
5574 ++static const u8 enc_output044[] __initconst = {
5575 ++ 0x7e, 0x72, 0xf5, 0xa1, 0x85, 0xaf, 0x16, 0xa6,
5576 ++ 0x11, 0x92, 0x1b, 0x43, 0x8f, 0x74, 0x9f, 0x0b,
5577 ++ 0x12, 0x42, 0xc6, 0x70, 0x73, 0x23, 0x34, 0x02,
5578 ++ 0x9a, 0xdf, 0xe1, 0xc5, 0x00, 0x16, 0x51, 0xe4
5579 ++};
5580 ++static const u8 enc_assoc044[] __initconst = {
5581 ++ 0x02
5582 ++};
5583 ++static const u8 enc_nonce044[] __initconst = {
5584 ++ 0x87, 0x34, 0x5f, 0x10, 0x55, 0xfd, 0x9e, 0x21,
5585 ++ 0x02, 0xd5, 0x06, 0x56
5586 ++};
5587 ++static const u8 enc_key044[] __initconst = {
5588 ++ 0x7d, 0x00, 0xb4, 0x80, 0x95, 0xad, 0xfa, 0x32,
5589 ++ 0x72, 0x05, 0x06, 0x07, 0xb2, 0x64, 0x18, 0x50,
5590 ++ 0x02, 0xba, 0x99, 0x95, 0x7c, 0x49, 0x8b, 0xe0,
5591 ++ 0x22, 0x77, 0x0f, 0x2c, 0xe2, 0xf3, 0x14, 0x3c
5592 ++};
5593 ++
5594 ++/* wycheproof - misc */
5595 ++static const u8 enc_input045[] __initconst = {
5596 ++ 0x02, 0xcd, 0xe1, 0x68, 0xfb, 0xa3, 0xf5, 0x44,
5597 ++ 0xbb, 0xd0, 0x33, 0x2f, 0x7a, 0xde, 0xad, 0xa8
5598 ++};
5599 ++static const u8 enc_output045[] __initconst = {
5600 ++ 0x85, 0xf2, 0x9a, 0x71, 0x95, 0x57, 0xcd, 0xd1,
5601 ++ 0x4d, 0x1f, 0x8f, 0xff, 0xab, 0x6d, 0x9e, 0x60,
5602 ++ 0x73, 0x2c, 0xa3, 0x2b, 0xec, 0xd5, 0x15, 0xa1,
5603 ++ 0xed, 0x35, 0x3f, 0x54, 0x2e, 0x99, 0x98, 0x58
5604 ++};
5605 ++static const u8 enc_assoc045[] __initconst = {
5606 ++ 0xb6, 0x48
5607 ++};
5608 ++static const u8 enc_nonce045[] __initconst = {
5609 ++ 0x87, 0xa3, 0x16, 0x3e, 0xc0, 0x59, 0x8a, 0xd9,
5610 ++ 0x5b, 0x3a, 0xa7, 0x13
5611 ++};
5612 ++static const u8 enc_key045[] __initconst = {
5613 ++ 0x64, 0x32, 0x71, 0x7f, 0x1d, 0xb8, 0x5e, 0x41,
5614 ++ 0xac, 0x78, 0x36, 0xbc, 0xe2, 0x51, 0x85, 0xa0,
5615 ++ 0x80, 0xd5, 0x76, 0x2b, 0x9e, 0x2b, 0x18, 0x44,
5616 ++ 0x4b, 0x6e, 0xc7, 0x2c, 0x3b, 0xd8, 0xe4, 0xdc
5617 ++};
5618 ++
5619 ++/* wycheproof - misc */
5620 ++static const u8 enc_input046[] __initconst = {
5621 ++ 0x16, 0xdd, 0xd2, 0x3f, 0xf5, 0x3f, 0x3d, 0x23,
5622 ++ 0xc0, 0x63, 0x34, 0x48, 0x70, 0x40, 0xeb, 0x47
5623 ++};
5624 ++static const u8 enc_output046[] __initconst = {
5625 ++ 0xc1, 0xb2, 0x95, 0x93, 0x6d, 0x56, 0xfa, 0xda,
5626 ++ 0xc0, 0x3e, 0x5f, 0x74, 0x2b, 0xff, 0x73, 0xa1,
5627 ++ 0x39, 0xc4, 0x57, 0xdb, 0xab, 0x66, 0x38, 0x2b,
5628 ++ 0xab, 0xb3, 0xb5, 0x58, 0x00, 0xcd, 0xa5, 0xb8
5629 ++};
5630 ++static const u8 enc_assoc046[] __initconst = {
5631 ++ 0xbd, 0x4c, 0xd0, 0x2f, 0xc7, 0x50, 0x2b, 0xbd,
5632 ++ 0xbd, 0xf6, 0xc9, 0xa3, 0xcb, 0xe8, 0xf0
5633 ++};
5634 ++static const u8 enc_nonce046[] __initconst = {
5635 ++ 0x6f, 0x57, 0x3a, 0xa8, 0x6b, 0xaa, 0x49, 0x2b,
5636 ++ 0xa4, 0x65, 0x96, 0xdf
5637 ++};
5638 ++static const u8 enc_key046[] __initconst = {
5639 ++ 0x8e, 0x34, 0xcf, 0x73, 0xd2, 0x45, 0xa1, 0x08,
5640 ++ 0x2a, 0x92, 0x0b, 0x86, 0x36, 0x4e, 0xb8, 0x96,
5641 ++ 0xc4, 0x94, 0x64, 0x67, 0xbc, 0xb3, 0xd5, 0x89,
5642 ++ 0x29, 0xfc, 0xb3, 0x66, 0x90, 0xe6, 0x39, 0x4f
5643 ++};
5644 ++
5645 ++/* wycheproof - misc */
5646 ++static const u8 enc_input047[] __initconst = {
5647 ++ 0x62, 0x3b, 0x78, 0x50, 0xc3, 0x21, 0xe2, 0xcf,
5648 ++ 0x0c, 0x6f, 0xbc, 0xc8, 0xdf, 0xd1, 0xaf, 0xf2
5649 ++};
5650 ++static const u8 enc_output047[] __initconst = {
5651 ++ 0xc8, 0x4c, 0x9b, 0xb7, 0xc6, 0x1c, 0x1b, 0xcb,
5652 ++ 0x17, 0x77, 0x2a, 0x1c, 0x50, 0x0c, 0x50, 0x95,
5653 ++ 0xdb, 0xad, 0xf7, 0xa5, 0x13, 0x8c, 0xa0, 0x34,
5654 ++ 0x59, 0xa2, 0xcd, 0x65, 0x83, 0x1e, 0x09, 0x2f
5655 ++};
5656 ++static const u8 enc_assoc047[] __initconst = {
5657 ++ 0x89, 0xcc, 0xe9, 0xfb, 0x47, 0x44, 0x1d, 0x07,
5658 ++ 0xe0, 0x24, 0x5a, 0x66, 0xfe, 0x8b, 0x77, 0x8b
5659 ++};
5660 ++static const u8 enc_nonce047[] __initconst = {
5661 ++ 0x1a, 0x65, 0x18, 0xf0, 0x2e, 0xde, 0x1d, 0xa6,
5662 ++ 0x80, 0x92, 0x66, 0xd9
5663 ++};
5664 ++static const u8 enc_key047[] __initconst = {
5665 ++ 0xcb, 0x55, 0x75, 0xf5, 0xc7, 0xc4, 0x5c, 0x91,
5666 ++ 0xcf, 0x32, 0x0b, 0x13, 0x9f, 0xb5, 0x94, 0x23,
5667 ++ 0x75, 0x60, 0xd0, 0xa3, 0xe6, 0xf8, 0x65, 0xa6,
5668 ++ 0x7d, 0x4f, 0x63, 0x3f, 0x2c, 0x08, 0xf0, 0x16
5669 ++};
5670 ++
5671 ++/* wycheproof - misc */
5672 ++static const u8 enc_input048[] __initconst = {
5673 ++ 0x87, 0xb3, 0xa4, 0xd7, 0xb2, 0x6d, 0x8d, 0x32,
5674 ++ 0x03, 0xa0, 0xde, 0x1d, 0x64, 0xef, 0x82, 0xe3
5675 ++};
5676 ++static const u8 enc_output048[] __initconst = {
5677 ++ 0x94, 0xbc, 0x80, 0x62, 0x1e, 0xd1, 0xe7, 0x1b,
5678 ++ 0x1f, 0xd2, 0xb5, 0xc3, 0xa1, 0x5e, 0x35, 0x68,
5679 ++ 0x33, 0x35, 0x11, 0x86, 0x17, 0x96, 0x97, 0x84,
5680 ++ 0x01, 0x59, 0x8b, 0x96, 0x37, 0x22, 0xf5, 0xb3
5681 ++};
5682 ++static const u8 enc_assoc048[] __initconst = {
5683 ++ 0xd1, 0x9f, 0x2d, 0x98, 0x90, 0x95, 0xf7, 0xab,
5684 ++ 0x03, 0xa5, 0xfd, 0xe8, 0x44, 0x16, 0xe0, 0x0c,
5685 ++ 0x0e
5686 ++};
5687 ++static const u8 enc_nonce048[] __initconst = {
5688 ++ 0x56, 0x4d, 0xee, 0x49, 0xab, 0x00, 0xd2, 0x40,
5689 ++ 0xfc, 0x10, 0x68, 0xc3
5690 ++};
5691 ++static const u8 enc_key048[] __initconst = {
5692 ++ 0xa5, 0x56, 0x9e, 0x72, 0x9a, 0x69, 0xb2, 0x4b,
5693 ++ 0xa6, 0xe0, 0xff, 0x15, 0xc4, 0x62, 0x78, 0x97,
5694 ++ 0x43, 0x68, 0x24, 0xc9, 0x41, 0xe9, 0xd0, 0x0b,
5695 ++ 0x2e, 0x93, 0xfd, 0xdc, 0x4b, 0xa7, 0x76, 0x57
5696 ++};
5697 ++
5698 ++/* wycheproof - misc */
5699 ++static const u8 enc_input049[] __initconst = {
5700 ++ 0xe6, 0x01, 0xb3, 0x85, 0x57, 0x79, 0x7d, 0xa2,
5701 ++ 0xf8, 0xa4, 0x10, 0x6a, 0x08, 0x9d, 0x1d, 0xa6
5702 ++};
5703 ++static const u8 enc_output049[] __initconst = {
5704 ++ 0x29, 0x9b, 0x5d, 0x3f, 0x3d, 0x03, 0xc0, 0x87,
5705 ++ 0x20, 0x9a, 0x16, 0xe2, 0x85, 0x14, 0x31, 0x11,
5706 ++ 0x4b, 0x45, 0x4e, 0xd1, 0x98, 0xde, 0x11, 0x7e,
5707 ++ 0x83, 0xec, 0x49, 0xfa, 0x8d, 0x85, 0x08, 0xd6
5708 ++};
5709 ++static const u8 enc_assoc049[] __initconst = {
5710 ++ 0x5e, 0x64, 0x70, 0xfa, 0xcd, 0x99, 0xc1, 0xd8,
5711 ++ 0x1e, 0x37, 0xcd, 0x44, 0x01, 0x5f, 0xe1, 0x94,
5712 ++ 0x80, 0xa2, 0xa4, 0xd3, 0x35, 0x2a, 0x4f, 0xf5,
5713 ++ 0x60, 0xc0, 0x64, 0x0f, 0xdb, 0xda
5714 ++};
5715 ++static const u8 enc_nonce049[] __initconst = {
5716 ++ 0xdf, 0x87, 0x13, 0xe8, 0x7e, 0xc3, 0xdb, 0xcf,
5717 ++ 0xad, 0x14, 0xd5, 0x3e
5718 ++};
5719 ++static const u8 enc_key049[] __initconst = {
5720 ++ 0x56, 0x20, 0x74, 0x65, 0xb4, 0xe4, 0x8e, 0x6d,
5721 ++ 0x04, 0x63, 0x0f, 0x4a, 0x42, 0xf3, 0x5c, 0xfc,
5722 ++ 0x16, 0x3a, 0xb2, 0x89, 0xc2, 0x2a, 0x2b, 0x47,
5723 ++ 0x84, 0xf6, 0xf9, 0x29, 0x03, 0x30, 0xbe, 0xe0
5724 ++};
5725 ++
5726 ++/* wycheproof - misc */
5727 ++static const u8 enc_input050[] __initconst = {
5728 ++ 0xdc, 0x9e, 0x9e, 0xaf, 0x11, 0xe3, 0x14, 0x18,
5729 ++ 0x2d, 0xf6, 0xa4, 0xeb, 0xa1, 0x7a, 0xec, 0x9c
5730 ++};
5731 ++static const u8 enc_output050[] __initconst = {
5732 ++ 0x60, 0x5b, 0xbf, 0x90, 0xae, 0xb9, 0x74, 0xf6,
5733 ++ 0x60, 0x2b, 0xc7, 0x78, 0x05, 0x6f, 0x0d, 0xca,
5734 ++ 0x38, 0xea, 0x23, 0xd9, 0x90, 0x54, 0xb4, 0x6b,
5735 ++ 0x42, 0xff, 0xe0, 0x04, 0x12, 0x9d, 0x22, 0x04
5736 ++};
5737 ++static const u8 enc_assoc050[] __initconst = {
5738 ++ 0xba, 0x44, 0x6f, 0x6f, 0x9a, 0x0c, 0xed, 0x22,
5739 ++ 0x45, 0x0f, 0xeb, 0x10, 0x73, 0x7d, 0x90, 0x07,
5740 ++ 0xfd, 0x69, 0xab, 0xc1, 0x9b, 0x1d, 0x4d, 0x90,
5741 ++ 0x49, 0xa5, 0x55, 0x1e, 0x86, 0xec, 0x2b, 0x37
5742 ++};
5743 ++static const u8 enc_nonce050[] __initconst = {
5744 ++ 0x8d, 0xf4, 0xb1, 0x5a, 0x88, 0x8c, 0x33, 0x28,
5745 ++ 0x6a, 0x7b, 0x76, 0x51
5746 ++};
5747 ++static const u8 enc_key050[] __initconst = {
5748 ++ 0x39, 0x37, 0x98, 0x6a, 0xf8, 0x6d, 0xaf, 0xc1,
5749 ++ 0xba, 0x0c, 0x46, 0x72, 0xd8, 0xab, 0xc4, 0x6c,
5750 ++ 0x20, 0x70, 0x62, 0x68, 0x2d, 0x9c, 0x26, 0x4a,
5751 ++ 0xb0, 0x6d, 0x6c, 0x58, 0x07, 0x20, 0x51, 0x30
5752 ++};
5753 ++
5754 ++/* wycheproof - misc */
5755 ++static const u8 enc_input051[] __initconst = {
5756 ++ 0x81, 0xce, 0x84, 0xed, 0xe9, 0xb3, 0x58, 0x59,
5757 ++ 0xcc, 0x8c, 0x49, 0xa8, 0xf6, 0xbe, 0x7d, 0xc6
5758 ++};
5759 ++static const u8 enc_output051[] __initconst = {
5760 ++ 0x7b, 0x7c, 0xe0, 0xd8, 0x24, 0x80, 0x9a, 0x70,
5761 ++ 0xde, 0x32, 0x56, 0x2c, 0xcf, 0x2c, 0x2b, 0xbd,
5762 ++ 0x15, 0xd4, 0x4a, 0x00, 0xce, 0x0d, 0x19, 0xb4,
5763 ++ 0x23, 0x1f, 0x92, 0x1e, 0x22, 0xbc, 0x0a, 0x43
5764 ++};
5765 ++static const u8 enc_assoc051[] __initconst = {
5766 ++ 0xd4, 0x1a, 0x82, 0x8d, 0x5e, 0x71, 0x82, 0x92,
5767 ++ 0x47, 0x02, 0x19, 0x05, 0x40, 0x2e, 0xa2, 0x57,
5768 ++ 0xdc, 0xcb, 0xc3, 0xb8, 0x0f, 0xcd, 0x56, 0x75,
5769 ++ 0x05, 0x6b, 0x68, 0xbb, 0x59, 0xe6, 0x2e, 0x88,
5770 ++ 0x73
5771 ++};
5772 ++static const u8 enc_nonce051[] __initconst = {
5773 ++ 0xbe, 0x40, 0xe5, 0xf1, 0xa1, 0x18, 0x17, 0xa0,
5774 ++ 0xa8, 0xfa, 0x89, 0x49
5775 ++};
5776 ++static const u8 enc_key051[] __initconst = {
5777 ++ 0x36, 0x37, 0x2a, 0xbc, 0xdb, 0x78, 0xe0, 0x27,
5778 ++ 0x96, 0x46, 0xac, 0x3d, 0x17, 0x6b, 0x96, 0x74,
5779 ++ 0xe9, 0x15, 0x4e, 0xec, 0xf0, 0xd5, 0x46, 0x9c,
5780 ++ 0x65, 0x1e, 0xc7, 0xe1, 0x6b, 0x4c, 0x11, 0x99
5781 ++};
5782 ++
5783 ++/* wycheproof - misc */
5784 ++static const u8 enc_input052[] __initconst = {
5785 ++ 0xa6, 0x67, 0x47, 0xc8, 0x9e, 0x85, 0x7a, 0xf3,
5786 ++ 0xa1, 0x8e, 0x2c, 0x79, 0x50, 0x00, 0x87, 0xed
5787 ++};
5788 ++static const u8 enc_output052[] __initconst = {
5789 ++ 0xca, 0x82, 0xbf, 0xf3, 0xe2, 0xf3, 0x10, 0xcc,
5790 ++ 0xc9, 0x76, 0x67, 0x2c, 0x44, 0x15, 0xe6, 0x9b,
5791 ++ 0x57, 0x63, 0x8c, 0x62, 0xa5, 0xd8, 0x5d, 0xed,
5792 ++ 0x77, 0x4f, 0x91, 0x3c, 0x81, 0x3e, 0xa0, 0x32
5793 ++};
5794 ++static const u8 enc_assoc052[] __initconst = {
5795 ++ 0x3f, 0x2d, 0xd4, 0x9b, 0xbf, 0x09, 0xd6, 0x9a,
5796 ++ 0x78, 0xa3, 0xd8, 0x0e, 0xa2, 0x56, 0x66, 0x14,
5797 ++ 0xfc, 0x37, 0x94, 0x74, 0x19, 0x6c, 0x1a, 0xae,
5798 ++ 0x84, 0x58, 0x3d, 0xa7, 0x3d, 0x7f, 0xf8, 0x5c,
5799 ++ 0x6f, 0x42, 0xca, 0x42, 0x05, 0x6a, 0x97, 0x92,
5800 ++ 0xcc, 0x1b, 0x9f, 0xb3, 0xc7, 0xd2, 0x61
5801 ++};
5802 ++static const u8 enc_nonce052[] __initconst = {
5803 ++ 0x84, 0xc8, 0x7d, 0xae, 0x4e, 0xee, 0x27, 0x73,
5804 ++ 0x0e, 0xc3, 0x5d, 0x12
5805 ++};
5806 ++static const u8 enc_key052[] __initconst = {
5807 ++ 0x9f, 0x14, 0x79, 0xed, 0x09, 0x7d, 0x7f, 0xe5,
5808 ++ 0x29, 0xc1, 0x1f, 0x2f, 0x5a, 0xdd, 0x9a, 0xaf,
5809 ++ 0xf4, 0xa1, 0xca, 0x0b, 0x68, 0x99, 0x7a, 0x2c,
5810 ++ 0xb7, 0xf7, 0x97, 0x49, 0xbd, 0x90, 0xaa, 0xf4
5811 ++};
5812 ++
5813 + /* wycheproof - misc */
5814 + static const u8 enc_input053[] __initconst = {
5815 + 0x25, 0x6d, 0x40, 0x88, 0x80, 0x94, 0x17, 0x83,
5816 +@@ -2759,6 +3858,126 @@ static const u8 enc_key073[] __initconst = {
5817 + 0x98, 0x99, 0x9a, 0x9b, 0x9c, 0x9d, 0x9e, 0x9f
5818 + };
5819 +
5820 ++/* wycheproof - checking for int overflows */
5821 ++static const u8 enc_input074[] __initconst = {
5822 ++ 0xd4, 0x50, 0x0b, 0xf0, 0x09, 0x49, 0x35, 0x51,
5823 ++ 0xc3, 0x80, 0xad, 0xf5, 0x2c, 0x57, 0x3a, 0x69,
5824 ++ 0xdf, 0x7e, 0x8b, 0x76, 0x24, 0x63, 0x33, 0x0f,
5825 ++ 0xac, 0xc1, 0x6a, 0x57, 0x26, 0xbe, 0x71, 0x90,
5826 ++ 0xc6, 0x3c, 0x5a, 0x1c, 0x92, 0x65, 0x84, 0xa0,
5827 ++ 0x96, 0x75, 0x68, 0x28, 0xdc, 0xdc, 0x64, 0xac,
5828 ++ 0xdf, 0x96, 0x3d, 0x93, 0x1b, 0xf1, 0xda, 0xe2,
5829 ++ 0x38, 0xf3, 0xf1, 0x57, 0x22, 0x4a, 0xc4, 0xb5,
5830 ++ 0x42, 0xd7, 0x85, 0xb0, 0xdd, 0x84, 0xdb, 0x6b,
5831 ++ 0xe3, 0xbc, 0x5a, 0x36, 0x63, 0xe8, 0x41, 0x49,
5832 ++ 0xff, 0xbe, 0xd0, 0x9e, 0x54, 0xf7, 0x8f, 0x16,
5833 ++ 0xa8, 0x22, 0x3b, 0x24, 0xcb, 0x01, 0x9f, 0x58,
5834 ++ 0xb2, 0x1b, 0x0e, 0x55, 0x1e, 0x7a, 0xa0, 0x73,
5835 ++ 0x27, 0x62, 0x95, 0x51, 0x37, 0x6c, 0xcb, 0xc3,
5836 ++ 0x93, 0x76, 0x71, 0xa0, 0x62, 0x9b, 0xd9, 0x5c,
5837 ++ 0x99, 0x15, 0xc7, 0x85, 0x55, 0x77, 0x1e, 0x7a
5838 ++};
5839 ++static const u8 enc_output074[] __initconst = {
5840 ++ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
5841 ++ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
5842 ++ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
5843 ++ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
5844 ++ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
5845 ++ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
5846 ++ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
5847 ++ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
5848 ++ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
5849 ++ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
5850 ++ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
5851 ++ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
5852 ++ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
5853 ++ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
5854 ++ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
5855 ++ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
5856 ++ 0x0b, 0x30, 0x0d, 0x8d, 0xa5, 0x6c, 0x21, 0x85,
5857 ++ 0x75, 0x52, 0x79, 0x55, 0x3c, 0x4c, 0x82, 0xca
5858 ++};
5859 ++static const u8 enc_assoc074[] __initconst = {
5860 ++ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
5861 ++ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
5862 ++ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
5863 ++ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
5864 ++ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
5865 ++ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
5866 ++ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
5867 ++ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff
5868 ++};
5869 ++static const u8 enc_nonce074[] __initconst = {
5870 ++ 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30,
5871 ++ 0x00, 0x02, 0x50, 0x6e
5872 ++};
5873 ++static const u8 enc_key074[] __initconst = {
5874 ++ 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30,
5875 ++ 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30,
5876 ++ 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30,
5877 ++ 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30
5878 ++};
5879 ++
5880 ++/* wycheproof - checking for int overflows */
5881 ++static const u8 enc_input075[] __initconst = {
5882 ++ 0x7d, 0xe8, 0x7f, 0x67, 0x29, 0x94, 0x52, 0x75,
5883 ++ 0xd0, 0x65, 0x5d, 0xa4, 0xc7, 0xfd, 0xe4, 0x56,
5884 ++ 0x9e, 0x16, 0xf1, 0x11, 0xb5, 0xeb, 0x26, 0xc2,
5885 ++ 0x2d, 0x85, 0x9e, 0x3f, 0xf8, 0x22, 0xec, 0xed,
5886 ++ 0x3a, 0x6d, 0xd9, 0xa6, 0x0f, 0x22, 0x95, 0x7f,
5887 ++ 0x7b, 0x7c, 0x85, 0x7e, 0x88, 0x22, 0xeb, 0x9f,
5888 ++ 0xe0, 0xb8, 0xd7, 0x02, 0x21, 0x41, 0xf2, 0xd0,
5889 ++ 0xb4, 0x8f, 0x4b, 0x56, 0x12, 0xd3, 0x22, 0xa8,
5890 ++ 0x8d, 0xd0, 0xfe, 0x0b, 0x4d, 0x91, 0x79, 0x32,
5891 ++ 0x4f, 0x7c, 0x6c, 0x9e, 0x99, 0x0e, 0xfb, 0xd8,
5892 ++ 0x0e, 0x5e, 0xd6, 0x77, 0x58, 0x26, 0x49, 0x8b,
5893 ++ 0x1e, 0xfe, 0x0f, 0x71, 0xa0, 0xf3, 0xec, 0x5b,
5894 ++ 0x29, 0xcb, 0x28, 0xc2, 0x54, 0x0a, 0x7d, 0xcd,
5895 ++ 0x51, 0xb7, 0xda, 0xae, 0xe0, 0xff, 0x4a, 0x7f,
5896 ++ 0x3a, 0xc1, 0xee, 0x54, 0xc2, 0x9e, 0xe4, 0xc1,
5897 ++ 0x70, 0xde, 0x40, 0x8f, 0x66, 0x69, 0x21, 0x94
5898 ++};
5899 ++static const u8 enc_output075[] __initconst = {
5900 ++ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
5901 ++ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
5902 ++ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
5903 ++ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
5904 ++ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
5905 ++ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
5906 ++ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
5907 ++ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
5908 ++ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
5909 ++ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
5910 ++ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
5911 ++ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
5912 ++ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
5913 ++ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
5914 ++ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
5915 ++ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
5916 ++ 0xc5, 0x78, 0xe2, 0xaa, 0x44, 0xd3, 0x09, 0xb7,
5917 ++ 0xb6, 0xa5, 0x19, 0x3b, 0xdc, 0x61, 0x18, 0xf5
5918 ++};
5919 ++static const u8 enc_assoc075[] __initconst = {
5920 ++ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
5921 ++ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
5922 ++ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
5923 ++ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
5924 ++ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
5925 ++ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
5926 ++ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
5927 ++ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff
5928 ++};
5929 ++static const u8 enc_nonce075[] __initconst = {
5930 ++ 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30,
5931 ++ 0x00, 0x03, 0x18, 0xa5
5932 ++};
5933 ++static const u8 enc_key075[] __initconst = {
5934 ++ 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30,
5935 ++ 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30,
5936 ++ 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30,
5937 ++ 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30
5938 ++};
5939 ++
5940 + /* wycheproof - checking for int overflows */
5941 + static const u8 enc_input076[] __initconst = {
5942 + 0x1b, 0x99, 0x6f, 0x9a, 0x3c, 0xcc, 0x67, 0x85,
5943 +@@ -3349,6 +4568,286 @@ static const u8 enc_key085[] __initconst = {
5944 + 0x98, 0x99, 0x9a, 0x9b, 0x9c, 0x9d, 0x9e, 0x9f
5945 + };
5946 +
5947 ++/* wycheproof - special case tag */
5948 ++static const u8 enc_input086[] __initconst = {
5949 ++ 0x9a, 0x49, 0xc4, 0x0f, 0x8b, 0x48, 0xd7, 0xc6,
5950 ++ 0x6d, 0x1d, 0xb4, 0xe5, 0x3f, 0x20, 0xf2, 0xdd,
5951 ++ 0x4a, 0xaa, 0x24, 0x1d, 0xda, 0xb2, 0x6b, 0x5b,
5952 ++ 0xc0, 0xe2, 0x18, 0xb7, 0x2c, 0x33, 0x90, 0xf2,
5953 ++ 0xdf, 0x3e, 0xbd, 0x01, 0x76, 0x70, 0x44, 0x19,
5954 ++ 0x97, 0x2b, 0xcd, 0xbc, 0x6b, 0xbc, 0xb3, 0xe4,
5955 ++ 0xe7, 0x4a, 0x71, 0x52, 0x8e, 0xf5, 0x12, 0x63,
5956 ++ 0xce, 0x24, 0xe0, 0xd5, 0x75, 0xe0, 0xe4, 0x4d
5957 ++};
5958 ++static const u8 enc_output086[] __initconst = {
5959 ++ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
5960 ++ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
5961 ++ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
5962 ++ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
5963 ++ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
5964 ++ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
5965 ++ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
5966 ++ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
5967 ++ 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
5968 ++ 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f
5969 ++};
5970 ++static const u8 enc_assoc086[] __initconst = {
5971 ++ 0x85, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
5972 ++ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
5973 ++ 0xa6, 0x90, 0x2f, 0xcb, 0xc8, 0x83, 0xbb, 0xc1,
5974 ++ 0x80, 0xb2, 0x56, 0xae, 0x34, 0xad, 0x7f, 0x00
5975 ++};
5976 ++static const u8 enc_nonce086[] __initconst = {
5977 ++ 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
5978 ++ 0x08, 0x09, 0x0a, 0x0b
5979 ++};
5980 ++static const u8 enc_key086[] __initconst = {
5981 ++ 0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87,
5982 ++ 0x88, 0x89, 0x8a, 0x8b, 0x8c, 0x8d, 0x8e, 0x8f,
5983 ++ 0x90, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97,
5984 ++ 0x98, 0x99, 0x9a, 0x9b, 0x9c, 0x9d, 0x9e, 0x9f
5985 ++};
5986 ++
5987 ++/* wycheproof - special case tag */
5988 ++static const u8 enc_input087[] __initconst = {
5989 ++ 0x9a, 0x49, 0xc4, 0x0f, 0x8b, 0x48, 0xd7, 0xc6,
5990 ++ 0x6d, 0x1d, 0xb4, 0xe5, 0x3f, 0x20, 0xf2, 0xdd,
5991 ++ 0x4a, 0xaa, 0x24, 0x1d, 0xda, 0xb2, 0x6b, 0x5b,
5992 ++ 0xc0, 0xe2, 0x18, 0xb7, 0x2c, 0x33, 0x90, 0xf2,
5993 ++ 0xdf, 0x3e, 0xbd, 0x01, 0x76, 0x70, 0x44, 0x19,
5994 ++ 0x97, 0x2b, 0xcd, 0xbc, 0x6b, 0xbc, 0xb3, 0xe4,
5995 ++ 0xe7, 0x4a, 0x71, 0x52, 0x8e, 0xf5, 0x12, 0x63,
5996 ++ 0xce, 0x24, 0xe0, 0xd5, 0x75, 0xe0, 0xe4, 0x4d
5997 ++};
5998 ++static const u8 enc_output087[] __initconst = {
5999 ++ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
6000 ++ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
6001 ++ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
6002 ++ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
6003 ++ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
6004 ++ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
6005 ++ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
6006 ++ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
6007 ++ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
6008 ++ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
6009 ++};
6010 ++static const u8 enc_assoc087[] __initconst = {
6011 ++ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
6012 ++ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
6013 ++ 0x24, 0x7e, 0x50, 0x64, 0x2a, 0x1c, 0x0a, 0x2f,
6014 ++ 0x8f, 0x77, 0x21, 0x96, 0x09, 0xdb, 0xa9, 0x58
6015 ++};
6016 ++static const u8 enc_nonce087[] __initconst = {
6017 ++ 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
6018 ++ 0x08, 0x09, 0x0a, 0x0b
6019 ++};
6020 ++static const u8 enc_key087[] __initconst = {
6021 ++ 0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87,
6022 ++ 0x88, 0x89, 0x8a, 0x8b, 0x8c, 0x8d, 0x8e, 0x8f,
6023 ++ 0x90, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97,
6024 ++ 0x98, 0x99, 0x9a, 0x9b, 0x9c, 0x9d, 0x9e, 0x9f
6025 ++};
6026 ++
6027 ++/* wycheproof - special case tag */
6028 ++static const u8 enc_input088[] __initconst = {
6029 ++ 0x9a, 0x49, 0xc4, 0x0f, 0x8b, 0x48, 0xd7, 0xc6,
6030 ++ 0x6d, 0x1d, 0xb4, 0xe5, 0x3f, 0x20, 0xf2, 0xdd,
6031 ++ 0x4a, 0xaa, 0x24, 0x1d, 0xda, 0xb2, 0x6b, 0x5b,
6032 ++ 0xc0, 0xe2, 0x18, 0xb7, 0x2c, 0x33, 0x90, 0xf2,
6033 ++ 0xdf, 0x3e, 0xbd, 0x01, 0x76, 0x70, 0x44, 0x19,
6034 ++ 0x97, 0x2b, 0xcd, 0xbc, 0x6b, 0xbc, 0xb3, 0xe4,
6035 ++ 0xe7, 0x4a, 0x71, 0x52, 0x8e, 0xf5, 0x12, 0x63,
6036 ++ 0xce, 0x24, 0xe0, 0xd5, 0x75, 0xe0, 0xe4, 0x4d
6037 ++};
6038 ++static const u8 enc_output088[] __initconst = {
6039 ++ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
6040 ++ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
6041 ++ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
6042 ++ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
6043 ++ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
6044 ++ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
6045 ++ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
6046 ++ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
6047 ++ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
6048 ++ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff
6049 ++};
6050 ++static const u8 enc_assoc088[] __initconst = {
6051 ++ 0x7c, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
6052 ++ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
6053 ++ 0xd9, 0xe7, 0x2c, 0x06, 0x4a, 0xc8, 0x96, 0x1f,
6054 ++ 0x3f, 0xa5, 0x85, 0xe0, 0xe2, 0xab, 0xd6, 0x00
6055 ++};
6056 ++static const u8 enc_nonce088[] __initconst = {
6057 ++ 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
6058 ++ 0x08, 0x09, 0x0a, 0x0b
6059 ++};
6060 ++static const u8 enc_key088[] __initconst = {
6061 ++ 0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87,
6062 ++ 0x88, 0x89, 0x8a, 0x8b, 0x8c, 0x8d, 0x8e, 0x8f,
6063 ++ 0x90, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97,
6064 ++ 0x98, 0x99, 0x9a, 0x9b, 0x9c, 0x9d, 0x9e, 0x9f
6065 ++};
6066 ++
6067 ++/* wycheproof - special case tag */
6068 ++static const u8 enc_input089[] __initconst = {
6069 ++ 0x9a, 0x49, 0xc4, 0x0f, 0x8b, 0x48, 0xd7, 0xc6,
6070 ++ 0x6d, 0x1d, 0xb4, 0xe5, 0x3f, 0x20, 0xf2, 0xdd,
6071 ++ 0x4a, 0xaa, 0x24, 0x1d, 0xda, 0xb2, 0x6b, 0x5b,
6072 ++ 0xc0, 0xe2, 0x18, 0xb7, 0x2c, 0x33, 0x90, 0xf2,
6073 ++ 0xdf, 0x3e, 0xbd, 0x01, 0x76, 0x70, 0x44, 0x19,
6074 ++ 0x97, 0x2b, 0xcd, 0xbc, 0x6b, 0xbc, 0xb3, 0xe4,
6075 ++ 0xe7, 0x4a, 0x71, 0x52, 0x8e, 0xf5, 0x12, 0x63,
6076 ++ 0xce, 0x24, 0xe0, 0xd5, 0x75, 0xe0, 0xe4, 0x4d
6077 ++};
6078 ++static const u8 enc_output089[] __initconst = {
6079 ++ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
6080 ++ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
6081 ++ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
6082 ++ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
6083 ++ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
6084 ++ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
6085 ++ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
6086 ++ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
6087 ++ 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x80,
6088 ++ 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x80
6089 ++};
6090 ++static const u8 enc_assoc089[] __initconst = {
6091 ++ 0x65, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
6092 ++ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
6093 ++ 0x95, 0xaf, 0x0f, 0x4d, 0x0b, 0x68, 0x6e, 0xae,
6094 ++ 0xcc, 0xca, 0x43, 0x07, 0xd5, 0x96, 0xf5, 0x02
6095 ++};
6096 ++static const u8 enc_nonce089[] __initconst = {
6097 ++ 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
6098 ++ 0x08, 0x09, 0x0a, 0x0b
6099 ++};
6100 ++static const u8 enc_key089[] __initconst = {
6101 ++ 0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87,
6102 ++ 0x88, 0x89, 0x8a, 0x8b, 0x8c, 0x8d, 0x8e, 0x8f,
6103 ++ 0x90, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97,
6104 ++ 0x98, 0x99, 0x9a, 0x9b, 0x9c, 0x9d, 0x9e, 0x9f
6105 ++};
6106 ++
6107 ++/* wycheproof - special case tag */
6108 ++static const u8 enc_input090[] __initconst = {
6109 ++ 0x9a, 0x49, 0xc4, 0x0f, 0x8b, 0x48, 0xd7, 0xc6,
6110 ++ 0x6d, 0x1d, 0xb4, 0xe5, 0x3f, 0x20, 0xf2, 0xdd,
6111 ++ 0x4a, 0xaa, 0x24, 0x1d, 0xda, 0xb2, 0x6b, 0x5b,
6112 ++ 0xc0, 0xe2, 0x18, 0xb7, 0x2c, 0x33, 0x90, 0xf2,
6113 ++ 0xdf, 0x3e, 0xbd, 0x01, 0x76, 0x70, 0x44, 0x19,
6114 ++ 0x97, 0x2b, 0xcd, 0xbc, 0x6b, 0xbc, 0xb3, 0xe4,
6115 ++ 0xe7, 0x4a, 0x71, 0x52, 0x8e, 0xf5, 0x12, 0x63,
6116 ++ 0xce, 0x24, 0xe0, 0xd5, 0x75, 0xe0, 0xe4, 0x4d
6117 ++};
6118 ++static const u8 enc_output090[] __initconst = {
6119 ++ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
6120 ++ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
6121 ++ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
6122 ++ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
6123 ++ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
6124 ++ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
6125 ++ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
6126 ++ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
6127 ++ 0xff, 0xff, 0xff, 0x7f, 0xff, 0xff, 0xff, 0x7f,
6128 ++ 0xff, 0xff, 0xff, 0x7f, 0xff, 0xff, 0xff, 0x7f
6129 ++};
6130 ++static const u8 enc_assoc090[] __initconst = {
6131 ++ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
6132 ++ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
6133 ++ 0x85, 0x40, 0xb4, 0x64, 0x35, 0x77, 0x07, 0xbe,
6134 ++ 0x3a, 0x39, 0xd5, 0x5c, 0x34, 0xf8, 0xbc, 0xb3
6135 ++};
6136 ++static const u8 enc_nonce090[] __initconst = {
6137 ++ 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
6138 ++ 0x08, 0x09, 0x0a, 0x0b
6139 ++};
6140 ++static const u8 enc_key090[] __initconst = {
6141 ++ 0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87,
6142 ++ 0x88, 0x89, 0x8a, 0x8b, 0x8c, 0x8d, 0x8e, 0x8f,
6143 ++ 0x90, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97,
6144 ++ 0x98, 0x99, 0x9a, 0x9b, 0x9c, 0x9d, 0x9e, 0x9f
6145 ++};
6146 ++
6147 ++/* wycheproof - special case tag */
6148 ++static const u8 enc_input091[] __initconst = {
6149 ++ 0x9a, 0x49, 0xc4, 0x0f, 0x8b, 0x48, 0xd7, 0xc6,
6150 ++ 0x6d, 0x1d, 0xb4, 0xe5, 0x3f, 0x20, 0xf2, 0xdd,
6151 ++ 0x4a, 0xaa, 0x24, 0x1d, 0xda, 0xb2, 0x6b, 0x5b,
6152 ++ 0xc0, 0xe2, 0x18, 0xb7, 0x2c, 0x33, 0x90, 0xf2,
6153 ++ 0xdf, 0x3e, 0xbd, 0x01, 0x76, 0x70, 0x44, 0x19,
6154 ++ 0x97, 0x2b, 0xcd, 0xbc, 0x6b, 0xbc, 0xb3, 0xe4,
6155 ++ 0xe7, 0x4a, 0x71, 0x52, 0x8e, 0xf5, 0x12, 0x63,
6156 ++ 0xce, 0x24, 0xe0, 0xd5, 0x75, 0xe0, 0xe4, 0x4d
6157 ++};
6158 ++static const u8 enc_output091[] __initconst = {
6159 ++ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
6160 ++ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
6161 ++ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
6162 ++ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
6163 ++ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
6164 ++ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
6165 ++ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
6166 ++ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
6167 ++ 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
6168 ++ 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00
6169 ++};
6170 ++static const u8 enc_assoc091[] __initconst = {
6171 ++ 0x4f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
6172 ++ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
6173 ++ 0x66, 0x23, 0xd9, 0x90, 0xb8, 0x98, 0xd8, 0x30,
6174 ++ 0xd2, 0x12, 0xaf, 0x23, 0x83, 0x33, 0x07, 0x01
6175 ++};
6176 ++static const u8 enc_nonce091[] __initconst = {
6177 ++ 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
6178 ++ 0x08, 0x09, 0x0a, 0x0b
6179 ++};
6180 ++static const u8 enc_key091[] __initconst = {
6181 ++ 0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87,
6182 ++ 0x88, 0x89, 0x8a, 0x8b, 0x8c, 0x8d, 0x8e, 0x8f,
6183 ++ 0x90, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97,
6184 ++ 0x98, 0x99, 0x9a, 0x9b, 0x9c, 0x9d, 0x9e, 0x9f
6185 ++};
6186 ++
6187 ++/* wycheproof - special case tag */
6188 ++static const u8 enc_input092[] __initconst = {
6189 ++ 0x9a, 0x49, 0xc4, 0x0f, 0x8b, 0x48, 0xd7, 0xc6,
6190 ++ 0x6d, 0x1d, 0xb4, 0xe5, 0x3f, 0x20, 0xf2, 0xdd,
6191 ++ 0x4a, 0xaa, 0x24, 0x1d, 0xda, 0xb2, 0x6b, 0x5b,
6192 ++ 0xc0, 0xe2, 0x18, 0xb7, 0x2c, 0x33, 0x90, 0xf2,
6193 ++ 0xdf, 0x3e, 0xbd, 0x01, 0x76, 0x70, 0x44, 0x19,
6194 ++ 0x97, 0x2b, 0xcd, 0xbc, 0x6b, 0xbc, 0xb3, 0xe4,
6195 ++ 0xe7, 0x4a, 0x71, 0x52, 0x8e, 0xf5, 0x12, 0x63,
6196 ++ 0xce, 0x24, 0xe0, 0xd5, 0x75, 0xe0, 0xe4, 0x4d
6197 ++};
6198 ++static const u8 enc_output092[] __initconst = {
6199 ++ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
6200 ++ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
6201 ++ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
6202 ++ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
6203 ++ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
6204 ++ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
6205 ++ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
6206 ++ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
6207 ++ 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00,
6208 ++ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
6209 ++};
6210 ++static const u8 enc_assoc092[] __initconst = {
6211 ++ 0x83, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
6212 ++ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
6213 ++ 0x5f, 0x16, 0xd0, 0x9f, 0x17, 0x78, 0x72, 0x11,
6214 ++ 0xb7, 0xd4, 0x84, 0xe0, 0x24, 0xf8, 0x97, 0x01
6215 ++};
6216 ++static const u8 enc_nonce092[] __initconst = {
6217 ++ 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
6218 ++ 0x08, 0x09, 0x0a, 0x0b
6219 ++};
6220 ++static const u8 enc_key092[] __initconst = {
6221 ++ 0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87,
6222 ++ 0x88, 0x89, 0x8a, 0x8b, 0x8c, 0x8d, 0x8e, 0x8f,
6223 ++ 0x90, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97,
6224 ++ 0x98, 0x99, 0x9a, 0x9b, 0x9c, 0x9d, 0x9e, 0x9f
6225 ++};
6226 ++
6227 + /* wycheproof - edge case intermediate sums in poly1305 */
6228 + static const u8 enc_input093[] __initconst = {
6229 + 0x00, 0x52, 0x35, 0xd2, 0xa9, 0x19, 0xf2, 0x8d,
6230 +@@ -4455,6 +5954,86 @@ chacha20poly1305_enc_vectors[] __initconst = {
6231 + sizeof(enc_input011), sizeof(enc_assoc011), sizeof(enc_nonce011) },
6232 + { enc_input012, enc_output012, enc_assoc012, enc_nonce012, enc_key012,
6233 + sizeof(enc_input012), sizeof(enc_assoc012), sizeof(enc_nonce012) },
6234 ++ { enc_input013, enc_output013, enc_assoc013, enc_nonce013, enc_key013,
6235 ++ sizeof(enc_input013), sizeof(enc_assoc013), sizeof(enc_nonce013) },
6236 ++ { enc_input014, enc_output014, enc_assoc014, enc_nonce014, enc_key014,
6237 ++ sizeof(enc_input014), sizeof(enc_assoc014), sizeof(enc_nonce014) },
6238 ++ { enc_input015, enc_output015, enc_assoc015, enc_nonce015, enc_key015,
6239 ++ sizeof(enc_input015), sizeof(enc_assoc015), sizeof(enc_nonce015) },
6240 ++ { enc_input016, enc_output016, enc_assoc016, enc_nonce016, enc_key016,
6241 ++ sizeof(enc_input016), sizeof(enc_assoc016), sizeof(enc_nonce016) },
6242 ++ { enc_input017, enc_output017, enc_assoc017, enc_nonce017, enc_key017,
6243 ++ sizeof(enc_input017), sizeof(enc_assoc017), sizeof(enc_nonce017) },
6244 ++ { enc_input018, enc_output018, enc_assoc018, enc_nonce018, enc_key018,
6245 ++ sizeof(enc_input018), sizeof(enc_assoc018), sizeof(enc_nonce018) },
6246 ++ { enc_input019, enc_output019, enc_assoc019, enc_nonce019, enc_key019,
6247 ++ sizeof(enc_input019), sizeof(enc_assoc019), sizeof(enc_nonce019) },
6248 ++ { enc_input020, enc_output020, enc_assoc020, enc_nonce020, enc_key020,
6249 ++ sizeof(enc_input020), sizeof(enc_assoc020), sizeof(enc_nonce020) },
6250 ++ { enc_input021, enc_output021, enc_assoc021, enc_nonce021, enc_key021,
6251 ++ sizeof(enc_input021), sizeof(enc_assoc021), sizeof(enc_nonce021) },
6252 ++ { enc_input022, enc_output022, enc_assoc022, enc_nonce022, enc_key022,
6253 ++ sizeof(enc_input022), sizeof(enc_assoc022), sizeof(enc_nonce022) },
6254 ++ { enc_input023, enc_output023, enc_assoc023, enc_nonce023, enc_key023,
6255 ++ sizeof(enc_input023), sizeof(enc_assoc023), sizeof(enc_nonce023) },
6256 ++ { enc_input024, enc_output024, enc_assoc024, enc_nonce024, enc_key024,
6257 ++ sizeof(enc_input024), sizeof(enc_assoc024), sizeof(enc_nonce024) },
6258 ++ { enc_input025, enc_output025, enc_assoc025, enc_nonce025, enc_key025,
6259 ++ sizeof(enc_input025), sizeof(enc_assoc025), sizeof(enc_nonce025) },
6260 ++ { enc_input026, enc_output026, enc_assoc026, enc_nonce026, enc_key026,
6261 ++ sizeof(enc_input026), sizeof(enc_assoc026), sizeof(enc_nonce026) },
6262 ++ { enc_input027, enc_output027, enc_assoc027, enc_nonce027, enc_key027,
6263 ++ sizeof(enc_input027), sizeof(enc_assoc027), sizeof(enc_nonce027) },
6264 ++ { enc_input028, enc_output028, enc_assoc028, enc_nonce028, enc_key028,
6265 ++ sizeof(enc_input028), sizeof(enc_assoc028), sizeof(enc_nonce028) },
6266 ++ { enc_input029, enc_output029, enc_assoc029, enc_nonce029, enc_key029,
6267 ++ sizeof(enc_input029), sizeof(enc_assoc029), sizeof(enc_nonce029) },
6268 ++ { enc_input030, enc_output030, enc_assoc030, enc_nonce030, enc_key030,
6269 ++ sizeof(enc_input030), sizeof(enc_assoc030), sizeof(enc_nonce030) },
6270 ++ { enc_input031, enc_output031, enc_assoc031, enc_nonce031, enc_key031,
6271 ++ sizeof(enc_input031), sizeof(enc_assoc031), sizeof(enc_nonce031) },
6272 ++ { enc_input032, enc_output032, enc_assoc032, enc_nonce032, enc_key032,
6273 ++ sizeof(enc_input032), sizeof(enc_assoc032), sizeof(enc_nonce032) },
6274 ++ { enc_input033, enc_output033, enc_assoc033, enc_nonce033, enc_key033,
6275 ++ sizeof(enc_input033), sizeof(enc_assoc033), sizeof(enc_nonce033) },
6276 ++ { enc_input034, enc_output034, enc_assoc034, enc_nonce034, enc_key034,
6277 ++ sizeof(enc_input034), sizeof(enc_assoc034), sizeof(enc_nonce034) },
6278 ++ { enc_input035, enc_output035, enc_assoc035, enc_nonce035, enc_key035,
6279 ++ sizeof(enc_input035), sizeof(enc_assoc035), sizeof(enc_nonce035) },
6280 ++ { enc_input036, enc_output036, enc_assoc036, enc_nonce036, enc_key036,
6281 ++ sizeof(enc_input036), sizeof(enc_assoc036), sizeof(enc_nonce036) },
6282 ++ { enc_input037, enc_output037, enc_assoc037, enc_nonce037, enc_key037,
6283 ++ sizeof(enc_input037), sizeof(enc_assoc037), sizeof(enc_nonce037) },
6284 ++ { enc_input038, enc_output038, enc_assoc038, enc_nonce038, enc_key038,
6285 ++ sizeof(enc_input038), sizeof(enc_assoc038), sizeof(enc_nonce038) },
6286 ++ { enc_input039, enc_output039, enc_assoc039, enc_nonce039, enc_key039,
6287 ++ sizeof(enc_input039), sizeof(enc_assoc039), sizeof(enc_nonce039) },
6288 ++ { enc_input040, enc_output040, enc_assoc040, enc_nonce040, enc_key040,
6289 ++ sizeof(enc_input040), sizeof(enc_assoc040), sizeof(enc_nonce040) },
6290 ++ { enc_input041, enc_output041, enc_assoc041, enc_nonce041, enc_key041,
6291 ++ sizeof(enc_input041), sizeof(enc_assoc041), sizeof(enc_nonce041) },
6292 ++ { enc_input042, enc_output042, enc_assoc042, enc_nonce042, enc_key042,
6293 ++ sizeof(enc_input042), sizeof(enc_assoc042), sizeof(enc_nonce042) },
6294 ++ { enc_input043, enc_output043, enc_assoc043, enc_nonce043, enc_key043,
6295 ++ sizeof(enc_input043), sizeof(enc_assoc043), sizeof(enc_nonce043) },
6296 ++ { enc_input044, enc_output044, enc_assoc044, enc_nonce044, enc_key044,
6297 ++ sizeof(enc_input044), sizeof(enc_assoc044), sizeof(enc_nonce044) },
6298 ++ { enc_input045, enc_output045, enc_assoc045, enc_nonce045, enc_key045,
6299 ++ sizeof(enc_input045), sizeof(enc_assoc045), sizeof(enc_nonce045) },
6300 ++ { enc_input046, enc_output046, enc_assoc046, enc_nonce046, enc_key046,
6301 ++ sizeof(enc_input046), sizeof(enc_assoc046), sizeof(enc_nonce046) },
6302 ++ { enc_input047, enc_output047, enc_assoc047, enc_nonce047, enc_key047,
6303 ++ sizeof(enc_input047), sizeof(enc_assoc047), sizeof(enc_nonce047) },
6304 ++ { enc_input048, enc_output048, enc_assoc048, enc_nonce048, enc_key048,
6305 ++ sizeof(enc_input048), sizeof(enc_assoc048), sizeof(enc_nonce048) },
6306 ++ { enc_input049, enc_output049, enc_assoc049, enc_nonce049, enc_key049,
6307 ++ sizeof(enc_input049), sizeof(enc_assoc049), sizeof(enc_nonce049) },
6308 ++ { enc_input050, enc_output050, enc_assoc050, enc_nonce050, enc_key050,
6309 ++ sizeof(enc_input050), sizeof(enc_assoc050), sizeof(enc_nonce050) },
6310 ++ { enc_input051, enc_output051, enc_assoc051, enc_nonce051, enc_key051,
6311 ++ sizeof(enc_input051), sizeof(enc_assoc051), sizeof(enc_nonce051) },
6312 ++ { enc_input052, enc_output052, enc_assoc052, enc_nonce052, enc_key052,
6313 ++ sizeof(enc_input052), sizeof(enc_assoc052), sizeof(enc_nonce052) },
6314 + { enc_input053, enc_output053, enc_assoc053, enc_nonce053, enc_key053,
6315 + sizeof(enc_input053), sizeof(enc_assoc053), sizeof(enc_nonce053) },
6316 + { enc_input054, enc_output054, enc_assoc054, enc_nonce054, enc_key054,
6317 +@@ -4497,6 +6076,10 @@ chacha20poly1305_enc_vectors[] __initconst = {
6318 + sizeof(enc_input072), sizeof(enc_assoc072), sizeof(enc_nonce072) },
6319 + { enc_input073, enc_output073, enc_assoc073, enc_nonce073, enc_key073,
6320 + sizeof(enc_input073), sizeof(enc_assoc073), sizeof(enc_nonce073) },
6321 ++ { enc_input074, enc_output074, enc_assoc074, enc_nonce074, enc_key074,
6322 ++ sizeof(enc_input074), sizeof(enc_assoc074), sizeof(enc_nonce074) },
6323 ++ { enc_input075, enc_output075, enc_assoc075, enc_nonce075, enc_key075,
6324 ++ sizeof(enc_input075), sizeof(enc_assoc075), sizeof(enc_nonce075) },
6325 + { enc_input076, enc_output076, enc_assoc076, enc_nonce076, enc_key076,
6326 + sizeof(enc_input076), sizeof(enc_assoc076), sizeof(enc_nonce076) },
6327 + { enc_input077, enc_output077, enc_assoc077, enc_nonce077, enc_key077,
6328 +@@ -4517,6 +6100,20 @@ chacha20poly1305_enc_vectors[] __initconst = {
6329 + sizeof(enc_input084), sizeof(enc_assoc084), sizeof(enc_nonce084) },
6330 + { enc_input085, enc_output085, enc_assoc085, enc_nonce085, enc_key085,
6331 + sizeof(enc_input085), sizeof(enc_assoc085), sizeof(enc_nonce085) },
6332 ++ { enc_input086, enc_output086, enc_assoc086, enc_nonce086, enc_key086,
6333 ++ sizeof(enc_input086), sizeof(enc_assoc086), sizeof(enc_nonce086) },
6334 ++ { enc_input087, enc_output087, enc_assoc087, enc_nonce087, enc_key087,
6335 ++ sizeof(enc_input087), sizeof(enc_assoc087), sizeof(enc_nonce087) },
6336 ++ { enc_input088, enc_output088, enc_assoc088, enc_nonce088, enc_key088,
6337 ++ sizeof(enc_input088), sizeof(enc_assoc088), sizeof(enc_nonce088) },
6338 ++ { enc_input089, enc_output089, enc_assoc089, enc_nonce089, enc_key089,
6339 ++ sizeof(enc_input089), sizeof(enc_assoc089), sizeof(enc_nonce089) },
6340 ++ { enc_input090, enc_output090, enc_assoc090, enc_nonce090, enc_key090,
6341 ++ sizeof(enc_input090), sizeof(enc_assoc090), sizeof(enc_nonce090) },
6342 ++ { enc_input091, enc_output091, enc_assoc091, enc_nonce091, enc_key091,
6343 ++ sizeof(enc_input091), sizeof(enc_assoc091), sizeof(enc_nonce091) },
6344 ++ { enc_input092, enc_output092, enc_assoc092, enc_nonce092, enc_key092,
6345 ++ sizeof(enc_input092), sizeof(enc_assoc092), sizeof(enc_nonce092) },
6346 + { enc_input093, enc_output093, enc_assoc093, enc_nonce093, enc_key093,
6347 + sizeof(enc_input093), sizeof(enc_assoc093), sizeof(enc_nonce093) },
6348 + { enc_input094, enc_output094, enc_assoc094, enc_nonce094, enc_key094,
6349 +@@ -7224,6 +8821,43 @@ xchacha20poly1305_dec_vectors[] __initconst = {
6350 + sizeof(xdec_input001), sizeof(xdec_assoc001), sizeof(xdec_nonce001) }
6351 + };
6352 +
6353 ++/* This is for the selftests-only, since it is only useful for the purpose of
6354 ++ * testing the underlying primitives and interactions.
6355 ++ */
6356 ++static void __init
6357 ++chacha20poly1305_encrypt_bignonce(u8 *dst, const u8 *src, const size_t src_len,
6358 ++ const u8 *ad, const size_t ad_len,
6359 ++ const u8 nonce[12],
6360 ++ const u8 key[CHACHA20POLY1305_KEY_SIZE])
6361 ++{
6362 ++ const u8 *pad0 = page_address(ZERO_PAGE(0));
6363 ++ struct poly1305_desc_ctx poly1305_state;
6364 ++ u32 chacha20_state[CHACHA_STATE_WORDS];
6365 ++ union {
6366 ++ u8 block0[POLY1305_KEY_SIZE];
6367 ++ __le64 lens[2];
6368 ++ } b = {{ 0 }};
6369 ++ u8 bottom_row[16] = { 0 };
6370 ++ u32 le_key[8];
6371 ++ int i;
6372 ++
6373 ++ memcpy(&bottom_row[4], nonce, 12);
6374 ++ for (i = 0; i < 8; ++i)
6375 ++ le_key[i] = get_unaligned_le32(key + sizeof(le_key[i]) * i);
6376 ++ chacha_init(chacha20_state, le_key, bottom_row);
6377 ++ chacha20_crypt(chacha20_state, b.block0, b.block0, sizeof(b.block0));
6378 ++ poly1305_init(&poly1305_state, b.block0);
6379 ++ poly1305_update(&poly1305_state, ad, ad_len);
6380 ++ poly1305_update(&poly1305_state, pad0, (0x10 - ad_len) & 0xf);
6381 ++ chacha20_crypt(chacha20_state, dst, src, src_len);
6382 ++ poly1305_update(&poly1305_state, dst, src_len);
6383 ++ poly1305_update(&poly1305_state, pad0, (0x10 - src_len) & 0xf);
6384 ++ b.lens[0] = cpu_to_le64(ad_len);
6385 ++ b.lens[1] = cpu_to_le64(src_len);
6386 ++ poly1305_update(&poly1305_state, (u8 *)b.lens, sizeof(b.lens));
6387 ++ poly1305_final(&poly1305_state, dst + src_len);
6388 ++}
6389 ++
6390 + static void __init
6391 + chacha20poly1305_selftest_encrypt(u8 *dst, const u8 *src, const size_t src_len,
6392 + const u8 *ad, const size_t ad_len,
6393 +@@ -7233,6 +8867,9 @@ chacha20poly1305_selftest_encrypt(u8 *dst, const u8 *src, const size_t src_len,
6394 + if (nonce_len == 8)
6395 + chacha20poly1305_encrypt(dst, src, src_len, ad, ad_len,
6396 + get_unaligned_le64(nonce), key);
6397 ++ else if (nonce_len == 12)
6398 ++ chacha20poly1305_encrypt_bignonce(dst, src, src_len, ad,
6399 ++ ad_len, nonce, key);
6400 + else
6401 + BUG();
6402 + }
6403 +@@ -7248,14 +8885,14 @@ decryption_success(bool func_ret, bool expect_failure, int memcmp_result)
6404 + bool __init chacha20poly1305_selftest(void)
6405 + {
6406 + enum { MAXIMUM_TEST_BUFFER_LEN = 1UL << 12 };
6407 +- size_t i;
6408 +- u8 *computed_output = NULL, *heap_src = NULL;
6409 +- struct scatterlist sg_src;
6410 ++ size_t i, j, k, total_len;
6411 ++ u8 *computed_output = NULL, *input = NULL;
6412 + bool success = true, ret;
6413 ++ struct scatterlist sg_src[3];
6414 +
6415 +- heap_src = kmalloc(MAXIMUM_TEST_BUFFER_LEN, GFP_KERNEL);
6416 + computed_output = kmalloc(MAXIMUM_TEST_BUFFER_LEN, GFP_KERNEL);
6417 +- if (!heap_src || !computed_output) {
6418 ++ input = kmalloc(MAXIMUM_TEST_BUFFER_LEN, GFP_KERNEL);
6419 ++ if (!computed_output || !input) {
6420 + pr_err("chacha20poly1305 self-test malloc: FAIL\n");
6421 + success = false;
6422 + goto out;
6423 +@@ -7284,17 +8921,17 @@ bool __init chacha20poly1305_selftest(void)
6424 + for (i = 0; i < ARRAY_SIZE(chacha20poly1305_enc_vectors); ++i) {
6425 + if (chacha20poly1305_enc_vectors[i].nlen != 8)
6426 + continue;
6427 +- memcpy(heap_src, chacha20poly1305_enc_vectors[i].input,
6428 ++ memcpy(computed_output, chacha20poly1305_enc_vectors[i].input,
6429 + chacha20poly1305_enc_vectors[i].ilen);
6430 +- sg_init_one(&sg_src, heap_src,
6431 ++ sg_init_one(sg_src, computed_output,
6432 + chacha20poly1305_enc_vectors[i].ilen + POLY1305_DIGEST_SIZE);
6433 +- chacha20poly1305_encrypt_sg_inplace(&sg_src,
6434 ++ ret = chacha20poly1305_encrypt_sg_inplace(sg_src,
6435 + chacha20poly1305_enc_vectors[i].ilen,
6436 + chacha20poly1305_enc_vectors[i].assoc,
6437 + chacha20poly1305_enc_vectors[i].alen,
6438 + get_unaligned_le64(chacha20poly1305_enc_vectors[i].nonce),
6439 + chacha20poly1305_enc_vectors[i].key);
6440 +- if (memcmp(heap_src,
6441 ++ if (!ret || memcmp(computed_output,
6442 + chacha20poly1305_enc_vectors[i].output,
6443 + chacha20poly1305_enc_vectors[i].ilen +
6444 + POLY1305_DIGEST_SIZE)) {
6445 +@@ -7326,11 +8963,11 @@ bool __init chacha20poly1305_selftest(void)
6446 + }
6447 +
6448 + for (i = 0; i < ARRAY_SIZE(chacha20poly1305_dec_vectors); ++i) {
6449 +- memcpy(heap_src, chacha20poly1305_dec_vectors[i].input,
6450 ++ memcpy(computed_output, chacha20poly1305_dec_vectors[i].input,
6451 + chacha20poly1305_dec_vectors[i].ilen);
6452 +- sg_init_one(&sg_src, heap_src,
6453 ++ sg_init_one(sg_src, computed_output,
6454 + chacha20poly1305_dec_vectors[i].ilen);
6455 +- ret = chacha20poly1305_decrypt_sg_inplace(&sg_src,
6456 ++ ret = chacha20poly1305_decrypt_sg_inplace(sg_src,
6457 + chacha20poly1305_dec_vectors[i].ilen,
6458 + chacha20poly1305_dec_vectors[i].assoc,
6459 + chacha20poly1305_dec_vectors[i].alen,
6460 +@@ -7338,7 +8975,7 @@ bool __init chacha20poly1305_selftest(void)
6461 + chacha20poly1305_dec_vectors[i].key);
6462 + if (!decryption_success(ret,
6463 + chacha20poly1305_dec_vectors[i].failure,
6464 +- memcmp(heap_src, chacha20poly1305_dec_vectors[i].output,
6465 ++ memcmp(computed_output, chacha20poly1305_dec_vectors[i].output,
6466 + chacha20poly1305_dec_vectors[i].ilen -
6467 + POLY1305_DIGEST_SIZE))) {
6468 + pr_err("chacha20poly1305 sg decryption self-test %zu: FAIL\n",
6469 +@@ -7365,6 +9002,7 @@ bool __init chacha20poly1305_selftest(void)
6470 + success = false;
6471 + }
6472 + }
6473 ++
6474 + for (i = 0; i < ARRAY_SIZE(xchacha20poly1305_dec_vectors); ++i) {
6475 + memset(computed_output, 0, MAXIMUM_TEST_BUFFER_LEN);
6476 + ret = xchacha20poly1305_decrypt(computed_output,
6477 +@@ -7386,8 +9024,59 @@ bool __init chacha20poly1305_selftest(void)
6478 + }
6479 + }
6480 +
6481 ++ for (total_len = POLY1305_DIGEST_SIZE; IS_ENABLED(DEBUG_CHACHA20POLY1305_SLOW_CHUNK_TEST)
6482 ++ && total_len <= 1 << 10; ++total_len) {
6483 ++ for (i = 0; i <= total_len; ++i) {
6484 ++ for (j = i; j <= total_len; ++j) {
6485 ++ k = 0;
6486 ++ sg_init_table(sg_src, 3);
6487 ++ if (i)
6488 ++ sg_set_buf(&sg_src[k++], input, i);
6489 ++ if (j - i)
6490 ++ sg_set_buf(&sg_src[k++], input + i, j - i);
6491 ++ if (total_len - j)
6492 ++ sg_set_buf(&sg_src[k++], input + j, total_len - j);
6493 ++ sg_init_marker(sg_src, k);
6494 ++ memset(computed_output, 0, total_len);
6495 ++ memset(input, 0, total_len);
6496 ++
6497 ++ if (!chacha20poly1305_encrypt_sg_inplace(sg_src,
6498 ++ total_len - POLY1305_DIGEST_SIZE, NULL, 0,
6499 ++ 0, enc_key001))
6500 ++ goto chunkfail;
6501 ++ chacha20poly1305_encrypt(computed_output,
6502 ++ computed_output,
6503 ++ total_len - POLY1305_DIGEST_SIZE, NULL, 0, 0,
6504 ++ enc_key001);
6505 ++ if (memcmp(computed_output, input, total_len))
6506 ++ goto chunkfail;
6507 ++ if (!chacha20poly1305_decrypt(computed_output,
6508 ++ input, total_len, NULL, 0, 0, enc_key001))
6509 ++ goto chunkfail;
6510 ++ for (k = 0; k < total_len - POLY1305_DIGEST_SIZE; ++k) {
6511 ++ if (computed_output[k])
6512 ++ goto chunkfail;
6513 ++ }
6514 ++ if (!chacha20poly1305_decrypt_sg_inplace(sg_src,
6515 ++ total_len, NULL, 0, 0, enc_key001))
6516 ++ goto chunkfail;
6517 ++ for (k = 0; k < total_len - POLY1305_DIGEST_SIZE; ++k) {
6518 ++ if (input[k])
6519 ++ goto chunkfail;
6520 ++ }
6521 ++ continue;
6522 ++
6523 ++ chunkfail:
6524 ++ pr_err("chacha20poly1305 chunked self-test %zu/%zu/%zu: FAIL\n",
6525 ++ total_len, i, j);
6526 ++ success = false;
6527 ++ }
6528 ++
6529 ++ }
6530 ++ }
6531 ++
6532 + out:
6533 +- kfree(heap_src);
6534 + kfree(computed_output);
6535 ++ kfree(input);
6536 + return success;
6537 + }
6538 +diff --git a/mm/memcontrol.c b/mm/memcontrol.c
6539 +index c051ca158b1e..8ff9ef8503be 100644
6540 +--- a/mm/memcontrol.c
6541 ++++ b/mm/memcontrol.c
6542 +@@ -777,6 +777,17 @@ void __mod_lruvec_slab_state(void *p, enum node_stat_item idx, int val)
6543 + rcu_read_unlock();
6544 + }
6545 +
6546 ++void mod_memcg_obj_state(void *p, int idx, int val)
6547 ++{
6548 ++ struct mem_cgroup *memcg;
6549 ++
6550 ++ rcu_read_lock();
6551 ++ memcg = mem_cgroup_from_obj(p);
6552 ++ if (memcg)
6553 ++ mod_memcg_state(memcg, idx, val);
6554 ++ rcu_read_unlock();
6555 ++}
6556 ++
6557 + /**
6558 + * __count_memcg_events - account VM events in a cgroup
6559 + * @memcg: the memory cgroup
6560 +@@ -2661,6 +2672,33 @@ static void commit_charge(struct page *page, struct mem_cgroup *memcg,
6561 + }
6562 +
6563 + #ifdef CONFIG_MEMCG_KMEM
6564 ++/*
6565 ++ * Returns a pointer to the memory cgroup to which the kernel object is charged.
6566 ++ *
6567 ++ * The caller must ensure the memcg lifetime, e.g. by taking rcu_read_lock(),
6568 ++ * cgroup_mutex, etc.
6569 ++ */
6570 ++struct mem_cgroup *mem_cgroup_from_obj(void *p)
6571 ++{
6572 ++ struct page *page;
6573 ++
6574 ++ if (mem_cgroup_disabled())
6575 ++ return NULL;
6576 ++
6577 ++ page = virt_to_head_page(p);
6578 ++
6579 ++ /*
6580 ++ * Slab pages don't have page->mem_cgroup set because corresponding
6581 ++ * kmem caches can be reparented during the lifetime. That's why
6582 ++ * memcg_from_slab_page() should be used instead.
6583 ++ */
6584 ++ if (PageSlab(page))
6585 ++ return memcg_from_slab_page(page);
6586 ++
6587 ++ /* All other pages use page->mem_cgroup */
6588 ++ return page->mem_cgroup;
6589 ++}
6590 ++
6591 + static int memcg_alloc_cache_id(void)
6592 + {
6593 + int id, size;
6594 +diff --git a/mm/sparse.c b/mm/sparse.c
6595 +index 3c24708a4dc6..81fd7d8556a2 100644
6596 +--- a/mm/sparse.c
6597 ++++ b/mm/sparse.c
6598 +@@ -791,6 +791,12 @@ static void section_deactivate(unsigned long pfn, unsigned long nr_pages,
6599 + ms->usage = NULL;
6600 + }
6601 + memmap = sparse_decode_mem_map(ms->section_mem_map, section_nr);
6602 ++ /*
6603 ++ * Mark the section invalid so that valid_section()
6604 ++ * return false. This prevents code from dereferencing
6605 ++ * ms->usage array.
6606 ++ */
6607 ++ ms->section_mem_map &= ~SECTION_HAS_MEM_MAP;
6608 + }
6609 +
6610 + if (section_is_early && memmap)
6611 +diff --git a/mm/swapfile.c b/mm/swapfile.c
6612 +index bb3261d45b6a..1aa41fefabc0 100644
6613 +--- a/mm/swapfile.c
6614 ++++ b/mm/swapfile.c
6615 +@@ -2899,10 +2899,6 @@ static int claim_swapfile(struct swap_info_struct *p, struct inode *inode)
6616 + p->bdev = inode->i_sb->s_bdev;
6617 + }
6618 +
6619 +- inode_lock(inode);
6620 +- if (IS_SWAPFILE(inode))
6621 +- return -EBUSY;
6622 +-
6623 + return 0;
6624 + }
6625 +
6626 +@@ -3157,17 +3153,22 @@ SYSCALL_DEFINE2(swapon, const char __user *, specialfile, int, swap_flags)
6627 + mapping = swap_file->f_mapping;
6628 + inode = mapping->host;
6629 +
6630 +- /* If S_ISREG(inode->i_mode) will do inode_lock(inode); */
6631 + error = claim_swapfile(p, inode);
6632 + if (unlikely(error))
6633 + goto bad_swap;
6634 +
6635 ++ inode_lock(inode);
6636 ++ if (IS_SWAPFILE(inode)) {
6637 ++ error = -EBUSY;
6638 ++ goto bad_swap_unlock_inode;
6639 ++ }
6640 ++
6641 + /*
6642 + * Read the swap header.
6643 + */
6644 + if (!mapping->a_ops->readpage) {
6645 + error = -EINVAL;
6646 +- goto bad_swap;
6647 ++ goto bad_swap_unlock_inode;
6648 + }
6649 + page = read_mapping_page(mapping, 0, swap_file);
6650 + if (IS_ERR(page)) {
6651 +@@ -3179,14 +3180,14 @@ SYSCALL_DEFINE2(swapon, const char __user *, specialfile, int, swap_flags)
6652 + maxpages = read_swap_header(p, swap_header, inode);
6653 + if (unlikely(!maxpages)) {
6654 + error = -EINVAL;
6655 +- goto bad_swap;
6656 ++ goto bad_swap_unlock_inode;
6657 + }
6658 +
6659 + /* OK, set up the swap map and apply the bad block list */
6660 + swap_map = vzalloc(maxpages);
6661 + if (!swap_map) {
6662 + error = -ENOMEM;
6663 +- goto bad_swap;
6664 ++ goto bad_swap_unlock_inode;
6665 + }
6666 +
6667 + if (bdi_cap_stable_pages_required(inode_to_bdi(inode)))
6668 +@@ -3211,7 +3212,7 @@ SYSCALL_DEFINE2(swapon, const char __user *, specialfile, int, swap_flags)
6669 + GFP_KERNEL);
6670 + if (!cluster_info) {
6671 + error = -ENOMEM;
6672 +- goto bad_swap;
6673 ++ goto bad_swap_unlock_inode;
6674 + }
6675 +
6676 + for (ci = 0; ci < nr_cluster; ci++)
6677 +@@ -3220,7 +3221,7 @@ SYSCALL_DEFINE2(swapon, const char __user *, specialfile, int, swap_flags)
6678 + p->percpu_cluster = alloc_percpu(struct percpu_cluster);
6679 + if (!p->percpu_cluster) {
6680 + error = -ENOMEM;
6681 +- goto bad_swap;
6682 ++ goto bad_swap_unlock_inode;
6683 + }
6684 + for_each_possible_cpu(cpu) {
6685 + struct percpu_cluster *cluster;
6686 +@@ -3234,13 +3235,13 @@ SYSCALL_DEFINE2(swapon, const char __user *, specialfile, int, swap_flags)
6687 +
6688 + error = swap_cgroup_swapon(p->type, maxpages);
6689 + if (error)
6690 +- goto bad_swap;
6691 ++ goto bad_swap_unlock_inode;
6692 +
6693 + nr_extents = setup_swap_map_and_extents(p, swap_header, swap_map,
6694 + cluster_info, maxpages, &span);
6695 + if (unlikely(nr_extents < 0)) {
6696 + error = nr_extents;
6697 +- goto bad_swap;
6698 ++ goto bad_swap_unlock_inode;
6699 + }
6700 + /* frontswap enabled? set up bit-per-page map for frontswap */
6701 + if (IS_ENABLED(CONFIG_FRONTSWAP))
6702 +@@ -3280,7 +3281,7 @@ SYSCALL_DEFINE2(swapon, const char __user *, specialfile, int, swap_flags)
6703 +
6704 + error = init_swap_address_space(p->type, maxpages);
6705 + if (error)
6706 +- goto bad_swap;
6707 ++ goto bad_swap_unlock_inode;
6708 +
6709 + /*
6710 + * Flush any pending IO and dirty mappings before we start using this
6711 +@@ -3290,7 +3291,7 @@ SYSCALL_DEFINE2(swapon, const char __user *, specialfile, int, swap_flags)
6712 + error = inode_drain_writes(inode);
6713 + if (error) {
6714 + inode->i_flags &= ~S_SWAPFILE;
6715 +- goto bad_swap;
6716 ++ goto bad_swap_unlock_inode;
6717 + }
6718 +
6719 + mutex_lock(&swapon_mutex);
6720 +@@ -3315,6 +3316,8 @@ SYSCALL_DEFINE2(swapon, const char __user *, specialfile, int, swap_flags)
6721 +
6722 + error = 0;
6723 + goto out;
6724 ++bad_swap_unlock_inode:
6725 ++ inode_unlock(inode);
6726 + bad_swap:
6727 + free_percpu(p->percpu_cluster);
6728 + p->percpu_cluster = NULL;
6729 +@@ -3322,6 +3325,7 @@ bad_swap:
6730 + set_blocksize(p->bdev, p->old_block_size);
6731 + blkdev_put(p->bdev, FMODE_READ | FMODE_WRITE | FMODE_EXCL);
6732 + }
6733 ++ inode = NULL;
6734 + destroy_swap_extents(p);
6735 + swap_cgroup_swapoff(p->type);
6736 + spin_lock(&swap_lock);
6737 +@@ -3333,13 +3337,8 @@ bad_swap:
6738 + kvfree(frontswap_map);
6739 + if (inced_nr_rotate_swap)
6740 + atomic_dec(&nr_rotate_swap);
6741 +- if (swap_file) {
6742 +- if (inode) {
6743 +- inode_unlock(inode);
6744 +- inode = NULL;
6745 +- }
6746 ++ if (swap_file)
6747 + filp_close(swap_file, NULL);
6748 +- }
6749 + out:
6750 + if (page && !IS_ERR(page)) {
6751 + kunmap(page);
6752 +diff --git a/net/Kconfig b/net/Kconfig
6753 +index bd191f978a23..198a11d45031 100644
6754 +--- a/net/Kconfig
6755 ++++ b/net/Kconfig
6756 +@@ -52,6 +52,9 @@ config NET_INGRESS
6757 + config NET_EGRESS
6758 + bool
6759 +
6760 ++config NET_REDIRECT
6761 ++ bool
6762 ++
6763 + config SKB_EXTENSIONS
6764 + bool
6765 +
6766 +diff --git a/net/bpfilter/main.c b/net/bpfilter/main.c
6767 +index 77396a098fbe..efea4874743e 100644
6768 +--- a/net/bpfilter/main.c
6769 ++++ b/net/bpfilter/main.c
6770 +@@ -10,7 +10,7 @@
6771 + #include <asm/unistd.h>
6772 + #include "msgfmt.h"
6773 +
6774 +-int debug_fd;
6775 ++FILE *debug_f;
6776 +
6777 + static int handle_get_cmd(struct mbox_request *cmd)
6778 + {
6779 +@@ -35,9 +35,10 @@ static void loop(void)
6780 + struct mbox_reply reply;
6781 + int n;
6782 +
6783 ++ fprintf(debug_f, "testing the buffer\n");
6784 + n = read(0, &req, sizeof(req));
6785 + if (n != sizeof(req)) {
6786 +- dprintf(debug_fd, "invalid request %d\n", n);
6787 ++ fprintf(debug_f, "invalid request %d\n", n);
6788 + return;
6789 + }
6790 +
6791 +@@ -47,7 +48,7 @@ static void loop(void)
6792 +
6793 + n = write(1, &reply, sizeof(reply));
6794 + if (n != sizeof(reply)) {
6795 +- dprintf(debug_fd, "reply failed %d\n", n);
6796 ++ fprintf(debug_f, "reply failed %d\n", n);
6797 + return;
6798 + }
6799 + }
6800 +@@ -55,9 +56,10 @@ static void loop(void)
6801 +
6802 + int main(void)
6803 + {
6804 +- debug_fd = open("/dev/kmsg", 00000002);
6805 +- dprintf(debug_fd, "Started bpfilter\n");
6806 ++ debug_f = fopen("/dev/kmsg", "w");
6807 ++ setvbuf(debug_f, 0, _IOLBF, 0);
6808 ++ fprintf(debug_f, "Started bpfilter\n");
6809 + loop();
6810 +- close(debug_fd);
6811 ++ fclose(debug_f);
6812 + return 0;
6813 + }
6814 +diff --git a/net/ceph/osdmap.c b/net/ceph/osdmap.c
6815 +index 4e0de14f80bb..2a6e63a8edbe 100644
6816 +--- a/net/ceph/osdmap.c
6817 ++++ b/net/ceph/osdmap.c
6818 +@@ -710,6 +710,15 @@ int ceph_pg_poolid_by_name(struct ceph_osdmap *map, const char *name)
6819 + }
6820 + EXPORT_SYMBOL(ceph_pg_poolid_by_name);
6821 +
6822 ++u64 ceph_pg_pool_flags(struct ceph_osdmap *map, u64 id)
6823 ++{
6824 ++ struct ceph_pg_pool_info *pi;
6825 ++
6826 ++ pi = __lookup_pg_pool(&map->pg_pools, id);
6827 ++ return pi ? pi->flags : 0;
6828 ++}
6829 ++EXPORT_SYMBOL(ceph_pg_pool_flags);
6830 ++
6831 + static void __remove_pg_pool(struct rb_root *root, struct ceph_pg_pool_info *pi)
6832 + {
6833 + rb_erase(&pi->node, root);
6834 +diff --git a/net/core/dev.c b/net/core/dev.c
6835 +index c3da35f3c7e4..6cedb1d95fce 100644
6836 +--- a/net/core/dev.c
6837 ++++ b/net/core/dev.c
6838 +@@ -4464,7 +4464,7 @@ static u32 netif_receive_generic_xdp(struct sk_buff *skb,
6839 + /* Reinjected packets coming from act_mirred or similar should
6840 + * not get XDP generic processing.
6841 + */
6842 +- if (skb_is_tc_redirected(skb))
6843 ++ if (skb_is_redirected(skb))
6844 + return XDP_PASS;
6845 +
6846 + /* XDP packets must be linear and must have sufficient headroom
6847 +@@ -5013,7 +5013,7 @@ skip_taps:
6848 + goto out;
6849 + }
6850 + #endif
6851 +- skb_reset_tc(skb);
6852 ++ skb_reset_redirect(skb);
6853 + skip_classify:
6854 + if (pfmemalloc && !skb_pfmemalloc_protocol(skb))
6855 + goto drop;
6856 +diff --git a/net/core/pktgen.c b/net/core/pktgen.c
6857 +index 294bfcf0ce0e..5b5b6675fd25 100644
6858 +--- a/net/core/pktgen.c
6859 ++++ b/net/core/pktgen.c
6860 +@@ -3362,7 +3362,7 @@ static void pktgen_xmit(struct pktgen_dev *pkt_dev)
6861 + /* skb was 'freed' by stack, so clean few
6862 + * bits and reuse it
6863 + */
6864 +- skb_reset_tc(skb);
6865 ++ skb_reset_redirect(skb);
6866 + } while (--burst > 0);
6867 + goto out; /* Skips xmit_mode M_START_XMIT */
6868 + } else if (pkt_dev->xmit_mode == M_QUEUE_XMIT) {
6869 +diff --git a/net/core/sock_map.c b/net/core/sock_map.c
6870 +index 405397801bb0..8291568b707f 100644
6871 +--- a/net/core/sock_map.c
6872 ++++ b/net/core/sock_map.c
6873 +@@ -233,8 +233,11 @@ static void sock_map_free(struct bpf_map *map)
6874 + struct bpf_stab *stab = container_of(map, struct bpf_stab, map);
6875 + int i;
6876 +
6877 ++ /* After the sync no updates or deletes will be in-flight so it
6878 ++ * is safe to walk map and remove entries without risking a race
6879 ++ * in EEXIST update case.
6880 ++ */
6881 + synchronize_rcu();
6882 +- raw_spin_lock_bh(&stab->lock);
6883 + for (i = 0; i < stab->map.max_entries; i++) {
6884 + struct sock **psk = &stab->sks[i];
6885 + struct sock *sk;
6886 +@@ -248,7 +251,6 @@ static void sock_map_free(struct bpf_map *map)
6887 + release_sock(sk);
6888 + }
6889 + }
6890 +- raw_spin_unlock_bh(&stab->lock);
6891 +
6892 + /* wait for psock readers accessing its map link */
6893 + synchronize_rcu();
6894 +@@ -863,10 +865,13 @@ static void sock_hash_free(struct bpf_map *map)
6895 + struct hlist_node *node;
6896 + int i;
6897 +
6898 ++ /* After the sync no updates or deletes will be in-flight so it
6899 ++ * is safe to walk map and remove entries without risking a race
6900 ++ * in EEXIST update case.
6901 ++ */
6902 + synchronize_rcu();
6903 + for (i = 0; i < htab->buckets_num; i++) {
6904 + bucket = sock_hash_select_bucket(htab, i);
6905 +- raw_spin_lock_bh(&bucket->lock);
6906 + hlist_for_each_entry_safe(elem, node, &bucket->head, node) {
6907 + hlist_del_rcu(&elem->node);
6908 + lock_sock(elem->sk);
6909 +@@ -875,7 +880,6 @@ static void sock_hash_free(struct bpf_map *map)
6910 + rcu_read_unlock();
6911 + release_sock(elem->sk);
6912 + }
6913 +- raw_spin_unlock_bh(&bucket->lock);
6914 + }
6915 +
6916 + /* wait for psock readers accessing its map link */
6917 +diff --git a/net/dsa/tag_8021q.c b/net/dsa/tag_8021q.c
6918 +index 2fb6c26294b5..b97ad93d1c1a 100644
6919 +--- a/net/dsa/tag_8021q.c
6920 ++++ b/net/dsa/tag_8021q.c
6921 +@@ -298,47 +298,4 @@ struct sk_buff *dsa_8021q_xmit(struct sk_buff *skb, struct net_device *netdev,
6922 + }
6923 + EXPORT_SYMBOL_GPL(dsa_8021q_xmit);
6924 +
6925 +-/* In the DSA packet_type handler, skb->data points in the middle of the VLAN
6926 +- * tag, after tpid and before tci. This is because so far, ETH_HLEN
6927 +- * (DMAC, SMAC, EtherType) bytes were pulled.
6928 +- * There are 2 bytes of VLAN tag left in skb->data, and upper
6929 +- * layers expect the 'real' EtherType to be consumed as well.
6930 +- * Coincidentally, a VLAN header is also of the same size as
6931 +- * the number of bytes that need to be pulled.
6932 +- *
6933 +- * skb_mac_header skb->data
6934 +- * | |
6935 +- * v v
6936 +- * | | | | | | | | | | | | | | | | | | |
6937 +- * +-----------------------+-----------------------+-------+-------+-------+
6938 +- * | Destination MAC | Source MAC | TPID | TCI | EType |
6939 +- * +-----------------------+-----------------------+-------+-------+-------+
6940 +- * ^ | |
6941 +- * |<--VLAN_HLEN-->to <---VLAN_HLEN--->
6942 +- * from |
6943 +- * >>>>>>> v
6944 +- * >>>>>>> | | | | | | | | | | | | | | |
6945 +- * >>>>>>> +-----------------------+-----------------------+-------+
6946 +- * >>>>>>> | Destination MAC | Source MAC | EType |
6947 +- * +-----------------------+-----------------------+-------+
6948 +- * ^ ^
6949 +- * (now part of | |
6950 +- * skb->head) skb_mac_header skb->data
6951 +- */
6952 +-struct sk_buff *dsa_8021q_remove_header(struct sk_buff *skb)
6953 +-{
6954 +- u8 *from = skb_mac_header(skb);
6955 +- u8 *dest = from + VLAN_HLEN;
6956 +-
6957 +- memmove(dest, from, ETH_HLEN - VLAN_HLEN);
6958 +- skb_pull(skb, VLAN_HLEN);
6959 +- skb_push(skb, ETH_HLEN);
6960 +- skb_reset_mac_header(skb);
6961 +- skb_reset_mac_len(skb);
6962 +- skb_pull_rcsum(skb, ETH_HLEN);
6963 +-
6964 +- return skb;
6965 +-}
6966 +-EXPORT_SYMBOL_GPL(dsa_8021q_remove_header);
6967 +-
6968 + MODULE_LICENSE("GPL v2");
6969 +diff --git a/net/dsa/tag_brcm.c b/net/dsa/tag_brcm.c
6970 +index 9c3114179690..9169b63a89e3 100644
6971 +--- a/net/dsa/tag_brcm.c
6972 ++++ b/net/dsa/tag_brcm.c
6973 +@@ -140,6 +140,8 @@ static struct sk_buff *brcm_tag_rcv_ll(struct sk_buff *skb,
6974 + /* Remove Broadcom tag and update checksum */
6975 + skb_pull_rcsum(skb, BRCM_TAG_LEN);
6976 +
6977 ++ skb->offload_fwd_mark = 1;
6978 ++
6979 + return skb;
6980 + }
6981 + #endif
6982 +diff --git a/net/dsa/tag_sja1105.c b/net/dsa/tag_sja1105.c
6983 +index 63ef2a14c934..12f3ce52e62e 100644
6984 +--- a/net/dsa/tag_sja1105.c
6985 ++++ b/net/dsa/tag_sja1105.c
6986 +@@ -238,14 +238,14 @@ static struct sk_buff *sja1105_rcv(struct sk_buff *skb,
6987 + {
6988 + struct sja1105_meta meta = {0};
6989 + int source_port, switch_id;
6990 +- struct vlan_ethhdr *hdr;
6991 ++ struct ethhdr *hdr;
6992 + u16 tpid, vid, tci;
6993 + bool is_link_local;
6994 + bool is_tagged;
6995 + bool is_meta;
6996 +
6997 +- hdr = vlan_eth_hdr(skb);
6998 +- tpid = ntohs(hdr->h_vlan_proto);
6999 ++ hdr = eth_hdr(skb);
7000 ++ tpid = ntohs(hdr->h_proto);
7001 + is_tagged = (tpid == ETH_P_SJA1105);
7002 + is_link_local = sja1105_is_link_local(skb);
7003 + is_meta = sja1105_is_meta_frame(skb);
7004 +@@ -254,7 +254,12 @@ static struct sk_buff *sja1105_rcv(struct sk_buff *skb,
7005 +
7006 + if (is_tagged) {
7007 + /* Normal traffic path. */
7008 +- tci = ntohs(hdr->h_vlan_TCI);
7009 ++ skb_push_rcsum(skb, ETH_HLEN);
7010 ++ __skb_vlan_pop(skb, &tci);
7011 ++ skb_pull_rcsum(skb, ETH_HLEN);
7012 ++ skb_reset_network_header(skb);
7013 ++ skb_reset_transport_header(skb);
7014 ++
7015 + vid = tci & VLAN_VID_MASK;
7016 + source_port = dsa_8021q_rx_source_port(vid);
7017 + switch_id = dsa_8021q_rx_switch_id(vid);
7018 +@@ -283,12 +288,6 @@ static struct sk_buff *sja1105_rcv(struct sk_buff *skb,
7019 + return NULL;
7020 + }
7021 +
7022 +- /* Delete/overwrite fake VLAN header, DSA expects to not find
7023 +- * it there, see dsa_switch_rcv: skb_push(skb, ETH_HLEN).
7024 +- */
7025 +- if (is_tagged)
7026 +- skb = dsa_8021q_remove_header(skb);
7027 +-
7028 + return sja1105_rcv_meta_state_machine(skb, &meta, is_link_local,
7029 + is_meta);
7030 + }
7031 +diff --git a/net/hsr/hsr_framereg.c b/net/hsr/hsr_framereg.c
7032 +index 27dc65d7de67..002f341f3564 100644
7033 +--- a/net/hsr/hsr_framereg.c
7034 ++++ b/net/hsr/hsr_framereg.c
7035 +@@ -482,12 +482,9 @@ int hsr_get_node_data(struct hsr_priv *hsr,
7036 + struct hsr_port *port;
7037 + unsigned long tdiff;
7038 +
7039 +- rcu_read_lock();
7040 + node = find_node_by_addr_A(&hsr->node_db, addr);
7041 +- if (!node) {
7042 +- rcu_read_unlock();
7043 +- return -ENOENT; /* No such entry */
7044 +- }
7045 ++ if (!node)
7046 ++ return -ENOENT;
7047 +
7048 + ether_addr_copy(addr_b, node->macaddress_B);
7049 +
7050 +@@ -522,7 +519,5 @@ int hsr_get_node_data(struct hsr_priv *hsr,
7051 + *addr_b_ifindex = -1;
7052 + }
7053 +
7054 +- rcu_read_unlock();
7055 +-
7056 + return 0;
7057 + }
7058 +diff --git a/net/hsr/hsr_netlink.c b/net/hsr/hsr_netlink.c
7059 +index 8dc0547f01d0..fae21c863b1f 100644
7060 +--- a/net/hsr/hsr_netlink.c
7061 ++++ b/net/hsr/hsr_netlink.c
7062 +@@ -251,15 +251,16 @@ static int hsr_get_node_status(struct sk_buff *skb_in, struct genl_info *info)
7063 + if (!na)
7064 + goto invalid;
7065 +
7066 +- hsr_dev = __dev_get_by_index(genl_info_net(info),
7067 +- nla_get_u32(info->attrs[HSR_A_IFINDEX]));
7068 ++ rcu_read_lock();
7069 ++ hsr_dev = dev_get_by_index_rcu(genl_info_net(info),
7070 ++ nla_get_u32(info->attrs[HSR_A_IFINDEX]));
7071 + if (!hsr_dev)
7072 +- goto invalid;
7073 ++ goto rcu_unlock;
7074 + if (!is_hsr_master(hsr_dev))
7075 +- goto invalid;
7076 ++ goto rcu_unlock;
7077 +
7078 + /* Send reply */
7079 +- skb_out = genlmsg_new(NLMSG_GOODSIZE, GFP_KERNEL);
7080 ++ skb_out = genlmsg_new(NLMSG_GOODSIZE, GFP_ATOMIC);
7081 + if (!skb_out) {
7082 + res = -ENOMEM;
7083 + goto fail;
7084 +@@ -313,12 +314,10 @@ static int hsr_get_node_status(struct sk_buff *skb_in, struct genl_info *info)
7085 + res = nla_put_u16(skb_out, HSR_A_IF1_SEQ, hsr_node_if1_seq);
7086 + if (res < 0)
7087 + goto nla_put_failure;
7088 +- rcu_read_lock();
7089 + port = hsr_port_get_hsr(hsr, HSR_PT_SLAVE_A);
7090 + if (port)
7091 + res = nla_put_u32(skb_out, HSR_A_IF1_IFINDEX,
7092 + port->dev->ifindex);
7093 +- rcu_read_unlock();
7094 + if (res < 0)
7095 + goto nla_put_failure;
7096 +
7097 +@@ -328,20 +327,22 @@ static int hsr_get_node_status(struct sk_buff *skb_in, struct genl_info *info)
7098 + res = nla_put_u16(skb_out, HSR_A_IF2_SEQ, hsr_node_if2_seq);
7099 + if (res < 0)
7100 + goto nla_put_failure;
7101 +- rcu_read_lock();
7102 + port = hsr_port_get_hsr(hsr, HSR_PT_SLAVE_B);
7103 + if (port)
7104 + res = nla_put_u32(skb_out, HSR_A_IF2_IFINDEX,
7105 + port->dev->ifindex);
7106 +- rcu_read_unlock();
7107 + if (res < 0)
7108 + goto nla_put_failure;
7109 +
7110 ++ rcu_read_unlock();
7111 ++
7112 + genlmsg_end(skb_out, msg_head);
7113 + genlmsg_unicast(genl_info_net(info), skb_out, info->snd_portid);
7114 +
7115 + return 0;
7116 +
7117 ++rcu_unlock:
7118 ++ rcu_read_unlock();
7119 + invalid:
7120 + netlink_ack(skb_in, nlmsg_hdr(skb_in), -EINVAL, NULL);
7121 + return 0;
7122 +@@ -351,6 +352,7 @@ nla_put_failure:
7123 + /* Fall through */
7124 +
7125 + fail:
7126 ++ rcu_read_unlock();
7127 + return res;
7128 + }
7129 +
7130 +@@ -358,16 +360,14 @@ fail:
7131 + */
7132 + static int hsr_get_node_list(struct sk_buff *skb_in, struct genl_info *info)
7133 + {
7134 +- /* For receiving */
7135 +- struct nlattr *na;
7136 ++ unsigned char addr[ETH_ALEN];
7137 + struct net_device *hsr_dev;
7138 +-
7139 +- /* For sending */
7140 + struct sk_buff *skb_out;
7141 +- void *msg_head;
7142 + struct hsr_priv *hsr;
7143 +- void *pos;
7144 +- unsigned char addr[ETH_ALEN];
7145 ++ bool restart = false;
7146 ++ struct nlattr *na;
7147 ++ void *pos = NULL;
7148 ++ void *msg_head;
7149 + int res;
7150 +
7151 + if (!info)
7152 +@@ -377,15 +377,17 @@ static int hsr_get_node_list(struct sk_buff *skb_in, struct genl_info *info)
7153 + if (!na)
7154 + goto invalid;
7155 +
7156 +- hsr_dev = __dev_get_by_index(genl_info_net(info),
7157 +- nla_get_u32(info->attrs[HSR_A_IFINDEX]));
7158 ++ rcu_read_lock();
7159 ++ hsr_dev = dev_get_by_index_rcu(genl_info_net(info),
7160 ++ nla_get_u32(info->attrs[HSR_A_IFINDEX]));
7161 + if (!hsr_dev)
7162 +- goto invalid;
7163 ++ goto rcu_unlock;
7164 + if (!is_hsr_master(hsr_dev))
7165 +- goto invalid;
7166 ++ goto rcu_unlock;
7167 +
7168 ++restart:
7169 + /* Send reply */
7170 +- skb_out = genlmsg_new(NLMSG_GOODSIZE, GFP_KERNEL);
7171 ++ skb_out = genlmsg_new(GENLMSG_DEFAULT_SIZE, GFP_ATOMIC);
7172 + if (!skb_out) {
7173 + res = -ENOMEM;
7174 + goto fail;
7175 +@@ -399,18 +401,26 @@ static int hsr_get_node_list(struct sk_buff *skb_in, struct genl_info *info)
7176 + goto nla_put_failure;
7177 + }
7178 +
7179 +- res = nla_put_u32(skb_out, HSR_A_IFINDEX, hsr_dev->ifindex);
7180 +- if (res < 0)
7181 +- goto nla_put_failure;
7182 ++ if (!restart) {
7183 ++ res = nla_put_u32(skb_out, HSR_A_IFINDEX, hsr_dev->ifindex);
7184 ++ if (res < 0)
7185 ++ goto nla_put_failure;
7186 ++ }
7187 +
7188 + hsr = netdev_priv(hsr_dev);
7189 +
7190 +- rcu_read_lock();
7191 +- pos = hsr_get_next_node(hsr, NULL, addr);
7192 ++ if (!pos)
7193 ++ pos = hsr_get_next_node(hsr, NULL, addr);
7194 + while (pos) {
7195 + res = nla_put(skb_out, HSR_A_NODE_ADDR, ETH_ALEN, addr);
7196 + if (res < 0) {
7197 +- rcu_read_unlock();
7198 ++ if (res == -EMSGSIZE) {
7199 ++ genlmsg_end(skb_out, msg_head);
7200 ++ genlmsg_unicast(genl_info_net(info), skb_out,
7201 ++ info->snd_portid);
7202 ++ restart = true;
7203 ++ goto restart;
7204 ++ }
7205 + goto nla_put_failure;
7206 + }
7207 + pos = hsr_get_next_node(hsr, pos, addr);
7208 +@@ -422,15 +432,18 @@ static int hsr_get_node_list(struct sk_buff *skb_in, struct genl_info *info)
7209 +
7210 + return 0;
7211 +
7212 ++rcu_unlock:
7213 ++ rcu_read_unlock();
7214 + invalid:
7215 + netlink_ack(skb_in, nlmsg_hdr(skb_in), -EINVAL, NULL);
7216 + return 0;
7217 +
7218 + nla_put_failure:
7219 +- kfree_skb(skb_out);
7220 ++ nlmsg_free(skb_out);
7221 + /* Fall through */
7222 +
7223 + fail:
7224 ++ rcu_read_unlock();
7225 + return res;
7226 + }
7227 +
7228 +@@ -457,6 +470,7 @@ static struct genl_family hsr_genl_family __ro_after_init = {
7229 + .version = 1,
7230 + .maxattr = HSR_A_MAX,
7231 + .policy = hsr_genl_policy,
7232 ++ .netnsok = true,
7233 + .module = THIS_MODULE,
7234 + .ops = hsr_ops,
7235 + .n_ops = ARRAY_SIZE(hsr_ops),
7236 +diff --git a/net/hsr/hsr_slave.c b/net/hsr/hsr_slave.c
7237 +index fbfd0db182b7..a9104d42aafb 100644
7238 +--- a/net/hsr/hsr_slave.c
7239 ++++ b/net/hsr/hsr_slave.c
7240 +@@ -145,16 +145,16 @@ int hsr_add_port(struct hsr_priv *hsr, struct net_device *dev,
7241 + if (!port)
7242 + return -ENOMEM;
7243 +
7244 ++ port->hsr = hsr;
7245 ++ port->dev = dev;
7246 ++ port->type = type;
7247 ++
7248 + if (type != HSR_PT_MASTER) {
7249 + res = hsr_portdev_setup(dev, port);
7250 + if (res)
7251 + goto fail_dev_setup;
7252 + }
7253 +
7254 +- port->hsr = hsr;
7255 +- port->dev = dev;
7256 +- port->type = type;
7257 +-
7258 + list_add_tail_rcu(&port->port_list, &hsr->ports);
7259 + synchronize_rcu();
7260 +
7261 +diff --git a/net/ipv4/Kconfig b/net/ipv4/Kconfig
7262 +index fc816b187170..4fb96cadb84c 100644
7263 +--- a/net/ipv4/Kconfig
7264 ++++ b/net/ipv4/Kconfig
7265 +@@ -303,6 +303,7 @@ config SYN_COOKIES
7266 +
7267 + config NET_IPVTI
7268 + tristate "Virtual (secure) IP: tunneling"
7269 ++ depends on IPV6 || IPV6=n
7270 + select INET_TUNNEL
7271 + select NET_IP_TUNNEL
7272 + select XFRM
7273 +diff --git a/net/ipv4/fib_frontend.c b/net/ipv4/fib_frontend.c
7274 +index 577db1d50a24..213be9c050ad 100644
7275 +--- a/net/ipv4/fib_frontend.c
7276 ++++ b/net/ipv4/fib_frontend.c
7277 +@@ -997,7 +997,9 @@ static int inet_dump_fib(struct sk_buff *skb, struct netlink_callback *cb)
7278 + return -ENOENT;
7279 + }
7280 +
7281 ++ rcu_read_lock();
7282 + err = fib_table_dump(tb, skb, cb, &filter);
7283 ++ rcu_read_unlock();
7284 + return skb->len ? : err;
7285 + }
7286 +
7287 +diff --git a/net/ipv4/ip_gre.c b/net/ipv4/ip_gre.c
7288 +index 8274f98c511c..029b24eeafba 100644
7289 +--- a/net/ipv4/ip_gre.c
7290 ++++ b/net/ipv4/ip_gre.c
7291 +@@ -1153,6 +1153,24 @@ static int ipgre_netlink_parms(struct net_device *dev,
7292 + if (data[IFLA_GRE_FWMARK])
7293 + *fwmark = nla_get_u32(data[IFLA_GRE_FWMARK]);
7294 +
7295 ++ return 0;
7296 ++}
7297 ++
7298 ++static int erspan_netlink_parms(struct net_device *dev,
7299 ++ struct nlattr *data[],
7300 ++ struct nlattr *tb[],
7301 ++ struct ip_tunnel_parm *parms,
7302 ++ __u32 *fwmark)
7303 ++{
7304 ++ struct ip_tunnel *t = netdev_priv(dev);
7305 ++ int err;
7306 ++
7307 ++ err = ipgre_netlink_parms(dev, data, tb, parms, fwmark);
7308 ++ if (err)
7309 ++ return err;
7310 ++ if (!data)
7311 ++ return 0;
7312 ++
7313 + if (data[IFLA_GRE_ERSPAN_VER]) {
7314 + t->erspan_ver = nla_get_u8(data[IFLA_GRE_ERSPAN_VER]);
7315 +
7316 +@@ -1276,45 +1294,70 @@ static void ipgre_tap_setup(struct net_device *dev)
7317 + ip_tunnel_setup(dev, gre_tap_net_id);
7318 + }
7319 +
7320 +-static int ipgre_newlink(struct net *src_net, struct net_device *dev,
7321 +- struct nlattr *tb[], struct nlattr *data[],
7322 +- struct netlink_ext_ack *extack)
7323 ++static int
7324 ++ipgre_newlink_encap_setup(struct net_device *dev, struct nlattr *data[])
7325 + {
7326 +- struct ip_tunnel_parm p;
7327 + struct ip_tunnel_encap ipencap;
7328 +- __u32 fwmark = 0;
7329 +- int err;
7330 +
7331 + if (ipgre_netlink_encap_parms(data, &ipencap)) {
7332 + struct ip_tunnel *t = netdev_priv(dev);
7333 +- err = ip_tunnel_encap_setup(t, &ipencap);
7334 ++ int err = ip_tunnel_encap_setup(t, &ipencap);
7335 +
7336 + if (err < 0)
7337 + return err;
7338 + }
7339 +
7340 ++ return 0;
7341 ++}
7342 ++
7343 ++static int ipgre_newlink(struct net *src_net, struct net_device *dev,
7344 ++ struct nlattr *tb[], struct nlattr *data[],
7345 ++ struct netlink_ext_ack *extack)
7346 ++{
7347 ++ struct ip_tunnel_parm p;
7348 ++ __u32 fwmark = 0;
7349 ++ int err;
7350 ++
7351 ++ err = ipgre_newlink_encap_setup(dev, data);
7352 ++ if (err)
7353 ++ return err;
7354 ++
7355 + err = ipgre_netlink_parms(dev, data, tb, &p, &fwmark);
7356 + if (err < 0)
7357 + return err;
7358 + return ip_tunnel_newlink(dev, tb, &p, fwmark);
7359 + }
7360 +
7361 ++static int erspan_newlink(struct net *src_net, struct net_device *dev,
7362 ++ struct nlattr *tb[], struct nlattr *data[],
7363 ++ struct netlink_ext_ack *extack)
7364 ++{
7365 ++ struct ip_tunnel_parm p;
7366 ++ __u32 fwmark = 0;
7367 ++ int err;
7368 ++
7369 ++ err = ipgre_newlink_encap_setup(dev, data);
7370 ++ if (err)
7371 ++ return err;
7372 ++
7373 ++ err = erspan_netlink_parms(dev, data, tb, &p, &fwmark);
7374 ++ if (err)
7375 ++ return err;
7376 ++ return ip_tunnel_newlink(dev, tb, &p, fwmark);
7377 ++}
7378 ++
7379 + static int ipgre_changelink(struct net_device *dev, struct nlattr *tb[],
7380 + struct nlattr *data[],
7381 + struct netlink_ext_ack *extack)
7382 + {
7383 + struct ip_tunnel *t = netdev_priv(dev);
7384 +- struct ip_tunnel_encap ipencap;
7385 + __u32 fwmark = t->fwmark;
7386 + struct ip_tunnel_parm p;
7387 + int err;
7388 +
7389 +- if (ipgre_netlink_encap_parms(data, &ipencap)) {
7390 +- err = ip_tunnel_encap_setup(t, &ipencap);
7391 +-
7392 +- if (err < 0)
7393 +- return err;
7394 +- }
7395 ++ err = ipgre_newlink_encap_setup(dev, data);
7396 ++ if (err)
7397 ++ return err;
7398 +
7399 + err = ipgre_netlink_parms(dev, data, tb, &p, &fwmark);
7400 + if (err < 0)
7401 +@@ -1327,8 +1370,34 @@ static int ipgre_changelink(struct net_device *dev, struct nlattr *tb[],
7402 + t->parms.i_flags = p.i_flags;
7403 + t->parms.o_flags = p.o_flags;
7404 +
7405 +- if (strcmp(dev->rtnl_link_ops->kind, "erspan"))
7406 +- ipgre_link_update(dev, !tb[IFLA_MTU]);
7407 ++ ipgre_link_update(dev, !tb[IFLA_MTU]);
7408 ++
7409 ++ return 0;
7410 ++}
7411 ++
7412 ++static int erspan_changelink(struct net_device *dev, struct nlattr *tb[],
7413 ++ struct nlattr *data[],
7414 ++ struct netlink_ext_ack *extack)
7415 ++{
7416 ++ struct ip_tunnel *t = netdev_priv(dev);
7417 ++ __u32 fwmark = t->fwmark;
7418 ++ struct ip_tunnel_parm p;
7419 ++ int err;
7420 ++
7421 ++ err = ipgre_newlink_encap_setup(dev, data);
7422 ++ if (err)
7423 ++ return err;
7424 ++
7425 ++ err = erspan_netlink_parms(dev, data, tb, &p, &fwmark);
7426 ++ if (err < 0)
7427 ++ return err;
7428 ++
7429 ++ err = ip_tunnel_changelink(dev, tb, &p, fwmark);
7430 ++ if (err < 0)
7431 ++ return err;
7432 ++
7433 ++ t->parms.i_flags = p.i_flags;
7434 ++ t->parms.o_flags = p.o_flags;
7435 +
7436 + return 0;
7437 + }
7438 +@@ -1519,8 +1588,8 @@ static struct rtnl_link_ops erspan_link_ops __read_mostly = {
7439 + .priv_size = sizeof(struct ip_tunnel),
7440 + .setup = erspan_setup,
7441 + .validate = erspan_validate,
7442 +- .newlink = ipgre_newlink,
7443 +- .changelink = ipgre_changelink,
7444 ++ .newlink = erspan_newlink,
7445 ++ .changelink = erspan_changelink,
7446 + .dellink = ip_tunnel_dellink,
7447 + .get_size = ipgre_get_size,
7448 + .fill_info = ipgre_fill_info,
7449 +diff --git a/net/ipv4/ip_vti.c b/net/ipv4/ip_vti.c
7450 +index 37cddd18f282..1b4e6f298648 100644
7451 +--- a/net/ipv4/ip_vti.c
7452 ++++ b/net/ipv4/ip_vti.c
7453 +@@ -187,17 +187,39 @@ static netdev_tx_t vti_xmit(struct sk_buff *skb, struct net_device *dev,
7454 + int mtu;
7455 +
7456 + if (!dst) {
7457 +- struct rtable *rt;
7458 +-
7459 +- fl->u.ip4.flowi4_oif = dev->ifindex;
7460 +- fl->u.ip4.flowi4_flags |= FLOWI_FLAG_ANYSRC;
7461 +- rt = __ip_route_output_key(dev_net(dev), &fl->u.ip4);
7462 +- if (IS_ERR(rt)) {
7463 ++ switch (skb->protocol) {
7464 ++ case htons(ETH_P_IP): {
7465 ++ struct rtable *rt;
7466 ++
7467 ++ fl->u.ip4.flowi4_oif = dev->ifindex;
7468 ++ fl->u.ip4.flowi4_flags |= FLOWI_FLAG_ANYSRC;
7469 ++ rt = __ip_route_output_key(dev_net(dev), &fl->u.ip4);
7470 ++ if (IS_ERR(rt)) {
7471 ++ dev->stats.tx_carrier_errors++;
7472 ++ goto tx_error_icmp;
7473 ++ }
7474 ++ dst = &rt->dst;
7475 ++ skb_dst_set(skb, dst);
7476 ++ break;
7477 ++ }
7478 ++#if IS_ENABLED(CONFIG_IPV6)
7479 ++ case htons(ETH_P_IPV6):
7480 ++ fl->u.ip6.flowi6_oif = dev->ifindex;
7481 ++ fl->u.ip6.flowi6_flags |= FLOWI_FLAG_ANYSRC;
7482 ++ dst = ip6_route_output(dev_net(dev), NULL, &fl->u.ip6);
7483 ++ if (dst->error) {
7484 ++ dst_release(dst);
7485 ++ dst = NULL;
7486 ++ dev->stats.tx_carrier_errors++;
7487 ++ goto tx_error_icmp;
7488 ++ }
7489 ++ skb_dst_set(skb, dst);
7490 ++ break;
7491 ++#endif
7492 ++ default:
7493 + dev->stats.tx_carrier_errors++;
7494 + goto tx_error_icmp;
7495 + }
7496 +- dst = &rt->dst;
7497 +- skb_dst_set(skb, dst);
7498 + }
7499 +
7500 + dst_hold(dst);
7501 +diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c
7502 +index 94e137f7aa9f..4a4af955e467 100644
7503 +--- a/net/ipv4/tcp.c
7504 ++++ b/net/ipv4/tcp.c
7505 +@@ -2947,8 +2947,10 @@ static int do_tcp_setsockopt(struct sock *sk, int level,
7506 + err = -EPERM;
7507 + else if (tp->repair_queue == TCP_SEND_QUEUE)
7508 + WRITE_ONCE(tp->write_seq, val);
7509 +- else if (tp->repair_queue == TCP_RECV_QUEUE)
7510 ++ else if (tp->repair_queue == TCP_RECV_QUEUE) {
7511 + WRITE_ONCE(tp->rcv_nxt, val);
7512 ++ WRITE_ONCE(tp->copied_seq, val);
7513 ++ }
7514 + else
7515 + err = -EINVAL;
7516 + break;
7517 +diff --git a/net/ipv4/tcp_output.c b/net/ipv4/tcp_output.c
7518 +index b62b59b18db9..32c200e7cd19 100644
7519 +--- a/net/ipv4/tcp_output.c
7520 ++++ b/net/ipv4/tcp_output.c
7521 +@@ -1048,6 +1048,10 @@ static int __tcp_transmit_skb(struct sock *sk, struct sk_buff *skb,
7522 +
7523 + if (unlikely(!skb))
7524 + return -ENOBUFS;
7525 ++ /* retransmit skbs might have a non zero value in skb->dev
7526 ++ * because skb->dev is aliased with skb->rbnode.rb_left
7527 ++ */
7528 ++ skb->dev = NULL;
7529 + }
7530 +
7531 + inet = inet_sk(sk);
7532 +@@ -2976,8 +2980,12 @@ int __tcp_retransmit_skb(struct sock *sk, struct sk_buff *skb, int segs)
7533 +
7534 + tcp_skb_tsorted_save(skb) {
7535 + nskb = __pskb_copy(skb, MAX_TCP_HEADER, GFP_ATOMIC);
7536 +- err = nskb ? tcp_transmit_skb(sk, nskb, 0, GFP_ATOMIC) :
7537 +- -ENOBUFS;
7538 ++ if (nskb) {
7539 ++ nskb->dev = NULL;
7540 ++ err = tcp_transmit_skb(sk, nskb, 0, GFP_ATOMIC);
7541 ++ } else {
7542 ++ err = -ENOBUFS;
7543 ++ }
7544 + } tcp_skb_tsorted_restore(skb);
7545 +
7546 + if (!err) {
7547 +diff --git a/net/ipv6/ip6_vti.c b/net/ipv6/ip6_vti.c
7548 +index 524006aa0d78..cc6180e08a4f 100644
7549 +--- a/net/ipv6/ip6_vti.c
7550 ++++ b/net/ipv6/ip6_vti.c
7551 +@@ -311,7 +311,7 @@ static int vti6_rcv(struct sk_buff *skb)
7552 +
7553 + if (!xfrm6_policy_check(NULL, XFRM_POLICY_IN, skb)) {
7554 + rcu_read_unlock();
7555 +- return 0;
7556 ++ goto discard;
7557 + }
7558 +
7559 + ipv6h = ipv6_hdr(skb);
7560 +@@ -450,15 +450,33 @@ vti6_xmit(struct sk_buff *skb, struct net_device *dev, struct flowi *fl)
7561 + int mtu;
7562 +
7563 + if (!dst) {
7564 +- fl->u.ip6.flowi6_oif = dev->ifindex;
7565 +- fl->u.ip6.flowi6_flags |= FLOWI_FLAG_ANYSRC;
7566 +- dst = ip6_route_output(dev_net(dev), NULL, &fl->u.ip6);
7567 +- if (dst->error) {
7568 +- dst_release(dst);
7569 +- dst = NULL;
7570 ++ switch (skb->protocol) {
7571 ++ case htons(ETH_P_IP): {
7572 ++ struct rtable *rt;
7573 ++
7574 ++ fl->u.ip4.flowi4_oif = dev->ifindex;
7575 ++ fl->u.ip4.flowi4_flags |= FLOWI_FLAG_ANYSRC;
7576 ++ rt = __ip_route_output_key(dev_net(dev), &fl->u.ip4);
7577 ++ if (IS_ERR(rt))
7578 ++ goto tx_err_link_failure;
7579 ++ dst = &rt->dst;
7580 ++ skb_dst_set(skb, dst);
7581 ++ break;
7582 ++ }
7583 ++ case htons(ETH_P_IPV6):
7584 ++ fl->u.ip6.flowi6_oif = dev->ifindex;
7585 ++ fl->u.ip6.flowi6_flags |= FLOWI_FLAG_ANYSRC;
7586 ++ dst = ip6_route_output(dev_net(dev), NULL, &fl->u.ip6);
7587 ++ if (dst->error) {
7588 ++ dst_release(dst);
7589 ++ dst = NULL;
7590 ++ goto tx_err_link_failure;
7591 ++ }
7592 ++ skb_dst_set(skb, dst);
7593 ++ break;
7594 ++ default:
7595 + goto tx_err_link_failure;
7596 + }
7597 +- skb_dst_set(skb, dst);
7598 + }
7599 +
7600 + dst_hold(dst);
7601 +diff --git a/net/mac80211/debugfs_sta.c b/net/mac80211/debugfs_sta.c
7602 +index c80b1e163ea4..3419ed66c7b0 100644
7603 +--- a/net/mac80211/debugfs_sta.c
7604 ++++ b/net/mac80211/debugfs_sta.c
7605 +@@ -5,7 +5,7 @@
7606 + * Copyright 2007 Johannes Berg <johannes@××××××××××××.net>
7607 + * Copyright 2013-2014 Intel Mobile Communications GmbH
7608 + * Copyright(c) 2016 Intel Deutschland GmbH
7609 +- * Copyright (C) 2018 - 2019 Intel Corporation
7610 ++ * Copyright (C) 2018 - 2020 Intel Corporation
7611 + */
7612 +
7613 + #include <linux/debugfs.h>
7614 +@@ -78,6 +78,7 @@ static const char * const sta_flag_names[] = {
7615 + FLAG(MPSP_OWNER),
7616 + FLAG(MPSP_RECIPIENT),
7617 + FLAG(PS_DELIVER),
7618 ++ FLAG(USES_ENCRYPTION),
7619 + #undef FLAG
7620 + };
7621 +
7622 +diff --git a/net/mac80211/key.c b/net/mac80211/key.c
7623 +index 0f889b919b06..efc1acc6543c 100644
7624 +--- a/net/mac80211/key.c
7625 ++++ b/net/mac80211/key.c
7626 +@@ -6,7 +6,7 @@
7627 + * Copyright 2007-2008 Johannes Berg <johannes@××××××××××××.net>
7628 + * Copyright 2013-2014 Intel Mobile Communications GmbH
7629 + * Copyright 2015-2017 Intel Deutschland GmbH
7630 +- * Copyright 2018-2019 Intel Corporation
7631 ++ * Copyright 2018-2020 Intel Corporation
7632 + */
7633 +
7634 + #include <linux/if_ether.h>
7635 +@@ -262,22 +262,29 @@ static void ieee80211_key_disable_hw_accel(struct ieee80211_key *key)
7636 + sta ? sta->sta.addr : bcast_addr, ret);
7637 + }
7638 +
7639 +-int ieee80211_set_tx_key(struct ieee80211_key *key)
7640 ++static int _ieee80211_set_tx_key(struct ieee80211_key *key, bool force)
7641 + {
7642 + struct sta_info *sta = key->sta;
7643 + struct ieee80211_local *local = key->local;
7644 +
7645 + assert_key_lock(local);
7646 +
7647 ++ set_sta_flag(sta, WLAN_STA_USES_ENCRYPTION);
7648 ++
7649 + sta->ptk_idx = key->conf.keyidx;
7650 +
7651 +- if (!ieee80211_hw_check(&local->hw, AMPDU_KEYBORDER_SUPPORT))
7652 ++ if (force || !ieee80211_hw_check(&local->hw, AMPDU_KEYBORDER_SUPPORT))
7653 + clear_sta_flag(sta, WLAN_STA_BLOCK_BA);
7654 + ieee80211_check_fast_xmit(sta);
7655 +
7656 + return 0;
7657 + }
7658 +
7659 ++int ieee80211_set_tx_key(struct ieee80211_key *key)
7660 ++{
7661 ++ return _ieee80211_set_tx_key(key, false);
7662 ++}
7663 ++
7664 + static void ieee80211_pairwise_rekey(struct ieee80211_key *old,
7665 + struct ieee80211_key *new)
7666 + {
7667 +@@ -441,11 +448,8 @@ static int ieee80211_key_replace(struct ieee80211_sub_if_data *sdata,
7668 + if (pairwise) {
7669 + rcu_assign_pointer(sta->ptk[idx], new);
7670 + if (new &&
7671 +- !(new->conf.flags & IEEE80211_KEY_FLAG_NO_AUTO_TX)) {
7672 +- sta->ptk_idx = idx;
7673 +- clear_sta_flag(sta, WLAN_STA_BLOCK_BA);
7674 +- ieee80211_check_fast_xmit(sta);
7675 +- }
7676 ++ !(new->conf.flags & IEEE80211_KEY_FLAG_NO_AUTO_TX))
7677 ++ _ieee80211_set_tx_key(new, true);
7678 + } else {
7679 + rcu_assign_pointer(sta->gtk[idx], new);
7680 + }
7681 +diff --git a/net/mac80211/mesh_hwmp.c b/net/mac80211/mesh_hwmp.c
7682 +index d69983370381..38a0383dfbcf 100644
7683 +--- a/net/mac80211/mesh_hwmp.c
7684 ++++ b/net/mac80211/mesh_hwmp.c
7685 +@@ -1152,7 +1152,8 @@ int mesh_nexthop_resolve(struct ieee80211_sub_if_data *sdata,
7686 + }
7687 + }
7688 +
7689 +- if (!(mpath->flags & MESH_PATH_RESOLVING))
7690 ++ if (!(mpath->flags & MESH_PATH_RESOLVING) &&
7691 ++ mesh_path_sel_is_hwmp(sdata))
7692 + mesh_queue_preq(mpath, PREQ_Q_F_START);
7693 +
7694 + if (skb_queue_len(&mpath->frame_queue) >= MESH_FRAME_QUEUE_LEN)
7695 +diff --git a/net/mac80211/sta_info.c b/net/mac80211/sta_info.c
7696 +index 0f5f40678885..e3572be307d6 100644
7697 +--- a/net/mac80211/sta_info.c
7698 ++++ b/net/mac80211/sta_info.c
7699 +@@ -4,7 +4,7 @@
7700 + * Copyright 2006-2007 Jiri Benc <jbenc@××××.cz>
7701 + * Copyright 2013-2014 Intel Mobile Communications GmbH
7702 + * Copyright (C) 2015 - 2017 Intel Deutschland GmbH
7703 +- * Copyright (C) 2018-2019 Intel Corporation
7704 ++ * Copyright (C) 2018-2020 Intel Corporation
7705 + */
7706 +
7707 + #include <linux/module.h>
7708 +@@ -1049,6 +1049,11 @@ static void __sta_info_destroy_part2(struct sta_info *sta)
7709 + might_sleep();
7710 + lockdep_assert_held(&local->sta_mtx);
7711 +
7712 ++ while (sta->sta_state == IEEE80211_STA_AUTHORIZED) {
7713 ++ ret = sta_info_move_state(sta, IEEE80211_STA_ASSOC);
7714 ++ WARN_ON_ONCE(ret);
7715 ++ }
7716 ++
7717 + /* now keys can no longer be reached */
7718 + ieee80211_free_sta_keys(local, sta);
7719 +
7720 +diff --git a/net/mac80211/sta_info.h b/net/mac80211/sta_info.h
7721 +index c00e28585f9d..552eed36faca 100644
7722 +--- a/net/mac80211/sta_info.h
7723 ++++ b/net/mac80211/sta_info.h
7724 +@@ -98,6 +98,7 @@ enum ieee80211_sta_info_flags {
7725 + WLAN_STA_MPSP_OWNER,
7726 + WLAN_STA_MPSP_RECIPIENT,
7727 + WLAN_STA_PS_DELIVER,
7728 ++ WLAN_STA_USES_ENCRYPTION,
7729 +
7730 + NUM_WLAN_STA_FLAGS,
7731 + };
7732 +diff --git a/net/mac80211/tx.c b/net/mac80211/tx.c
7733 +index b0444e4aba2a..08ff42c3afd1 100644
7734 +--- a/net/mac80211/tx.c
7735 ++++ b/net/mac80211/tx.c
7736 +@@ -5,7 +5,7 @@
7737 + * Copyright 2006-2007 Jiri Benc <jbenc@××××.cz>
7738 + * Copyright 2007 Johannes Berg <johannes@××××××××××××.net>
7739 + * Copyright 2013-2014 Intel Mobile Communications GmbH
7740 +- * Copyright (C) 2018 Intel Corporation
7741 ++ * Copyright (C) 2018, 2020 Intel Corporation
7742 + *
7743 + * Transmit and frame generation functions.
7744 + */
7745 +@@ -590,10 +590,13 @@ ieee80211_tx_h_select_key(struct ieee80211_tx_data *tx)
7746 + struct ieee80211_tx_info *info = IEEE80211_SKB_CB(tx->skb);
7747 + struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)tx->skb->data;
7748 +
7749 +- if (unlikely(info->flags & IEEE80211_TX_INTFL_DONT_ENCRYPT))
7750 ++ if (unlikely(info->flags & IEEE80211_TX_INTFL_DONT_ENCRYPT)) {
7751 + tx->key = NULL;
7752 +- else if (tx->sta &&
7753 +- (key = rcu_dereference(tx->sta->ptk[tx->sta->ptk_idx])))
7754 ++ return TX_CONTINUE;
7755 ++ }
7756 ++
7757 ++ if (tx->sta &&
7758 ++ (key = rcu_dereference(tx->sta->ptk[tx->sta->ptk_idx])))
7759 + tx->key = key;
7760 + else if (ieee80211_is_group_privacy_action(tx->skb) &&
7761 + (key = rcu_dereference(tx->sdata->default_multicast_key)))
7762 +@@ -654,6 +657,9 @@ ieee80211_tx_h_select_key(struct ieee80211_tx_data *tx)
7763 + if (!skip_hw && tx->key &&
7764 + tx->key->flags & KEY_FLAG_UPLOADED_TO_HARDWARE)
7765 + info->control.hw_key = &tx->key->conf;
7766 ++ } else if (!ieee80211_is_mgmt(hdr->frame_control) && tx->sta &&
7767 ++ test_sta_flag(tx->sta, WLAN_STA_USES_ENCRYPTION)) {
7768 ++ return TX_DROP;
7769 + }
7770 +
7771 + return TX_CONTINUE;
7772 +@@ -5129,6 +5135,7 @@ int ieee80211_tx_control_port(struct wiphy *wiphy, struct net_device *dev,
7773 + struct ieee80211_local *local = sdata->local;
7774 + struct sk_buff *skb;
7775 + struct ethhdr *ehdr;
7776 ++ u32 ctrl_flags = 0;
7777 + u32 flags;
7778 +
7779 + /* Only accept CONTROL_PORT_PROTOCOL configured in CONNECT/ASSOCIATE
7780 +@@ -5138,6 +5145,9 @@ int ieee80211_tx_control_port(struct wiphy *wiphy, struct net_device *dev,
7781 + proto != cpu_to_be16(ETH_P_PREAUTH))
7782 + return -EINVAL;
7783 +
7784 ++ if (proto == sdata->control_port_protocol)
7785 ++ ctrl_flags |= IEEE80211_TX_CTRL_PORT_CTRL_PROTO;
7786 ++
7787 + if (unencrypted)
7788 + flags = IEEE80211_TX_INTFL_DONT_ENCRYPT;
7789 + else
7790 +@@ -5163,7 +5173,7 @@ int ieee80211_tx_control_port(struct wiphy *wiphy, struct net_device *dev,
7791 + skb_reset_mac_header(skb);
7792 +
7793 + local_bh_disable();
7794 +- __ieee80211_subif_start_xmit(skb, skb->dev, flags, 0);
7795 ++ __ieee80211_subif_start_xmit(skb, skb->dev, flags, ctrl_flags);
7796 + local_bh_enable();
7797 +
7798 + return 0;
7799 +diff --git a/net/netfilter/nf_flow_table_ip.c b/net/netfilter/nf_flow_table_ip.c
7800 +index 7ea2ddc2aa93..36fe8808ca6c 100644
7801 +--- a/net/netfilter/nf_flow_table_ip.c
7802 ++++ b/net/netfilter/nf_flow_table_ip.c
7803 +@@ -189,6 +189,7 @@ static int nf_flow_tuple_ip(struct sk_buff *skb, const struct net_device *dev,
7804 + if (!pskb_may_pull(skb, thoff + sizeof(*ports)))
7805 + return -1;
7806 +
7807 ++ iph = ip_hdr(skb);
7808 + ports = (struct flow_ports *)(skb_network_header(skb) + thoff);
7809 +
7810 + tuple->src_v4.s_addr = iph->saddr;
7811 +@@ -449,6 +450,7 @@ static int nf_flow_tuple_ipv6(struct sk_buff *skb, const struct net_device *dev,
7812 + if (!pskb_may_pull(skb, thoff + sizeof(*ports)))
7813 + return -1;
7814 +
7815 ++ ip6h = ipv6_hdr(skb);
7816 + ports = (struct flow_ports *)(skb_network_header(skb) + thoff);
7817 +
7818 + tuple->src_v6 = ip6h->saddr;
7819 +diff --git a/net/netfilter/nf_flow_table_offload.c b/net/netfilter/nf_flow_table_offload.c
7820 +index b879e673953f..18ec95b3c46f 100644
7821 +--- a/net/netfilter/nf_flow_table_offload.c
7822 ++++ b/net/netfilter/nf_flow_table_offload.c
7823 +@@ -87,6 +87,7 @@ static int nf_flow_rule_match(struct nf_flow_match *match,
7824 + default:
7825 + return -EOPNOTSUPP;
7826 + }
7827 ++ mask->control.addr_type = 0xffff;
7828 + match->dissector.used_keys |= BIT(key->control.addr_type);
7829 + mask->basic.n_proto = 0xffff;
7830 +
7831 +diff --git a/net/netfilter/nft_fwd_netdev.c b/net/netfilter/nft_fwd_netdev.c
7832 +index aba11c2333f3..3087e23297db 100644
7833 +--- a/net/netfilter/nft_fwd_netdev.c
7834 ++++ b/net/netfilter/nft_fwd_netdev.c
7835 +@@ -28,6 +28,9 @@ static void nft_fwd_netdev_eval(const struct nft_expr *expr,
7836 + struct nft_fwd_netdev *priv = nft_expr_priv(expr);
7837 + int oif = regs->data[priv->sreg_dev];
7838 +
7839 ++ /* This is used by ifb only. */
7840 ++ skb_set_redirected(pkt->skb, true);
7841 ++
7842 + nf_fwd_netdev_egress(pkt, oif);
7843 + regs->verdict.code = NF_STOLEN;
7844 + }
7845 +@@ -190,6 +193,13 @@ nla_put_failure:
7846 + return -1;
7847 + }
7848 +
7849 ++static int nft_fwd_validate(const struct nft_ctx *ctx,
7850 ++ const struct nft_expr *expr,
7851 ++ const struct nft_data **data)
7852 ++{
7853 ++ return nft_chain_validate_hooks(ctx->chain, (1 << NF_NETDEV_INGRESS));
7854 ++}
7855 ++
7856 + static struct nft_expr_type nft_fwd_netdev_type;
7857 + static const struct nft_expr_ops nft_fwd_neigh_netdev_ops = {
7858 + .type = &nft_fwd_netdev_type,
7859 +@@ -197,6 +207,7 @@ static const struct nft_expr_ops nft_fwd_neigh_netdev_ops = {
7860 + .eval = nft_fwd_neigh_eval,
7861 + .init = nft_fwd_neigh_init,
7862 + .dump = nft_fwd_neigh_dump,
7863 ++ .validate = nft_fwd_validate,
7864 + };
7865 +
7866 + static const struct nft_expr_ops nft_fwd_netdev_ops = {
7867 +@@ -205,6 +216,7 @@ static const struct nft_expr_ops nft_fwd_netdev_ops = {
7868 + .eval = nft_fwd_netdev_eval,
7869 + .init = nft_fwd_netdev_init,
7870 + .dump = nft_fwd_netdev_dump,
7871 ++ .validate = nft_fwd_validate,
7872 + .offload = nft_fwd_netdev_offload,
7873 + };
7874 +
7875 +diff --git a/net/packet/af_packet.c b/net/packet/af_packet.c
7876 +index 20edb7c25e22..1d63ab3a878a 100644
7877 +--- a/net/packet/af_packet.c
7878 ++++ b/net/packet/af_packet.c
7879 +@@ -2172,6 +2172,7 @@ static int tpacket_rcv(struct sk_buff *skb, struct net_device *dev,
7880 + struct timespec ts;
7881 + __u32 ts_status;
7882 + bool is_drop_n_account = false;
7883 ++ unsigned int slot_id = 0;
7884 + bool do_vnet = false;
7885 +
7886 + /* struct tpacket{2,3}_hdr is aligned to a multiple of TPACKET_ALIGNMENT.
7887 +@@ -2274,6 +2275,13 @@ static int tpacket_rcv(struct sk_buff *skb, struct net_device *dev,
7888 + if (!h.raw)
7889 + goto drop_n_account;
7890 +
7891 ++ if (po->tp_version <= TPACKET_V2) {
7892 ++ slot_id = po->rx_ring.head;
7893 ++ if (test_bit(slot_id, po->rx_ring.rx_owner_map))
7894 ++ goto drop_n_account;
7895 ++ __set_bit(slot_id, po->rx_ring.rx_owner_map);
7896 ++ }
7897 ++
7898 + if (do_vnet &&
7899 + virtio_net_hdr_from_skb(skb, h.raw + macoff -
7900 + sizeof(struct virtio_net_hdr),
7901 +@@ -2379,7 +2387,10 @@ static int tpacket_rcv(struct sk_buff *skb, struct net_device *dev,
7902 + #endif
7903 +
7904 + if (po->tp_version <= TPACKET_V2) {
7905 ++ spin_lock(&sk->sk_receive_queue.lock);
7906 + __packet_set_status(po, h.raw, status);
7907 ++ __clear_bit(slot_id, po->rx_ring.rx_owner_map);
7908 ++ spin_unlock(&sk->sk_receive_queue.lock);
7909 + sk->sk_data_ready(sk);
7910 + } else {
7911 + prb_clear_blk_fill_status(&po->rx_ring);
7912 +@@ -4276,6 +4287,7 @@ static int packet_set_ring(struct sock *sk, union tpacket_req_u *req_u,
7913 + {
7914 + struct pgv *pg_vec = NULL;
7915 + struct packet_sock *po = pkt_sk(sk);
7916 ++ unsigned long *rx_owner_map = NULL;
7917 + int was_running, order = 0;
7918 + struct packet_ring_buffer *rb;
7919 + struct sk_buff_head *rb_queue;
7920 +@@ -4361,6 +4373,12 @@ static int packet_set_ring(struct sock *sk, union tpacket_req_u *req_u,
7921 + }
7922 + break;
7923 + default:
7924 ++ if (!tx_ring) {
7925 ++ rx_owner_map = bitmap_alloc(req->tp_frame_nr,
7926 ++ GFP_KERNEL | __GFP_NOWARN | __GFP_ZERO);
7927 ++ if (!rx_owner_map)
7928 ++ goto out_free_pg_vec;
7929 ++ }
7930 + break;
7931 + }
7932 + }
7933 +@@ -4390,6 +4408,8 @@ static int packet_set_ring(struct sock *sk, union tpacket_req_u *req_u,
7934 + err = 0;
7935 + spin_lock_bh(&rb_queue->lock);
7936 + swap(rb->pg_vec, pg_vec);
7937 ++ if (po->tp_version <= TPACKET_V2)
7938 ++ swap(rb->rx_owner_map, rx_owner_map);
7939 + rb->frame_max = (req->tp_frame_nr - 1);
7940 + rb->head = 0;
7941 + rb->frame_size = req->tp_frame_size;
7942 +@@ -4421,6 +4441,7 @@ static int packet_set_ring(struct sock *sk, union tpacket_req_u *req_u,
7943 + }
7944 +
7945 + out_free_pg_vec:
7946 ++ bitmap_free(rx_owner_map);
7947 + if (pg_vec)
7948 + free_pg_vec(pg_vec, order, req->tp_block_nr);
7949 + out:
7950 +diff --git a/net/packet/internal.h b/net/packet/internal.h
7951 +index 82fb2b10f790..907f4cd2a718 100644
7952 +--- a/net/packet/internal.h
7953 ++++ b/net/packet/internal.h
7954 +@@ -70,7 +70,10 @@ struct packet_ring_buffer {
7955 +
7956 + unsigned int __percpu *pending_refcnt;
7957 +
7958 +- struct tpacket_kbdq_core prb_bdqc;
7959 ++ union {
7960 ++ unsigned long *rx_owner_map;
7961 ++ struct tpacket_kbdq_core prb_bdqc;
7962 ++ };
7963 + };
7964 +
7965 + extern struct mutex fanout_mutex;
7966 +diff --git a/net/rxrpc/af_rxrpc.c b/net/rxrpc/af_rxrpc.c
7967 +index fe42f986cd94..bad0d6adcc49 100644
7968 +--- a/net/rxrpc/af_rxrpc.c
7969 ++++ b/net/rxrpc/af_rxrpc.c
7970 +@@ -371,44 +371,17 @@ EXPORT_SYMBOL(rxrpc_kernel_end_call);
7971 + * rxrpc_kernel_check_life - Check to see whether a call is still alive
7972 + * @sock: The socket the call is on
7973 + * @call: The call to check
7974 +- * @_life: Where to store the life value
7975 + *
7976 +- * Allow a kernel service to find out whether a call is still alive - ie. we're
7977 +- * getting ACKs from the server. Passes back in *_life a number representing
7978 +- * the life state which can be compared to that returned by a previous call and
7979 +- * return true if the call is still alive.
7980 +- *
7981 +- * If the life state stalls, rxrpc_kernel_probe_life() should be called and
7982 +- * then 2RTT waited.
7983 ++ * Allow a kernel service to find out whether a call is still alive -
7984 ++ * ie. whether it has completed.
7985 + */
7986 + bool rxrpc_kernel_check_life(const struct socket *sock,
7987 +- const struct rxrpc_call *call,
7988 +- u32 *_life)
7989 ++ const struct rxrpc_call *call)
7990 + {
7991 +- *_life = call->acks_latest;
7992 + return call->state != RXRPC_CALL_COMPLETE;
7993 + }
7994 + EXPORT_SYMBOL(rxrpc_kernel_check_life);
7995 +
7996 +-/**
7997 +- * rxrpc_kernel_probe_life - Poke the peer to see if it's still alive
7998 +- * @sock: The socket the call is on
7999 +- * @call: The call to check
8000 +- *
8001 +- * In conjunction with rxrpc_kernel_check_life(), allow a kernel service to
8002 +- * find out whether a call is still alive by pinging it. This should cause the
8003 +- * life state to be bumped in about 2*RTT.
8004 +- *
8005 +- * The must be called in TASK_RUNNING state on pain of might_sleep() objecting.
8006 +- */
8007 +-void rxrpc_kernel_probe_life(struct socket *sock, struct rxrpc_call *call)
8008 +-{
8009 +- rxrpc_propose_ACK(call, RXRPC_ACK_PING, 0, true, false,
8010 +- rxrpc_propose_ack_ping_for_check_life);
8011 +- rxrpc_send_ack_packet(call, true, NULL);
8012 +-}
8013 +-EXPORT_SYMBOL(rxrpc_kernel_probe_life);
8014 +-
8015 + /**
8016 + * rxrpc_kernel_get_epoch - Retrieve the epoch value from a call.
8017 + * @sock: The socket the call is on
8018 +diff --git a/net/rxrpc/ar-internal.h b/net/rxrpc/ar-internal.h
8019 +index 7d730c438404..394d18857979 100644
8020 +--- a/net/rxrpc/ar-internal.h
8021 ++++ b/net/rxrpc/ar-internal.h
8022 +@@ -675,7 +675,6 @@ struct rxrpc_call {
8023 +
8024 + /* transmission-phase ACK management */
8025 + ktime_t acks_latest_ts; /* Timestamp of latest ACK received */
8026 +- rxrpc_serial_t acks_latest; /* serial number of latest ACK received */
8027 + rxrpc_seq_t acks_lowest_nak; /* Lowest NACK in the buffer (or ==tx_hard_ack) */
8028 + rxrpc_seq_t acks_lost_top; /* tx_top at the time lost-ack ping sent */
8029 + rxrpc_serial_t acks_lost_ping; /* Serial number of probe ACK */
8030 +diff --git a/net/rxrpc/input.c b/net/rxrpc/input.c
8031 +index ef10fbf71b15..69e09d69c896 100644
8032 +--- a/net/rxrpc/input.c
8033 ++++ b/net/rxrpc/input.c
8034 +@@ -882,7 +882,6 @@ static void rxrpc_input_ack(struct rxrpc_call *call, struct sk_buff *skb)
8035 + before(prev_pkt, call->ackr_prev_seq))
8036 + goto out;
8037 + call->acks_latest_ts = skb->tstamp;
8038 +- call->acks_latest = sp->hdr.serial;
8039 +
8040 + call->ackr_first_seq = first_soft_ack;
8041 + call->ackr_prev_seq = prev_pkt;
8042 +diff --git a/net/sched/act_ct.c b/net/sched/act_ct.c
8043 +index f685c0d73708..41114b463161 100644
8044 +--- a/net/sched/act_ct.c
8045 ++++ b/net/sched/act_ct.c
8046 +@@ -739,7 +739,7 @@ static int tcf_ct_init(struct net *net, struct nlattr *nla,
8047 + if (goto_ch)
8048 + tcf_chain_put_by_act(goto_ch);
8049 + if (params)
8050 +- kfree_rcu(params, rcu);
8051 ++ call_rcu(&params->rcu, tcf_ct_params_free);
8052 + if (res == ACT_P_CREATED)
8053 + tcf_idr_insert(tn, *a);
8054 +
8055 +diff --git a/net/sched/act_mirred.c b/net/sched/act_mirred.c
8056 +index 1ad300e6dbc0..83dd82fc9f40 100644
8057 +--- a/net/sched/act_mirred.c
8058 ++++ b/net/sched/act_mirred.c
8059 +@@ -284,10 +284,8 @@ static int tcf_mirred_act(struct sk_buff *skb, const struct tc_action *a,
8060 +
8061 + /* mirror is always swallowed */
8062 + if (is_redirect) {
8063 +- skb2->tc_redirected = 1;
8064 +- skb2->tc_from_ingress = skb2->tc_at_ingress;
8065 +- if (skb2->tc_from_ingress)
8066 +- skb2->tstamp = 0;
8067 ++ skb_set_redirected(skb2, skb2->tc_at_ingress);
8068 ++
8069 + /* let's the caller reinsert the packet, if possible */
8070 + if (use_reinsert) {
8071 + res->ingress = want_ingress;
8072 +diff --git a/net/sched/cls_route.c b/net/sched/cls_route.c
8073 +index 6f8786b06bde..5efa3e7ace15 100644
8074 +--- a/net/sched/cls_route.c
8075 ++++ b/net/sched/cls_route.c
8076 +@@ -534,8 +534,8 @@ static int route4_change(struct net *net, struct sk_buff *in_skb,
8077 + fp = &b->ht[h];
8078 + for (pfp = rtnl_dereference(*fp); pfp;
8079 + fp = &pfp->next, pfp = rtnl_dereference(*fp)) {
8080 +- if (pfp == f) {
8081 +- *fp = f->next;
8082 ++ if (pfp == fold) {
8083 ++ rcu_assign_pointer(*fp, fold->next);
8084 + break;
8085 + }
8086 + }
8087 +diff --git a/net/sched/cls_tcindex.c b/net/sched/cls_tcindex.c
8088 +index 09b7dc5fe7e0..9904299424a1 100644
8089 +--- a/net/sched/cls_tcindex.c
8090 ++++ b/net/sched/cls_tcindex.c
8091 +@@ -261,8 +261,10 @@ static void tcindex_partial_destroy_work(struct work_struct *work)
8092 + struct tcindex_data,
8093 + rwork);
8094 +
8095 ++ rtnl_lock();
8096 + kfree(p->perfect);
8097 + kfree(p);
8098 ++ rtnl_unlock();
8099 + }
8100 +
8101 + static void tcindex_free_perfect_hash(struct tcindex_data *cp)
8102 +@@ -357,6 +359,7 @@ tcindex_set_parms(struct net *net, struct tcf_proto *tp, unsigned long base,
8103 +
8104 + if (tcindex_alloc_perfect_hash(net, cp) < 0)
8105 + goto errout;
8106 ++ cp->alloc_hash = cp->hash;
8107 + for (i = 0; i < min(cp->hash, p->hash); i++)
8108 + cp->perfect[i].res = p->perfect[i].res;
8109 + balloc = 1;
8110 +diff --git a/net/sched/sch_cbs.c b/net/sched/sch_cbs.c
8111 +index b2905b03a432..2eaac2ff380f 100644
8112 +--- a/net/sched/sch_cbs.c
8113 ++++ b/net/sched/sch_cbs.c
8114 +@@ -181,6 +181,11 @@ static struct sk_buff *cbs_dequeue_soft(struct Qdisc *sch)
8115 + s64 credits;
8116 + int len;
8117 +
8118 ++ /* The previous packet is still being sent */
8119 ++ if (now < q->last) {
8120 ++ qdisc_watchdog_schedule_ns(&q->watchdog, q->last);
8121 ++ return NULL;
8122 ++ }
8123 + if (q->credits < 0) {
8124 + credits = timediff_to_credits(now - q->last, q->idleslope);
8125 +
8126 +@@ -212,7 +217,12 @@ static struct sk_buff *cbs_dequeue_soft(struct Qdisc *sch)
8127 + credits += q->credits;
8128 +
8129 + q->credits = max_t(s64, credits, q->locredit);
8130 +- q->last = now;
8131 ++ /* Estimate of the transmission of the last byte of the packet in ns */
8132 ++ if (unlikely(atomic64_read(&q->port_rate) == 0))
8133 ++ q->last = now;
8134 ++ else
8135 ++ q->last = now + div64_s64(len * NSEC_PER_SEC,
8136 ++ atomic64_read(&q->port_rate));
8137 +
8138 + return skb;
8139 + }
8140 +diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c
8141 +index c7e30f5818d6..fe7aa8637c29 100644
8142 +--- a/net/wireless/nl80211.c
8143 ++++ b/net/wireless/nl80211.c
8144 +@@ -16416,7 +16416,7 @@ void cfg80211_sta_opmode_change_notify(struct net_device *dev, const u8 *mac,
8145 + goto nla_put_failure;
8146 +
8147 + if ((sta_opmode->changed & STA_OPMODE_MAX_BW_CHANGED) &&
8148 +- nla_put_u8(msg, NL80211_ATTR_CHANNEL_WIDTH, sta_opmode->bw))
8149 ++ nla_put_u32(msg, NL80211_ATTR_CHANNEL_WIDTH, sta_opmode->bw))
8150 + goto nla_put_failure;
8151 +
8152 + if ((sta_opmode->changed & STA_OPMODE_N_SS_CHANGED) &&
8153 +diff --git a/net/xfrm/xfrm_device.c b/net/xfrm/xfrm_device.c
8154 +index 189ef15acbbc..64486ad81341 100644
8155 +--- a/net/xfrm/xfrm_device.c
8156 ++++ b/net/xfrm/xfrm_device.c
8157 +@@ -390,6 +390,7 @@ static int xfrm_dev_event(struct notifier_block *this, unsigned long event, void
8158 + return xfrm_dev_feat_change(dev);
8159 +
8160 + case NETDEV_DOWN:
8161 ++ case NETDEV_UNREGISTER:
8162 + return xfrm_dev_down(dev);
8163 + }
8164 + return NOTIFY_DONE;
8165 +diff --git a/net/xfrm/xfrm_policy.c b/net/xfrm/xfrm_policy.c
8166 +index f2d1e573ea55..264cf05a4eaa 100644
8167 +--- a/net/xfrm/xfrm_policy.c
8168 ++++ b/net/xfrm/xfrm_policy.c
8169 +@@ -431,7 +431,9 @@ EXPORT_SYMBOL(xfrm_policy_destroy);
8170 +
8171 + static void xfrm_policy_kill(struct xfrm_policy *policy)
8172 + {
8173 ++ write_lock_bh(&policy->lock);
8174 + policy->walk.dead = 1;
8175 ++ write_unlock_bh(&policy->lock);
8176 +
8177 + atomic_inc(&policy->genid);
8178 +
8179 +diff --git a/net/xfrm/xfrm_user.c b/net/xfrm/xfrm_user.c
8180 +index b88ba45ff1ac..e6cfaa680ef3 100644
8181 +--- a/net/xfrm/xfrm_user.c
8182 ++++ b/net/xfrm/xfrm_user.c
8183 +@@ -110,7 +110,8 @@ static inline int verify_sec_ctx_len(struct nlattr **attrs)
8184 + return 0;
8185 +
8186 + uctx = nla_data(rt);
8187 +- if (uctx->len != (sizeof(struct xfrm_user_sec_ctx) + uctx->ctx_len))
8188 ++ if (uctx->len > nla_len(rt) ||
8189 ++ uctx->len != (sizeof(struct xfrm_user_sec_ctx) + uctx->ctx_len))
8190 + return -EINVAL;
8191 +
8192 + return 0;
8193 +@@ -2273,6 +2274,9 @@ static int xfrm_add_acquire(struct sk_buff *skb, struct nlmsghdr *nlh,
8194 + xfrm_mark_get(attrs, &mark);
8195 +
8196 + err = verify_newpolicy_info(&ua->policy);
8197 ++ if (err)
8198 ++ goto free_state;
8199 ++ err = verify_sec_ctx_len(attrs);
8200 + if (err)
8201 + goto free_state;
8202 +
8203 +diff --git a/scripts/dtc/dtc-lexer.l b/scripts/dtc/dtc-lexer.l
8204 +index 5c6c3fd557d7..b3b7270300de 100644
8205 +--- a/scripts/dtc/dtc-lexer.l
8206 ++++ b/scripts/dtc/dtc-lexer.l
8207 +@@ -23,7 +23,6 @@ LINECOMMENT "//".*\n
8208 + #include "srcpos.h"
8209 + #include "dtc-parser.tab.h"
8210 +
8211 +-YYLTYPE yylloc;
8212 + extern bool treesource_error;
8213 +
8214 + /* CAUTION: this will stop working if we ever use yyless() or yyunput() */
8215 +diff --git a/tools/perf/Makefile b/tools/perf/Makefile
8216 +index 7902a5681fc8..b8fc7d972be9 100644
8217 +--- a/tools/perf/Makefile
8218 ++++ b/tools/perf/Makefile
8219 +@@ -35,7 +35,7 @@ endif
8220 + # Only pass canonical directory names as the output directory:
8221 + #
8222 + ifneq ($(O),)
8223 +- FULL_O := $(shell readlink -f $(O) || echo $(O))
8224 ++ FULL_O := $(shell cd $(PWD); readlink -f $(O) || echo $(O))
8225 + endif
8226 +
8227 + #
8228 +diff --git a/tools/perf/util/probe-file.c b/tools/perf/util/probe-file.c
8229 +index 5003ba403345..c03a591d41a4 100644
8230 +--- a/tools/perf/util/probe-file.c
8231 ++++ b/tools/perf/util/probe-file.c
8232 +@@ -206,6 +206,9 @@ static struct strlist *__probe_file__get_namelist(int fd, bool include_group)
8233 + } else
8234 + ret = strlist__add(sl, tev.event);
8235 + clear_probe_trace_event(&tev);
8236 ++ /* Skip if there is same name multi-probe event in the list */
8237 ++ if (ret == -EEXIST)
8238 ++ ret = 0;
8239 + if (ret < 0)
8240 + break;
8241 + }
8242 +diff --git a/tools/perf/util/probe-finder.c b/tools/perf/util/probe-finder.c
8243 +index c470c49a804f..722c4f317506 100644
8244 +--- a/tools/perf/util/probe-finder.c
8245 ++++ b/tools/perf/util/probe-finder.c
8246 +@@ -636,14 +636,19 @@ static int convert_to_trace_point(Dwarf_Die *sp_die, Dwfl_Module *mod,
8247 + return -EINVAL;
8248 + }
8249 +
8250 +- /* Try to get actual symbol name from symtab */
8251 +- symbol = dwfl_module_addrsym(mod, paddr, &sym, NULL);
8252 ++ if (dwarf_entrypc(sp_die, &eaddr) == 0) {
8253 ++ /* If the DIE has entrypc, use it. */
8254 ++ symbol = dwarf_diename(sp_die);
8255 ++ } else {
8256 ++ /* Try to get actual symbol name and address from symtab */
8257 ++ symbol = dwfl_module_addrsym(mod, paddr, &sym, NULL);
8258 ++ eaddr = sym.st_value;
8259 ++ }
8260 + if (!symbol) {
8261 + pr_warning("Failed to find symbol at 0x%lx\n",
8262 + (unsigned long)paddr);
8263 + return -ENOENT;
8264 + }
8265 +- eaddr = sym.st_value;
8266 +
8267 + tp->offset = (unsigned long)(paddr - eaddr);
8268 + tp->address = (unsigned long)paddr;
8269 +diff --git a/tools/power/cpupower/utils/idle_monitor/amd_fam14h_idle.c b/tools/power/cpupower/utils/idle_monitor/amd_fam14h_idle.c
8270 +index 33dc34db4f3c..20f46348271b 100644
8271 +--- a/tools/power/cpupower/utils/idle_monitor/amd_fam14h_idle.c
8272 ++++ b/tools/power/cpupower/utils/idle_monitor/amd_fam14h_idle.c
8273 +@@ -82,7 +82,7 @@ static struct pci_access *pci_acc;
8274 + static struct pci_dev *amd_fam14h_pci_dev;
8275 + static int nbp1_entered;
8276 +
8277 +-struct timespec start_time;
8278 ++static struct timespec start_time;
8279 + static unsigned long long timediff;
8280 +
8281 + #ifdef DEBUG
8282 +diff --git a/tools/power/cpupower/utils/idle_monitor/cpuidle_sysfs.c b/tools/power/cpupower/utils/idle_monitor/cpuidle_sysfs.c
8283 +index 3c4cee160b0e..a65f7d011513 100644
8284 +--- a/tools/power/cpupower/utils/idle_monitor/cpuidle_sysfs.c
8285 ++++ b/tools/power/cpupower/utils/idle_monitor/cpuidle_sysfs.c
8286 +@@ -19,7 +19,7 @@ struct cpuidle_monitor cpuidle_sysfs_monitor;
8287 +
8288 + static unsigned long long **previous_count;
8289 + static unsigned long long **current_count;
8290 +-struct timespec start_time;
8291 ++static struct timespec start_time;
8292 + static unsigned long long timediff;
8293 +
8294 + static int cpuidle_get_count_percent(unsigned int id, double *percent,
8295 +diff --git a/tools/power/cpupower/utils/idle_monitor/cpupower-monitor.c b/tools/power/cpupower/utils/idle_monitor/cpupower-monitor.c
8296 +index 6d44fec55ad5..7c77045fef52 100644
8297 +--- a/tools/power/cpupower/utils/idle_monitor/cpupower-monitor.c
8298 ++++ b/tools/power/cpupower/utils/idle_monitor/cpupower-monitor.c
8299 +@@ -27,6 +27,8 @@ struct cpuidle_monitor *all_monitors[] = {
8300 + 0
8301 + };
8302 +
8303 ++int cpu_count;
8304 ++
8305 + static struct cpuidle_monitor *monitors[MONITORS_MAX];
8306 + static unsigned int avail_monitors;
8307 +
8308 +diff --git a/tools/power/cpupower/utils/idle_monitor/cpupower-monitor.h b/tools/power/cpupower/utils/idle_monitor/cpupower-monitor.h
8309 +index 5b5eb1da0cce..c559d3115330 100644
8310 +--- a/tools/power/cpupower/utils/idle_monitor/cpupower-monitor.h
8311 ++++ b/tools/power/cpupower/utils/idle_monitor/cpupower-monitor.h
8312 +@@ -25,7 +25,7 @@
8313 + #endif
8314 + #define CSTATE_DESC_LEN 60
8315 +
8316 +-int cpu_count;
8317 ++extern int cpu_count;
8318 +
8319 + /* Hard to define the right names ...: */
8320 + enum power_range_e {
8321 +diff --git a/tools/scripts/Makefile.include b/tools/scripts/Makefile.include
8322 +index ded7a950dc40..6d2f3a1b2249 100644
8323 +--- a/tools/scripts/Makefile.include
8324 ++++ b/tools/scripts/Makefile.include
8325 +@@ -1,8 +1,8 @@
8326 + # SPDX-License-Identifier: GPL-2.0
8327 + ifneq ($(O),)
8328 + ifeq ($(origin O), command line)
8329 +- dummy := $(if $(shell test -d $(O) || echo $(O)),$(error O=$(O) does not exist),)
8330 +- ABSOLUTE_O := $(shell cd $(O) ; pwd)
8331 ++ dummy := $(if $(shell cd $(PWD); test -d $(O) || echo $(O)),$(error O=$(O) does not exist),)
8332 ++ ABSOLUTE_O := $(shell cd $(PWD); cd $(O) ; pwd)
8333 + OUTPUT := $(ABSOLUTE_O)/$(if $(subdir),$(subdir)/)
8334 + COMMAND_O := O=$(ABSOLUTE_O)
8335 + ifeq ($(objtree),)