Magellan Linux

Contents of /trunk/kernel-alx/patches-5.4/0213-5.4.114-all-fixes.patch

Parent Directory Parent Directory | Revision Log Revision Log


Revision 3637 - (show annotations) (download)
Mon Oct 24 12:40:44 2022 UTC (18 months ago) by niro
File size: 95079 byte(s)
-add missing
1 diff --git a/Makefile b/Makefile
2 index 7fe00a93c870c..355e05ba065cb 100644
3 --- a/Makefile
4 +++ b/Makefile
5 @@ -1,7 +1,7 @@
6 # SPDX-License-Identifier: GPL-2.0
7 VERSION = 5
8 PATCHLEVEL = 4
9 -SUBLEVEL = 113
10 +SUBLEVEL = 114
11 EXTRAVERSION =
12 NAME = Kleptomaniac Octopus
13
14 diff --git a/arch/arc/kernel/signal.c b/arch/arc/kernel/signal.c
15 index 3d57ed0d85350..4045180510939 100644
16 --- a/arch/arc/kernel/signal.c
17 +++ b/arch/arc/kernel/signal.c
18 @@ -96,7 +96,7 @@ stash_usr_regs(struct rt_sigframe __user *sf, struct pt_regs *regs,
19 sizeof(sf->uc.uc_mcontext.regs.scratch));
20 err |= __copy_to_user(&sf->uc.uc_sigmask, set, sizeof(sigset_t));
21
22 - return err;
23 + return err ? -EFAULT : 0;
24 }
25
26 static int restore_usr_regs(struct pt_regs *regs, struct rt_sigframe __user *sf)
27 @@ -110,7 +110,7 @@ static int restore_usr_regs(struct pt_regs *regs, struct rt_sigframe __user *sf)
28 &(sf->uc.uc_mcontext.regs.scratch),
29 sizeof(sf->uc.uc_mcontext.regs.scratch));
30 if (err)
31 - return err;
32 + return -EFAULT;
33
34 set_current_blocked(&set);
35 regs->bta = uregs.scratch.bta;
36 diff --git a/arch/arm/boot/dts/omap4.dtsi b/arch/arm/boot/dts/omap4.dtsi
37 index 904852006b9b1..0a36b8fe3fa92 100644
38 --- a/arch/arm/boot/dts/omap4.dtsi
39 +++ b/arch/arm/boot/dts/omap4.dtsi
40 @@ -22,6 +22,11 @@
41 i2c1 = &i2c2;
42 i2c2 = &i2c3;
43 i2c3 = &i2c4;
44 + mmc0 = &mmc1;
45 + mmc1 = &mmc2;
46 + mmc2 = &mmc3;
47 + mmc3 = &mmc4;
48 + mmc4 = &mmc5;
49 serial0 = &uart1;
50 serial1 = &uart2;
51 serial2 = &uart3;
52 diff --git a/arch/arm/boot/dts/omap44xx-clocks.dtsi b/arch/arm/boot/dts/omap44xx-clocks.dtsi
53 index e9d9c8460682c..68ab6a95f222d 100644
54 --- a/arch/arm/boot/dts/omap44xx-clocks.dtsi
55 +++ b/arch/arm/boot/dts/omap44xx-clocks.dtsi
56 @@ -770,14 +770,6 @@
57 ti,max-div = <2>;
58 };
59
60 - sha2md5_fck: sha2md5_fck@15c8 {
61 - #clock-cells = <0>;
62 - compatible = "ti,gate-clock";
63 - clocks = <&l3_div_ck>;
64 - ti,bit-shift = <1>;
65 - reg = <0x15c8>;
66 - };
67 -
68 usb_phy_cm_clk32k: usb_phy_cm_clk32k@640 {
69 #clock-cells = <0>;
70 compatible = "ti,gate-clock";
71 diff --git a/arch/arm/boot/dts/omap5.dtsi b/arch/arm/boot/dts/omap5.dtsi
72 index 041646fabb2db..3b56e993326d0 100644
73 --- a/arch/arm/boot/dts/omap5.dtsi
74 +++ b/arch/arm/boot/dts/omap5.dtsi
75 @@ -25,6 +25,11 @@
76 i2c2 = &i2c3;
77 i2c3 = &i2c4;
78 i2c4 = &i2c5;
79 + mmc0 = &mmc1;
80 + mmc1 = &mmc2;
81 + mmc2 = &mmc3;
82 + mmc3 = &mmc4;
83 + mmc4 = &mmc5;
84 serial0 = &uart1;
85 serial1 = &uart2;
86 serial2 = &uart3;
87 diff --git a/arch/arm/mach-footbridge/cats-pci.c b/arch/arm/mach-footbridge/cats-pci.c
88 index 0b2fd7e2e9b42..90b1e9be430e9 100644
89 --- a/arch/arm/mach-footbridge/cats-pci.c
90 +++ b/arch/arm/mach-footbridge/cats-pci.c
91 @@ -15,14 +15,14 @@
92 #include <asm/mach-types.h>
93
94 /* cats host-specific stuff */
95 -static int irqmap_cats[] __initdata = { IRQ_PCI, IRQ_IN0, IRQ_IN1, IRQ_IN3 };
96 +static int irqmap_cats[] = { IRQ_PCI, IRQ_IN0, IRQ_IN1, IRQ_IN3 };
97
98 static u8 cats_no_swizzle(struct pci_dev *dev, u8 *pin)
99 {
100 return 0;
101 }
102
103 -static int __init cats_map_irq(const struct pci_dev *dev, u8 slot, u8 pin)
104 +static int cats_map_irq(const struct pci_dev *dev, u8 slot, u8 pin)
105 {
106 if (dev->irq >= 255)
107 return -1; /* not a valid interrupt. */
108 diff --git a/arch/arm/mach-footbridge/ebsa285-pci.c b/arch/arm/mach-footbridge/ebsa285-pci.c
109 index 6f28aaa9ca79b..c3f280d08fa7f 100644
110 --- a/arch/arm/mach-footbridge/ebsa285-pci.c
111 +++ b/arch/arm/mach-footbridge/ebsa285-pci.c
112 @@ -14,9 +14,9 @@
113 #include <asm/mach/pci.h>
114 #include <asm/mach-types.h>
115
116 -static int irqmap_ebsa285[] __initdata = { IRQ_IN3, IRQ_IN1, IRQ_IN0, IRQ_PCI };
117 +static int irqmap_ebsa285[] = { IRQ_IN3, IRQ_IN1, IRQ_IN0, IRQ_PCI };
118
119 -static int __init ebsa285_map_irq(const struct pci_dev *dev, u8 slot, u8 pin)
120 +static int ebsa285_map_irq(const struct pci_dev *dev, u8 slot, u8 pin)
121 {
122 if (dev->vendor == PCI_VENDOR_ID_CONTAQ &&
123 dev->device == PCI_DEVICE_ID_CONTAQ_82C693)
124 diff --git a/arch/arm/mach-footbridge/netwinder-pci.c b/arch/arm/mach-footbridge/netwinder-pci.c
125 index 9473aa0305e5f..e8304392074b8 100644
126 --- a/arch/arm/mach-footbridge/netwinder-pci.c
127 +++ b/arch/arm/mach-footbridge/netwinder-pci.c
128 @@ -18,7 +18,7 @@
129 * We now use the slot ID instead of the device identifiers to select
130 * which interrupt is routed where.
131 */
132 -static int __init netwinder_map_irq(const struct pci_dev *dev, u8 slot, u8 pin)
133 +static int netwinder_map_irq(const struct pci_dev *dev, u8 slot, u8 pin)
134 {
135 switch (slot) {
136 case 0: /* host bridge */
137 diff --git a/arch/arm/mach-footbridge/personal-pci.c b/arch/arm/mach-footbridge/personal-pci.c
138 index 4391e433a4b2f..9d19aa98a663e 100644
139 --- a/arch/arm/mach-footbridge/personal-pci.c
140 +++ b/arch/arm/mach-footbridge/personal-pci.c
141 @@ -14,13 +14,12 @@
142 #include <asm/mach/pci.h>
143 #include <asm/mach-types.h>
144
145 -static int irqmap_personal_server[] __initdata = {
146 +static int irqmap_personal_server[] = {
147 IRQ_IN0, IRQ_IN1, IRQ_IN2, IRQ_IN3, 0, 0, 0,
148 IRQ_DOORBELLHOST, IRQ_DMA1, IRQ_DMA2, IRQ_PCI
149 };
150
151 -static int __init personal_server_map_irq(const struct pci_dev *dev, u8 slot,
152 - u8 pin)
153 +static int personal_server_map_irq(const struct pci_dev *dev, u8 slot, u8 pin)
154 {
155 unsigned char line;
156
157 diff --git a/arch/arm/mach-keystone/keystone.c b/arch/arm/mach-keystone/keystone.c
158 index 638808c4e1224..697adedaced49 100644
159 --- a/arch/arm/mach-keystone/keystone.c
160 +++ b/arch/arm/mach-keystone/keystone.c
161 @@ -62,7 +62,7 @@ static void __init keystone_init(void)
162 static long long __init keystone_pv_fixup(void)
163 {
164 long long offset;
165 - phys_addr_t mem_start, mem_end;
166 + u64 mem_start, mem_end;
167
168 mem_start = memblock_start_of_DRAM();
169 mem_end = memblock_end_of_DRAM();
170 @@ -75,7 +75,7 @@ static long long __init keystone_pv_fixup(void)
171 if (mem_start < KEYSTONE_HIGH_PHYS_START ||
172 mem_end > KEYSTONE_HIGH_PHYS_END) {
173 pr_crit("Invalid address space for memory (%08llx-%08llx)\n",
174 - (u64)mem_start, (u64)mem_end);
175 + mem_start, mem_end);
176 return 0;
177 }
178
179 diff --git a/arch/arm/mach-omap1/ams-delta-fiq-handler.S b/arch/arm/mach-omap1/ams-delta-fiq-handler.S
180 index 14a6c3eb32985..f745a65d3bd7a 100644
181 --- a/arch/arm/mach-omap1/ams-delta-fiq-handler.S
182 +++ b/arch/arm/mach-omap1/ams-delta-fiq-handler.S
183 @@ -15,6 +15,7 @@
184 #include <linux/platform_data/gpio-omap.h>
185
186 #include <asm/assembler.h>
187 +#include <asm/irq.h>
188
189 #include "ams-delta-fiq.h"
190 #include "board-ams-delta.h"
191 diff --git a/arch/arm/probes/uprobes/core.c b/arch/arm/probes/uprobes/core.c
192 index c4b49b322e8a8..f5f790c6e5f89 100644
193 --- a/arch/arm/probes/uprobes/core.c
194 +++ b/arch/arm/probes/uprobes/core.c
195 @@ -204,7 +204,7 @@ unsigned long uprobe_get_swbp_addr(struct pt_regs *regs)
196 static struct undef_hook uprobes_arm_break_hook = {
197 .instr_mask = 0x0fffffff,
198 .instr_val = (UPROBE_SWBP_ARM_INSN & 0x0fffffff),
199 - .cpsr_mask = MODE_MASK,
200 + .cpsr_mask = (PSR_T_BIT | MODE_MASK),
201 .cpsr_val = USR_MODE,
202 .fn = uprobe_trap_handler,
203 };
204 @@ -212,7 +212,7 @@ static struct undef_hook uprobes_arm_break_hook = {
205 static struct undef_hook uprobes_arm_ss_hook = {
206 .instr_mask = 0x0fffffff,
207 .instr_val = (UPROBE_SS_ARM_INSN & 0x0fffffff),
208 - .cpsr_mask = MODE_MASK,
209 + .cpsr_mask = (PSR_T_BIT | MODE_MASK),
210 .cpsr_val = USR_MODE,
211 .fn = uprobe_trap_handler,
212 };
213 diff --git a/arch/arm64/boot/dts/allwinner/sun50i-a64-pine64-lts.dts b/arch/arm64/boot/dts/allwinner/sun50i-a64-pine64-lts.dts
214 index 72d6961dc3128..8d15164f2a3c6 100644
215 --- a/arch/arm64/boot/dts/allwinner/sun50i-a64-pine64-lts.dts
216 +++ b/arch/arm64/boot/dts/allwinner/sun50i-a64-pine64-lts.dts
217 @@ -11,3 +11,7 @@
218 compatible = "pine64,pine64-lts", "allwinner,sun50i-r18",
219 "allwinner,sun50i-a64";
220 };
221 +
222 +&mmc0 {
223 + cd-gpios = <&pio 5 6 GPIO_ACTIVE_LOW>; /* PF6 push-push switch */
224 +};
225 diff --git a/arch/arm64/boot/dts/allwinner/sun50i-a64-sopine.dtsi b/arch/arm64/boot/dts/allwinner/sun50i-a64-sopine.dtsi
226 index d935e3028fcb6..19e5b7e298fdf 100644
227 --- a/arch/arm64/boot/dts/allwinner/sun50i-a64-sopine.dtsi
228 +++ b/arch/arm64/boot/dts/allwinner/sun50i-a64-sopine.dtsi
229 @@ -57,7 +57,7 @@
230 vmmc-supply = <&reg_dcdc1>;
231 disable-wp;
232 bus-width = <4>;
233 - cd-gpios = <&pio 5 6 GPIO_ACTIVE_LOW>; /* PF6 */
234 + cd-gpios = <&pio 5 6 GPIO_ACTIVE_HIGH>; /* PF6 push-pull switch */
235 status = "okay";
236 };
237
238 diff --git a/arch/arm64/include/asm/alternative.h b/arch/arm64/include/asm/alternative.h
239 index 619db9b4c9d5c..3cb3c4ab3ea56 100644
240 --- a/arch/arm64/include/asm/alternative.h
241 +++ b/arch/arm64/include/asm/alternative.h
242 @@ -119,9 +119,9 @@ static inline void apply_alternatives_module(void *start, size_t length) { }
243 .popsection
244 .subsection 1
245 663: \insn2
246 -664: .previous
247 - .org . - (664b-663b) + (662b-661b)
248 +664: .org . - (664b-663b) + (662b-661b)
249 .org . - (662b-661b) + (664b-663b)
250 + .previous
251 .endif
252 .endm
253
254 @@ -191,11 +191,11 @@ static inline void apply_alternatives_module(void *start, size_t length) { }
255 */
256 .macro alternative_endif
257 664:
258 + .org . - (664b-663b) + (662b-661b)
259 + .org . - (662b-661b) + (664b-663b)
260 .if .Lasm_alt_mode==0
261 .previous
262 .endif
263 - .org . - (664b-663b) + (662b-661b)
264 - .org . - (662b-661b) + (664b-663b)
265 .endm
266
267 /*
268 diff --git a/arch/arm64/include/asm/word-at-a-time.h b/arch/arm64/include/asm/word-at-a-time.h
269 index 3333950b59093..ea487218db790 100644
270 --- a/arch/arm64/include/asm/word-at-a-time.h
271 +++ b/arch/arm64/include/asm/word-at-a-time.h
272 @@ -53,7 +53,7 @@ static inline unsigned long find_zero(unsigned long mask)
273 */
274 static inline unsigned long load_unaligned_zeropad(const void *addr)
275 {
276 - unsigned long ret, offset;
277 + unsigned long ret, tmp;
278
279 /* Load word from unaligned pointer addr */
280 asm(
281 @@ -61,9 +61,9 @@ static inline unsigned long load_unaligned_zeropad(const void *addr)
282 "2:\n"
283 " .pushsection .fixup,\"ax\"\n"
284 " .align 2\n"
285 - "3: and %1, %2, #0x7\n"
286 - " bic %2, %2, #0x7\n"
287 - " ldr %0, [%2]\n"
288 + "3: bic %1, %2, #0x7\n"
289 + " ldr %0, [%1]\n"
290 + " and %1, %2, #0x7\n"
291 " lsl %1, %1, #0x3\n"
292 #ifndef __AARCH64EB__
293 " lsr %0, %0, %1\n"
294 @@ -73,7 +73,7 @@ static inline unsigned long load_unaligned_zeropad(const void *addr)
295 " b 2b\n"
296 " .popsection\n"
297 _ASM_EXTABLE(1b, 3b)
298 - : "=&r" (ret), "=&r" (offset)
299 + : "=&r" (ret), "=&r" (tmp)
300 : "r" (addr), "Q" (*(unsigned long *)addr));
301
302 return ret;
303 diff --git a/arch/riscv/Kconfig b/arch/riscv/Kconfig
304 index 6b23a0cb2b353..b21549a34447c 100644
305 --- a/arch/riscv/Kconfig
306 +++ b/arch/riscv/Kconfig
307 @@ -101,7 +101,7 @@ config ARCH_FLATMEM_ENABLE
308 config ARCH_SPARSEMEM_ENABLE
309 def_bool y
310 depends on MMU
311 - select SPARSEMEM_STATIC if 32BIT && SPARSMEM
312 + select SPARSEMEM_STATIC if 32BIT && SPARSEMEM
313 select SPARSEMEM_VMEMMAP_ENABLE if 64BIT
314
315 config ARCH_SELECT_MEMORY_MODEL
316 diff --git a/drivers/dma/dw/Kconfig b/drivers/dma/dw/Kconfig
317 index e5162690de8f1..db25f9b7778c9 100644
318 --- a/drivers/dma/dw/Kconfig
319 +++ b/drivers/dma/dw/Kconfig
320 @@ -10,6 +10,7 @@ config DW_DMAC_CORE
321
322 config DW_DMAC
323 tristate "Synopsys DesignWare AHB DMA platform driver"
324 + depends on HAS_IOMEM
325 select DW_DMAC_CORE
326 help
327 Support the Synopsys DesignWare AHB DMA controller. This
328 @@ -18,6 +19,7 @@ config DW_DMAC
329 config DW_DMAC_PCI
330 tristate "Synopsys DesignWare AHB DMA PCI driver"
331 depends on PCI
332 + depends on HAS_IOMEM
333 select DW_DMAC_CORE
334 help
335 Support the Synopsys DesignWare AHB DMA controller on the
336 diff --git a/drivers/gpio/gpiolib-sysfs.c b/drivers/gpio/gpiolib-sysfs.c
337 index fbf6b1a0a4fae..558cd900d3996 100644
338 --- a/drivers/gpio/gpiolib-sysfs.c
339 +++ b/drivers/gpio/gpiolib-sysfs.c
340 @@ -457,6 +457,8 @@ static ssize_t export_store(struct class *class,
341 long gpio;
342 struct gpio_desc *desc;
343 int status;
344 + struct gpio_chip *gc;
345 + int offset;
346
347 status = kstrtol(buf, 0, &gpio);
348 if (status < 0)
349 @@ -468,6 +470,12 @@ static ssize_t export_store(struct class *class,
350 pr_warn("%s: invalid GPIO %ld\n", __func__, gpio);
351 return -EINVAL;
352 }
353 + gc = desc->gdev->chip;
354 + offset = gpio_chip_hwgpio(desc);
355 + if (!gpiochip_line_is_valid(gc, offset)) {
356 + pr_warn("%s: GPIO %ld masked\n", __func__, gpio);
357 + return -EINVAL;
358 + }
359
360 /* No extra locking here; FLAG_SYSFS just signifies that the
361 * request and export were done by on behalf of userspace, so
362 diff --git a/drivers/gpu/drm/msm/adreno/a5xx_gpu.c b/drivers/gpu/drm/msm/adreno/a5xx_gpu.c
363 index f84049119f1c1..e3579e5ffa146 100644
364 --- a/drivers/gpu/drm/msm/adreno/a5xx_gpu.c
365 +++ b/drivers/gpu/drm/msm/adreno/a5xx_gpu.c
366 @@ -1131,8 +1131,8 @@ static int a5xx_pm_suspend(struct msm_gpu *gpu)
367
368 static int a5xx_get_timestamp(struct msm_gpu *gpu, uint64_t *value)
369 {
370 - *value = gpu_read64(gpu, REG_A5XX_RBBM_PERFCTR_CP_0_LO,
371 - REG_A5XX_RBBM_PERFCTR_CP_0_HI);
372 + *value = gpu_read64(gpu, REG_A5XX_RBBM_ALWAYSON_COUNTER_LO,
373 + REG_A5XX_RBBM_ALWAYSON_COUNTER_HI);
374
375 return 0;
376 }
377 diff --git a/drivers/gpu/drm/msm/adreno/a6xx_gpu.c b/drivers/gpu/drm/msm/adreno/a6xx_gpu.c
378 index ab75f0309d4b6..df2656e579917 100644
379 --- a/drivers/gpu/drm/msm/adreno/a6xx_gpu.c
380 +++ b/drivers/gpu/drm/msm/adreno/a6xx_gpu.c
381 @@ -773,8 +773,8 @@ static int a6xx_get_timestamp(struct msm_gpu *gpu, uint64_t *value)
382 /* Force the GPU power on so we can read this register */
383 a6xx_gmu_set_oob(&a6xx_gpu->gmu, GMU_OOB_GPU_SET);
384
385 - *value = gpu_read64(gpu, REG_A6XX_RBBM_PERFCTR_CP_0_LO,
386 - REG_A6XX_RBBM_PERFCTR_CP_0_HI);
387 + *value = gpu_read64(gpu, REG_A6XX_CP_ALWAYS_ON_COUNTER_LO,
388 + REG_A6XX_CP_ALWAYS_ON_COUNTER_HI);
389
390 a6xx_gmu_clear_oob(&a6xx_gpu->gmu, GMU_OOB_GPU_SET);
391 return 0;
392 diff --git a/drivers/hid/wacom_wac.c b/drivers/hid/wacom_wac.c
393 index f1928c1ac139c..bf0621e446199 100644
394 --- a/drivers/hid/wacom_wac.c
395 +++ b/drivers/hid/wacom_wac.c
396 @@ -3574,8 +3574,6 @@ int wacom_setup_pen_input_capabilities(struct input_dev *input_dev,
397 {
398 struct wacom_features *features = &wacom_wac->features;
399
400 - input_dev->evbit[0] |= BIT_MASK(EV_KEY) | BIT_MASK(EV_ABS);
401 -
402 if (!(features->device_type & WACOM_DEVICETYPE_PEN))
403 return -ENODEV;
404
405 @@ -3590,6 +3588,7 @@ int wacom_setup_pen_input_capabilities(struct input_dev *input_dev,
406 return 0;
407 }
408
409 + input_dev->evbit[0] |= BIT_MASK(EV_KEY) | BIT_MASK(EV_ABS);
410 __set_bit(BTN_TOUCH, input_dev->keybit);
411 __set_bit(ABS_MISC, input_dev->absbit);
412
413 @@ -3742,8 +3741,6 @@ int wacom_setup_touch_input_capabilities(struct input_dev *input_dev,
414 {
415 struct wacom_features *features = &wacom_wac->features;
416
417 - input_dev->evbit[0] |= BIT_MASK(EV_KEY) | BIT_MASK(EV_ABS);
418 -
419 if (!(features->device_type & WACOM_DEVICETYPE_TOUCH))
420 return -ENODEV;
421
422 @@ -3756,6 +3753,7 @@ int wacom_setup_touch_input_capabilities(struct input_dev *input_dev,
423 /* setup has already been done */
424 return 0;
425
426 + input_dev->evbit[0] |= BIT_MASK(EV_KEY) | BIT_MASK(EV_ABS);
427 __set_bit(BTN_TOUCH, input_dev->keybit);
428
429 if (features->touch_max == 1) {
430 diff --git a/drivers/input/keyboard/nspire-keypad.c b/drivers/input/keyboard/nspire-keypad.c
431 index 63d5e488137dc..e9fa1423f1360 100644
432 --- a/drivers/input/keyboard/nspire-keypad.c
433 +++ b/drivers/input/keyboard/nspire-keypad.c
434 @@ -93,9 +93,15 @@ static irqreturn_t nspire_keypad_irq(int irq, void *dev_id)
435 return IRQ_HANDLED;
436 }
437
438 -static int nspire_keypad_chip_init(struct nspire_keypad *keypad)
439 +static int nspire_keypad_open(struct input_dev *input)
440 {
441 + struct nspire_keypad *keypad = input_get_drvdata(input);
442 unsigned long val = 0, cycles_per_us, delay_cycles, row_delay_cycles;
443 + int error;
444 +
445 + error = clk_prepare_enable(keypad->clk);
446 + if (error)
447 + return error;
448
449 cycles_per_us = (clk_get_rate(keypad->clk) / 1000000);
450 if (cycles_per_us == 0)
451 @@ -121,30 +127,6 @@ static int nspire_keypad_chip_init(struct nspire_keypad *keypad)
452 keypad->int_mask = 1 << 1;
453 writel(keypad->int_mask, keypad->reg_base + KEYPAD_INTMSK);
454
455 - /* Disable GPIO interrupts to prevent hanging on touchpad */
456 - /* Possibly used to detect touchpad events */
457 - writel(0, keypad->reg_base + KEYPAD_UNKNOWN_INT);
458 - /* Acknowledge existing interrupts */
459 - writel(~0, keypad->reg_base + KEYPAD_UNKNOWN_INT_STS);
460 -
461 - return 0;
462 -}
463 -
464 -static int nspire_keypad_open(struct input_dev *input)
465 -{
466 - struct nspire_keypad *keypad = input_get_drvdata(input);
467 - int error;
468 -
469 - error = clk_prepare_enable(keypad->clk);
470 - if (error)
471 - return error;
472 -
473 - error = nspire_keypad_chip_init(keypad);
474 - if (error) {
475 - clk_disable_unprepare(keypad->clk);
476 - return error;
477 - }
478 -
479 return 0;
480 }
481
482 @@ -152,6 +134,11 @@ static void nspire_keypad_close(struct input_dev *input)
483 {
484 struct nspire_keypad *keypad = input_get_drvdata(input);
485
486 + /* Disable interrupts */
487 + writel(0, keypad->reg_base + KEYPAD_INTMSK);
488 + /* Acknowledge existing interrupts */
489 + writel(~0, keypad->reg_base + KEYPAD_INT);
490 +
491 clk_disable_unprepare(keypad->clk);
492 }
493
494 @@ -210,6 +197,25 @@ static int nspire_keypad_probe(struct platform_device *pdev)
495 return -ENOMEM;
496 }
497
498 + error = clk_prepare_enable(keypad->clk);
499 + if (error) {
500 + dev_err(&pdev->dev, "failed to enable clock\n");
501 + return error;
502 + }
503 +
504 + /* Disable interrupts */
505 + writel(0, keypad->reg_base + KEYPAD_INTMSK);
506 + /* Acknowledge existing interrupts */
507 + writel(~0, keypad->reg_base + KEYPAD_INT);
508 +
509 + /* Disable GPIO interrupts to prevent hanging on touchpad */
510 + /* Possibly used to detect touchpad events */
511 + writel(0, keypad->reg_base + KEYPAD_UNKNOWN_INT);
512 + /* Acknowledge existing GPIO interrupts */
513 + writel(~0, keypad->reg_base + KEYPAD_UNKNOWN_INT_STS);
514 +
515 + clk_disable_unprepare(keypad->clk);
516 +
517 input_set_drvdata(input, keypad);
518
519 input->id.bustype = BUS_HOST;
520 diff --git a/drivers/input/serio/i8042-x86ia64io.h b/drivers/input/serio/i8042-x86ia64io.h
521 index e7346c5f4738a..23442a144b834 100644
522 --- a/drivers/input/serio/i8042-x86ia64io.h
523 +++ b/drivers/input/serio/i8042-x86ia64io.h
524 @@ -588,6 +588,7 @@ static const struct dmi_system_id i8042_dmi_noselftest_table[] = {
525 DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."),
526 DMI_MATCH(DMI_CHASSIS_TYPE, "10"), /* Notebook */
527 },
528 + }, {
529 .matches = {
530 DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."),
531 DMI_MATCH(DMI_CHASSIS_TYPE, "31"), /* Convertible Notebook */
532 diff --git a/drivers/input/touchscreen/s6sy761.c b/drivers/input/touchscreen/s6sy761.c
533 index b63d7fdf0cd20..85a1f465c097e 100644
534 --- a/drivers/input/touchscreen/s6sy761.c
535 +++ b/drivers/input/touchscreen/s6sy761.c
536 @@ -145,8 +145,8 @@ static void s6sy761_report_coordinates(struct s6sy761_data *sdata,
537 u8 major = event[4];
538 u8 minor = event[5];
539 u8 z = event[6] & S6SY761_MASK_Z;
540 - u16 x = (event[1] << 3) | ((event[3] & S6SY761_MASK_X) >> 4);
541 - u16 y = (event[2] << 3) | (event[3] & S6SY761_MASK_Y);
542 + u16 x = (event[1] << 4) | ((event[3] & S6SY761_MASK_X) >> 4);
543 + u16 y = (event[2] << 4) | (event[3] & S6SY761_MASK_Y);
544
545 input_mt_slot(sdata->input, tid);
546
547 diff --git a/drivers/md/dm-verity-fec.c b/drivers/md/dm-verity-fec.c
548 index 66f4c6398f670..cea2b37897367 100644
549 --- a/drivers/md/dm-verity-fec.c
550 +++ b/drivers/md/dm-verity-fec.c
551 @@ -65,7 +65,7 @@ static u8 *fec_read_parity(struct dm_verity *v, u64 rsb, int index,
552 u8 *res;
553
554 position = (index + rsb) * v->fec->roots;
555 - block = div64_u64_rem(position, v->fec->roots << SECTOR_SHIFT, &rem);
556 + block = div64_u64_rem(position, v->fec->io_size, &rem);
557 *offset = (unsigned)rem;
558
559 res = dm_bufio_read(v->fec->bufio, block, buf);
560 @@ -154,7 +154,7 @@ static int fec_decode_bufs(struct dm_verity *v, struct dm_verity_fec_io *fio,
561
562 /* read the next block when we run out of parity bytes */
563 offset += v->fec->roots;
564 - if (offset >= v->fec->roots << SECTOR_SHIFT) {
565 + if (offset >= v->fec->io_size) {
566 dm_bufio_release(buf);
567
568 par = fec_read_parity(v, rsb, block_offset, &offset, &buf);
569 @@ -742,8 +742,13 @@ int verity_fec_ctr(struct dm_verity *v)
570 return -E2BIG;
571 }
572
573 + if ((f->roots << SECTOR_SHIFT) & ((1 << v->data_dev_block_bits) - 1))
574 + f->io_size = 1 << v->data_dev_block_bits;
575 + else
576 + f->io_size = v->fec->roots << SECTOR_SHIFT;
577 +
578 f->bufio = dm_bufio_client_create(f->dev->bdev,
579 - f->roots << SECTOR_SHIFT,
580 + f->io_size,
581 1, 0, NULL, NULL);
582 if (IS_ERR(f->bufio)) {
583 ti->error = "Cannot initialize FEC bufio client";
584 diff --git a/drivers/md/dm-verity-fec.h b/drivers/md/dm-verity-fec.h
585 index 42fbd3a7fc9f1..3c46c8d618833 100644
586 --- a/drivers/md/dm-verity-fec.h
587 +++ b/drivers/md/dm-verity-fec.h
588 @@ -36,6 +36,7 @@ struct dm_verity_fec {
589 struct dm_dev *dev; /* parity data device */
590 struct dm_bufio_client *data_bufio; /* for data dev access */
591 struct dm_bufio_client *bufio; /* for parity data access */
592 + size_t io_size; /* IO size for roots */
593 sector_t start; /* parity data start in blocks */
594 sector_t blocks; /* number of blocks covered */
595 sector_t rounds; /* number of interleaving rounds */
596 diff --git a/drivers/net/dsa/mv88e6xxx/chip.c b/drivers/net/dsa/mv88e6xxx/chip.c
597 index 1af09fd3fed1c..446eb06e50b49 100644
598 --- a/drivers/net/dsa/mv88e6xxx/chip.c
599 +++ b/drivers/net/dsa/mv88e6xxx/chip.c
600 @@ -2766,10 +2766,17 @@ unlock:
601 return err;
602 }
603
604 +/* prod_id for switch families which do not have a PHY model number */
605 +static const u16 family_prod_id_table[] = {
606 + [MV88E6XXX_FAMILY_6341] = MV88E6XXX_PORT_SWITCH_ID_PROD_6341,
607 + [MV88E6XXX_FAMILY_6390] = MV88E6XXX_PORT_SWITCH_ID_PROD_6390,
608 +};
609 +
610 static int mv88e6xxx_mdio_read(struct mii_bus *bus, int phy, int reg)
611 {
612 struct mv88e6xxx_mdio_bus *mdio_bus = bus->priv;
613 struct mv88e6xxx_chip *chip = mdio_bus->chip;
614 + u16 prod_id;
615 u16 val;
616 int err;
617
618 @@ -2780,23 +2787,12 @@ static int mv88e6xxx_mdio_read(struct mii_bus *bus, int phy, int reg)
619 err = chip->info->ops->phy_read(chip, bus, phy, reg, &val);
620 mv88e6xxx_reg_unlock(chip);
621
622 - if (reg == MII_PHYSID2) {
623 - /* Some internal PHYs don't have a model number. */
624 - if (chip->info->family != MV88E6XXX_FAMILY_6165)
625 - /* Then there is the 6165 family. It gets is
626 - * PHYs correct. But it can also have two
627 - * SERDES interfaces in the PHY address
628 - * space. And these don't have a model
629 - * number. But they are not PHYs, so we don't
630 - * want to give them something a PHY driver
631 - * will recognise.
632 - *
633 - * Use the mv88e6390 family model number
634 - * instead, for anything which really could be
635 - * a PHY,
636 - */
637 - if (!(val & 0x3f0))
638 - val |= MV88E6XXX_PORT_SWITCH_ID_PROD_6390 >> 4;
639 + /* Some internal PHYs don't have a model number. */
640 + if (reg == MII_PHYSID2 && !(val & 0x3f0) &&
641 + chip->info->family < ARRAY_SIZE(family_prod_id_table)) {
642 + prod_id = family_prod_id_table[chip->info->family];
643 + if (prod_id)
644 + val |= prod_id >> 4;
645 }
646
647 return err ? err : val;
648 diff --git a/drivers/net/ethernet/amd/pcnet32.c b/drivers/net/ethernet/amd/pcnet32.c
649 index f5ad12c109344..da84660ceae1f 100644
650 --- a/drivers/net/ethernet/amd/pcnet32.c
651 +++ b/drivers/net/ethernet/amd/pcnet32.c
652 @@ -1548,8 +1548,7 @@ pcnet32_probe_pci(struct pci_dev *pdev, const struct pci_device_id *ent)
653 }
654 pci_set_master(pdev);
655
656 - ioaddr = pci_resource_start(pdev, 0);
657 - if (!ioaddr) {
658 + if (!pci_resource_len(pdev, 0)) {
659 if (pcnet32_debug & NETIF_MSG_PROBE)
660 pr_err("card has no PCI IO resources, aborting\n");
661 err = -ENODEV;
662 @@ -1562,6 +1561,8 @@ pcnet32_probe_pci(struct pci_dev *pdev, const struct pci_device_id *ent)
663 pr_err("architecture does not support 32bit PCI busmaster DMA\n");
664 goto err_disable_dev;
665 }
666 +
667 + ioaddr = pci_resource_start(pdev, 0);
668 if (!request_region(ioaddr, PCNET32_TOTAL_SIZE, "pcnet32_probe_pci")) {
669 if (pcnet32_debug & NETIF_MSG_PROBE)
670 pr_err("io address range already allocated\n");
671 diff --git a/drivers/net/ethernet/cadence/macb_main.c b/drivers/net/ethernet/cadence/macb_main.c
672 index bdef5b3dd848c..377668465535f 100644
673 --- a/drivers/net/ethernet/cadence/macb_main.c
674 +++ b/drivers/net/ethernet/cadence/macb_main.c
675 @@ -3590,6 +3590,7 @@ static int macb_init(struct platform_device *pdev)
676 reg = gem_readl(bp, DCFG8);
677 bp->max_tuples = min((GEM_BFEXT(SCR2CMP, reg) / 3),
678 GEM_BFEXT(T2SCR, reg));
679 + INIT_LIST_HEAD(&bp->rx_fs_list.list);
680 if (bp->max_tuples > 0) {
681 /* also needs one ethtype match to check IPv4 */
682 if (GEM_BFEXT(SCR2ETH, reg) > 0) {
683 @@ -3600,7 +3601,6 @@ static int macb_init(struct platform_device *pdev)
684 /* Filtering is supported in hw but don't enable it in kernel now */
685 dev->hw_features |= NETIF_F_NTUPLE;
686 /* init Rx flow definitions */
687 - INIT_LIST_HEAD(&bp->rx_fs_list.list);
688 bp->rx_fs_list.count = 0;
689 spin_lock_init(&bp->rx_fs_lock);
690 } else
691 diff --git a/drivers/net/ethernet/davicom/dm9000.c b/drivers/net/ethernet/davicom/dm9000.c
692 index 4b958681d66e7..1d5d8984b49a3 100644
693 --- a/drivers/net/ethernet/davicom/dm9000.c
694 +++ b/drivers/net/ethernet/davicom/dm9000.c
695 @@ -1476,8 +1476,10 @@ dm9000_probe(struct platform_device *pdev)
696
697 /* Init network device */
698 ndev = alloc_etherdev(sizeof(struct board_info));
699 - if (!ndev)
700 - return -ENOMEM;
701 + if (!ndev) {
702 + ret = -ENOMEM;
703 + goto out_regulator_disable;
704 + }
705
706 SET_NETDEV_DEV(ndev, &pdev->dev);
707
708 diff --git a/drivers/net/ethernet/ibm/ibmvnic.c b/drivers/net/ethernet/ibm/ibmvnic.c
709 index 79b13750fa2d2..a2b7b982ee290 100644
710 --- a/drivers/net/ethernet/ibm/ibmvnic.c
711 +++ b/drivers/net/ethernet/ibm/ibmvnic.c
712 @@ -1081,19 +1081,13 @@ static int __ibmvnic_open(struct net_device *netdev)
713
714 rc = set_link_state(adapter, IBMVNIC_LOGICAL_LNK_UP);
715 if (rc) {
716 - for (i = 0; i < adapter->req_rx_queues; i++)
717 - napi_disable(&adapter->napi[i]);
718 + ibmvnic_napi_disable(adapter);
719 release_resources(adapter);
720 return rc;
721 }
722
723 netif_tx_start_all_queues(netdev);
724
725 - if (prev_state == VNIC_CLOSED) {
726 - for (i = 0; i < adapter->req_rx_queues; i++)
727 - napi_schedule(&adapter->napi[i]);
728 - }
729 -
730 adapter->state = VNIC_OPEN;
731 return rc;
732 }
733 @@ -1850,7 +1844,7 @@ static int do_reset(struct ibmvnic_adapter *adapter,
734 u64 old_num_rx_queues, old_num_tx_queues;
735 u64 old_num_rx_slots, old_num_tx_slots;
736 struct net_device *netdev = adapter->netdev;
737 - int i, rc;
738 + int rc;
739
740 netdev_dbg(adapter->netdev, "Re-setting driver (%d)\n",
741 rwi->reset_reason);
742 @@ -1995,10 +1989,6 @@ static int do_reset(struct ibmvnic_adapter *adapter,
743 /* refresh device's multicast list */
744 ibmvnic_set_multi(netdev);
745
746 - /* kick napi */
747 - for (i = 0; i < adapter->req_rx_queues; i++)
748 - napi_schedule(&adapter->napi[i]);
749 -
750 if (adapter->reset_reason == VNIC_RESET_FAILOVER ||
751 adapter->reset_reason == VNIC_RESET_MOBILITY) {
752 call_netdevice_notifiers(NETDEV_NOTIFY_PEERS, netdev);
753 diff --git a/drivers/net/ethernet/intel/i40e/i40e_main.c b/drivers/net/ethernet/intel/i40e/i40e_main.c
754 index a69aace057925..a1b4e995f2b7e 100644
755 --- a/drivers/net/ethernet/intel/i40e/i40e_main.c
756 +++ b/drivers/net/ethernet/intel/i40e/i40e_main.c
757 @@ -11872,6 +11872,7 @@ static int i40e_sw_init(struct i40e_pf *pf)
758 {
759 int err = 0;
760 int size;
761 + u16 pow;
762
763 /* Set default capability flags */
764 pf->flags = I40E_FLAG_RX_CSUM_ENABLED |
765 @@ -11890,6 +11891,11 @@ static int i40e_sw_init(struct i40e_pf *pf)
766 pf->rss_table_size = pf->hw.func_caps.rss_table_size;
767 pf->rss_size_max = min_t(int, pf->rss_size_max,
768 pf->hw.func_caps.num_tx_qp);
769 +
770 + /* find the next higher power-of-2 of num cpus */
771 + pow = roundup_pow_of_two(num_online_cpus());
772 + pf->rss_size_max = min_t(int, pf->rss_size_max, pow);
773 +
774 if (pf->hw.func_caps.rss) {
775 pf->flags |= I40E_FLAG_RSS_ENABLED;
776 pf->alloc_rss_size = min_t(int, pf->rss_size_max,
777 diff --git a/drivers/net/ethernet/realtek/r8169_main.c b/drivers/net/ethernet/realtek/r8169_main.c
778 index bd8decc54b871..8ff178fc2670c 100644
779 --- a/drivers/net/ethernet/realtek/r8169_main.c
780 +++ b/drivers/net/ethernet/realtek/r8169_main.c
781 @@ -742,12 +742,6 @@ static void rtl_unlock_config_regs(struct rtl8169_private *tp)
782 RTL_W8(tp, Cfg9346, Cfg9346_Unlock);
783 }
784
785 -static void rtl_tx_performance_tweak(struct rtl8169_private *tp, u16 force)
786 -{
787 - pcie_capability_clear_and_set_word(tp->pci_dev, PCI_EXP_DEVCTL,
788 - PCI_EXP_DEVCTL_READRQ, force);
789 -}
790 -
791 static bool rtl_is_8125(struct rtl8169_private *tp)
792 {
793 return tp->mac_version >= RTL_GIGA_MAC_VER_60;
794 @@ -4057,14 +4051,12 @@ static void r8168c_hw_jumbo_enable(struct rtl8169_private *tp)
795 {
796 RTL_W8(tp, Config3, RTL_R8(tp, Config3) | Jumbo_En0);
797 RTL_W8(tp, Config4, RTL_R8(tp, Config4) | Jumbo_En1);
798 - rtl_tx_performance_tweak(tp, PCI_EXP_DEVCTL_READRQ_512B);
799 }
800
801 static void r8168c_hw_jumbo_disable(struct rtl8169_private *tp)
802 {
803 RTL_W8(tp, Config3, RTL_R8(tp, Config3) & ~Jumbo_En0);
804 RTL_W8(tp, Config4, RTL_R8(tp, Config4) & ~Jumbo_En1);
805 - rtl_tx_performance_tweak(tp, PCI_EXP_DEVCTL_READRQ_4096B);
806 }
807
808 static void r8168dp_hw_jumbo_enable(struct rtl8169_private *tp)
809 @@ -4082,7 +4074,6 @@ static void r8168e_hw_jumbo_enable(struct rtl8169_private *tp)
810 RTL_W8(tp, MaxTxPacketSize, 0x24);
811 RTL_W8(tp, Config3, RTL_R8(tp, Config3) | Jumbo_En0);
812 RTL_W8(tp, Config4, RTL_R8(tp, Config4) | 0x01);
813 - rtl_tx_performance_tweak(tp, PCI_EXP_DEVCTL_READRQ_512B);
814 }
815
816 static void r8168e_hw_jumbo_disable(struct rtl8169_private *tp)
817 @@ -4090,93 +4081,70 @@ static void r8168e_hw_jumbo_disable(struct rtl8169_private *tp)
818 RTL_W8(tp, MaxTxPacketSize, 0x3f);
819 RTL_W8(tp, Config3, RTL_R8(tp, Config3) & ~Jumbo_En0);
820 RTL_W8(tp, Config4, RTL_R8(tp, Config4) & ~0x01);
821 - rtl_tx_performance_tweak(tp, PCI_EXP_DEVCTL_READRQ_4096B);
822 -}
823 -
824 -static void r8168b_0_hw_jumbo_enable(struct rtl8169_private *tp)
825 -{
826 - rtl_tx_performance_tweak(tp,
827 - PCI_EXP_DEVCTL_READRQ_512B | PCI_EXP_DEVCTL_NOSNOOP_EN);
828 -}
829 -
830 -static void r8168b_0_hw_jumbo_disable(struct rtl8169_private *tp)
831 -{
832 - rtl_tx_performance_tweak(tp,
833 - PCI_EXP_DEVCTL_READRQ_4096B | PCI_EXP_DEVCTL_NOSNOOP_EN);
834 }
835
836 static void r8168b_1_hw_jumbo_enable(struct rtl8169_private *tp)
837 {
838 - r8168b_0_hw_jumbo_enable(tp);
839 -
840 RTL_W8(tp, Config4, RTL_R8(tp, Config4) | (1 << 0));
841 }
842
843 static void r8168b_1_hw_jumbo_disable(struct rtl8169_private *tp)
844 {
845 - r8168b_0_hw_jumbo_disable(tp);
846 -
847 RTL_W8(tp, Config4, RTL_R8(tp, Config4) & ~(1 << 0));
848 }
849
850 -static void rtl_hw_jumbo_enable(struct rtl8169_private *tp)
851 +static void rtl_jumbo_config(struct rtl8169_private *tp)
852 {
853 - rtl_unlock_config_regs(tp);
854 - switch (tp->mac_version) {
855 - case RTL_GIGA_MAC_VER_11:
856 - r8168b_0_hw_jumbo_enable(tp);
857 - break;
858 - case RTL_GIGA_MAC_VER_12:
859 - case RTL_GIGA_MAC_VER_17:
860 - r8168b_1_hw_jumbo_enable(tp);
861 - break;
862 - case RTL_GIGA_MAC_VER_18 ... RTL_GIGA_MAC_VER_26:
863 - r8168c_hw_jumbo_enable(tp);
864 - break;
865 - case RTL_GIGA_MAC_VER_27 ... RTL_GIGA_MAC_VER_28:
866 - r8168dp_hw_jumbo_enable(tp);
867 - break;
868 - case RTL_GIGA_MAC_VER_31 ... RTL_GIGA_MAC_VER_33:
869 - r8168e_hw_jumbo_enable(tp);
870 - break;
871 - default:
872 - break;
873 - }
874 - rtl_lock_config_regs(tp);
875 -}
876 + bool jumbo = tp->dev->mtu > ETH_DATA_LEN;
877 + int readrq = 4096;
878
879 -static void rtl_hw_jumbo_disable(struct rtl8169_private *tp)
880 -{
881 rtl_unlock_config_regs(tp);
882 switch (tp->mac_version) {
883 - case RTL_GIGA_MAC_VER_11:
884 - r8168b_0_hw_jumbo_disable(tp);
885 - break;
886 case RTL_GIGA_MAC_VER_12:
887 case RTL_GIGA_MAC_VER_17:
888 - r8168b_1_hw_jumbo_disable(tp);
889 + if (jumbo) {
890 + readrq = 512;
891 + r8168b_1_hw_jumbo_enable(tp);
892 + } else {
893 + r8168b_1_hw_jumbo_disable(tp);
894 + }
895 break;
896 case RTL_GIGA_MAC_VER_18 ... RTL_GIGA_MAC_VER_26:
897 - r8168c_hw_jumbo_disable(tp);
898 + if (jumbo) {
899 + readrq = 512;
900 + r8168c_hw_jumbo_enable(tp);
901 + } else {
902 + r8168c_hw_jumbo_disable(tp);
903 + }
904 break;
905 case RTL_GIGA_MAC_VER_27 ... RTL_GIGA_MAC_VER_28:
906 - r8168dp_hw_jumbo_disable(tp);
907 + if (jumbo)
908 + r8168dp_hw_jumbo_enable(tp);
909 + else
910 + r8168dp_hw_jumbo_disable(tp);
911 break;
912 case RTL_GIGA_MAC_VER_31 ... RTL_GIGA_MAC_VER_33:
913 - r8168e_hw_jumbo_disable(tp);
914 + if (jumbo) {
915 + pcie_set_readrq(tp->pci_dev, 512);
916 + r8168e_hw_jumbo_enable(tp);
917 + } else {
918 + r8168e_hw_jumbo_disable(tp);
919 + }
920 break;
921 default:
922 break;
923 }
924 rtl_lock_config_regs(tp);
925 -}
926
927 -static void rtl_jumbo_config(struct rtl8169_private *tp, int mtu)
928 -{
929 - if (mtu > ETH_DATA_LEN)
930 - rtl_hw_jumbo_enable(tp);
931 - else
932 - rtl_hw_jumbo_disable(tp);
933 + if (pci_is_pcie(tp->pci_dev) && tp->supports_gmii)
934 + pcie_set_readrq(tp->pci_dev, readrq);
935 +
936 + /* Chip doesn't support pause in jumbo mode */
937 + linkmode_mod_bit(ETHTOOL_LINK_MODE_Pause_BIT,
938 + tp->phydev->advertising, !jumbo);
939 + linkmode_mod_bit(ETHTOOL_LINK_MODE_Asym_Pause_BIT,
940 + tp->phydev->advertising, !jumbo);
941 + phy_start_aneg(tp->phydev);
942 }
943
944 DECLARE_RTL_COND(rtl_chipcmd_cond)
945 @@ -4575,18 +4543,12 @@ static void rtl_hw_start_8168d(struct rtl8169_private *tp)
946 rtl_set_def_aspm_entry_latency(tp);
947
948 rtl_disable_clock_request(tp);
949 -
950 - if (tp->dev->mtu <= ETH_DATA_LEN)
951 - rtl_tx_performance_tweak(tp, PCI_EXP_DEVCTL_READRQ_4096B);
952 }
953
954 static void rtl_hw_start_8168dp(struct rtl8169_private *tp)
955 {
956 rtl_set_def_aspm_entry_latency(tp);
957
958 - if (tp->dev->mtu <= ETH_DATA_LEN)
959 - rtl_tx_performance_tweak(tp, PCI_EXP_DEVCTL_READRQ_4096B);
960 -
961 rtl_disable_clock_request(tp);
962 }
963
964 @@ -4601,8 +4563,6 @@ static void rtl_hw_start_8168d_4(struct rtl8169_private *tp)
965
966 rtl_set_def_aspm_entry_latency(tp);
967
968 - rtl_tx_performance_tweak(tp, PCI_EXP_DEVCTL_READRQ_4096B);
969 -
970 rtl_ephy_init(tp, e_info_8168d_4);
971
972 rtl_enable_clock_request(tp);
973 @@ -4677,8 +4637,6 @@ static void rtl_hw_start_8168f(struct rtl8169_private *tp)
974 {
975 rtl_set_def_aspm_entry_latency(tp);
976
977 - rtl_tx_performance_tweak(tp, PCI_EXP_DEVCTL_READRQ_4096B);
978 -
979 rtl_eri_write(tp, 0xc0, ERIAR_MASK_0011, 0x0000);
980 rtl_eri_write(tp, 0xb8, ERIAR_MASK_0011, 0x0000);
981 rtl_set_fifo_size(tp, 0x10, 0x10, 0x02, 0x06);
982 @@ -4741,8 +4699,6 @@ static void rtl_hw_start_8168g(struct rtl8169_private *tp)
983
984 rtl_set_def_aspm_entry_latency(tp);
985
986 - rtl_tx_performance_tweak(tp, PCI_EXP_DEVCTL_READRQ_4096B);
987 -
988 rtl_reset_packet_filter(tp);
989 rtl_eri_write(tp, 0x2f8, ERIAR_MASK_0011, 0x1d8f);
990
991 @@ -4979,8 +4935,6 @@ static void rtl_hw_start_8168h_1(struct rtl8169_private *tp)
992
993 rtl_set_def_aspm_entry_latency(tp);
994
995 - rtl_tx_performance_tweak(tp, PCI_EXP_DEVCTL_READRQ_4096B);
996 -
997 rtl_reset_packet_filter(tp);
998
999 rtl_eri_set_bits(tp, 0xdc, ERIAR_MASK_1111, BIT(4));
1000 @@ -5038,8 +4992,6 @@ static void rtl_hw_start_8168ep(struct rtl8169_private *tp)
1001
1002 rtl_set_def_aspm_entry_latency(tp);
1003
1004 - rtl_tx_performance_tweak(tp, PCI_EXP_DEVCTL_READRQ_4096B);
1005 -
1006 rtl_reset_packet_filter(tp);
1007
1008 rtl_eri_set_bits(tp, 0xd4, ERIAR_MASK_1111, 0x1f80);
1009 @@ -5142,8 +5094,6 @@ static void rtl_hw_start_8102e_1(struct rtl8169_private *tp)
1010
1011 RTL_W8(tp, DBG_REG, FIX_NAK_1);
1012
1013 - rtl_tx_performance_tweak(tp, PCI_EXP_DEVCTL_READRQ_4096B);
1014 -
1015 RTL_W8(tp, Config1,
1016 LEDS1 | LEDS0 | Speed_down | MEMMAP | IOMAP | VPD | PMEnable);
1017 RTL_W8(tp, Config3, RTL_R8(tp, Config3) & ~Beacon_en);
1018 @@ -5159,8 +5109,6 @@ static void rtl_hw_start_8102e_2(struct rtl8169_private *tp)
1019 {
1020 rtl_set_def_aspm_entry_latency(tp);
1021
1022 - rtl_tx_performance_tweak(tp, PCI_EXP_DEVCTL_READRQ_4096B);
1023 -
1024 RTL_W8(tp, Config1, MEMMAP | IOMAP | VPD | PMEnable);
1025 RTL_W8(tp, Config3, RTL_R8(tp, Config3) & ~Beacon_en);
1026 }
1027 @@ -5221,8 +5169,6 @@ static void rtl_hw_start_8402(struct rtl8169_private *tp)
1028
1029 rtl_ephy_init(tp, e_info_8402);
1030
1031 - rtl_tx_performance_tweak(tp, PCI_EXP_DEVCTL_READRQ_4096B);
1032 -
1033 rtl_set_fifo_size(tp, 0x00, 0x00, 0x02, 0x06);
1034 rtl_reset_packet_filter(tp);
1035 rtl_eri_write(tp, 0xc0, ERIAR_MASK_0011, 0x0000);
1036 @@ -5438,10 +5384,18 @@ static void rtl_hw_start_8125(struct rtl8169_private *tp)
1037
1038 static void rtl_hw_start_8168(struct rtl8169_private *tp)
1039 {
1040 - if (tp->mac_version == RTL_GIGA_MAC_VER_13 ||
1041 - tp->mac_version == RTL_GIGA_MAC_VER_16)
1042 + switch (tp->mac_version) {
1043 + case RTL_GIGA_MAC_VER_11:
1044 + case RTL_GIGA_MAC_VER_12:
1045 + case RTL_GIGA_MAC_VER_13:
1046 + case RTL_GIGA_MAC_VER_16:
1047 + case RTL_GIGA_MAC_VER_17:
1048 pcie_capability_set_word(tp->pci_dev, PCI_EXP_DEVCTL,
1049 PCI_EXP_DEVCTL_NOSNOOP_EN);
1050 + break;
1051 + default:
1052 + break;
1053 + }
1054
1055 if (rtl_is_8168evl_up(tp))
1056 RTL_W8(tp, MaxTxPacketSize, EarlySize);
1057 @@ -5498,7 +5452,7 @@ static void rtl_hw_start(struct rtl8169_private *tp)
1058 rtl_set_rx_tx_desc_registers(tp);
1059 rtl_lock_config_regs(tp);
1060
1061 - rtl_jumbo_config(tp, tp->dev->mtu);
1062 + rtl_jumbo_config(tp);
1063
1064 /* Initially a 10 us delay. Turned it into a PCI commit. - FR */
1065 RTL_R16(tp, CPlusCmd);
1066 @@ -5513,10 +5467,9 @@ static int rtl8169_change_mtu(struct net_device *dev, int new_mtu)
1067 {
1068 struct rtl8169_private *tp = netdev_priv(dev);
1069
1070 - rtl_jumbo_config(tp, new_mtu);
1071 -
1072 dev->mtu = new_mtu;
1073 netdev_update_features(dev);
1074 + rtl_jumbo_config(tp);
1075
1076 /* Reportedly at least Asus X453MA truncates packets otherwise */
1077 if (tp->mac_version == RTL_GIGA_MAC_VER_37)
1078 @@ -6368,8 +6321,6 @@ static int r8169_phy_connect(struct rtl8169_private *tp)
1079 if (!tp->supports_gmii)
1080 phy_set_max_speed(phydev, SPEED_100);
1081
1082 - phy_support_asym_pause(phydev);
1083 -
1084 phy_attached_info(phydev);
1085
1086 return 0;
1087 diff --git a/drivers/net/phy/marvell.c b/drivers/net/phy/marvell.c
1088 index 91cf1d1672637..9dbe625ad4477 100644
1089 --- a/drivers/net/phy/marvell.c
1090 +++ b/drivers/net/phy/marvell.c
1091 @@ -2401,9 +2401,31 @@ static struct phy_driver marvell_drivers[] = {
1092 .get_stats = marvell_get_stats,
1093 },
1094 {
1095 - .phy_id = MARVELL_PHY_ID_88E6390,
1096 + .phy_id = MARVELL_PHY_ID_88E6341_FAMILY,
1097 .phy_id_mask = MARVELL_PHY_ID_MASK,
1098 - .name = "Marvell 88E6390",
1099 + .name = "Marvell 88E6341 Family",
1100 + /* PHY_GBIT_FEATURES */
1101 + .probe = m88e1510_probe,
1102 + .config_init = &marvell_config_init,
1103 + .config_aneg = &m88e6390_config_aneg,
1104 + .read_status = &marvell_read_status,
1105 + .ack_interrupt = &marvell_ack_interrupt,
1106 + .config_intr = &marvell_config_intr,
1107 + .did_interrupt = &m88e1121_did_interrupt,
1108 + .resume = &genphy_resume,
1109 + .suspend = &genphy_suspend,
1110 + .read_page = marvell_read_page,
1111 + .write_page = marvell_write_page,
1112 + .get_sset_count = marvell_get_sset_count,
1113 + .get_strings = marvell_get_strings,
1114 + .get_stats = marvell_get_stats,
1115 + .get_tunable = m88e1540_get_tunable,
1116 + .set_tunable = m88e1540_set_tunable,
1117 + },
1118 + {
1119 + .phy_id = MARVELL_PHY_ID_88E6390_FAMILY,
1120 + .phy_id_mask = MARVELL_PHY_ID_MASK,
1121 + .name = "Marvell 88E6390 Family",
1122 /* PHY_GBIT_FEATURES */
1123 .probe = m88e6390_probe,
1124 .config_init = &marvell_config_init,
1125 @@ -2441,7 +2463,8 @@ static struct mdio_device_id __maybe_unused marvell_tbl[] = {
1126 { MARVELL_PHY_ID_88E1540, MARVELL_PHY_ID_MASK },
1127 { MARVELL_PHY_ID_88E1545, MARVELL_PHY_ID_MASK },
1128 { MARVELL_PHY_ID_88E3016, MARVELL_PHY_ID_MASK },
1129 - { MARVELL_PHY_ID_88E6390, MARVELL_PHY_ID_MASK },
1130 + { MARVELL_PHY_ID_88E6341_FAMILY, MARVELL_PHY_ID_MASK },
1131 + { MARVELL_PHY_ID_88E6390_FAMILY, MARVELL_PHY_ID_MASK },
1132 { }
1133 };
1134
1135 diff --git a/drivers/net/wireless/virt_wifi.c b/drivers/net/wireless/virt_wifi.c
1136 index 01305ba2d3aac..9d04ca53229b5 100644
1137 --- a/drivers/net/wireless/virt_wifi.c
1138 +++ b/drivers/net/wireless/virt_wifi.c
1139 @@ -12,6 +12,7 @@
1140 #include <net/cfg80211.h>
1141 #include <net/rtnetlink.h>
1142 #include <linux/etherdevice.h>
1143 +#include <linux/math64.h>
1144 #include <linux/module.h>
1145
1146 static struct wiphy *common_wiphy;
1147 @@ -168,11 +169,11 @@ static void virt_wifi_scan_result(struct work_struct *work)
1148 scan_result.work);
1149 struct wiphy *wiphy = priv_to_wiphy(priv);
1150 struct cfg80211_scan_info scan_info = { .aborted = false };
1151 + u64 tsf = div_u64(ktime_get_boottime_ns(), 1000);
1152
1153 informed_bss = cfg80211_inform_bss(wiphy, &channel_5ghz,
1154 CFG80211_BSS_FTYPE_PRESP,
1155 - fake_router_bssid,
1156 - ktime_get_boottime_ns(),
1157 + fake_router_bssid, tsf,
1158 WLAN_CAPABILITY_ESS, 0,
1159 (void *)&ssid, sizeof(ssid),
1160 DBM_TO_MBM(-50), GFP_KERNEL);
1161 diff --git a/drivers/nvdimm/region_devs.c b/drivers/nvdimm/region_devs.c
1162 index ef423ba1a7116..b8236a9e8750d 100644
1163 --- a/drivers/nvdimm/region_devs.c
1164 +++ b/drivers/nvdimm/region_devs.c
1165 @@ -1142,6 +1142,11 @@ int nvdimm_has_flush(struct nd_region *nd_region)
1166 || !IS_ENABLED(CONFIG_ARCH_HAS_PMEM_API))
1167 return -ENXIO;
1168
1169 + /* Test if an explicit flush function is defined */
1170 + if (test_bit(ND_REGION_ASYNC, &nd_region->flags) && nd_region->flush)
1171 + return 1;
1172 +
1173 + /* Test if any flush hints for the region are available */
1174 for (i = 0; i < nd_region->ndr_mappings; i++) {
1175 struct nd_mapping *nd_mapping = &nd_region->mapping[i];
1176 struct nvdimm *nvdimm = nd_mapping->nvdimm;
1177 @@ -1152,8 +1157,8 @@ int nvdimm_has_flush(struct nd_region *nd_region)
1178 }
1179
1180 /*
1181 - * The platform defines dimm devices without hints, assume
1182 - * platform persistence mechanism like ADR
1183 + * The platform defines dimm devices without hints nor explicit flush,
1184 + * assume platform persistence mechanism like ADR
1185 */
1186 return 0;
1187 }
1188 diff --git a/drivers/scsi/libsas/sas_ata.c b/drivers/scsi/libsas/sas_ata.c
1189 index dd755a56cf521..5d28bb7f2ca40 100644
1190 --- a/drivers/scsi/libsas/sas_ata.c
1191 +++ b/drivers/scsi/libsas/sas_ata.c
1192 @@ -200,18 +200,17 @@ static unsigned int sas_ata_qc_issue(struct ata_queued_cmd *qc)
1193 memcpy(task->ata_task.atapi_packet, qc->cdb, qc->dev->cdb_len);
1194 task->total_xfer_len = qc->nbytes;
1195 task->num_scatter = qc->n_elem;
1196 + task->data_dir = qc->dma_dir;
1197 + } else if (qc->tf.protocol == ATA_PROT_NODATA) {
1198 + task->data_dir = DMA_NONE;
1199 } else {
1200 for_each_sg(qc->sg, sg, qc->n_elem, si)
1201 xfer += sg_dma_len(sg);
1202
1203 task->total_xfer_len = xfer;
1204 task->num_scatter = si;
1205 - }
1206 -
1207 - if (qc->tf.protocol == ATA_PROT_NODATA)
1208 - task->data_dir = DMA_NONE;
1209 - else
1210 task->data_dir = qc->dma_dir;
1211 + }
1212 task->scatter = qc->sg;
1213 task->ata_task.retry_count = 1;
1214 task->task_state_flags = SAS_TASK_STATE_PENDING;
1215 diff --git a/drivers/scsi/qla2xxx/qla_dbg.c b/drivers/scsi/qla2xxx/qla_dbg.c
1216 index 7bbff91f8883e..88a56e8480f71 100644
1217 --- a/drivers/scsi/qla2xxx/qla_dbg.c
1218 +++ b/drivers/scsi/qla2xxx/qla_dbg.c
1219 @@ -18,7 +18,7 @@
1220 * | Device Discovery | 0x2134 | 0x210e-0x2116 |
1221 * | | | 0x211a |
1222 * | | | 0x211c-0x2128 |
1223 - * | | | 0x212a-0x2130 |
1224 + * | | | 0x212a-0x2134 |
1225 * | Queue Command and IO tracing | 0x3074 | 0x300b |
1226 * | | | 0x3027-0x3028 |
1227 * | | | 0x303d-0x3041 |
1228 diff --git a/drivers/scsi/qla2xxx/qla_def.h b/drivers/scsi/qla2xxx/qla_def.h
1229 index c57b95a206888..7c22f8eea3ead 100644
1230 --- a/drivers/scsi/qla2xxx/qla_def.h
1231 +++ b/drivers/scsi/qla2xxx/qla_def.h
1232 @@ -2281,7 +2281,7 @@ typedef struct {
1233 uint8_t fabric_port_name[WWN_SIZE];
1234 uint16_t fp_speed;
1235 uint8_t fc4_type;
1236 - uint8_t fc4f_nvme; /* nvme fc4 feature bits */
1237 + uint8_t fc4_features;
1238 } sw_info_t;
1239
1240 /* FCP-4 types */
1241 @@ -2452,7 +2452,7 @@ typedef struct fc_port {
1242 u32 supported_classes;
1243
1244 uint8_t fc4_type;
1245 - uint8_t fc4f_nvme;
1246 + uint8_t fc4_features;
1247 uint8_t scan_state;
1248
1249 unsigned long last_queue_full;
1250 @@ -2466,6 +2466,7 @@ typedef struct fc_port {
1251 struct qla_tgt_sess *tgt_session;
1252 struct ct_sns_desc ct_desc;
1253 enum discovery_state disc_state;
1254 + atomic_t shadow_disc_state;
1255 enum discovery_state next_disc_state;
1256 enum login_state fw_login_state;
1257 unsigned long dm_login_expire;
1258 @@ -2483,6 +2484,9 @@ typedef struct fc_port {
1259 u16 n2n_chip_reset;
1260 } fc_port_t;
1261
1262 +#define FC4_PRIORITY_NVME 0
1263 +#define FC4_PRIORITY_FCP 1
1264 +
1265 #define QLA_FCPORT_SCAN 1
1266 #define QLA_FCPORT_FOUND 2
1267
1268 @@ -2507,6 +2511,19 @@ struct event_arg {
1269
1270 extern const char *const port_state_str[5];
1271
1272 +static const char * const port_dstate_str[] = {
1273 + "DELETED",
1274 + "GNN_ID",
1275 + "GNL",
1276 + "LOGIN_PEND",
1277 + "LOGIN_FAILED",
1278 + "GPDB",
1279 + "UPD_FCPORT",
1280 + "LOGIN_COMPLETE",
1281 + "ADISC",
1282 + "DELETE_PEND"
1283 +};
1284 +
1285 /*
1286 * FC port flags.
1287 */
1288 @@ -4298,6 +4315,8 @@ struct qla_hw_data {
1289 atomic_t nvme_active_aen_cnt;
1290 uint16_t nvme_last_rptd_aen; /* Last recorded aen count */
1291
1292 + uint8_t fc4_type_priority;
1293 +
1294 atomic_t zio_threshold;
1295 uint16_t last_zio_threshold;
1296
1297 @@ -4823,6 +4842,23 @@ struct sff_8247_a0 {
1298 ha->current_topology == ISP_CFG_N || \
1299 !ha->current_topology)
1300
1301 +#define NVME_TYPE(fcport) \
1302 + (fcport->fc4_type & FS_FC4TYPE_NVME) \
1303 +
1304 +#define FCP_TYPE(fcport) \
1305 + (fcport->fc4_type & FS_FC4TYPE_FCP) \
1306 +
1307 +#define NVME_ONLY_TARGET(fcport) \
1308 + (NVME_TYPE(fcport) && !FCP_TYPE(fcport)) \
1309 +
1310 +#define NVME_FCP_TARGET(fcport) \
1311 + (FCP_TYPE(fcport) && NVME_TYPE(fcport)) \
1312 +
1313 +#define NVME_TARGET(ha, fcport) \
1314 + ((NVME_FCP_TARGET(fcport) && \
1315 + (ha->fc4_type_priority == FC4_PRIORITY_NVME)) || \
1316 + NVME_ONLY_TARGET(fcport)) \
1317 +
1318 #define PRLI_PHASE(_cls) \
1319 ((_cls == DSC_LS_PRLI_PEND) || (_cls == DSC_LS_PRLI_COMP))
1320
1321 diff --git a/drivers/scsi/qla2xxx/qla_fw.h b/drivers/scsi/qla2xxx/qla_fw.h
1322 index dc2366a296654..9dc09c1174169 100644
1323 --- a/drivers/scsi/qla2xxx/qla_fw.h
1324 +++ b/drivers/scsi/qla2xxx/qla_fw.h
1325 @@ -2105,4 +2105,6 @@ struct qla_fcp_prio_cfg {
1326 #define FA_FLASH_LAYOUT_ADDR_83 (0x3F1000/4)
1327 #define FA_FLASH_LAYOUT_ADDR_28 (0x11000/4)
1328
1329 +#define NVRAM_DUAL_FCP_NVME_FLAG_OFFSET 0x196
1330 +
1331 #endif
1332 diff --git a/drivers/scsi/qla2xxx/qla_gbl.h b/drivers/scsi/qla2xxx/qla_gbl.h
1333 index d11416dcee4ef..7aa233771ec86 100644
1334 --- a/drivers/scsi/qla2xxx/qla_gbl.h
1335 +++ b/drivers/scsi/qla2xxx/qla_gbl.h
1336 @@ -80,6 +80,7 @@ extern int qla24xx_async_gnl(struct scsi_qla_host *, fc_port_t *);
1337 int qla2x00_post_work(struct scsi_qla_host *vha, struct qla_work_evt *e);
1338 extern void *qla2x00_alloc_iocbs_ready(struct qla_qpair *, srb_t *);
1339 extern int qla24xx_update_fcport_fcp_prio(scsi_qla_host_t *, fc_port_t *);
1340 +extern int qla24xx_async_abort_cmd(srb_t *, bool);
1341
1342 extern void qla2x00_set_fcport_state(fc_port_t *fcport, int state);
1343 extern fc_port_t *
1344 @@ -255,6 +256,7 @@ extern char *qla2x00_get_fw_version_str(struct scsi_qla_host *, char *);
1345
1346 extern void qla2x00_mark_device_lost(scsi_qla_host_t *, fc_port_t *, int, int);
1347 extern void qla2x00_mark_all_devices_lost(scsi_qla_host_t *, int);
1348 +extern int qla24xx_async_abort_cmd(srb_t *, bool);
1349
1350 extern struct fw_blob *qla2x00_request_firmware(scsi_qla_host_t *);
1351
1352 @@ -917,4 +919,5 @@ int qla2x00_set_data_rate(scsi_qla_host_t *vha, uint16_t mode);
1353
1354 /* nvme.c */
1355 void qla_nvme_unregister_remote_port(struct fc_port *fcport);
1356 +void qla_handle_els_plogi_done(scsi_qla_host_t *vha, struct event_arg *ea);
1357 #endif /* _QLA_GBL_H */
1358 diff --git a/drivers/scsi/qla2xxx/qla_gs.c b/drivers/scsi/qla2xxx/qla_gs.c
1359 index fc6e12fb7d77b..d9b5ea77fde99 100644
1360 --- a/drivers/scsi/qla2xxx/qla_gs.c
1361 +++ b/drivers/scsi/qla2xxx/qla_gs.c
1362 @@ -248,7 +248,7 @@ qla2x00_ga_nxt(scsi_qla_host_t *vha, fc_port_t *fcport)
1363 WWN_SIZE);
1364
1365 fcport->fc4_type = (ct_rsp->rsp.ga_nxt.fc4_types[2] & BIT_0) ?
1366 - FC4_TYPE_FCP_SCSI : FC4_TYPE_OTHER;
1367 + FS_FC4TYPE_FCP : FC4_TYPE_OTHER;
1368
1369 if (ct_rsp->rsp.ga_nxt.port_type != NS_N_PORT_TYPE &&
1370 ct_rsp->rsp.ga_nxt.port_type != NS_NL_PORT_TYPE)
1371 @@ -2887,7 +2887,7 @@ qla2x00_gff_id(scsi_qla_host_t *vha, sw_info_t *list)
1372 struct ct_sns_req *ct_req;
1373 struct ct_sns_rsp *ct_rsp;
1374 struct qla_hw_data *ha = vha->hw;
1375 - uint8_t fcp_scsi_features = 0;
1376 + uint8_t fcp_scsi_features = 0, nvme_features = 0;
1377 struct ct_arg arg;
1378
1379 for (i = 0; i < ha->max_fibre_devices; i++) {
1380 @@ -2933,14 +2933,19 @@ qla2x00_gff_id(scsi_qla_host_t *vha, sw_info_t *list)
1381 ct_rsp->rsp.gff_id.fc4_features[GFF_FCP_SCSI_OFFSET];
1382 fcp_scsi_features &= 0x0f;
1383
1384 - if (fcp_scsi_features)
1385 - list[i].fc4_type = FC4_TYPE_FCP_SCSI;
1386 - else
1387 - list[i].fc4_type = FC4_TYPE_OTHER;
1388 + if (fcp_scsi_features) {
1389 + list[i].fc4_type = FS_FC4TYPE_FCP;
1390 + list[i].fc4_features = fcp_scsi_features;
1391 + }
1392
1393 - list[i].fc4f_nvme =
1394 + nvme_features =
1395 ct_rsp->rsp.gff_id.fc4_features[GFF_NVME_OFFSET];
1396 - list[i].fc4f_nvme &= 0xf;
1397 + nvme_features &= 0xf;
1398 +
1399 + if (nvme_features) {
1400 + list[i].fc4_type |= FS_FC4TYPE_NVME;
1401 + list[i].fc4_features = nvme_features;
1402 + }
1403 }
1404
1405 /* Last device exit. */
1406 @@ -3435,6 +3440,8 @@ void qla24xx_async_gffid_sp_done(srb_t *sp, int res)
1407 fc_port_t *fcport = sp->fcport;
1408 struct ct_sns_rsp *ct_rsp;
1409 struct event_arg ea;
1410 + uint8_t fc4_scsi_feat;
1411 + uint8_t fc4_nvme_feat;
1412
1413 ql_dbg(ql_dbg_disc, vha, 0x2133,
1414 "Async done-%s res %x ID %x. %8phC\n",
1415 @@ -3442,24 +3449,25 @@ void qla24xx_async_gffid_sp_done(srb_t *sp, int res)
1416
1417 fcport->flags &= ~FCF_ASYNC_SENT;
1418 ct_rsp = &fcport->ct_desc.ct_sns->p.rsp;
1419 + fc4_scsi_feat = ct_rsp->rsp.gff_id.fc4_features[GFF_FCP_SCSI_OFFSET];
1420 + fc4_nvme_feat = ct_rsp->rsp.gff_id.fc4_features[GFF_NVME_OFFSET];
1421 +
1422 /*
1423 * FC-GS-7, 5.2.3.12 FC-4 Features - format
1424 * The format of the FC-4 Features object, as defined by the FC-4,
1425 * Shall be an array of 4-bit values, one for each type code value
1426 */
1427 if (!res) {
1428 - if (ct_rsp->rsp.gff_id.fc4_features[GFF_FCP_SCSI_OFFSET] & 0xf) {
1429 + if (fc4_scsi_feat & 0xf) {
1430 /* w1 b00:03 */
1431 - fcport->fc4_type =
1432 - ct_rsp->rsp.gff_id.fc4_features[GFF_FCP_SCSI_OFFSET];
1433 - fcport->fc4_type &= 0xf;
1434 - }
1435 + fcport->fc4_type = FS_FC4TYPE_FCP;
1436 + fcport->fc4_features = fc4_scsi_feat & 0xf;
1437 + }
1438
1439 - if (ct_rsp->rsp.gff_id.fc4_features[GFF_NVME_OFFSET] & 0xf) {
1440 + if (fc4_nvme_feat & 0xf) {
1441 /* w5 [00:03]/28h */
1442 - fcport->fc4f_nvme =
1443 - ct_rsp->rsp.gff_id.fc4_features[GFF_NVME_OFFSET];
1444 - fcport->fc4f_nvme &= 0xf;
1445 + fcport->fc4_type |= FS_FC4TYPE_NVME;
1446 + fcport->fc4_features = fc4_nvme_feat & 0xf;
1447 }
1448 }
1449
1450 @@ -4282,7 +4290,7 @@ int qla24xx_async_gnnid(scsi_qla_host_t *vha, fc_port_t *fcport)
1451 if (!vha->flags.online || (fcport->flags & FCF_ASYNC_SENT))
1452 return rval;
1453
1454 - fcport->disc_state = DSC_GNN_ID;
1455 + qla2x00_set_fcport_disc_state(fcport, DSC_GNN_ID);
1456 sp = qla2x00_get_sp(vha, fcport, GFP_ATOMIC);
1457 if (!sp)
1458 goto done;
1459 diff --git a/drivers/scsi/qla2xxx/qla_init.c b/drivers/scsi/qla2xxx/qla_init.c
1460 index b300e11095828..643b8ae36cbeb 100644
1461 --- a/drivers/scsi/qla2xxx/qla_init.c
1462 +++ b/drivers/scsi/qla2xxx/qla_init.c
1463 @@ -50,16 +50,9 @@ qla2x00_sp_timeout(struct timer_list *t)
1464 {
1465 srb_t *sp = from_timer(sp, t, u.iocb_cmd.timer);
1466 struct srb_iocb *iocb;
1467 - struct req_que *req;
1468 - unsigned long flags;
1469 - struct qla_hw_data *ha = sp->vha->hw;
1470
1471 - WARN_ON_ONCE(irqs_disabled());
1472 - spin_lock_irqsave(&ha->hardware_lock, flags);
1473 - req = sp->qpair->req;
1474 - req->outstanding_cmds[sp->handle] = NULL;
1475 + WARN_ON(irqs_disabled());
1476 iocb = &sp->u.iocb_cmd;
1477 - spin_unlock_irqrestore(&ha->hardware_lock, flags);
1478 iocb->timeout(sp);
1479 }
1480
1481 @@ -153,7 +146,7 @@ static void qla24xx_abort_sp_done(srb_t *sp, int res)
1482 sp->free(sp);
1483 }
1484
1485 -static int qla24xx_async_abort_cmd(srb_t *cmd_sp, bool wait)
1486 +int qla24xx_async_abort_cmd(srb_t *cmd_sp, bool wait)
1487 {
1488 scsi_qla_host_t *vha = cmd_sp->vha;
1489 struct srb_iocb *abt_iocb;
1490 @@ -253,6 +246,7 @@ qla2x00_async_iocb_timeout(void *data)
1491 case SRB_NACK_PRLI:
1492 case SRB_NACK_LOGO:
1493 case SRB_CTRL_VP:
1494 + default:
1495 rc = qla24xx_async_abort_cmd(sp, false);
1496 if (rc) {
1497 spin_lock_irqsave(sp->qpair->qp_lock_ptr, flags);
1498 @@ -269,10 +263,6 @@ qla2x00_async_iocb_timeout(void *data)
1499 sp->done(sp, QLA_FUNCTION_TIMEOUT);
1500 }
1501 break;
1502 - default:
1503 - WARN_ON_ONCE(true);
1504 - sp->done(sp, QLA_FUNCTION_TIMEOUT);
1505 - break;
1506 }
1507 }
1508
1509 @@ -337,10 +327,10 @@ qla2x00_async_login(struct scsi_qla_host *vha, fc_port_t *fcport,
1510 if (!sp)
1511 goto done;
1512
1513 + qla2x00_set_fcport_disc_state(fcport, DSC_LOGIN_PEND);
1514 fcport->flags |= FCF_ASYNC_SENT;
1515 fcport->logout_completed = 0;
1516
1517 - fcport->disc_state = DSC_LOGIN_PEND;
1518 sp->type = SRB_LOGIN_CMD;
1519 sp->name = "login";
1520 sp->gen1 = fcport->rscn_gen;
1521 @@ -356,7 +346,7 @@ qla2x00_async_login(struct scsi_qla_host *vha, fc_port_t *fcport,
1522 else
1523 lio->u.logio.flags |= SRB_LOGIN_COND_PLOGI;
1524
1525 - if (fcport->fc4f_nvme)
1526 + if (NVME_TARGET(vha->hw, fcport))
1527 lio->u.logio.flags |= SRB_LOGIN_SKIP_PRLI;
1528
1529 ql_dbg(ql_dbg_disc, vha, 0x2072,
1530 @@ -544,7 +534,7 @@ static int qla_post_els_plogi_work(struct scsi_qla_host *vha, fc_port_t *fcport)
1531
1532 e->u.fcport.fcport = fcport;
1533 fcport->flags |= FCF_ASYNC_ACTIVE;
1534 - fcport->disc_state = DSC_LOGIN_PEND;
1535 + qla2x00_set_fcport_disc_state(fcport, DSC_LOGIN_PEND);
1536 return qla2x00_post_work(vha, e);
1537 }
1538
1539 @@ -767,14 +757,12 @@ static void qla24xx_handle_gnl_done_event(scsi_qla_host_t *vha,
1540 fcport->fc4_type &= ~FS_FC4TYPE_NVME;
1541 }
1542
1543 -
1544 ql_dbg(ql_dbg_disc, vha, 0x20e2,
1545 - "%s found %8phC CLS [%x|%x] nvme %d ID[%02x%02x%02x|%02x%02x%02x] lid[%d|%d]\n",
1546 + "%s found %8phC CLS [%x|%x] fc4_type %d ID[%06x|%06x] lid[%d|%d]\n",
1547 __func__, fcport->port_name,
1548 e->current_login_state, fcport->fw_login_state,
1549 - fcport->fc4f_nvme, id.b.domain, id.b.area, id.b.al_pa,
1550 - fcport->d_id.b.domain, fcport->d_id.b.area,
1551 - fcport->d_id.b.al_pa, loop_id, fcport->loop_id);
1552 + fcport->fc4_type, id.b24, fcport->d_id.b24,
1553 + loop_id, fcport->loop_id);
1554
1555 switch (fcport->disc_state) {
1556 case DSC_DELETE_PEND:
1557 @@ -856,7 +844,8 @@ static void qla24xx_handle_gnl_done_event(scsi_qla_host_t *vha,
1558 * with GNL. Push disc_state back to DELETED
1559 * so GNL can go out again
1560 */
1561 - fcport->disc_state = DSC_DELETED;
1562 + qla2x00_set_fcport_disc_state(fcport,
1563 + DSC_DELETED);
1564 break;
1565 case DSC_LS_PRLI_COMP:
1566 if ((e->prli_svc_param_word_3[0] & BIT_4) == 0)
1567 @@ -932,7 +921,7 @@ static void qla24xx_handle_gnl_done_event(scsi_qla_host_t *vha,
1568 qla24xx_fcport_handle_login(vha, fcport);
1569 break;
1570 case ISP_CFG_N:
1571 - fcport->disc_state = DSC_DELETED;
1572 + qla2x00_set_fcport_disc_state(fcport, DSC_DELETED);
1573 if (time_after_eq(jiffies, fcport->dm_login_expire)) {
1574 if (fcport->n2n_link_reset_cnt < 2) {
1575 fcport->n2n_link_reset_cnt++;
1576 @@ -1102,7 +1091,7 @@ int qla24xx_async_gnl(struct scsi_qla_host *vha, fc_port_t *fcport)
1577
1578 spin_lock_irqsave(&vha->hw->tgt.sess_lock, flags);
1579 fcport->flags |= FCF_ASYNC_SENT;
1580 - fcport->disc_state = DSC_GNL;
1581 + qla2x00_set_fcport_disc_state(fcport, DSC_GNL);
1582 fcport->last_rscn_gen = fcport->rscn_gen;
1583 fcport->last_login_gen = fcport->login_gen;
1584
1585 @@ -1277,13 +1266,13 @@ qla24xx_async_prli(struct scsi_qla_host *vha, fc_port_t *fcport)
1586 sp->done = qla2x00_async_prli_sp_done;
1587 lio->u.logio.flags = 0;
1588
1589 - if (fcport->fc4f_nvme)
1590 + if (NVME_TARGET(vha->hw, fcport))
1591 lio->u.logio.flags |= SRB_LOGIN_NVME_PRLI;
1592
1593 ql_dbg(ql_dbg_disc, vha, 0x211b,
1594 "Async-prli - %8phC hdl=%x, loopid=%x portid=%06x retries=%d %s.\n",
1595 fcport->port_name, sp->handle, fcport->loop_id, fcport->d_id.b24,
1596 - fcport->login_retry, fcport->fc4f_nvme ? "nvme" : "fc");
1597 + fcport->login_retry, NVME_TARGET(vha->hw, fcport) ? "nvme" : "fc");
1598
1599 rval = qla2x00_start_sp(sp);
1600 if (rval != QLA_SUCCESS) {
1601 @@ -1332,12 +1321,12 @@ int qla24xx_async_gpdb(struct scsi_qla_host *vha, fc_port_t *fcport, u8 opt)
1602 return rval;
1603 }
1604
1605 - fcport->disc_state = DSC_GPDB;
1606 -
1607 sp = qla2x00_get_sp(vha, fcport, GFP_KERNEL);
1608 if (!sp)
1609 goto done;
1610
1611 + qla2x00_set_fcport_disc_state(fcport, DSC_GPDB);
1612 +
1613 fcport->flags |= FCF_ASYNC_SENT;
1614 sp->type = SRB_MB_IOCB;
1615 sp->name = "gpdb";
1616 @@ -1416,7 +1405,7 @@ void __qla24xx_handle_gpdb_event(scsi_qla_host_t *vha, struct event_arg *ea)
1617 ql_dbg(ql_dbg_disc, vha, 0x20d6,
1618 "%s %d %8phC session revalidate success\n",
1619 __func__, __LINE__, ea->fcport->port_name);
1620 - ea->fcport->disc_state = DSC_LOGIN_COMPLETE;
1621 + qla2x00_set_fcport_disc_state(ea->fcport, DSC_LOGIN_COMPLETE);
1622 }
1623 spin_unlock_irqrestore(&vha->hw->tgt.sess_lock, flags);
1624 }
1625 @@ -1434,14 +1423,14 @@ void qla24xx_handle_gpdb_event(scsi_qla_host_t *vha, struct event_arg *ea)
1626 fcport->flags &= ~FCF_ASYNC_SENT;
1627
1628 ql_dbg(ql_dbg_disc, vha, 0x20d2,
1629 - "%s %8phC DS %d LS %d nvme %x rc %d\n", __func__, fcport->port_name,
1630 - fcport->disc_state, pd->current_login_state, fcport->fc4f_nvme,
1631 - ea->rc);
1632 + "%s %8phC DS %d LS %d fc4_type %x rc %d\n", __func__,
1633 + fcport->port_name, fcport->disc_state, pd->current_login_state,
1634 + fcport->fc4_type, ea->rc);
1635
1636 if (fcport->disc_state == DSC_DELETE_PEND)
1637 return;
1638
1639 - if (fcport->fc4f_nvme)
1640 + if (NVME_TARGET(vha->hw, fcport))
1641 ls = pd->current_login_state >> 4;
1642 else
1643 ls = pd->current_login_state & 0xf;
1644 @@ -1470,7 +1459,7 @@ void qla24xx_handle_gpdb_event(scsi_qla_host_t *vha, struct event_arg *ea)
1645 /* Set discovery state back to GNL to Relogin attempt */
1646 if (qla_dual_mode_enabled(vha) ||
1647 qla_ini_mode_enabled(vha)) {
1648 - fcport->disc_state = DSC_GNL;
1649 + qla2x00_set_fcport_disc_state(fcport, DSC_GNL);
1650 set_bit(RELOGIN_NEEDED, &vha->dpc_flags);
1651 }
1652 return;
1653 @@ -1630,7 +1619,8 @@ int qla24xx_fcport_handle_login(struct scsi_qla_host *vha, fc_port_t *fcport)
1654 ql_dbg(ql_dbg_disc, vha, 0x2118,
1655 "%s %d %8phC post %s PRLI\n",
1656 __func__, __LINE__, fcport->port_name,
1657 - fcport->fc4f_nvme ? "NVME" : "FC");
1658 + NVME_TARGET(vha->hw, fcport) ? "NVME" :
1659 + "FC");
1660 qla24xx_post_prli_work(vha, fcport);
1661 }
1662 break;
1663 @@ -1757,6 +1747,15 @@ void qla24xx_handle_relogin_event(scsi_qla_host_t *vha,
1664 qla24xx_fcport_handle_login(vha, fcport);
1665 }
1666
1667 +void qla_handle_els_plogi_done(scsi_qla_host_t *vha,
1668 + struct event_arg *ea)
1669 +{
1670 + ql_dbg(ql_dbg_disc, vha, 0x2118,
1671 + "%s %d %8phC post PRLI\n",
1672 + __func__, __LINE__, ea->fcport->port_name);
1673 + qla24xx_post_prli_work(vha, ea->fcport);
1674 +}
1675 +
1676 /*
1677 * RSCN(s) came in for this fcport, but the RSCN(s) was not able
1678 * to be consumed by the fcport
1679 @@ -1785,9 +1784,23 @@ qla2x00_tmf_iocb_timeout(void *data)
1680 {
1681 srb_t *sp = data;
1682 struct srb_iocb *tmf = &sp->u.iocb_cmd;
1683 + int rc, h;
1684 + unsigned long flags;
1685
1686 - tmf->u.tmf.comp_status = CS_TIMEOUT;
1687 - complete(&tmf->u.tmf.comp);
1688 + rc = qla24xx_async_abort_cmd(sp, false);
1689 + if (rc) {
1690 + spin_lock_irqsave(sp->qpair->qp_lock_ptr, flags);
1691 + for (h = 1; h < sp->qpair->req->num_outstanding_cmds; h++) {
1692 + if (sp->qpair->req->outstanding_cmds[h] == sp) {
1693 + sp->qpair->req->outstanding_cmds[h] = NULL;
1694 + break;
1695 + }
1696 + }
1697 + spin_unlock_irqrestore(sp->qpair->qp_lock_ptr, flags);
1698 + tmf->u.tmf.comp_status = CS_TIMEOUT;
1699 + tmf->u.tmf.data = QLA_FUNCTION_FAILED;
1700 + complete(&tmf->u.tmf.comp);
1701 + }
1702 }
1703
1704 static void qla2x00_tmf_sp_done(srb_t *sp, int res)
1705 @@ -1916,12 +1929,20 @@ qla24xx_handle_prli_done_event(struct scsi_qla_host *vha, struct event_arg *ea)
1706 break;
1707 }
1708
1709 - if (ea->fcport->fc4f_nvme) {
1710 + /*
1711 + * Retry PRLI with other FC-4 type if failure occurred on dual
1712 + * FCP/NVMe port
1713 + */
1714 + if (NVME_FCP_TARGET(ea->fcport)) {
1715 ql_dbg(ql_dbg_disc, vha, 0x2118,
1716 - "%s %d %8phC post fc4 prli\n",
1717 - __func__, __LINE__, ea->fcport->port_name);
1718 - ea->fcport->fc4f_nvme = 0;
1719 - return;
1720 + "%s %d %8phC post %s prli\n",
1721 + __func__, __LINE__, ea->fcport->port_name,
1722 + (ea->fcport->fc4_type & FS_FC4TYPE_NVME) ?
1723 + "NVMe" : "FCP");
1724 + if (vha->hw->fc4_type_priority == FC4_PRIORITY_NVME)
1725 + ea->fcport->fc4_type &= ~FS_FC4TYPE_NVME;
1726 + else
1727 + ea->fcport->fc4_type &= ~FS_FC4TYPE_FCP;
1728 }
1729
1730 ea->fcport->flags &= ~FCF_ASYNC_SENT;
1731 @@ -1988,7 +2009,7 @@ qla24xx_handle_plogi_done_event(struct scsi_qla_host *vha, struct event_arg *ea)
1732 * force a relogin attempt via implicit LOGO, PLOGI, and PRLI
1733 * requests.
1734 */
1735 - if (ea->fcport->fc4f_nvme) {
1736 + if (NVME_TARGET(vha->hw, ea->fcport)) {
1737 ql_dbg(ql_dbg_disc, vha, 0x2117,
1738 "%s %d %8phC post prli\n",
1739 __func__, __LINE__, ea->fcport->port_name);
1740 @@ -2015,7 +2036,7 @@ qla24xx_handle_plogi_done_event(struct scsi_qla_host *vha, struct event_arg *ea)
1741 __func__, __LINE__, ea->fcport->port_name, ea->data[1]);
1742
1743 ea->fcport->flags &= ~FCF_ASYNC_SENT;
1744 - ea->fcport->disc_state = DSC_LOGIN_FAILED;
1745 + qla2x00_set_fcport_disc_state(ea->fcport, DSC_LOGIN_FAILED);
1746 if (ea->data[1] & QLA_LOGIO_LOGIN_RETRIED)
1747 set_bit(RELOGIN_NEEDED, &vha->dpc_flags);
1748 else
1749 @@ -5395,7 +5416,7 @@ qla2x00_update_fcport(scsi_qla_host_t *vha, fc_port_t *fcport)
1750 ql_dbg(ql_dbg_disc, vha, 0x20ef, "%s %8phC\n",
1751 __func__, fcport->port_name);
1752
1753 - fcport->disc_state = DSC_UPD_FCPORT;
1754 + qla2x00_set_fcport_disc_state(fcport, DSC_UPD_FCPORT);
1755 fcport->login_retry = vha->hw->login_retry_count;
1756 fcport->flags &= ~(FCF_LOGIN_NEEDED | FCF_ASYNC_SENT);
1757 fcport->deleted = 0;
1758 @@ -5413,9 +5434,9 @@ qla2x00_update_fcport(scsi_qla_host_t *vha, fc_port_t *fcport)
1759
1760 qla2x00_iidma_fcport(vha, fcport);
1761
1762 - if (fcport->fc4f_nvme) {
1763 + if (NVME_TARGET(vha->hw, fcport)) {
1764 qla_nvme_register_remote(vha, fcport);
1765 - fcport->disc_state = DSC_LOGIN_COMPLETE;
1766 + qla2x00_set_fcport_disc_state(fcport, DSC_LOGIN_COMPLETE);
1767 qla2x00_set_fcport_state(fcport, FCS_ONLINE);
1768 return;
1769 }
1770 @@ -5460,7 +5481,7 @@ qla2x00_update_fcport(scsi_qla_host_t *vha, fc_port_t *fcport)
1771 }
1772 }
1773
1774 - fcport->disc_state = DSC_LOGIN_COMPLETE;
1775 + qla2x00_set_fcport_disc_state(fcport, DSC_LOGIN_COMPLETE);
1776 }
1777
1778 void qla_register_fcport_fn(struct work_struct *work)
1779 @@ -5741,11 +5762,8 @@ qla2x00_find_all_fabric_devs(scsi_qla_host_t *vha)
1780 new_fcport->fc4_type = swl[swl_idx].fc4_type;
1781
1782 new_fcport->nvme_flag = 0;
1783 - new_fcport->fc4f_nvme = 0;
1784 if (vha->flags.nvme_enabled &&
1785 - swl[swl_idx].fc4f_nvme) {
1786 - new_fcport->fc4f_nvme =
1787 - swl[swl_idx].fc4f_nvme;
1788 + swl[swl_idx].fc4_type & FS_FC4TYPE_NVME) {
1789 ql_log(ql_log_info, vha, 0x2131,
1790 "FOUND: NVME port %8phC as FC Type 28h\n",
1791 new_fcport->port_name);
1792 @@ -5801,7 +5819,7 @@ qla2x00_find_all_fabric_devs(scsi_qla_host_t *vha)
1793
1794 /* Bypass ports whose FCP-4 type is not FCP_SCSI */
1795 if (ql2xgffidenable &&
1796 - (new_fcport->fc4_type != FC4_TYPE_FCP_SCSI &&
1797 + (!(new_fcport->fc4_type & FS_FC4TYPE_FCP) &&
1798 new_fcport->fc4_type != FC4_TYPE_UNKNOWN))
1799 continue;
1800
1801 @@ -5870,9 +5888,9 @@ qla2x00_find_all_fabric_devs(scsi_qla_host_t *vha)
1802 break;
1803 }
1804
1805 - if (fcport->fc4f_nvme) {
1806 + if (NVME_TARGET(vha->hw, fcport)) {
1807 if (fcport->disc_state == DSC_DELETE_PEND) {
1808 - fcport->disc_state = DSC_GNL;
1809 + qla2x00_set_fcport_disc_state(fcport, DSC_GNL);
1810 vha->fcport_count--;
1811 fcport->login_succ = 0;
1812 }
1813 @@ -8545,6 +8563,11 @@ qla81xx_nvram_config(scsi_qla_host_t *vha)
1814 /* N2N: driver will initiate Login instead of FW */
1815 icb->firmware_options_3 |= BIT_8;
1816
1817 + /* Determine NVMe/FCP priority for target ports */
1818 + ha->fc4_type_priority = qla2xxx_get_fc4_priority(vha);
1819 + ql_log(ql_log_info, vha, 0xffff, "FC4 priority set to %s\n",
1820 + ha->fc4_type_priority & BIT_0 ? "FCP" : "NVMe");
1821 +
1822 if (rval) {
1823 ql_log(ql_log_warn, vha, 0x0076,
1824 "NVRAM configuration failed.\n");
1825 diff --git a/drivers/scsi/qla2xxx/qla_inline.h b/drivers/scsi/qla2xxx/qla_inline.h
1826 index 6dfde42d799b5..477b0b8a5f4bc 100644
1827 --- a/drivers/scsi/qla2xxx/qla_inline.h
1828 +++ b/drivers/scsi/qla2xxx/qla_inline.h
1829 @@ -105,6 +105,30 @@ qla2x00_clean_dsd_pool(struct qla_hw_data *ha, struct crc_context *ctx)
1830 INIT_LIST_HEAD(&ctx->dsd_list);
1831 }
1832
1833 +static inline void
1834 +qla2x00_set_fcport_disc_state(fc_port_t *fcport, int state)
1835 +{
1836 + int old_val;
1837 + uint8_t shiftbits, mask;
1838 +
1839 + /* This will have to change when the max no. of states > 16 */
1840 + shiftbits = 4;
1841 + mask = (1 << shiftbits) - 1;
1842 +
1843 + fcport->disc_state = state;
1844 + while (1) {
1845 + old_val = atomic_read(&fcport->shadow_disc_state);
1846 + if (old_val == atomic_cmpxchg(&fcport->shadow_disc_state,
1847 + old_val, (old_val << shiftbits) | state)) {
1848 + ql_dbg(ql_dbg_disc, fcport->vha, 0x2134,
1849 + "FCPort %8phC disc_state transition: %s to %s - portid=%06x.\n",
1850 + fcport->port_name, port_dstate_str[old_val & mask],
1851 + port_dstate_str[state], fcport->d_id.b24);
1852 + return;
1853 + }
1854 + }
1855 +}
1856 +
1857 static inline int
1858 qla2x00_hba_err_chk_enabled(srb_t *sp)
1859 {
1860 @@ -312,3 +336,15 @@ qla_83xx_start_iocbs(struct qla_qpair *qpair)
1861
1862 WRT_REG_DWORD(req->req_q_in, req->ring_index);
1863 }
1864 +
1865 +static inline int
1866 +qla2xxx_get_fc4_priority(struct scsi_qla_host *vha)
1867 +{
1868 + uint32_t data;
1869 +
1870 + data =
1871 + ((uint8_t *)vha->hw->nvram)[NVRAM_DUAL_FCP_NVME_FLAG_OFFSET];
1872 +
1873 +
1874 + return ((data >> 6) & BIT_0);
1875 +}
1876 diff --git a/drivers/scsi/qla2xxx/qla_iocb.c b/drivers/scsi/qla2xxx/qla_iocb.c
1877 index aed4ce66e6cf9..936103604d02d 100644
1878 --- a/drivers/scsi/qla2xxx/qla_iocb.c
1879 +++ b/drivers/scsi/qla2xxx/qla_iocb.c
1880 @@ -2537,13 +2537,32 @@ qla2x00_els_dcmd_iocb_timeout(void *data)
1881 fc_port_t *fcport = sp->fcport;
1882 struct scsi_qla_host *vha = sp->vha;
1883 struct srb_iocb *lio = &sp->u.iocb_cmd;
1884 + unsigned long flags = 0;
1885 + int res, h;
1886
1887 ql_dbg(ql_dbg_io, vha, 0x3069,
1888 "%s Timeout, hdl=%x, portid=%02x%02x%02x\n",
1889 sp->name, sp->handle, fcport->d_id.b.domain, fcport->d_id.b.area,
1890 fcport->d_id.b.al_pa);
1891
1892 - complete(&lio->u.els_logo.comp);
1893 + /* Abort the exchange */
1894 + res = qla24xx_async_abort_cmd(sp, false);
1895 + if (res) {
1896 + ql_dbg(ql_dbg_io, vha, 0x3070,
1897 + "mbx abort_command failed.\n");
1898 + spin_lock_irqsave(sp->qpair->qp_lock_ptr, flags);
1899 + for (h = 1; h < sp->qpair->req->num_outstanding_cmds; h++) {
1900 + if (sp->qpair->req->outstanding_cmds[h] == sp) {
1901 + sp->qpair->req->outstanding_cmds[h] = NULL;
1902 + break;
1903 + }
1904 + }
1905 + spin_unlock_irqrestore(sp->qpair->qp_lock_ptr, flags);
1906 + complete(&lio->u.els_logo.comp);
1907 + } else {
1908 + ql_dbg(ql_dbg_io, vha, 0x3071,
1909 + "mbx abort_command success.\n");
1910 + }
1911 }
1912
1913 static void qla2x00_els_dcmd_sp_done(srb_t *sp, int res)
1914 @@ -2708,23 +2727,29 @@ qla2x00_els_dcmd2_iocb_timeout(void *data)
1915 srb_t *sp = data;
1916 fc_port_t *fcport = sp->fcport;
1917 struct scsi_qla_host *vha = sp->vha;
1918 - struct qla_hw_data *ha = vha->hw;
1919 unsigned long flags = 0;
1920 - int res;
1921 + int res, h;
1922
1923 ql_dbg(ql_dbg_io + ql_dbg_disc, vha, 0x3069,
1924 "%s hdl=%x ELS Timeout, %8phC portid=%06x\n",
1925 sp->name, sp->handle, fcport->port_name, fcport->d_id.b24);
1926
1927 /* Abort the exchange */
1928 - spin_lock_irqsave(&ha->hardware_lock, flags);
1929 - res = ha->isp_ops->abort_command(sp);
1930 + res = qla24xx_async_abort_cmd(sp, false);
1931 ql_dbg(ql_dbg_io, vha, 0x3070,
1932 "mbx abort_command %s\n",
1933 (res == QLA_SUCCESS) ? "successful" : "failed");
1934 - spin_unlock_irqrestore(&ha->hardware_lock, flags);
1935 -
1936 - sp->done(sp, QLA_FUNCTION_TIMEOUT);
1937 + if (res) {
1938 + spin_lock_irqsave(sp->qpair->qp_lock_ptr, flags);
1939 + for (h = 1; h < sp->qpair->req->num_outstanding_cmds; h++) {
1940 + if (sp->qpair->req->outstanding_cmds[h] == sp) {
1941 + sp->qpair->req->outstanding_cmds[h] = NULL;
1942 + break;
1943 + }
1944 + }
1945 + spin_unlock_irqrestore(sp->qpair->qp_lock_ptr, flags);
1946 + sp->done(sp, QLA_FUNCTION_TIMEOUT);
1947 + }
1948 }
1949
1950 void qla2x00_els_dcmd2_free(scsi_qla_host_t *vha, struct els_plogi *els_plogi)
1951 @@ -2769,9 +2794,8 @@ static void qla2x00_els_dcmd2_sp_done(srb_t *sp, int res)
1952 case CS_COMPLETE:
1953 memset(&ea, 0, sizeof(ea));
1954 ea.fcport = fcport;
1955 - ea.data[0] = MBS_COMMAND_COMPLETE;
1956 - ea.sp = sp;
1957 - qla24xx_handle_plogi_done_event(vha, &ea);
1958 + ea.rc = res;
1959 + qla_handle_els_plogi_done(vha, &ea);
1960 break;
1961
1962 case CS_IOCB_ERROR:
1963 @@ -2844,7 +2868,8 @@ static void qla2x00_els_dcmd2_sp_done(srb_t *sp, int res)
1964 fw_status[0], fw_status[1], fw_status[2]);
1965
1966 fcport->flags &= ~FCF_ASYNC_SENT;
1967 - fcport->disc_state = DSC_LOGIN_FAILED;
1968 + qla2x00_set_fcport_disc_state(fcport,
1969 + DSC_LOGIN_FAILED);
1970 set_bit(RELOGIN_NEEDED, &vha->dpc_flags);
1971 break;
1972 }
1973 @@ -2857,7 +2882,7 @@ static void qla2x00_els_dcmd2_sp_done(srb_t *sp, int res)
1974 fw_status[0], fw_status[1], fw_status[2]);
1975
1976 sp->fcport->flags &= ~FCF_ASYNC_SENT;
1977 - sp->fcport->disc_state = DSC_LOGIN_FAILED;
1978 + qla2x00_set_fcport_disc_state(fcport, DSC_LOGIN_FAILED);
1979 set_bit(RELOGIN_NEEDED, &vha->dpc_flags);
1980 break;
1981 }
1982 @@ -2894,7 +2919,7 @@ qla24xx_els_dcmd2_iocb(scsi_qla_host_t *vha, int els_opcode,
1983 }
1984
1985 fcport->flags |= FCF_ASYNC_SENT;
1986 - fcport->disc_state = DSC_LOGIN_PEND;
1987 + qla2x00_set_fcport_disc_state(fcport, DSC_LOGIN_PEND);
1988 elsio = &sp->u.iocb_cmd;
1989 ql_dbg(ql_dbg_io, vha, 0x3073,
1990 "Enter: PLOGI portid=%06x\n", fcport->d_id.b24);
1991 diff --git a/drivers/scsi/qla2xxx/qla_mbx.c b/drivers/scsi/qla2xxx/qla_mbx.c
1992 index c1631e42d35d1..098388a12febc 100644
1993 --- a/drivers/scsi/qla2xxx/qla_mbx.c
1994 +++ b/drivers/scsi/qla2xxx/qla_mbx.c
1995 @@ -1924,7 +1924,7 @@ qla2x00_get_port_database(scsi_qla_host_t *vha, fc_port_t *fcport, uint8_t opt)
1996 pd24 = (struct port_database_24xx *) pd;
1997
1998 /* Check for logged in state. */
1999 - if (fcport->fc4f_nvme) {
2000 + if (NVME_TARGET(ha, fcport)) {
2001 current_login_state = pd24->current_login_state >> 4;
2002 last_login_state = pd24->last_login_state >> 4;
2003 } else {
2004 @@ -3891,8 +3891,9 @@ qla24xx_report_id_acquisition(scsi_qla_host_t *vha,
2005 fcport->scan_state = QLA_FCPORT_FOUND;
2006 fcport->n2n_flag = 1;
2007 fcport->keep_nport_handle = 1;
2008 + fcport->fc4_type = FS_FC4TYPE_FCP;
2009 if (vha->flags.nvme_enabled)
2010 - fcport->fc4f_nvme = 1;
2011 + fcport->fc4_type |= FS_FC4TYPE_NVME;
2012
2013 switch (fcport->disc_state) {
2014 case DSC_DELETED:
2015 @@ -6350,7 +6351,7 @@ int __qla24xx_parse_gpdb(struct scsi_qla_host *vha, fc_port_t *fcport,
2016 uint64_t zero = 0;
2017 u8 current_login_state, last_login_state;
2018
2019 - if (fcport->fc4f_nvme) {
2020 + if (NVME_TARGET(vha->hw, fcport)) {
2021 current_login_state = pd->current_login_state >> 4;
2022 last_login_state = pd->last_login_state >> 4;
2023 } else {
2024 @@ -6385,8 +6386,8 @@ int __qla24xx_parse_gpdb(struct scsi_qla_host *vha, fc_port_t *fcport,
2025 fcport->d_id.b.al_pa = pd->port_id[2];
2026 fcport->d_id.b.rsvd_1 = 0;
2027
2028 - if (fcport->fc4f_nvme) {
2029 - fcport->port_type = 0;
2030 + if (NVME_TARGET(vha->hw, fcport)) {
2031 + fcport->port_type = FCT_NVME;
2032 if ((pd->prli_svc_param_word_3[0] & BIT_5) == 0)
2033 fcport->port_type |= FCT_NVME_INITIATOR;
2034 if ((pd->prli_svc_param_word_3[0] & BIT_4) == 0)
2035 diff --git a/drivers/scsi/qla2xxx/qla_os.c b/drivers/scsi/qla2xxx/qla_os.c
2036 index 67b1e74fcd1e6..af8306a9777fc 100644
2037 --- a/drivers/scsi/qla2xxx/qla_os.c
2038 +++ b/drivers/scsi/qla2xxx/qla_os.c
2039 @@ -5014,7 +5014,7 @@ void qla24xx_sched_upd_fcport(fc_port_t *fcport)
2040 fcport->jiffies_at_registration = jiffies;
2041 fcport->sec_since_registration = 0;
2042 fcport->next_disc_state = DSC_DELETED;
2043 - fcport->disc_state = DSC_UPD_FCPORT;
2044 + qla2x00_set_fcport_disc_state(fcport, DSC_UPD_FCPORT);
2045 spin_unlock_irqrestore(&fcport->vha->work_lock, flags);
2046
2047 queue_work(system_unbound_wq, &fcport->reg_work);
2048 @@ -5055,19 +5055,17 @@ void qla24xx_create_new_sess(struct scsi_qla_host *vha, struct qla_work_evt *e)
2049 fcport->d_id = e->u.new_sess.id;
2050 fcport->flags |= FCF_FABRIC_DEVICE;
2051 fcport->fw_login_state = DSC_LS_PLOGI_PEND;
2052 - if (e->u.new_sess.fc4_type == FS_FC4TYPE_FCP)
2053 - fcport->fc4_type = FC4_TYPE_FCP_SCSI;
2054 -
2055 - if (e->u.new_sess.fc4_type == FS_FC4TYPE_NVME) {
2056 - fcport->fc4_type = FC4_TYPE_OTHER;
2057 - fcport->fc4f_nvme = FC4_TYPE_NVME;
2058 - }
2059
2060 memcpy(fcport->port_name, e->u.new_sess.port_name,
2061 WWN_SIZE);
2062
2063 - if (e->u.new_sess.fc4_type & FS_FCP_IS_N2N)
2064 + fcport->fc4_type = e->u.new_sess.fc4_type;
2065 + if (e->u.new_sess.fc4_type & FS_FCP_IS_N2N) {
2066 + fcport->fc4_type = FS_FC4TYPE_FCP;
2067 fcport->n2n_flag = 1;
2068 + if (vha->flags.nvme_enabled)
2069 + fcport->fc4_type |= FS_FC4TYPE_NVME;
2070 + }
2071
2072 } else {
2073 ql_dbg(ql_dbg_disc, vha, 0xffff,
2074 @@ -5171,7 +5169,8 @@ void qla24xx_create_new_sess(struct scsi_qla_host *vha, struct qla_work_evt *e)
2075 fcport->flags &= ~FCF_FABRIC_DEVICE;
2076 fcport->keep_nport_handle = 1;
2077 if (vha->flags.nvme_enabled) {
2078 - fcport->fc4f_nvme = 1;
2079 + fcport->fc4_type =
2080 + (FS_FC4TYPE_NVME | FS_FC4TYPE_FCP);
2081 fcport->n2n_flag = 1;
2082 }
2083 fcport->fw_login_state = 0;
2084 diff --git a/drivers/scsi/qla2xxx/qla_target.c b/drivers/scsi/qla2xxx/qla_target.c
2085 index 8fd0a568303b5..509539ec58e93 100644
2086 --- a/drivers/scsi/qla2xxx/qla_target.c
2087 +++ b/drivers/scsi/qla2xxx/qla_target.c
2088 @@ -596,7 +596,8 @@ static void qla2x00_async_nack_sp_done(srb_t *sp, int res)
2089 spin_lock_irqsave(&vha->hw->tgt.sess_lock, flags);
2090 } else {
2091 sp->fcport->login_retry = 0;
2092 - sp->fcport->disc_state = DSC_LOGIN_COMPLETE;
2093 + qla2x00_set_fcport_disc_state(sp->fcport,
2094 + DSC_LOGIN_COMPLETE);
2095 sp->fcport->deleted = 0;
2096 sp->fcport->logout_on_delete = 1;
2097 }
2098 @@ -1056,7 +1057,7 @@ void qlt_free_session_done(struct work_struct *work)
2099 tgt->sess_count--;
2100 }
2101
2102 - sess->disc_state = DSC_DELETED;
2103 + qla2x00_set_fcport_disc_state(sess, DSC_DELETED);
2104 sess->fw_login_state = DSC_LS_PORT_UNAVAIL;
2105 sess->deleted = QLA_SESS_DELETED;
2106
2107 @@ -1166,7 +1167,7 @@ void qlt_unreg_sess(struct fc_port *sess)
2108 vha->hw->tgt.tgt_ops->clear_nacl_from_fcport_map(sess);
2109
2110 sess->deleted = QLA_SESS_DELETION_IN_PROGRESS;
2111 - sess->disc_state = DSC_DELETE_PEND;
2112 + qla2x00_set_fcport_disc_state(sess, DSC_DELETE_PEND);
2113 sess->last_rscn_gen = sess->rscn_gen;
2114 sess->last_login_gen = sess->login_gen;
2115
2116 @@ -1268,7 +1269,7 @@ void qlt_schedule_sess_for_deletion(struct fc_port *sess)
2117 spin_unlock_irqrestore(&sess->vha->work_lock, flags);
2118
2119 sess->prli_pend_timer = 0;
2120 - sess->disc_state = DSC_DELETE_PEND;
2121 + qla2x00_set_fcport_disc_state(sess, DSC_DELETE_PEND);
2122
2123 qla24xx_chk_fcp_state(sess);
2124
2125 @@ -6061,7 +6062,7 @@ static fc_port_t *qlt_get_port_database(struct scsi_qla_host *vha,
2126 if (!IS_SW_RESV_ADDR(fcport->d_id))
2127 vha->fcport_count++;
2128 fcport->login_gen++;
2129 - fcport->disc_state = DSC_LOGIN_COMPLETE;
2130 + qla2x00_set_fcport_disc_state(fcport, DSC_LOGIN_COMPLETE);
2131 fcport->login_succ = 1;
2132 newfcport = 1;
2133 }
2134 diff --git a/drivers/scsi/scsi_transport_srp.c b/drivers/scsi/scsi_transport_srp.c
2135 index 8cd0a87764dfd..9fee851c23a56 100644
2136 --- a/drivers/scsi/scsi_transport_srp.c
2137 +++ b/drivers/scsi/scsi_transport_srp.c
2138 @@ -541,7 +541,7 @@ int srp_reconnect_rport(struct srp_rport *rport)
2139 res = mutex_lock_interruptible(&rport->mutex);
2140 if (res)
2141 goto out;
2142 - if (rport->state != SRP_RPORT_FAIL_FAST)
2143 + if (rport->state != SRP_RPORT_FAIL_FAST && rport->state != SRP_RPORT_LOST)
2144 /*
2145 * sdev state must be SDEV_TRANSPORT_OFFLINE, transition
2146 * to SDEV_BLOCK is illegal. Calling scsi_target_unblock()
2147 diff --git a/drivers/vfio/pci/vfio_pci.c b/drivers/vfio/pci/vfio_pci.c
2148 index 2372e161cd5e8..a603f363835c4 100644
2149 --- a/drivers/vfio/pci/vfio_pci.c
2150 +++ b/drivers/vfio/pci/vfio_pci.c
2151 @@ -1474,6 +1474,8 @@ static int vfio_pci_mmap(void *device_data, struct vm_area_struct *vma)
2152
2153 index = vma->vm_pgoff >> (VFIO_PCI_OFFSET_SHIFT - PAGE_SHIFT);
2154
2155 + if (index >= VFIO_PCI_NUM_REGIONS + vdev->num_regions)
2156 + return -EINVAL;
2157 if (vma->vm_end < vma->vm_start)
2158 return -EINVAL;
2159 if ((vma->vm_flags & VM_SHARED) == 0)
2160 @@ -1482,7 +1484,7 @@ static int vfio_pci_mmap(void *device_data, struct vm_area_struct *vma)
2161 int regnum = index - VFIO_PCI_NUM_REGIONS;
2162 struct vfio_pci_region *region = vdev->region + regnum;
2163
2164 - if (region && region->ops && region->ops->mmap &&
2165 + if (region->ops && region->ops->mmap &&
2166 (region->flags & VFIO_REGION_INFO_FLAG_MMAP))
2167 return region->ops->mmap(vdev, region, vma);
2168 return -EINVAL;
2169 diff --git a/fs/readdir.c b/fs/readdir.c
2170 index de2eceffdee8b..07a3b5baa4047 100644
2171 --- a/fs/readdir.c
2172 +++ b/fs/readdir.c
2173 @@ -150,6 +150,9 @@ static int fillonedir(struct dir_context *ctx, const char *name, int namlen,
2174
2175 if (buf->result)
2176 return -EINVAL;
2177 + buf->result = verify_dirent_name(name, namlen);
2178 + if (buf->result < 0)
2179 + return buf->result;
2180 d_ino = ino;
2181 if (sizeof(d_ino) < sizeof(ino) && d_ino != ino) {
2182 buf->result = -EOVERFLOW;
2183 @@ -417,6 +420,9 @@ static int compat_fillonedir(struct dir_context *ctx, const char *name,
2184
2185 if (buf->result)
2186 return -EINVAL;
2187 + buf->result = verify_dirent_name(name, namlen);
2188 + if (buf->result < 0)
2189 + return buf->result;
2190 d_ino = ino;
2191 if (sizeof(d_ino) < sizeof(ino) && d_ino != ino) {
2192 buf->result = -EOVERFLOW;
2193 diff --git a/include/linux/marvell_phy.h b/include/linux/marvell_phy.h
2194 index af6b11d4d6737..1847a07842437 100644
2195 --- a/include/linux/marvell_phy.h
2196 +++ b/include/linux/marvell_phy.h
2197 @@ -23,11 +23,12 @@
2198 #define MARVELL_PHY_ID_88X3310 0x002b09a0
2199 #define MARVELL_PHY_ID_88E2110 0x002b09b0
2200
2201 -/* The MV88e6390 Ethernet switch contains embedded PHYs. These PHYs do
2202 +/* These Ethernet switch families contain embedded PHYs, but they do
2203 * not have a model ID. So the switch driver traps reads to the ID2
2204 * register and returns the switch family ID
2205 */
2206 -#define MARVELL_PHY_ID_88E6390 0x01410f90
2207 +#define MARVELL_PHY_ID_88E6341_FAMILY 0x01410f41
2208 +#define MARVELL_PHY_ID_88E6390_FAMILY 0x01410f90
2209
2210 #define MARVELL_PHY_FAMILY_ID(id) ((id) >> 4)
2211
2212 diff --git a/include/linux/netfilter_arp/arp_tables.h b/include/linux/netfilter_arp/arp_tables.h
2213 index e98028f00e479..6988cf9ffe3ae 100644
2214 --- a/include/linux/netfilter_arp/arp_tables.h
2215 +++ b/include/linux/netfilter_arp/arp_tables.h
2216 @@ -52,8 +52,9 @@ extern void *arpt_alloc_initial_table(const struct xt_table *);
2217 int arpt_register_table(struct net *net, const struct xt_table *table,
2218 const struct arpt_replace *repl,
2219 const struct nf_hook_ops *ops, struct xt_table **res);
2220 -void arpt_unregister_table(struct net *net, struct xt_table *table,
2221 - const struct nf_hook_ops *ops);
2222 +void arpt_unregister_table(struct net *net, struct xt_table *table);
2223 +void arpt_unregister_table_pre_exit(struct net *net, struct xt_table *table,
2224 + const struct nf_hook_ops *ops);
2225 extern unsigned int arpt_do_table(struct sk_buff *skb,
2226 const struct nf_hook_state *state,
2227 struct xt_table *table);
2228 diff --git a/include/linux/netfilter_bridge/ebtables.h b/include/linux/netfilter_bridge/ebtables.h
2229 index 162f59d0d17a2..db472c9cd8e9d 100644
2230 --- a/include/linux/netfilter_bridge/ebtables.h
2231 +++ b/include/linux/netfilter_bridge/ebtables.h
2232 @@ -110,8 +110,9 @@ extern int ebt_register_table(struct net *net,
2233 const struct ebt_table *table,
2234 const struct nf_hook_ops *ops,
2235 struct ebt_table **res);
2236 -extern void ebt_unregister_table(struct net *net, struct ebt_table *table,
2237 - const struct nf_hook_ops *);
2238 +extern void ebt_unregister_table(struct net *net, struct ebt_table *table);
2239 +void ebt_unregister_table_pre_exit(struct net *net, const char *tablename,
2240 + const struct nf_hook_ops *ops);
2241 extern unsigned int ebt_do_table(struct sk_buff *skb,
2242 const struct nf_hook_state *state,
2243 struct ebt_table *table);
2244 diff --git a/kernel/locking/lockdep.c b/kernel/locking/lockdep.c
2245 index bca0f7f71cde4..7429f15717559 100644
2246 --- a/kernel/locking/lockdep.c
2247 +++ b/kernel/locking/lockdep.c
2248 @@ -875,7 +875,8 @@ static bool assign_lock_key(struct lockdep_map *lock)
2249 /* Debug-check: all keys must be persistent! */
2250 debug_locks_off();
2251 pr_err("INFO: trying to register non-static key.\n");
2252 - pr_err("the code is fine but needs lockdep annotation.\n");
2253 + pr_err("The code is fine but needs lockdep annotation, or maybe\n");
2254 + pr_err("you didn't initialize this object before use?\n");
2255 pr_err("turning off the locking correctness validator.\n");
2256 dump_stack();
2257 return false;
2258 diff --git a/net/bridge/netfilter/ebtable_broute.c b/net/bridge/netfilter/ebtable_broute.c
2259 index 66e7af1654943..32bc2821027f3 100644
2260 --- a/net/bridge/netfilter/ebtable_broute.c
2261 +++ b/net/bridge/netfilter/ebtable_broute.c
2262 @@ -105,14 +105,20 @@ static int __net_init broute_net_init(struct net *net)
2263 &net->xt.broute_table);
2264 }
2265
2266 +static void __net_exit broute_net_pre_exit(struct net *net)
2267 +{
2268 + ebt_unregister_table_pre_exit(net, "broute", &ebt_ops_broute);
2269 +}
2270 +
2271 static void __net_exit broute_net_exit(struct net *net)
2272 {
2273 - ebt_unregister_table(net, net->xt.broute_table, &ebt_ops_broute);
2274 + ebt_unregister_table(net, net->xt.broute_table);
2275 }
2276
2277 static struct pernet_operations broute_net_ops = {
2278 .init = broute_net_init,
2279 .exit = broute_net_exit,
2280 + .pre_exit = broute_net_pre_exit,
2281 };
2282
2283 static int __init ebtable_broute_init(void)
2284 diff --git a/net/bridge/netfilter/ebtable_filter.c b/net/bridge/netfilter/ebtable_filter.c
2285 index 78cb9b21022d0..bcf982e12f16b 100644
2286 --- a/net/bridge/netfilter/ebtable_filter.c
2287 +++ b/net/bridge/netfilter/ebtable_filter.c
2288 @@ -99,14 +99,20 @@ static int __net_init frame_filter_net_init(struct net *net)
2289 &net->xt.frame_filter);
2290 }
2291
2292 +static void __net_exit frame_filter_net_pre_exit(struct net *net)
2293 +{
2294 + ebt_unregister_table_pre_exit(net, "filter", ebt_ops_filter);
2295 +}
2296 +
2297 static void __net_exit frame_filter_net_exit(struct net *net)
2298 {
2299 - ebt_unregister_table(net, net->xt.frame_filter, ebt_ops_filter);
2300 + ebt_unregister_table(net, net->xt.frame_filter);
2301 }
2302
2303 static struct pernet_operations frame_filter_net_ops = {
2304 .init = frame_filter_net_init,
2305 .exit = frame_filter_net_exit,
2306 + .pre_exit = frame_filter_net_pre_exit,
2307 };
2308
2309 static int __init ebtable_filter_init(void)
2310 diff --git a/net/bridge/netfilter/ebtable_nat.c b/net/bridge/netfilter/ebtable_nat.c
2311 index 0888936ef8537..0d092773f8161 100644
2312 --- a/net/bridge/netfilter/ebtable_nat.c
2313 +++ b/net/bridge/netfilter/ebtable_nat.c
2314 @@ -99,14 +99,20 @@ static int __net_init frame_nat_net_init(struct net *net)
2315 &net->xt.frame_nat);
2316 }
2317
2318 +static void __net_exit frame_nat_net_pre_exit(struct net *net)
2319 +{
2320 + ebt_unregister_table_pre_exit(net, "nat", ebt_ops_nat);
2321 +}
2322 +
2323 static void __net_exit frame_nat_net_exit(struct net *net)
2324 {
2325 - ebt_unregister_table(net, net->xt.frame_nat, ebt_ops_nat);
2326 + ebt_unregister_table(net, net->xt.frame_nat);
2327 }
2328
2329 static struct pernet_operations frame_nat_net_ops = {
2330 .init = frame_nat_net_init,
2331 .exit = frame_nat_net_exit,
2332 + .pre_exit = frame_nat_net_pre_exit,
2333 };
2334
2335 static int __init ebtable_nat_init(void)
2336 diff --git a/net/bridge/netfilter/ebtables.c b/net/bridge/netfilter/ebtables.c
2337 index e1256e03a9a86..d9375c52f50e6 100644
2338 --- a/net/bridge/netfilter/ebtables.c
2339 +++ b/net/bridge/netfilter/ebtables.c
2340 @@ -1237,10 +1237,34 @@ out:
2341 return ret;
2342 }
2343
2344 -void ebt_unregister_table(struct net *net, struct ebt_table *table,
2345 - const struct nf_hook_ops *ops)
2346 +static struct ebt_table *__ebt_find_table(struct net *net, const char *name)
2347 +{
2348 + struct ebt_table *t;
2349 +
2350 + mutex_lock(&ebt_mutex);
2351 +
2352 + list_for_each_entry(t, &net->xt.tables[NFPROTO_BRIDGE], list) {
2353 + if (strcmp(t->name, name) == 0) {
2354 + mutex_unlock(&ebt_mutex);
2355 + return t;
2356 + }
2357 + }
2358 +
2359 + mutex_unlock(&ebt_mutex);
2360 + return NULL;
2361 +}
2362 +
2363 +void ebt_unregister_table_pre_exit(struct net *net, const char *name, const struct nf_hook_ops *ops)
2364 +{
2365 + struct ebt_table *table = __ebt_find_table(net, name);
2366 +
2367 + if (table)
2368 + nf_unregister_net_hooks(net, ops, hweight32(table->valid_hooks));
2369 +}
2370 +EXPORT_SYMBOL(ebt_unregister_table_pre_exit);
2371 +
2372 +void ebt_unregister_table(struct net *net, struct ebt_table *table)
2373 {
2374 - nf_unregister_net_hooks(net, ops, hweight32(table->valid_hooks));
2375 __ebt_unregister_table(net, table);
2376 }
2377
2378 diff --git a/net/core/dev.c b/net/core/dev.c
2379 index 2ec21380f86d9..91909e5d6807e 100644
2380 --- a/net/core/dev.c
2381 +++ b/net/core/dev.c
2382 @@ -5406,7 +5406,8 @@ static void skb_gro_reset_offset(struct sk_buff *skb)
2383
2384 if (skb_mac_header(skb) == skb_tail_pointer(skb) &&
2385 pinfo->nr_frags &&
2386 - !PageHighMem(skb_frag_page(frag0))) {
2387 + !PageHighMem(skb_frag_page(frag0)) &&
2388 + (!NET_IP_ALIGN || !(skb_frag_off(frag0) & 3))) {
2389 NAPI_GRO_CB(skb)->frag0 = skb_frag_address(frag0);
2390 NAPI_GRO_CB(skb)->frag0_len = min_t(unsigned int,
2391 skb_frag_size(frag0),
2392 diff --git a/net/core/neighbour.c b/net/core/neighbour.c
2393 index 7080d708b7d08..6635b83113f8f 100644
2394 --- a/net/core/neighbour.c
2395 +++ b/net/core/neighbour.c
2396 @@ -1379,7 +1379,7 @@ static int __neigh_update(struct neighbour *neigh, const u8 *lladdr,
2397 * we can reinject the packet there.
2398 */
2399 n2 = NULL;
2400 - if (dst) {
2401 + if (dst && dst->obsolete != DST_OBSOLETE_DEAD) {
2402 n2 = dst_neigh_lookup_skb(dst, skb);
2403 if (n2)
2404 n1 = n2;
2405 diff --git a/net/ieee802154/nl802154.c b/net/ieee802154/nl802154.c
2406 index f03958fcb5be1..328bb9f5342e5 100644
2407 --- a/net/ieee802154/nl802154.c
2408 +++ b/net/ieee802154/nl802154.c
2409 @@ -1514,6 +1514,11 @@ nl802154_dump_llsec_key(struct sk_buff *skb, struct netlink_callback *cb)
2410 if (err)
2411 return err;
2412
2413 + if (wpan_dev->iftype == NL802154_IFTYPE_MONITOR) {
2414 + err = skb->len;
2415 + goto out_err;
2416 + }
2417 +
2418 if (!wpan_dev->netdev) {
2419 err = -EINVAL;
2420 goto out_err;
2421 @@ -1568,6 +1573,9 @@ static int nl802154_add_llsec_key(struct sk_buff *skb, struct genl_info *info)
2422 struct ieee802154_llsec_key_id id = { };
2423 u32 commands[NL802154_CMD_FRAME_NR_IDS / 32] = { };
2424
2425 + if (wpan_dev->iftype == NL802154_IFTYPE_MONITOR)
2426 + return -EOPNOTSUPP;
2427 +
2428 if (!info->attrs[NL802154_ATTR_SEC_KEY] ||
2429 nla_parse_nested_deprecated(attrs, NL802154_KEY_ATTR_MAX, info->attrs[NL802154_ATTR_SEC_KEY], nl802154_key_policy, info->extack))
2430 return -EINVAL;
2431 @@ -1617,6 +1625,9 @@ static int nl802154_del_llsec_key(struct sk_buff *skb, struct genl_info *info)
2432 struct nlattr *attrs[NL802154_KEY_ATTR_MAX + 1];
2433 struct ieee802154_llsec_key_id id;
2434
2435 + if (wpan_dev->iftype == NL802154_IFTYPE_MONITOR)
2436 + return -EOPNOTSUPP;
2437 +
2438 if (!info->attrs[NL802154_ATTR_SEC_KEY] ||
2439 nla_parse_nested_deprecated(attrs, NL802154_KEY_ATTR_MAX, info->attrs[NL802154_ATTR_SEC_KEY], nl802154_key_policy, info->extack))
2440 return -EINVAL;
2441 @@ -1682,6 +1693,11 @@ nl802154_dump_llsec_dev(struct sk_buff *skb, struct netlink_callback *cb)
2442 if (err)
2443 return err;
2444
2445 + if (wpan_dev->iftype == NL802154_IFTYPE_MONITOR) {
2446 + err = skb->len;
2447 + goto out_err;
2448 + }
2449 +
2450 if (!wpan_dev->netdev) {
2451 err = -EINVAL;
2452 goto out_err;
2453 @@ -1768,6 +1784,9 @@ static int nl802154_add_llsec_dev(struct sk_buff *skb, struct genl_info *info)
2454 struct wpan_dev *wpan_dev = dev->ieee802154_ptr;
2455 struct ieee802154_llsec_device dev_desc;
2456
2457 + if (wpan_dev->iftype == NL802154_IFTYPE_MONITOR)
2458 + return -EOPNOTSUPP;
2459 +
2460 if (ieee802154_llsec_parse_device(info->attrs[NL802154_ATTR_SEC_DEVICE],
2461 &dev_desc) < 0)
2462 return -EINVAL;
2463 @@ -1783,6 +1802,9 @@ static int nl802154_del_llsec_dev(struct sk_buff *skb, struct genl_info *info)
2464 struct nlattr *attrs[NL802154_DEV_ATTR_MAX + 1];
2465 __le64 extended_addr;
2466
2467 + if (wpan_dev->iftype == NL802154_IFTYPE_MONITOR)
2468 + return -EOPNOTSUPP;
2469 +
2470 if (!info->attrs[NL802154_ATTR_SEC_DEVICE] ||
2471 nla_parse_nested_deprecated(attrs, NL802154_DEV_ATTR_MAX, info->attrs[NL802154_ATTR_SEC_DEVICE], nl802154_dev_policy, info->extack))
2472 return -EINVAL;
2473 @@ -1852,6 +1874,11 @@ nl802154_dump_llsec_devkey(struct sk_buff *skb, struct netlink_callback *cb)
2474 if (err)
2475 return err;
2476
2477 + if (wpan_dev->iftype == NL802154_IFTYPE_MONITOR) {
2478 + err = skb->len;
2479 + goto out_err;
2480 + }
2481 +
2482 if (!wpan_dev->netdev) {
2483 err = -EINVAL;
2484 goto out_err;
2485 @@ -1909,6 +1936,9 @@ static int nl802154_add_llsec_devkey(struct sk_buff *skb, struct genl_info *info
2486 struct ieee802154_llsec_device_key key;
2487 __le64 extended_addr;
2488
2489 + if (wpan_dev->iftype == NL802154_IFTYPE_MONITOR)
2490 + return -EOPNOTSUPP;
2491 +
2492 if (!info->attrs[NL802154_ATTR_SEC_DEVKEY] ||
2493 nla_parse_nested_deprecated(attrs, NL802154_DEVKEY_ATTR_MAX, info->attrs[NL802154_ATTR_SEC_DEVKEY], nl802154_devkey_policy, info->extack) < 0)
2494 return -EINVAL;
2495 @@ -1940,6 +1970,9 @@ static int nl802154_del_llsec_devkey(struct sk_buff *skb, struct genl_info *info
2496 struct ieee802154_llsec_device_key key;
2497 __le64 extended_addr;
2498
2499 + if (wpan_dev->iftype == NL802154_IFTYPE_MONITOR)
2500 + return -EOPNOTSUPP;
2501 +
2502 if (!info->attrs[NL802154_ATTR_SEC_DEVKEY] ||
2503 nla_parse_nested_deprecated(attrs, NL802154_DEVKEY_ATTR_MAX, info->attrs[NL802154_ATTR_SEC_DEVKEY], nl802154_devkey_policy, info->extack))
2504 return -EINVAL;
2505 @@ -2014,6 +2047,11 @@ nl802154_dump_llsec_seclevel(struct sk_buff *skb, struct netlink_callback *cb)
2506 if (err)
2507 return err;
2508
2509 + if (wpan_dev->iftype == NL802154_IFTYPE_MONITOR) {
2510 + err = skb->len;
2511 + goto out_err;
2512 + }
2513 +
2514 if (!wpan_dev->netdev) {
2515 err = -EINVAL;
2516 goto out_err;
2517 @@ -2098,6 +2136,9 @@ static int nl802154_add_llsec_seclevel(struct sk_buff *skb,
2518 struct wpan_dev *wpan_dev = dev->ieee802154_ptr;
2519 struct ieee802154_llsec_seclevel sl;
2520
2521 + if (wpan_dev->iftype == NL802154_IFTYPE_MONITOR)
2522 + return -EOPNOTSUPP;
2523 +
2524 if (llsec_parse_seclevel(info->attrs[NL802154_ATTR_SEC_LEVEL],
2525 &sl) < 0)
2526 return -EINVAL;
2527 diff --git a/net/ipv4/netfilter/arp_tables.c b/net/ipv4/netfilter/arp_tables.c
2528 index dc7dac676415e..a6f2e5bf70456 100644
2529 --- a/net/ipv4/netfilter/arp_tables.c
2530 +++ b/net/ipv4/netfilter/arp_tables.c
2531 @@ -1580,10 +1580,15 @@ out_free:
2532 return ret;
2533 }
2534
2535 -void arpt_unregister_table(struct net *net, struct xt_table *table,
2536 - const struct nf_hook_ops *ops)
2537 +void arpt_unregister_table_pre_exit(struct net *net, struct xt_table *table,
2538 + const struct nf_hook_ops *ops)
2539 {
2540 nf_unregister_net_hooks(net, ops, hweight32(table->valid_hooks));
2541 +}
2542 +EXPORT_SYMBOL(arpt_unregister_table_pre_exit);
2543 +
2544 +void arpt_unregister_table(struct net *net, struct xt_table *table)
2545 +{
2546 __arpt_unregister_table(net, table);
2547 }
2548
2549 diff --git a/net/ipv4/netfilter/arptable_filter.c b/net/ipv4/netfilter/arptable_filter.c
2550 index c216b9ad3bb24..6c300ba5634e2 100644
2551 --- a/net/ipv4/netfilter/arptable_filter.c
2552 +++ b/net/ipv4/netfilter/arptable_filter.c
2553 @@ -56,16 +56,24 @@ static int __net_init arptable_filter_table_init(struct net *net)
2554 return err;
2555 }
2556
2557 +static void __net_exit arptable_filter_net_pre_exit(struct net *net)
2558 +{
2559 + if (net->ipv4.arptable_filter)
2560 + arpt_unregister_table_pre_exit(net, net->ipv4.arptable_filter,
2561 + arpfilter_ops);
2562 +}
2563 +
2564 static void __net_exit arptable_filter_net_exit(struct net *net)
2565 {
2566 if (!net->ipv4.arptable_filter)
2567 return;
2568 - arpt_unregister_table(net, net->ipv4.arptable_filter, arpfilter_ops);
2569 + arpt_unregister_table(net, net->ipv4.arptable_filter);
2570 net->ipv4.arptable_filter = NULL;
2571 }
2572
2573 static struct pernet_operations arptable_filter_net_ops = {
2574 .exit = arptable_filter_net_exit,
2575 + .pre_exit = arptable_filter_net_pre_exit,
2576 };
2577
2578 static int __init arptable_filter_init(void)
2579 diff --git a/net/ipv6/ip6_tunnel.c b/net/ipv6/ip6_tunnel.c
2580 index 8dcf7bacc99a6..69799b612ee80 100644
2581 --- a/net/ipv6/ip6_tunnel.c
2582 +++ b/net/ipv6/ip6_tunnel.c
2583 @@ -2217,6 +2217,16 @@ static void __net_exit ip6_tnl_destroy_tunnels(struct net *net, struct list_head
2584 t = rtnl_dereference(t->next);
2585 }
2586 }
2587 +
2588 + t = rtnl_dereference(ip6n->tnls_wc[0]);
2589 + while (t) {
2590 + /* If dev is in the same netns, it has already
2591 + * been added to the list by the previous loop.
2592 + */
2593 + if (!net_eq(dev_net(t->dev), net))
2594 + unregister_netdevice_queue(t->dev, list);
2595 + t = rtnl_dereference(t->next);
2596 + }
2597 }
2598
2599 static int __net_init ip6_tnl_init_net(struct net *net)
2600 diff --git a/net/ipv6/sit.c b/net/ipv6/sit.c
2601 index de4c871787e2f..2710f3bc856f8 100644
2602 --- a/net/ipv6/sit.c
2603 +++ b/net/ipv6/sit.c
2604 @@ -1819,9 +1819,9 @@ static void __net_exit sit_destroy_tunnels(struct net *net,
2605 if (dev->rtnl_link_ops == &sit_link_ops)
2606 unregister_netdevice_queue(dev, head);
2607
2608 - for (prio = 1; prio < 4; prio++) {
2609 + for (prio = 0; prio < 4; prio++) {
2610 int h;
2611 - for (h = 0; h < IP6_SIT_HASH_SIZE; h++) {
2612 + for (h = 0; h < (prio ? IP6_SIT_HASH_SIZE : 1); h++) {
2613 struct ip_tunnel *t;
2614
2615 t = rtnl_dereference(sitn->tunnels[prio][h]);
2616 diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c
2617 index 677928bf13d13..1b50bbf030ed8 100644
2618 --- a/net/mac80211/cfg.c
2619 +++ b/net/mac80211/cfg.c
2620 @@ -1670,8 +1670,10 @@ static int ieee80211_change_station(struct wiphy *wiphy,
2621 }
2622
2623 if (sta->sdata->vif.type == NL80211_IFTYPE_AP_VLAN &&
2624 - sta->sdata->u.vlan.sta)
2625 + sta->sdata->u.vlan.sta) {
2626 + ieee80211_clear_fast_rx(sta);
2627 RCU_INIT_POINTER(sta->sdata->u.vlan.sta, NULL);
2628 + }
2629
2630 if (test_sta_flag(sta, WLAN_STA_AUTHORIZED))
2631 ieee80211_vif_dec_num_mcast(sta->sdata);
2632 diff --git a/net/netfilter/nf_conntrack_standalone.c b/net/netfilter/nf_conntrack_standalone.c
2633 index dc57f530df9db..1a69825401263 100644
2634 --- a/net/netfilter/nf_conntrack_standalone.c
2635 +++ b/net/netfilter/nf_conntrack_standalone.c
2636 @@ -266,6 +266,7 @@ static const char* l4proto_name(u16 proto)
2637 case IPPROTO_GRE: return "gre";
2638 case IPPROTO_SCTP: return "sctp";
2639 case IPPROTO_UDPLITE: return "udplite";
2640 + case IPPROTO_ICMPV6: return "icmpv6";
2641 }
2642
2643 return "unknown";
2644 diff --git a/net/netfilter/nft_limit.c b/net/netfilter/nft_limit.c
2645 index 35b67d7e36947..6e7b92e6f4246 100644
2646 --- a/net/netfilter/nft_limit.c
2647 +++ b/net/netfilter/nft_limit.c
2648 @@ -76,13 +76,13 @@ static int nft_limit_init(struct nft_limit *limit,
2649 return -EOVERFLOW;
2650
2651 if (pkts) {
2652 - tokens = div_u64(limit->nsecs, limit->rate) * limit->burst;
2653 + tokens = div64_u64(limit->nsecs, limit->rate) * limit->burst;
2654 } else {
2655 /* The token bucket size limits the number of tokens can be
2656 * accumulated. tokens_max specifies the bucket size.
2657 * tokens_max = unit * (rate + burst) / rate.
2658 */
2659 - tokens = div_u64(limit->nsecs * (limit->rate + limit->burst),
2660 + tokens = div64_u64(limit->nsecs * (limit->rate + limit->burst),
2661 limit->rate);
2662 }
2663
2664 diff --git a/net/sctp/socket.c b/net/sctp/socket.c
2665 index 41abfff6a6a3d..783fd65b1f98d 100644
2666 --- a/net/sctp/socket.c
2667 +++ b/net/sctp/socket.c
2668 @@ -1539,11 +1539,9 @@ static void sctp_close(struct sock *sk, long timeout)
2669
2670 /* Supposedly, no process has access to the socket, but
2671 * the net layers still may.
2672 - * Also, sctp_destroy_sock() needs to be called with addr_wq_lock
2673 - * held and that should be grabbed before socket lock.
2674 */
2675 - spin_lock_bh(&net->sctp.addr_wq_lock);
2676 - bh_lock_sock_nested(sk);
2677 + local_bh_disable();
2678 + bh_lock_sock(sk);
2679
2680 /* Hold the sock, since sk_common_release() will put sock_put()
2681 * and we have just a little more cleanup.
2682 @@ -1552,7 +1550,7 @@ static void sctp_close(struct sock *sk, long timeout)
2683 sk_common_release(sk);
2684
2685 bh_unlock_sock(sk);
2686 - spin_unlock_bh(&net->sctp.addr_wq_lock);
2687 + local_bh_enable();
2688
2689 sock_put(sk);
2690
2691 @@ -5115,9 +5113,6 @@ static int sctp_init_sock(struct sock *sk)
2692 sk_sockets_allocated_inc(sk);
2693 sock_prot_inuse_add(net, sk->sk_prot, 1);
2694
2695 - /* Nothing can fail after this block, otherwise
2696 - * sctp_destroy_sock() will be called without addr_wq_lock held
2697 - */
2698 if (net->sctp.default_auto_asconf) {
2699 spin_lock(&sock_net(sk)->sctp.addr_wq_lock);
2700 list_add_tail(&sp->auto_asconf_list,
2701 @@ -5152,7 +5147,9 @@ static void sctp_destroy_sock(struct sock *sk)
2702
2703 if (sp->do_auto_asconf) {
2704 sp->do_auto_asconf = 0;
2705 + spin_lock_bh(&sock_net(sk)->sctp.addr_wq_lock);
2706 list_del(&sp->auto_asconf_list);
2707 + spin_unlock_bh(&sock_net(sk)->sctp.addr_wq_lock);
2708 }
2709 sctp_endpoint_free(sp->ep);
2710 local_bh_disable();
2711 diff --git a/sound/soc/codecs/max98373.c b/sound/soc/codecs/max98373.c
2712 index 96718e3a1ad0e..16fbc9faed90b 100644
2713 --- a/sound/soc/codecs/max98373.c
2714 +++ b/sound/soc/codecs/max98373.c
2715 @@ -410,11 +410,13 @@ static int max98373_dac_event(struct snd_soc_dapm_widget *w,
2716 regmap_update_bits(max98373->regmap,
2717 MAX98373_R20FF_GLOBAL_SHDN,
2718 MAX98373_GLOBAL_EN_MASK, 1);
2719 + usleep_range(30000, 31000);
2720 break;
2721 case SND_SOC_DAPM_POST_PMD:
2722 regmap_update_bits(max98373->regmap,
2723 MAX98373_R20FF_GLOBAL_SHDN,
2724 MAX98373_GLOBAL_EN_MASK, 0);
2725 + usleep_range(30000, 31000);
2726 max98373->tdm_mode = false;
2727 break;
2728 default:
2729 diff --git a/sound/soc/fsl/fsl_esai.c b/sound/soc/fsl/fsl_esai.c
2730 index 84290be778f0e..33ade79fa032e 100644
2731 --- a/sound/soc/fsl/fsl_esai.c
2732 +++ b/sound/soc/fsl/fsl_esai.c
2733 @@ -494,11 +494,13 @@ static int fsl_esai_startup(struct snd_pcm_substream *substream,
2734 ESAI_SAICR_SYNC, esai_priv->synchronous ?
2735 ESAI_SAICR_SYNC : 0);
2736
2737 - /* Set a default slot number -- 2 */
2738 + /* Set slots count */
2739 regmap_update_bits(esai_priv->regmap, REG_ESAI_TCCR,
2740 - ESAI_xCCR_xDC_MASK, ESAI_xCCR_xDC(2));
2741 + ESAI_xCCR_xDC_MASK,
2742 + ESAI_xCCR_xDC(esai_priv->slots));
2743 regmap_update_bits(esai_priv->regmap, REG_ESAI_RCCR,
2744 - ESAI_xCCR_xDC_MASK, ESAI_xCCR_xDC(2));
2745 + ESAI_xCCR_xDC_MASK,
2746 + ESAI_xCCR_xDC(esai_priv->slots));
2747 }
2748
2749 return 0;