diff options
author | David S. Miller <davem@davemloft.net> | 2018-08-09 14:52:36 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2018-08-09 14:52:36 -0400 |
commit | a736e074680745faa5dc6be8dd3c58ad4850aab9 (patch) | |
tree | 620e6d20cfce3806399fbefa8d911cc848463f9b | |
parent | 192e91d244e376b32d90ffbf78c87a0fb35a4040 (diff) | |
parent | 112cbae26d18e75098d95cc234cfa5059de8d479 (diff) |
Merge ra.kernel.org:/pub/scm/linux/kernel/git/davem/net
Overlapping changes in RXRPC, changing to ktime_get_seconds() whilst
adding some tracepoints.
Signed-off-by: David S. Miller <davem@davemloft.net>
40 files changed, 374 insertions, 355 deletions
diff --git a/arch/arm64/crypto/aes-ce-ccm-core.S b/arch/arm64/crypto/aes-ce-ccm-core.S index 88f5aef7934c..e3a375c4cb83 100644 --- a/arch/arm64/crypto/aes-ce-ccm-core.S +++ b/arch/arm64/crypto/aes-ce-ccm-core.S | |||
@@ -19,33 +19,24 @@ | |||
19 | * u32 *macp, u8 const rk[], u32 rounds); | 19 | * u32 *macp, u8 const rk[], u32 rounds); |
20 | */ | 20 | */ |
21 | ENTRY(ce_aes_ccm_auth_data) | 21 | ENTRY(ce_aes_ccm_auth_data) |
22 | frame_push 7 | 22 | ldr w8, [x3] /* leftover from prev round? */ |
23 | |||
24 | mov x19, x0 | ||
25 | mov x20, x1 | ||
26 | mov x21, x2 | ||
27 | mov x22, x3 | ||
28 | mov x23, x4 | ||
29 | mov x24, x5 | ||
30 | |||
31 | ldr w25, [x22] /* leftover from prev round? */ | ||
32 | ld1 {v0.16b}, [x0] /* load mac */ | 23 | ld1 {v0.16b}, [x0] /* load mac */ |
33 | cbz w25, 1f | 24 | cbz w8, 1f |
34 | sub w25, w25, #16 | 25 | sub w8, w8, #16 |
35 | eor v1.16b, v1.16b, v1.16b | 26 | eor v1.16b, v1.16b, v1.16b |
36 | 0: ldrb w7, [x20], #1 /* get 1 byte of input */ | 27 | 0: ldrb w7, [x1], #1 /* get 1 byte of input */ |
37 | subs w21, w21, #1 | 28 | subs w2, w2, #1 |
38 | add w25, w25, #1 | 29 | add w8, w8, #1 |
39 | ins v1.b[0], w7 | 30 | ins v1.b[0], w7 |
40 | ext v1.16b, v1.16b, v1.16b, #1 /* rotate in the input bytes */ | 31 | ext v1.16b, v1.16b, v1.16b, #1 /* rotate in the input bytes */ |
41 | beq 8f /* out of input? */ | 32 | beq 8f /* out of input? */ |
42 | cbnz w25, 0b | 33 | cbnz w8, 0b |
43 | eor v0.16b, v0.16b, v1.16b | 34 | eor v0.16b, v0.16b, v1.16b |
44 | 1: ld1 {v3.4s}, [x23] /* load first round key */ | 35 | 1: ld1 {v3.4s}, [x4] /* load first round key */ |
45 | prfm pldl1strm, [x20] | 36 | prfm pldl1strm, [x1] |
46 | cmp w24, #12 /* which key size? */ | 37 | cmp w5, #12 /* which key size? */ |
47 | add x6, x23, #16 | 38 | add x6, x4, #16 |
48 | sub w7, w24, #2 /* modified # of rounds */ | 39 | sub w7, w5, #2 /* modified # of rounds */ |
49 | bmi 2f | 40 | bmi 2f |
50 | bne 5f | 41 | bne 5f |
51 | mov v5.16b, v3.16b | 42 | mov v5.16b, v3.16b |
@@ -64,43 +55,33 @@ ENTRY(ce_aes_ccm_auth_data) | |||
64 | ld1 {v5.4s}, [x6], #16 /* load next round key */ | 55 | ld1 {v5.4s}, [x6], #16 /* load next round key */ |
65 | bpl 3b | 56 | bpl 3b |
66 | aese v0.16b, v4.16b | 57 | aese v0.16b, v4.16b |
67 | subs w21, w21, #16 /* last data? */ | 58 | subs w2, w2, #16 /* last data? */ |
68 | eor v0.16b, v0.16b, v5.16b /* final round */ | 59 | eor v0.16b, v0.16b, v5.16b /* final round */ |
69 | bmi 6f | 60 | bmi 6f |
70 | ld1 {v1.16b}, [x20], #16 /* load next input block */ | 61 | ld1 {v1.16b}, [x1], #16 /* load next input block */ |
71 | eor v0.16b, v0.16b, v1.16b /* xor with mac */ | 62 | eor v0.16b, v0.16b, v1.16b /* xor with mac */ |
72 | beq 6f | 63 | bne 1b |
73 | 64 | 6: st1 {v0.16b}, [x0] /* store mac */ | |
74 | if_will_cond_yield_neon | ||
75 | st1 {v0.16b}, [x19] /* store mac */ | ||
76 | do_cond_yield_neon | ||
77 | ld1 {v0.16b}, [x19] /* reload mac */ | ||
78 | endif_yield_neon | ||
79 | |||
80 | b 1b | ||
81 | 6: st1 {v0.16b}, [x19] /* store mac */ | ||
82 | beq 10f | 65 | beq 10f |
83 | adds w21, w21, #16 | 66 | adds w2, w2, #16 |
84 | beq 10f | 67 | beq 10f |
85 | mov w25, w21 | 68 | mov w8, w2 |
86 | 7: ldrb w7, [x20], #1 | 69 | 7: ldrb w7, [x1], #1 |
87 | umov w6, v0.b[0] | 70 | umov w6, v0.b[0] |
88 | eor w6, w6, w7 | 71 | eor w6, w6, w7 |
89 | strb w6, [x19], #1 | 72 | strb w6, [x0], #1 |
90 | subs w21, w21, #1 | 73 | subs w2, w2, #1 |
91 | beq 10f | 74 | beq 10f |
92 | ext v0.16b, v0.16b, v0.16b, #1 /* rotate out the mac bytes */ | 75 | ext v0.16b, v0.16b, v0.16b, #1 /* rotate out the mac bytes */ |
93 | b 7b | 76 | b 7b |
94 | 8: mov w7, w25 | 77 | 8: mov w7, w8 |
95 | add w25, w25, #16 | 78 | add w8, w8, #16 |
96 | 9: ext v1.16b, v1.16b, v1.16b, #1 | 79 | 9: ext v1.16b, v1.16b, v1.16b, #1 |
97 | adds w7, w7, #1 | 80 | adds w7, w7, #1 |
98 | bne 9b | 81 | bne 9b |
99 | eor v0.16b, v0.16b, v1.16b | 82 | eor v0.16b, v0.16b, v1.16b |
100 | st1 {v0.16b}, [x19] | 83 | st1 {v0.16b}, [x0] |
101 | 10: str w25, [x22] | 84 | 10: str w8, [x3] |
102 | |||
103 | frame_pop | ||
104 | ret | 85 | ret |
105 | ENDPROC(ce_aes_ccm_auth_data) | 86 | ENDPROC(ce_aes_ccm_auth_data) |
106 | 87 | ||
@@ -145,29 +126,19 @@ ENTRY(ce_aes_ccm_final) | |||
145 | ENDPROC(ce_aes_ccm_final) | 126 | ENDPROC(ce_aes_ccm_final) |
146 | 127 | ||
147 | .macro aes_ccm_do_crypt,enc | 128 | .macro aes_ccm_do_crypt,enc |
148 | frame_push 8 | 129 | ldr x8, [x6, #8] /* load lower ctr */ |
149 | 130 | ld1 {v0.16b}, [x5] /* load mac */ | |
150 | mov x19, x0 | 131 | CPU_LE( rev x8, x8 ) /* keep swabbed ctr in reg */ |
151 | mov x20, x1 | ||
152 | mov x21, x2 | ||
153 | mov x22, x3 | ||
154 | mov x23, x4 | ||
155 | mov x24, x5 | ||
156 | mov x25, x6 | ||
157 | |||
158 | ldr x26, [x25, #8] /* load lower ctr */ | ||
159 | ld1 {v0.16b}, [x24] /* load mac */ | ||
160 | CPU_LE( rev x26, x26 ) /* keep swabbed ctr in reg */ | ||
161 | 0: /* outer loop */ | 132 | 0: /* outer loop */ |
162 | ld1 {v1.8b}, [x25] /* load upper ctr */ | 133 | ld1 {v1.8b}, [x6] /* load upper ctr */ |
163 | prfm pldl1strm, [x20] | 134 | prfm pldl1strm, [x1] |
164 | add x26, x26, #1 | 135 | add x8, x8, #1 |
165 | rev x9, x26 | 136 | rev x9, x8 |
166 | cmp w23, #12 /* which key size? */ | 137 | cmp w4, #12 /* which key size? */ |
167 | sub w7, w23, #2 /* get modified # of rounds */ | 138 | sub w7, w4, #2 /* get modified # of rounds */ |
168 | ins v1.d[1], x9 /* no carry in lower ctr */ | 139 | ins v1.d[1], x9 /* no carry in lower ctr */ |
169 | ld1 {v3.4s}, [x22] /* load first round key */ | 140 | ld1 {v3.4s}, [x3] /* load first round key */ |
170 | add x10, x22, #16 | 141 | add x10, x3, #16 |
171 | bmi 1f | 142 | bmi 1f |
172 | bne 4f | 143 | bne 4f |
173 | mov v5.16b, v3.16b | 144 | mov v5.16b, v3.16b |
@@ -194,9 +165,9 @@ CPU_LE( rev x26, x26 ) /* keep swabbed ctr in reg */ | |||
194 | bpl 2b | 165 | bpl 2b |
195 | aese v0.16b, v4.16b | 166 | aese v0.16b, v4.16b |
196 | aese v1.16b, v4.16b | 167 | aese v1.16b, v4.16b |
197 | subs w21, w21, #16 | 168 | subs w2, w2, #16 |
198 | bmi 7f /* partial block? */ | 169 | bmi 6f /* partial block? */ |
199 | ld1 {v2.16b}, [x20], #16 /* load next input block */ | 170 | ld1 {v2.16b}, [x1], #16 /* load next input block */ |
200 | .if \enc == 1 | 171 | .if \enc == 1 |
201 | eor v2.16b, v2.16b, v5.16b /* final round enc+mac */ | 172 | eor v2.16b, v2.16b, v5.16b /* final round enc+mac */ |
202 | eor v1.16b, v1.16b, v2.16b /* xor with crypted ctr */ | 173 | eor v1.16b, v1.16b, v2.16b /* xor with crypted ctr */ |
@@ -205,29 +176,18 @@ CPU_LE( rev x26, x26 ) /* keep swabbed ctr in reg */ | |||
205 | eor v1.16b, v2.16b, v5.16b /* final round enc */ | 176 | eor v1.16b, v2.16b, v5.16b /* final round enc */ |
206 | .endif | 177 | .endif |
207 | eor v0.16b, v0.16b, v2.16b /* xor mac with pt ^ rk[last] */ | 178 | eor v0.16b, v0.16b, v2.16b /* xor mac with pt ^ rk[last] */ |
208 | st1 {v1.16b}, [x19], #16 /* write output block */ | 179 | st1 {v1.16b}, [x0], #16 /* write output block */ |
209 | beq 5f | 180 | bne 0b |
210 | 181 | CPU_LE( rev x8, x8 ) | |
211 | if_will_cond_yield_neon | 182 | st1 {v0.16b}, [x5] /* store mac */ |
212 | st1 {v0.16b}, [x24] /* store mac */ | 183 | str x8, [x6, #8] /* store lsb end of ctr (BE) */ |
213 | do_cond_yield_neon | 184 | 5: ret |
214 | ld1 {v0.16b}, [x24] /* reload mac */ | 185 | |
215 | endif_yield_neon | 186 | 6: eor v0.16b, v0.16b, v5.16b /* final round mac */ |
216 | |||
217 | b 0b | ||
218 | 5: | ||
219 | CPU_LE( rev x26, x26 ) | ||
220 | st1 {v0.16b}, [x24] /* store mac */ | ||
221 | str x26, [x25, #8] /* store lsb end of ctr (BE) */ | ||
222 | |||
223 | 6: frame_pop | ||
224 | ret | ||
225 | |||
226 | 7: eor v0.16b, v0.16b, v5.16b /* final round mac */ | ||
227 | eor v1.16b, v1.16b, v5.16b /* final round enc */ | 187 | eor v1.16b, v1.16b, v5.16b /* final round enc */ |
228 | st1 {v0.16b}, [x24] /* store mac */ | 188 | st1 {v0.16b}, [x5] /* store mac */ |
229 | add w21, w21, #16 /* process partial tail block */ | 189 | add w2, w2, #16 /* process partial tail block */ |
230 | 8: ldrb w9, [x20], #1 /* get 1 byte of input */ | 190 | 7: ldrb w9, [x1], #1 /* get 1 byte of input */ |
231 | umov w6, v1.b[0] /* get top crypted ctr byte */ | 191 | umov w6, v1.b[0] /* get top crypted ctr byte */ |
232 | umov w7, v0.b[0] /* get top mac byte */ | 192 | umov w7, v0.b[0] /* get top mac byte */ |
233 | .if \enc == 1 | 193 | .if \enc == 1 |
@@ -237,13 +197,13 @@ CPU_LE( rev x26, x26 ) | |||
237 | eor w9, w9, w6 | 197 | eor w9, w9, w6 |
238 | eor w7, w7, w9 | 198 | eor w7, w7, w9 |
239 | .endif | 199 | .endif |
240 | strb w9, [x19], #1 /* store out byte */ | 200 | strb w9, [x0], #1 /* store out byte */ |
241 | strb w7, [x24], #1 /* store mac byte */ | 201 | strb w7, [x5], #1 /* store mac byte */ |
242 | subs w21, w21, #1 | 202 | subs w2, w2, #1 |
243 | beq 6b | 203 | beq 5b |
244 | ext v0.16b, v0.16b, v0.16b, #1 /* shift out mac byte */ | 204 | ext v0.16b, v0.16b, v0.16b, #1 /* shift out mac byte */ |
245 | ext v1.16b, v1.16b, v1.16b, #1 /* shift out ctr byte */ | 205 | ext v1.16b, v1.16b, v1.16b, #1 /* shift out ctr byte */ |
246 | b 8b | 206 | b 7b |
247 | .endm | 207 | .endm |
248 | 208 | ||
249 | /* | 209 | /* |
diff --git a/arch/arm64/crypto/ghash-ce-core.S b/arch/arm64/crypto/ghash-ce-core.S index dcffb9e77589..c723647b37db 100644 --- a/arch/arm64/crypto/ghash-ce-core.S +++ b/arch/arm64/crypto/ghash-ce-core.S | |||
@@ -322,55 +322,41 @@ ENDPROC(pmull_ghash_update_p8) | |||
322 | .endm | 322 | .endm |
323 | 323 | ||
324 | .macro pmull_gcm_do_crypt, enc | 324 | .macro pmull_gcm_do_crypt, enc |
325 | frame_push 10 | 325 | ld1 {SHASH.2d}, [x4] |
326 | ld1 {XL.2d}, [x1] | ||
327 | ldr x8, [x5, #8] // load lower counter | ||
326 | 328 | ||
327 | mov x19, x0 | 329 | load_round_keys w7, x6 |
328 | mov x20, x1 | ||
329 | mov x21, x2 | ||
330 | mov x22, x3 | ||
331 | mov x23, x4 | ||
332 | mov x24, x5 | ||
333 | mov x25, x6 | ||
334 | mov x26, x7 | ||
335 | .if \enc == 1 | ||
336 | ldr x27, [sp, #96] // first stacked arg | ||
337 | .endif | ||
338 | |||
339 | ldr x28, [x24, #8] // load lower counter | ||
340 | CPU_LE( rev x28, x28 ) | ||
341 | |||
342 | 0: mov x0, x25 | ||
343 | load_round_keys w26, x0 | ||
344 | ld1 {SHASH.2d}, [x23] | ||
345 | ld1 {XL.2d}, [x20] | ||
346 | 330 | ||
347 | movi MASK.16b, #0xe1 | 331 | movi MASK.16b, #0xe1 |
348 | ext SHASH2.16b, SHASH.16b, SHASH.16b, #8 | 332 | ext SHASH2.16b, SHASH.16b, SHASH.16b, #8 |
333 | CPU_LE( rev x8, x8 ) | ||
349 | shl MASK.2d, MASK.2d, #57 | 334 | shl MASK.2d, MASK.2d, #57 |
350 | eor SHASH2.16b, SHASH2.16b, SHASH.16b | 335 | eor SHASH2.16b, SHASH2.16b, SHASH.16b |
351 | 336 | ||
352 | .if \enc == 1 | 337 | .if \enc == 1 |
353 | ld1 {KS.16b}, [x27] | 338 | ldr x10, [sp] |
339 | ld1 {KS.16b}, [x10] | ||
354 | .endif | 340 | .endif |
355 | 341 | ||
356 | 1: ld1 {CTR.8b}, [x24] // load upper counter | 342 | 0: ld1 {CTR.8b}, [x5] // load upper counter |
357 | ld1 {INP.16b}, [x22], #16 | 343 | ld1 {INP.16b}, [x3], #16 |
358 | rev x9, x28 | 344 | rev x9, x8 |
359 | add x28, x28, #1 | 345 | add x8, x8, #1 |
360 | sub w19, w19, #1 | 346 | sub w0, w0, #1 |
361 | ins CTR.d[1], x9 // set lower counter | 347 | ins CTR.d[1], x9 // set lower counter |
362 | 348 | ||
363 | .if \enc == 1 | 349 | .if \enc == 1 |
364 | eor INP.16b, INP.16b, KS.16b // encrypt input | 350 | eor INP.16b, INP.16b, KS.16b // encrypt input |
365 | st1 {INP.16b}, [x21], #16 | 351 | st1 {INP.16b}, [x2], #16 |
366 | .endif | 352 | .endif |
367 | 353 | ||
368 | rev64 T1.16b, INP.16b | 354 | rev64 T1.16b, INP.16b |
369 | 355 | ||
370 | cmp w26, #12 | 356 | cmp w7, #12 |
371 | b.ge 4f // AES-192/256? | 357 | b.ge 2f // AES-192/256? |
372 | 358 | ||
373 | 2: enc_round CTR, v21 | 359 | 1: enc_round CTR, v21 |
374 | 360 | ||
375 | ext T2.16b, XL.16b, XL.16b, #8 | 361 | ext T2.16b, XL.16b, XL.16b, #8 |
376 | ext IN1.16b, T1.16b, T1.16b, #8 | 362 | ext IN1.16b, T1.16b, T1.16b, #8 |
@@ -425,39 +411,27 @@ CPU_LE( rev x28, x28 ) | |||
425 | 411 | ||
426 | .if \enc == 0 | 412 | .if \enc == 0 |
427 | eor INP.16b, INP.16b, KS.16b | 413 | eor INP.16b, INP.16b, KS.16b |
428 | st1 {INP.16b}, [x21], #16 | 414 | st1 {INP.16b}, [x2], #16 |
429 | .endif | 415 | .endif |
430 | 416 | ||
431 | cbz w19, 3f | 417 | cbnz w0, 0b |
432 | 418 | ||
433 | if_will_cond_yield_neon | 419 | CPU_LE( rev x8, x8 ) |
434 | st1 {XL.2d}, [x20] | 420 | st1 {XL.2d}, [x1] |
435 | .if \enc == 1 | 421 | str x8, [x5, #8] // store lower counter |
436 | st1 {KS.16b}, [x27] | ||
437 | .endif | ||
438 | do_cond_yield_neon | ||
439 | b 0b | ||
440 | endif_yield_neon | ||
441 | 422 | ||
442 | b 1b | ||
443 | |||
444 | 3: st1 {XL.2d}, [x20] | ||
445 | .if \enc == 1 | 423 | .if \enc == 1 |
446 | st1 {KS.16b}, [x27] | 424 | st1 {KS.16b}, [x10] |
447 | .endif | 425 | .endif |
448 | 426 | ||
449 | CPU_LE( rev x28, x28 ) | ||
450 | str x28, [x24, #8] // store lower counter | ||
451 | |||
452 | frame_pop | ||
453 | ret | 427 | ret |
454 | 428 | ||
455 | 4: b.eq 5f // AES-192? | 429 | 2: b.eq 3f // AES-192? |
456 | enc_round CTR, v17 | 430 | enc_round CTR, v17 |
457 | enc_round CTR, v18 | 431 | enc_round CTR, v18 |
458 | 5: enc_round CTR, v19 | 432 | 3: enc_round CTR, v19 |
459 | enc_round CTR, v20 | 433 | enc_round CTR, v20 |
460 | b 2b | 434 | b 1b |
461 | .endm | 435 | .endm |
462 | 436 | ||
463 | /* | 437 | /* |
diff --git a/arch/parisc/Kconfig b/arch/parisc/Kconfig index 17526bebcbd2..46f656b8fc23 100644 --- a/arch/parisc/Kconfig +++ b/arch/parisc/Kconfig | |||
@@ -195,7 +195,7 @@ config PREFETCH | |||
195 | 195 | ||
196 | config MLONGCALLS | 196 | config MLONGCALLS |
197 | bool "Enable the -mlong-calls compiler option for big kernels" | 197 | bool "Enable the -mlong-calls compiler option for big kernels" |
198 | def_bool y if (!MODULES) | 198 | default y |
199 | depends on PA8X00 | 199 | depends on PA8X00 |
200 | help | 200 | help |
201 | If you configure the kernel to include many drivers built-in instead | 201 | If you configure the kernel to include many drivers built-in instead |
diff --git a/arch/parisc/include/asm/barrier.h b/arch/parisc/include/asm/barrier.h new file mode 100644 index 000000000000..dbaaca84f27f --- /dev/null +++ b/arch/parisc/include/asm/barrier.h | |||
@@ -0,0 +1,32 @@ | |||
1 | /* SPDX-License-Identifier: GPL-2.0 */ | ||
2 | #ifndef __ASM_BARRIER_H | ||
3 | #define __ASM_BARRIER_H | ||
4 | |||
5 | #ifndef __ASSEMBLY__ | ||
6 | |||
7 | /* The synchronize caches instruction executes as a nop on systems in | ||
8 | which all memory references are performed in order. */ | ||
9 | #define synchronize_caches() __asm__ __volatile__ ("sync" : : : "memory") | ||
10 | |||
11 | #if defined(CONFIG_SMP) | ||
12 | #define mb() do { synchronize_caches(); } while (0) | ||
13 | #define rmb() mb() | ||
14 | #define wmb() mb() | ||
15 | #define dma_rmb() mb() | ||
16 | #define dma_wmb() mb() | ||
17 | #else | ||
18 | #define mb() barrier() | ||
19 | #define rmb() barrier() | ||
20 | #define wmb() barrier() | ||
21 | #define dma_rmb() barrier() | ||
22 | #define dma_wmb() barrier() | ||
23 | #endif | ||
24 | |||
25 | #define __smp_mb() mb() | ||
26 | #define __smp_rmb() mb() | ||
27 | #define __smp_wmb() mb() | ||
28 | |||
29 | #include <asm-generic/barrier.h> | ||
30 | |||
31 | #endif /* !__ASSEMBLY__ */ | ||
32 | #endif /* __ASM_BARRIER_H */ | ||
diff --git a/arch/parisc/kernel/entry.S b/arch/parisc/kernel/entry.S index e95207c0565e..1b4732e20137 100644 --- a/arch/parisc/kernel/entry.S +++ b/arch/parisc/kernel/entry.S | |||
@@ -482,6 +482,8 @@ | |||
482 | .macro tlb_unlock0 spc,tmp | 482 | .macro tlb_unlock0 spc,tmp |
483 | #ifdef CONFIG_SMP | 483 | #ifdef CONFIG_SMP |
484 | or,COND(=) %r0,\spc,%r0 | 484 | or,COND(=) %r0,\spc,%r0 |
485 | sync | ||
486 | or,COND(=) %r0,\spc,%r0 | ||
485 | stw \spc,0(\tmp) | 487 | stw \spc,0(\tmp) |
486 | #endif | 488 | #endif |
487 | .endm | 489 | .endm |
diff --git a/arch/parisc/kernel/pacache.S b/arch/parisc/kernel/pacache.S index 22e6374ece44..97451e67d35b 100644 --- a/arch/parisc/kernel/pacache.S +++ b/arch/parisc/kernel/pacache.S | |||
@@ -353,6 +353,7 @@ ENDPROC_CFI(flush_data_cache_local) | |||
353 | .macro tlb_unlock la,flags,tmp | 353 | .macro tlb_unlock la,flags,tmp |
354 | #ifdef CONFIG_SMP | 354 | #ifdef CONFIG_SMP |
355 | ldi 1,\tmp | 355 | ldi 1,\tmp |
356 | sync | ||
356 | stw \tmp,0(\la) | 357 | stw \tmp,0(\la) |
357 | mtsm \flags | 358 | mtsm \flags |
358 | #endif | 359 | #endif |
diff --git a/arch/parisc/kernel/syscall.S b/arch/parisc/kernel/syscall.S index e775f80ae28c..4886a6db42e9 100644 --- a/arch/parisc/kernel/syscall.S +++ b/arch/parisc/kernel/syscall.S | |||
@@ -633,6 +633,7 @@ cas_action: | |||
633 | sub,<> %r28, %r25, %r0 | 633 | sub,<> %r28, %r25, %r0 |
634 | 2: stw,ma %r24, 0(%r26) | 634 | 2: stw,ma %r24, 0(%r26) |
635 | /* Free lock */ | 635 | /* Free lock */ |
636 | sync | ||
636 | stw,ma %r20, 0(%sr2,%r20) | 637 | stw,ma %r20, 0(%sr2,%r20) |
637 | #if ENABLE_LWS_DEBUG | 638 | #if ENABLE_LWS_DEBUG |
638 | /* Clear thread register indicator */ | 639 | /* Clear thread register indicator */ |
@@ -647,6 +648,7 @@ cas_action: | |||
647 | 3: | 648 | 3: |
648 | /* Error occurred on load or store */ | 649 | /* Error occurred on load or store */ |
649 | /* Free lock */ | 650 | /* Free lock */ |
651 | sync | ||
650 | stw %r20, 0(%sr2,%r20) | 652 | stw %r20, 0(%sr2,%r20) |
651 | #if ENABLE_LWS_DEBUG | 653 | #if ENABLE_LWS_DEBUG |
652 | stw %r0, 4(%sr2,%r20) | 654 | stw %r0, 4(%sr2,%r20) |
@@ -848,6 +850,7 @@ cas2_action: | |||
848 | 850 | ||
849 | cas2_end: | 851 | cas2_end: |
850 | /* Free lock */ | 852 | /* Free lock */ |
853 | sync | ||
851 | stw,ma %r20, 0(%sr2,%r20) | 854 | stw,ma %r20, 0(%sr2,%r20) |
852 | /* Enable interrupts */ | 855 | /* Enable interrupts */ |
853 | ssm PSW_SM_I, %r0 | 856 | ssm PSW_SM_I, %r0 |
@@ -858,6 +861,7 @@ cas2_end: | |||
858 | 22: | 861 | 22: |
859 | /* Error occurred on load or store */ | 862 | /* Error occurred on load or store */ |
860 | /* Free lock */ | 863 | /* Free lock */ |
864 | sync | ||
861 | stw %r20, 0(%sr2,%r20) | 865 | stw %r20, 0(%sr2,%r20) |
862 | ssm PSW_SM_I, %r0 | 866 | ssm PSW_SM_I, %r0 |
863 | ldo 1(%r0),%r28 | 867 | ldo 1(%r0),%r28 |
diff --git a/arch/x86/crypto/aegis128-aesni-glue.c b/arch/x86/crypto/aegis128-aesni-glue.c index 5de7c0d46edf..acd11b3bf639 100644 --- a/arch/x86/crypto/aegis128-aesni-glue.c +++ b/arch/x86/crypto/aegis128-aesni-glue.c | |||
@@ -375,16 +375,12 @@ static struct aead_alg crypto_aegis128_aesni_alg[] = { | |||
375 | } | 375 | } |
376 | }; | 376 | }; |
377 | 377 | ||
378 | static const struct x86_cpu_id aesni_cpu_id[] = { | ||
379 | X86_FEATURE_MATCH(X86_FEATURE_AES), | ||
380 | X86_FEATURE_MATCH(X86_FEATURE_XMM2), | ||
381 | {} | ||
382 | }; | ||
383 | MODULE_DEVICE_TABLE(x86cpu, aesni_cpu_id); | ||
384 | |||
385 | static int __init crypto_aegis128_aesni_module_init(void) | 378 | static int __init crypto_aegis128_aesni_module_init(void) |
386 | { | 379 | { |
387 | if (!x86_match_cpu(aesni_cpu_id)) | 380 | if (!boot_cpu_has(X86_FEATURE_XMM2) || |
381 | !boot_cpu_has(X86_FEATURE_AES) || | ||
382 | !boot_cpu_has(X86_FEATURE_OSXSAVE) || | ||
383 | !cpu_has_xfeatures(XFEATURE_MASK_SSE, NULL)) | ||
388 | return -ENODEV; | 384 | return -ENODEV; |
389 | 385 | ||
390 | return crypto_register_aeads(crypto_aegis128_aesni_alg, | 386 | return crypto_register_aeads(crypto_aegis128_aesni_alg, |
diff --git a/arch/x86/crypto/aegis128l-aesni-glue.c b/arch/x86/crypto/aegis128l-aesni-glue.c index 876e4866e633..2071c3d1ae07 100644 --- a/arch/x86/crypto/aegis128l-aesni-glue.c +++ b/arch/x86/crypto/aegis128l-aesni-glue.c | |||
@@ -375,16 +375,12 @@ static struct aead_alg crypto_aegis128l_aesni_alg[] = { | |||
375 | } | 375 | } |
376 | }; | 376 | }; |
377 | 377 | ||
378 | static const struct x86_cpu_id aesni_cpu_id[] = { | ||
379 | X86_FEATURE_MATCH(X86_FEATURE_AES), | ||
380 | X86_FEATURE_MATCH(X86_FEATURE_XMM2), | ||
381 | {} | ||
382 | }; | ||
383 | MODULE_DEVICE_TABLE(x86cpu, aesni_cpu_id); | ||
384 | |||
385 | static int __init crypto_aegis128l_aesni_module_init(void) | 378 | static int __init crypto_aegis128l_aesni_module_init(void) |
386 | { | 379 | { |
387 | if (!x86_match_cpu(aesni_cpu_id)) | 380 | if (!boot_cpu_has(X86_FEATURE_XMM2) || |
381 | !boot_cpu_has(X86_FEATURE_AES) || | ||
382 | !boot_cpu_has(X86_FEATURE_OSXSAVE) || | ||
383 | !cpu_has_xfeatures(XFEATURE_MASK_SSE, NULL)) | ||
388 | return -ENODEV; | 384 | return -ENODEV; |
389 | 385 | ||
390 | return crypto_register_aeads(crypto_aegis128l_aesni_alg, | 386 | return crypto_register_aeads(crypto_aegis128l_aesni_alg, |
diff --git a/arch/x86/crypto/aegis256-aesni-glue.c b/arch/x86/crypto/aegis256-aesni-glue.c index 2b5dd3af8f4d..b5f2a8fd5a71 100644 --- a/arch/x86/crypto/aegis256-aesni-glue.c +++ b/arch/x86/crypto/aegis256-aesni-glue.c | |||
@@ -375,16 +375,12 @@ static struct aead_alg crypto_aegis256_aesni_alg[] = { | |||
375 | } | 375 | } |
376 | }; | 376 | }; |
377 | 377 | ||
378 | static const struct x86_cpu_id aesni_cpu_id[] = { | ||
379 | X86_FEATURE_MATCH(X86_FEATURE_AES), | ||
380 | X86_FEATURE_MATCH(X86_FEATURE_XMM2), | ||
381 | {} | ||
382 | }; | ||
383 | MODULE_DEVICE_TABLE(x86cpu, aesni_cpu_id); | ||
384 | |||
385 | static int __init crypto_aegis256_aesni_module_init(void) | 378 | static int __init crypto_aegis256_aesni_module_init(void) |
386 | { | 379 | { |
387 | if (!x86_match_cpu(aesni_cpu_id)) | 380 | if (!boot_cpu_has(X86_FEATURE_XMM2) || |
381 | !boot_cpu_has(X86_FEATURE_AES) || | ||
382 | !boot_cpu_has(X86_FEATURE_OSXSAVE) || | ||
383 | !cpu_has_xfeatures(XFEATURE_MASK_SSE, NULL)) | ||
388 | return -ENODEV; | 384 | return -ENODEV; |
389 | 385 | ||
390 | return crypto_register_aeads(crypto_aegis256_aesni_alg, | 386 | return crypto_register_aeads(crypto_aegis256_aesni_alg, |
diff --git a/arch/x86/crypto/morus1280-avx2-glue.c b/arch/x86/crypto/morus1280-avx2-glue.c index f111f36d26dc..6634907d6ccd 100644 --- a/arch/x86/crypto/morus1280-avx2-glue.c +++ b/arch/x86/crypto/morus1280-avx2-glue.c | |||
@@ -37,15 +37,11 @@ asmlinkage void crypto_morus1280_avx2_final(void *state, void *tag_xor, | |||
37 | 37 | ||
38 | MORUS1280_DECLARE_ALGS(avx2, "morus1280-avx2", 400); | 38 | MORUS1280_DECLARE_ALGS(avx2, "morus1280-avx2", 400); |
39 | 39 | ||
40 | static const struct x86_cpu_id avx2_cpu_id[] = { | ||
41 | X86_FEATURE_MATCH(X86_FEATURE_AVX2), | ||
42 | {} | ||
43 | }; | ||
44 | MODULE_DEVICE_TABLE(x86cpu, avx2_cpu_id); | ||
45 | |||
46 | static int __init crypto_morus1280_avx2_module_init(void) | 40 | static int __init crypto_morus1280_avx2_module_init(void) |
47 | { | 41 | { |
48 | if (!x86_match_cpu(avx2_cpu_id)) | 42 | if (!boot_cpu_has(X86_FEATURE_AVX2) || |
43 | !boot_cpu_has(X86_FEATURE_OSXSAVE) || | ||
44 | !cpu_has_xfeatures(XFEATURE_MASK_SSE | XFEATURE_MASK_YMM, NULL)) | ||
49 | return -ENODEV; | 45 | return -ENODEV; |
50 | 46 | ||
51 | return crypto_register_aeads(crypto_morus1280_avx2_algs, | 47 | return crypto_register_aeads(crypto_morus1280_avx2_algs, |
diff --git a/arch/x86/crypto/morus1280-sse2-glue.c b/arch/x86/crypto/morus1280-sse2-glue.c index 839270aa713c..95cf857d2cbb 100644 --- a/arch/x86/crypto/morus1280-sse2-glue.c +++ b/arch/x86/crypto/morus1280-sse2-glue.c | |||
@@ -37,15 +37,11 @@ asmlinkage void crypto_morus1280_sse2_final(void *state, void *tag_xor, | |||
37 | 37 | ||
38 | MORUS1280_DECLARE_ALGS(sse2, "morus1280-sse2", 350); | 38 | MORUS1280_DECLARE_ALGS(sse2, "morus1280-sse2", 350); |
39 | 39 | ||
40 | static const struct x86_cpu_id sse2_cpu_id[] = { | ||
41 | X86_FEATURE_MATCH(X86_FEATURE_XMM2), | ||
42 | {} | ||
43 | }; | ||
44 | MODULE_DEVICE_TABLE(x86cpu, sse2_cpu_id); | ||
45 | |||
46 | static int __init crypto_morus1280_sse2_module_init(void) | 40 | static int __init crypto_morus1280_sse2_module_init(void) |
47 | { | 41 | { |
48 | if (!x86_match_cpu(sse2_cpu_id)) | 42 | if (!boot_cpu_has(X86_FEATURE_XMM2) || |
43 | !boot_cpu_has(X86_FEATURE_OSXSAVE) || | ||
44 | !cpu_has_xfeatures(XFEATURE_MASK_SSE, NULL)) | ||
49 | return -ENODEV; | 45 | return -ENODEV; |
50 | 46 | ||
51 | return crypto_register_aeads(crypto_morus1280_sse2_algs, | 47 | return crypto_register_aeads(crypto_morus1280_sse2_algs, |
diff --git a/arch/x86/crypto/morus640-sse2-glue.c b/arch/x86/crypto/morus640-sse2-glue.c index 26b47e2db8d2..615fb7bc9a32 100644 --- a/arch/x86/crypto/morus640-sse2-glue.c +++ b/arch/x86/crypto/morus640-sse2-glue.c | |||
@@ -37,15 +37,11 @@ asmlinkage void crypto_morus640_sse2_final(void *state, void *tag_xor, | |||
37 | 37 | ||
38 | MORUS640_DECLARE_ALGS(sse2, "morus640-sse2", 400); | 38 | MORUS640_DECLARE_ALGS(sse2, "morus640-sse2", 400); |
39 | 39 | ||
40 | static const struct x86_cpu_id sse2_cpu_id[] = { | ||
41 | X86_FEATURE_MATCH(X86_FEATURE_XMM2), | ||
42 | {} | ||
43 | }; | ||
44 | MODULE_DEVICE_TABLE(x86cpu, sse2_cpu_id); | ||
45 | |||
46 | static int __init crypto_morus640_sse2_module_init(void) | 40 | static int __init crypto_morus640_sse2_module_init(void) |
47 | { | 41 | { |
48 | if (!x86_match_cpu(sse2_cpu_id)) | 42 | if (!boot_cpu_has(X86_FEATURE_XMM2) || |
43 | !boot_cpu_has(X86_FEATURE_OSXSAVE) || | ||
44 | !cpu_has_xfeatures(XFEATURE_MASK_SSE, NULL)) | ||
49 | return -ENODEV; | 45 | return -ENODEV; |
50 | 46 | ||
51 | return crypto_register_aeads(crypto_morus640_sse2_algs, | 47 | return crypto_register_aeads(crypto_morus640_sse2_algs, |
diff --git a/drivers/gpio/gpiolib-acpi.c b/drivers/gpio/gpiolib-acpi.c index e2232cbcec8b..addd9fecc198 100644 --- a/drivers/gpio/gpiolib-acpi.c +++ b/drivers/gpio/gpiolib-acpi.c | |||
@@ -25,6 +25,7 @@ | |||
25 | 25 | ||
26 | struct acpi_gpio_event { | 26 | struct acpi_gpio_event { |
27 | struct list_head node; | 27 | struct list_head node; |
28 | struct list_head initial_sync_list; | ||
28 | acpi_handle handle; | 29 | acpi_handle handle; |
29 | unsigned int pin; | 30 | unsigned int pin; |
30 | unsigned int irq; | 31 | unsigned int irq; |
@@ -50,6 +51,9 @@ struct acpi_gpio_chip { | |||
50 | struct list_head events; | 51 | struct list_head events; |
51 | }; | 52 | }; |
52 | 53 | ||
54 | static LIST_HEAD(acpi_gpio_initial_sync_list); | ||
55 | static DEFINE_MUTEX(acpi_gpio_initial_sync_list_lock); | ||
56 | |||
53 | static int acpi_gpiochip_find(struct gpio_chip *gc, void *data) | 57 | static int acpi_gpiochip_find(struct gpio_chip *gc, void *data) |
54 | { | 58 | { |
55 | if (!gc->parent) | 59 | if (!gc->parent) |
@@ -85,6 +89,21 @@ static struct gpio_desc *acpi_get_gpiod(char *path, int pin) | |||
85 | return gpiochip_get_desc(chip, pin); | 89 | return gpiochip_get_desc(chip, pin); |
86 | } | 90 | } |
87 | 91 | ||
92 | static void acpi_gpio_add_to_initial_sync_list(struct acpi_gpio_event *event) | ||
93 | { | ||
94 | mutex_lock(&acpi_gpio_initial_sync_list_lock); | ||
95 | list_add(&event->initial_sync_list, &acpi_gpio_initial_sync_list); | ||
96 | mutex_unlock(&acpi_gpio_initial_sync_list_lock); | ||
97 | } | ||
98 | |||
99 | static void acpi_gpio_del_from_initial_sync_list(struct acpi_gpio_event *event) | ||
100 | { | ||
101 | mutex_lock(&acpi_gpio_initial_sync_list_lock); | ||
102 | if (!list_empty(&event->initial_sync_list)) | ||
103 | list_del_init(&event->initial_sync_list); | ||
104 | mutex_unlock(&acpi_gpio_initial_sync_list_lock); | ||
105 | } | ||
106 | |||
88 | static irqreturn_t acpi_gpio_irq_handler(int irq, void *data) | 107 | static irqreturn_t acpi_gpio_irq_handler(int irq, void *data) |
89 | { | 108 | { |
90 | struct acpi_gpio_event *event = data; | 109 | struct acpi_gpio_event *event = data; |
@@ -136,7 +155,7 @@ static acpi_status acpi_gpiochip_request_interrupt(struct acpi_resource *ares, | |||
136 | irq_handler_t handler = NULL; | 155 | irq_handler_t handler = NULL; |
137 | struct gpio_desc *desc; | 156 | struct gpio_desc *desc; |
138 | unsigned long irqflags; | 157 | unsigned long irqflags; |
139 | int ret, pin, irq; | 158 | int ret, pin, irq, value; |
140 | 159 | ||
141 | if (!acpi_gpio_get_irq_resource(ares, &agpio)) | 160 | if (!acpi_gpio_get_irq_resource(ares, &agpio)) |
142 | return AE_OK; | 161 | return AE_OK; |
@@ -167,6 +186,8 @@ static acpi_status acpi_gpiochip_request_interrupt(struct acpi_resource *ares, | |||
167 | 186 | ||
168 | gpiod_direction_input(desc); | 187 | gpiod_direction_input(desc); |
169 | 188 | ||
189 | value = gpiod_get_value(desc); | ||
190 | |||
170 | ret = gpiochip_lock_as_irq(chip, pin); | 191 | ret = gpiochip_lock_as_irq(chip, pin); |
171 | if (ret) { | 192 | if (ret) { |
172 | dev_err(chip->parent, "Failed to lock GPIO as interrupt\n"); | 193 | dev_err(chip->parent, "Failed to lock GPIO as interrupt\n"); |
@@ -208,6 +229,7 @@ static acpi_status acpi_gpiochip_request_interrupt(struct acpi_resource *ares, | |||
208 | event->irq = irq; | 229 | event->irq = irq; |
209 | event->pin = pin; | 230 | event->pin = pin; |
210 | event->desc = desc; | 231 | event->desc = desc; |
232 | INIT_LIST_HEAD(&event->initial_sync_list); | ||
211 | 233 | ||
212 | ret = request_threaded_irq(event->irq, NULL, handler, irqflags, | 234 | ret = request_threaded_irq(event->irq, NULL, handler, irqflags, |
213 | "ACPI:Event", event); | 235 | "ACPI:Event", event); |
@@ -222,6 +244,18 @@ static acpi_status acpi_gpiochip_request_interrupt(struct acpi_resource *ares, | |||
222 | enable_irq_wake(irq); | 244 | enable_irq_wake(irq); |
223 | 245 | ||
224 | list_add_tail(&event->node, &acpi_gpio->events); | 246 | list_add_tail(&event->node, &acpi_gpio->events); |
247 | |||
248 | /* | ||
249 | * Make sure we trigger the initial state of the IRQ when using RISING | ||
250 | * or FALLING. Note we run the handlers on late_init, the AML code | ||
251 | * may refer to OperationRegions from other (builtin) drivers which | ||
252 | * may be probed after us. | ||
253 | */ | ||
254 | if (handler == acpi_gpio_irq_handler && | ||
255 | (((irqflags & IRQF_TRIGGER_RISING) && value == 1) || | ||
256 | ((irqflags & IRQF_TRIGGER_FALLING) && value == 0))) | ||
257 | acpi_gpio_add_to_initial_sync_list(event); | ||
258 | |||
225 | return AE_OK; | 259 | return AE_OK; |
226 | 260 | ||
227 | fail_free_event: | 261 | fail_free_event: |
@@ -294,6 +328,8 @@ void acpi_gpiochip_free_interrupts(struct gpio_chip *chip) | |||
294 | list_for_each_entry_safe_reverse(event, ep, &acpi_gpio->events, node) { | 328 | list_for_each_entry_safe_reverse(event, ep, &acpi_gpio->events, node) { |
295 | struct gpio_desc *desc; | 329 | struct gpio_desc *desc; |
296 | 330 | ||
331 | acpi_gpio_del_from_initial_sync_list(event); | ||
332 | |||
297 | if (irqd_is_wakeup_set(irq_get_irq_data(event->irq))) | 333 | if (irqd_is_wakeup_set(irq_get_irq_data(event->irq))) |
298 | disable_irq_wake(event->irq); | 334 | disable_irq_wake(event->irq); |
299 | 335 | ||
@@ -1158,3 +1194,21 @@ bool acpi_can_fallback_to_crs(struct acpi_device *adev, const char *con_id) | |||
1158 | 1194 | ||
1159 | return con_id == NULL; | 1195 | return con_id == NULL; |
1160 | } | 1196 | } |
1197 | |||
1198 | /* Sync the initial state of handlers after all builtin drivers have probed */ | ||
1199 | static int acpi_gpio_initial_sync(void) | ||
1200 | { | ||
1201 | struct acpi_gpio_event *event, *ep; | ||
1202 | |||
1203 | mutex_lock(&acpi_gpio_initial_sync_list_lock); | ||
1204 | list_for_each_entry_safe(event, ep, &acpi_gpio_initial_sync_list, | ||
1205 | initial_sync_list) { | ||
1206 | acpi_evaluate_object(event->handle, NULL, NULL, NULL); | ||
1207 | list_del_init(&event->initial_sync_list); | ||
1208 | } | ||
1209 | mutex_unlock(&acpi_gpio_initial_sync_list_lock); | ||
1210 | |||
1211 | return 0; | ||
1212 | } | ||
1213 | /* We must use _sync so that this runs after the first deferred_probe run */ | ||
1214 | late_initcall_sync(acpi_gpio_initial_sync); | ||
diff --git a/drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_b0.c b/drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_b0.c index 4809bf4baa34..1d44a386e7d3 100644 --- a/drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_b0.c +++ b/drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_b0.c | |||
@@ -764,7 +764,7 @@ static int hw_atl_b0_hw_packet_filter_set(struct aq_hw_s *self, | |||
764 | 764 | ||
765 | hw_atl_rpfl2promiscuous_mode_en_set(self, IS_FILTER_ENABLED(IFF_PROMISC)); | 765 | hw_atl_rpfl2promiscuous_mode_en_set(self, IS_FILTER_ENABLED(IFF_PROMISC)); |
766 | hw_atl_rpfl2multicast_flr_en_set(self, | 766 | hw_atl_rpfl2multicast_flr_en_set(self, |
767 | IS_FILTER_ENABLED(IFF_MULTICAST), 0); | 767 | IS_FILTER_ENABLED(IFF_ALLMULTI), 0); |
768 | 768 | ||
769 | hw_atl_rpfl2_accept_all_mc_packets_set(self, | 769 | hw_atl_rpfl2_accept_all_mc_packets_set(self, |
770 | IS_FILTER_ENABLED(IFF_ALLMULTI)); | 770 | IS_FILTER_ENABLED(IFF_ALLMULTI)); |
diff --git a/drivers/net/ethernet/cavium/thunder/thunder_bgx.c b/drivers/net/ethernet/cavium/thunder/thunder_bgx.c index 5d08d2aeb172..e337da6ba2a4 100644 --- a/drivers/net/ethernet/cavium/thunder/thunder_bgx.c +++ b/drivers/net/ethernet/cavium/thunder/thunder_bgx.c | |||
@@ -1083,6 +1083,8 @@ static int bgx_lmac_enable(struct bgx *bgx, u8 lmacid) | |||
1083 | lmac->dmacs_count = (RX_DMAC_COUNT / bgx->lmac_count); | 1083 | lmac->dmacs_count = (RX_DMAC_COUNT / bgx->lmac_count); |
1084 | lmac->dmacs = kcalloc(lmac->dmacs_count, sizeof(*lmac->dmacs), | 1084 | lmac->dmacs = kcalloc(lmac->dmacs_count, sizeof(*lmac->dmacs), |
1085 | GFP_KERNEL); | 1085 | GFP_KERNEL); |
1086 | if (!lmac->dmacs) | ||
1087 | return -ENOMEM; | ||
1086 | 1088 | ||
1087 | /* Enable lmac */ | 1089 | /* Enable lmac */ |
1088 | bgx_reg_modify(bgx, lmacid, BGX_CMRX_CFG, CMR_EN); | 1090 | bgx_reg_modify(bgx, lmacid, BGX_CMRX_CFG, CMR_EN); |
diff --git a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_filter.c b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_filter.c index 00fc5f1afb1d..7dddb9e748b8 100644 --- a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_filter.c +++ b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_filter.c | |||
@@ -1038,10 +1038,8 @@ static void mk_act_open_req(struct filter_entry *f, struct sk_buff *skb, | |||
1038 | OPCODE_TID(req) = htonl(MK_OPCODE_TID(CPL_ACT_OPEN_REQ, qid_filterid)); | 1038 | OPCODE_TID(req) = htonl(MK_OPCODE_TID(CPL_ACT_OPEN_REQ, qid_filterid)); |
1039 | req->local_port = cpu_to_be16(f->fs.val.lport); | 1039 | req->local_port = cpu_to_be16(f->fs.val.lport); |
1040 | req->peer_port = cpu_to_be16(f->fs.val.fport); | 1040 | req->peer_port = cpu_to_be16(f->fs.val.fport); |
1041 | req->local_ip = f->fs.val.lip[0] | f->fs.val.lip[1] << 8 | | 1041 | memcpy(&req->local_ip, f->fs.val.lip, 4); |
1042 | f->fs.val.lip[2] << 16 | f->fs.val.lip[3] << 24; | 1042 | memcpy(&req->peer_ip, f->fs.val.fip, 4); |
1043 | req->peer_ip = f->fs.val.fip[0] | f->fs.val.fip[1] << 8 | | ||
1044 | f->fs.val.fip[2] << 16 | f->fs.val.fip[3] << 24; | ||
1045 | req->opt0 = cpu_to_be64(NAGLE_V(f->fs.newvlan == VLAN_REMOVE || | 1043 | req->opt0 = cpu_to_be64(NAGLE_V(f->fs.newvlan == VLAN_REMOVE || |
1046 | f->fs.newvlan == VLAN_REWRITE) | | 1044 | f->fs.newvlan == VLAN_REWRITE) | |
1047 | DELACK_V(f->fs.hitcnts) | | 1045 | DELACK_V(f->fs.hitcnts) | |
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en.h b/drivers/net/ethernet/mellanox/mlx5/core/en.h index c7ed3d20fd54..dddd29a3be97 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/en.h +++ b/drivers/net/ethernet/mellanox/mlx5/core/en.h | |||
@@ -858,8 +858,6 @@ struct mlx5e_profile { | |||
858 | mlx5e_fp_handle_rx_cqe handle_rx_cqe; | 858 | mlx5e_fp_handle_rx_cqe handle_rx_cqe; |
859 | mlx5e_fp_handle_rx_cqe handle_rx_cqe_mpwqe; | 859 | mlx5e_fp_handle_rx_cqe handle_rx_cqe_mpwqe; |
860 | } rx_handlers; | 860 | } rx_handlers; |
861 | void (*netdev_registered_init)(struct mlx5e_priv *priv); | ||
862 | void (*netdev_registered_remove)(struct mlx5e_priv *priv); | ||
863 | int max_tc; | 861 | int max_tc; |
864 | }; | 862 | }; |
865 | 863 | ||
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_dcbnl.c b/drivers/net/ethernet/mellanox/mlx5/core/en_dcbnl.c index e33afa8d2417..722998d68564 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/en_dcbnl.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_dcbnl.c | |||
@@ -443,16 +443,12 @@ static int mlx5e_dcbnl_ieee_setapp(struct net_device *dev, struct dcb_app *app) | |||
443 | bool is_new; | 443 | bool is_new; |
444 | int err; | 444 | int err; |
445 | 445 | ||
446 | if (app->selector != IEEE_8021QAZ_APP_SEL_DSCP) | 446 | if (!MLX5_CAP_GEN(priv->mdev, vport_group_manager) || |
447 | return -EINVAL; | 447 | !MLX5_DSCP_SUPPORTED(priv->mdev)) |
448 | 448 | return -EOPNOTSUPP; | |
449 | if (!MLX5_CAP_GEN(priv->mdev, vport_group_manager)) | ||
450 | return -EINVAL; | ||
451 | |||
452 | if (!MLX5_DSCP_SUPPORTED(priv->mdev)) | ||
453 | return -EINVAL; | ||
454 | 449 | ||
455 | if (app->protocol >= MLX5E_MAX_DSCP) | 450 | if ((app->selector != IEEE_8021QAZ_APP_SEL_DSCP) || |
451 | (app->protocol >= MLX5E_MAX_DSCP)) | ||
456 | return -EINVAL; | 452 | return -EINVAL; |
457 | 453 | ||
458 | /* Save the old entry info */ | 454 | /* Save the old entry info */ |
@@ -500,16 +496,12 @@ static int mlx5e_dcbnl_ieee_delapp(struct net_device *dev, struct dcb_app *app) | |||
500 | struct mlx5e_priv *priv = netdev_priv(dev); | 496 | struct mlx5e_priv *priv = netdev_priv(dev); |
501 | int err; | 497 | int err; |
502 | 498 | ||
503 | if (app->selector != IEEE_8021QAZ_APP_SEL_DSCP) | 499 | if (!MLX5_CAP_GEN(priv->mdev, vport_group_manager) || |
504 | return -EINVAL; | 500 | !MLX5_DSCP_SUPPORTED(priv->mdev)) |
505 | 501 | return -EOPNOTSUPP; | |
506 | if (!MLX5_CAP_GEN(priv->mdev, vport_group_manager)) | ||
507 | return -EINVAL; | ||
508 | |||
509 | if (!MLX5_DSCP_SUPPORTED(priv->mdev)) | ||
510 | return -EINVAL; | ||
511 | 502 | ||
512 | if (app->protocol >= MLX5E_MAX_DSCP) | 503 | if ((app->selector != IEEE_8021QAZ_APP_SEL_DSCP) || |
504 | (app->protocol >= MLX5E_MAX_DSCP)) | ||
513 | return -EINVAL; | 505 | return -EINVAL; |
514 | 506 | ||
515 | /* Skip if no dscp app entry */ | 507 | /* Skip if no dscp app entry */ |
@@ -1146,7 +1138,7 @@ static int mlx5e_set_trust_state(struct mlx5e_priv *priv, u8 trust_state) | |||
1146 | { | 1138 | { |
1147 | int err; | 1139 | int err; |
1148 | 1140 | ||
1149 | err = mlx5_set_trust_state(priv->mdev, trust_state); | 1141 | err = mlx5_set_trust_state(priv->mdev, trust_state); |
1150 | if (err) | 1142 | if (err) |
1151 | return err; | 1143 | return err; |
1152 | priv->dcbx_dp.trust_state = trust_state; | 1144 | priv->dcbx_dp.trust_state = trust_state; |
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c b/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c index c28fe469b04a..9131a1376e7d 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c | |||
@@ -2034,15 +2034,15 @@ static bool actions_match_supported(struct mlx5e_priv *priv, | |||
2034 | static bool same_hw_devs(struct mlx5e_priv *priv, struct mlx5e_priv *peer_priv) | 2034 | static bool same_hw_devs(struct mlx5e_priv *priv, struct mlx5e_priv *peer_priv) |
2035 | { | 2035 | { |
2036 | struct mlx5_core_dev *fmdev, *pmdev; | 2036 | struct mlx5_core_dev *fmdev, *pmdev; |
2037 | u16 func_id, peer_id; | 2037 | u64 fsystem_guid, psystem_guid; |
2038 | 2038 | ||
2039 | fmdev = priv->mdev; | 2039 | fmdev = priv->mdev; |
2040 | pmdev = peer_priv->mdev; | 2040 | pmdev = peer_priv->mdev; |
2041 | 2041 | ||
2042 | func_id = (u16)((fmdev->pdev->bus->number << 8) | PCI_SLOT(fmdev->pdev->devfn)); | 2042 | mlx5_query_nic_vport_system_image_guid(fmdev, &fsystem_guid); |
2043 | peer_id = (u16)((pmdev->pdev->bus->number << 8) | PCI_SLOT(pmdev->pdev->devfn)); | 2043 | mlx5_query_nic_vport_system_image_guid(pmdev, &psystem_guid); |
2044 | 2044 | ||
2045 | return (func_id == peer_id); | 2045 | return (fsystem_guid == psystem_guid); |
2046 | } | 2046 | } |
2047 | 2047 | ||
2048 | static int parse_tc_nic_actions(struct mlx5e_priv *priv, struct tcf_exts *exts, | 2048 | static int parse_tc_nic_actions(struct mlx5e_priv *priv, struct tcf_exts *exts, |
diff --git a/drivers/vhost/vhost.c b/drivers/vhost/vhost.c index 6f6c42d5e4be..96c1d8400822 100644 --- a/drivers/vhost/vhost.c +++ b/drivers/vhost/vhost.c | |||
@@ -1595,9 +1595,12 @@ int vhost_init_device_iotlb(struct vhost_dev *d, bool enabled) | |||
1595 | d->iotlb = niotlb; | 1595 | d->iotlb = niotlb; |
1596 | 1596 | ||
1597 | for (i = 0; i < d->nvqs; ++i) { | 1597 | for (i = 0; i < d->nvqs; ++i) { |
1598 | mutex_lock(&d->vqs[i]->mutex); | 1598 | struct vhost_virtqueue *vq = d->vqs[i]; |
1599 | d->vqs[i]->iotlb = niotlb; | 1599 | |
1600 | mutex_unlock(&d->vqs[i]->mutex); | 1600 | mutex_lock(&vq->mutex); |
1601 | vq->iotlb = niotlb; | ||
1602 | __vhost_vq_meta_reset(vq); | ||
1603 | mutex_unlock(&vq->mutex); | ||
1601 | } | 1604 | } |
1602 | 1605 | ||
1603 | vhost_umem_clean(oiotlb); | 1606 | vhost_umem_clean(oiotlb); |
diff --git a/include/net/af_vsock.h b/include/net/af_vsock.h index 9324ac2d9ff2..43913ae79f64 100644 --- a/include/net/af_vsock.h +++ b/include/net/af_vsock.h | |||
@@ -64,7 +64,8 @@ struct vsock_sock { | |||
64 | struct list_head pending_links; | 64 | struct list_head pending_links; |
65 | struct list_head accept_queue; | 65 | struct list_head accept_queue; |
66 | bool rejected; | 66 | bool rejected; |
67 | struct delayed_work dwork; | 67 | struct delayed_work connect_work; |
68 | struct delayed_work pending_work; | ||
68 | struct delayed_work close_work; | 69 | struct delayed_work close_work; |
69 | bool close_work_scheduled; | 70 | bool close_work_scheduled; |
70 | u32 peer_shutdown; | 71 | u32 peer_shutdown; |
@@ -77,7 +78,6 @@ struct vsock_sock { | |||
77 | 78 | ||
78 | s64 vsock_stream_has_data(struct vsock_sock *vsk); | 79 | s64 vsock_stream_has_data(struct vsock_sock *vsk); |
79 | s64 vsock_stream_has_space(struct vsock_sock *vsk); | 80 | s64 vsock_stream_has_space(struct vsock_sock *vsk); |
80 | void vsock_pending_work(struct work_struct *work); | ||
81 | struct sock *__vsock_create(struct net *net, | 81 | struct sock *__vsock_create(struct net *net, |
82 | struct socket *sock, | 82 | struct socket *sock, |
83 | struct sock *parent, | 83 | struct sock *parent, |
diff --git a/include/net/llc.h b/include/net/llc.h index dc35f25eb679..890a87318014 100644 --- a/include/net/llc.h +++ b/include/net/llc.h | |||
@@ -116,6 +116,11 @@ static inline void llc_sap_hold(struct llc_sap *sap) | |||
116 | refcount_inc(&sap->refcnt); | 116 | refcount_inc(&sap->refcnt); |
117 | } | 117 | } |
118 | 118 | ||
119 | static inline bool llc_sap_hold_safe(struct llc_sap *sap) | ||
120 | { | ||
121 | return refcount_inc_not_zero(&sap->refcnt); | ||
122 | } | ||
123 | |||
119 | void llc_sap_close(struct llc_sap *sap); | 124 | void llc_sap_close(struct llc_sap *sap); |
120 | 125 | ||
121 | static inline void llc_sap_put(struct llc_sap *sap) | 126 | static inline void llc_sap_put(struct llc_sap *sap) |
diff --git a/net/dccp/ccids/ccid2.c b/net/dccp/ccids/ccid2.c index 2b75df469220..842a9c7c73a3 100644 --- a/net/dccp/ccids/ccid2.c +++ b/net/dccp/ccids/ccid2.c | |||
@@ -229,14 +229,16 @@ static void ccid2_cwnd_restart(struct sock *sk, const u32 now) | |||
229 | struct ccid2_hc_tx_sock *hc = ccid2_hc_tx_sk(sk); | 229 | struct ccid2_hc_tx_sock *hc = ccid2_hc_tx_sk(sk); |
230 | u32 cwnd = hc->tx_cwnd, restart_cwnd, | 230 | u32 cwnd = hc->tx_cwnd, restart_cwnd, |
231 | iwnd = rfc3390_bytes_to_packets(dccp_sk(sk)->dccps_mss_cache); | 231 | iwnd = rfc3390_bytes_to_packets(dccp_sk(sk)->dccps_mss_cache); |
232 | s32 delta = now - hc->tx_lsndtime; | ||
232 | 233 | ||
233 | hc->tx_ssthresh = max(hc->tx_ssthresh, (cwnd >> 1) + (cwnd >> 2)); | 234 | hc->tx_ssthresh = max(hc->tx_ssthresh, (cwnd >> 1) + (cwnd >> 2)); |
234 | 235 | ||
235 | /* don't reduce cwnd below the initial window (IW) */ | 236 | /* don't reduce cwnd below the initial window (IW) */ |
236 | restart_cwnd = min(cwnd, iwnd); | 237 | restart_cwnd = min(cwnd, iwnd); |
237 | cwnd >>= (now - hc->tx_lsndtime) / hc->tx_rto; | ||
238 | hc->tx_cwnd = max(cwnd, restart_cwnd); | ||
239 | 238 | ||
239 | while ((delta -= hc->tx_rto) >= 0 && cwnd > restart_cwnd) | ||
240 | cwnd >>= 1; | ||
241 | hc->tx_cwnd = max(cwnd, restart_cwnd); | ||
240 | hc->tx_cwnd_stamp = now; | 242 | hc->tx_cwnd_stamp = now; |
241 | hc->tx_cwnd_used = 0; | 243 | hc->tx_cwnd_used = 0; |
242 | 244 | ||
diff --git a/net/dsa/slave.c b/net/dsa/slave.c index 1ba3bde96b55..962c4fd338ba 100644 --- a/net/dsa/slave.c +++ b/net/dsa/slave.c | |||
@@ -639,7 +639,7 @@ static int dsa_slave_set_eee(struct net_device *dev, struct ethtool_eee *e) | |||
639 | int ret; | 639 | int ret; |
640 | 640 | ||
641 | /* Port's PHY and MAC both need to be EEE capable */ | 641 | /* Port's PHY and MAC both need to be EEE capable */ |
642 | if (!dev->phydev) | 642 | if (!dev->phydev && !dp->pl) |
643 | return -ENODEV; | 643 | return -ENODEV; |
644 | 644 | ||
645 | if (!ds->ops->set_mac_eee) | 645 | if (!ds->ops->set_mac_eee) |
@@ -659,7 +659,7 @@ static int dsa_slave_get_eee(struct net_device *dev, struct ethtool_eee *e) | |||
659 | int ret; | 659 | int ret; |
660 | 660 | ||
661 | /* Port's PHY and MAC both need to be EEE capable */ | 661 | /* Port's PHY and MAC both need to be EEE capable */ |
662 | if (!dev->phydev) | 662 | if (!dev->phydev && !dp->pl) |
663 | return -ENODEV; | 663 | return -ENODEV; |
664 | 664 | ||
665 | if (!ds->ops->get_mac_eee) | 665 | if (!ds->ops->get_mac_eee) |
diff --git a/net/ipv6/ip6_tunnel.c b/net/ipv6/ip6_tunnel.c index 820cebe0c687..5df2a58d945c 100644 --- a/net/ipv6/ip6_tunnel.c +++ b/net/ipv6/ip6_tunnel.c | |||
@@ -1133,12 +1133,8 @@ route_lookup: | |||
1133 | max_headroom += 8; | 1133 | max_headroom += 8; |
1134 | mtu -= 8; | 1134 | mtu -= 8; |
1135 | } | 1135 | } |
1136 | if (skb->protocol == htons(ETH_P_IPV6)) { | 1136 | mtu = max(mtu, skb->protocol == htons(ETH_P_IPV6) ? |
1137 | if (mtu < IPV6_MIN_MTU) | 1137 | IPV6_MIN_MTU : IPV4_MIN_MTU); |
1138 | mtu = IPV6_MIN_MTU; | ||
1139 | } else if (mtu < 576) { | ||
1140 | mtu = 576; | ||
1141 | } | ||
1142 | 1138 | ||
1143 | skb_dst_update_pmtu(skb, mtu); | 1139 | skb_dst_update_pmtu(skb, mtu); |
1144 | if (skb->len - t->tun_hlen - eth_hlen > mtu && !skb_is_gso(skb)) { | 1140 | if (skb->len - t->tun_hlen - eth_hlen > mtu && !skb_is_gso(skb)) { |
diff --git a/net/ipv6/route.c b/net/ipv6/route.c index ec18b3ce8b6d..7208c16302f6 100644 --- a/net/ipv6/route.c +++ b/net/ipv6/route.c | |||
@@ -978,10 +978,6 @@ static void rt6_set_from(struct rt6_info *rt, struct fib6_info *from) | |||
978 | rt->rt6i_flags &= ~RTF_EXPIRES; | 978 | rt->rt6i_flags &= ~RTF_EXPIRES; |
979 | rcu_assign_pointer(rt->from, from); | 979 | rcu_assign_pointer(rt->from, from); |
980 | dst_init_metrics(&rt->dst, from->fib6_metrics->metrics, true); | 980 | dst_init_metrics(&rt->dst, from->fib6_metrics->metrics, true); |
981 | if (from->fib6_metrics != &dst_default_metrics) { | ||
982 | rt->dst._metrics |= DST_METRICS_REFCOUNTED; | ||
983 | refcount_inc(&from->fib6_metrics->refcnt); | ||
984 | } | ||
985 | } | 981 | } |
986 | 982 | ||
987 | /* Caller must already hold reference to @ort */ | 983 | /* Caller must already hold reference to @ort */ |
diff --git a/net/llc/llc_core.c b/net/llc/llc_core.c index 89041260784c..260b3dc1b4a2 100644 --- a/net/llc/llc_core.c +++ b/net/llc/llc_core.c | |||
@@ -73,8 +73,8 @@ struct llc_sap *llc_sap_find(unsigned char sap_value) | |||
73 | 73 | ||
74 | rcu_read_lock_bh(); | 74 | rcu_read_lock_bh(); |
75 | sap = __llc_sap_find(sap_value); | 75 | sap = __llc_sap_find(sap_value); |
76 | if (sap) | 76 | if (!sap || !llc_sap_hold_safe(sap)) |
77 | llc_sap_hold(sap); | 77 | sap = NULL; |
78 | rcu_read_unlock_bh(); | 78 | rcu_read_unlock_bh(); |
79 | return sap; | 79 | return sap; |
80 | } | 80 | } |
diff --git a/net/packet/af_packet.c b/net/packet/af_packet.c index 345e38058ae5..75c92a87e7b2 100644 --- a/net/packet/af_packet.c +++ b/net/packet/af_packet.c | |||
@@ -4230,6 +4230,8 @@ static int packet_set_ring(struct sock *sk, union tpacket_req_u *req_u, | |||
4230 | } | 4230 | } |
4231 | 4231 | ||
4232 | if (req->tp_block_nr) { | 4232 | if (req->tp_block_nr) { |
4233 | unsigned int min_frame_size; | ||
4234 | |||
4233 | /* Sanity tests and some calculations */ | 4235 | /* Sanity tests and some calculations */ |
4234 | err = -EBUSY; | 4236 | err = -EBUSY; |
4235 | if (unlikely(rb->pg_vec)) | 4237 | if (unlikely(rb->pg_vec)) |
@@ -4252,12 +4254,12 @@ static int packet_set_ring(struct sock *sk, union tpacket_req_u *req_u, | |||
4252 | goto out; | 4254 | goto out; |
4253 | if (unlikely(!PAGE_ALIGNED(req->tp_block_size))) | 4255 | if (unlikely(!PAGE_ALIGNED(req->tp_block_size))) |
4254 | goto out; | 4256 | goto out; |
4257 | min_frame_size = po->tp_hdrlen + po->tp_reserve; | ||
4255 | if (po->tp_version >= TPACKET_V3 && | 4258 | if (po->tp_version >= TPACKET_V3 && |
4256 | req->tp_block_size <= | 4259 | req->tp_block_size < |
4257 | BLK_PLUS_PRIV((u64)req_u->req3.tp_sizeof_priv) + sizeof(struct tpacket3_hdr)) | 4260 | BLK_PLUS_PRIV((u64)req_u->req3.tp_sizeof_priv) + min_frame_size) |
4258 | goto out; | 4261 | goto out; |
4259 | if (unlikely(req->tp_frame_size < po->tp_hdrlen + | 4262 | if (unlikely(req->tp_frame_size < min_frame_size)) |
4260 | po->tp_reserve)) | ||
4261 | goto out; | 4263 | goto out; |
4262 | if (unlikely(req->tp_frame_size & (TPACKET_ALIGNMENT - 1))) | 4264 | if (unlikely(req->tp_frame_size & (TPACKET_ALIGNMENT - 1))) |
4263 | goto out; | 4265 | goto out; |
diff --git a/net/rxrpc/ar-internal.h b/net/rxrpc/ar-internal.h index 9d9278a13d91..c97558710421 100644 --- a/net/rxrpc/ar-internal.h +++ b/net/rxrpc/ar-internal.h | |||
@@ -104,9 +104,9 @@ struct rxrpc_net { | |||
104 | 104 | ||
105 | #define RXRPC_KEEPALIVE_TIME 20 /* NAT keepalive time in seconds */ | 105 | #define RXRPC_KEEPALIVE_TIME 20 /* NAT keepalive time in seconds */ |
106 | u8 peer_keepalive_cursor; | 106 | u8 peer_keepalive_cursor; |
107 | ktime_t peer_keepalive_base; | 107 | time64_t peer_keepalive_base; |
108 | struct hlist_head peer_keepalive[RXRPC_KEEPALIVE_TIME + 1]; | 108 | struct list_head peer_keepalive[32]; |
109 | struct hlist_head peer_keepalive_new; | 109 | struct list_head peer_keepalive_new; |
110 | struct timer_list peer_keepalive_timer; | 110 | struct timer_list peer_keepalive_timer; |
111 | struct work_struct peer_keepalive_work; | 111 | struct work_struct peer_keepalive_work; |
112 | }; | 112 | }; |
@@ -295,7 +295,7 @@ struct rxrpc_peer { | |||
295 | struct hlist_head error_targets; /* targets for net error distribution */ | 295 | struct hlist_head error_targets; /* targets for net error distribution */ |
296 | struct work_struct error_distributor; | 296 | struct work_struct error_distributor; |
297 | struct rb_root service_conns; /* Service connections */ | 297 | struct rb_root service_conns; /* Service connections */ |
298 | struct hlist_node keepalive_link; /* Link in net->peer_keepalive[] */ | 298 | struct list_head keepalive_link; /* Link in net->peer_keepalive[] */ |
299 | time64_t last_tx_at; /* Last time packet sent here */ | 299 | time64_t last_tx_at; /* Last time packet sent here */ |
300 | seqlock_t service_conn_lock; | 300 | seqlock_t service_conn_lock; |
301 | spinlock_t lock; /* access lock */ | 301 | spinlock_t lock; /* access lock */ |
diff --git a/net/rxrpc/conn_event.c b/net/rxrpc/conn_event.c index 84d40ba9856f..6df56ce68861 100644 --- a/net/rxrpc/conn_event.c +++ b/net/rxrpc/conn_event.c | |||
@@ -138,7 +138,7 @@ static void rxrpc_conn_retransmit_call(struct rxrpc_connection *conn, | |||
138 | } | 138 | } |
139 | 139 | ||
140 | ret = kernel_sendmsg(conn->params.local->socket, &msg, iov, ioc, len); | 140 | ret = kernel_sendmsg(conn->params.local->socket, &msg, iov, ioc, len); |
141 | conn->params.peer->last_tx_at = ktime_get_real(); | 141 | conn->params.peer->last_tx_at = ktime_get_seconds(); |
142 | if (ret < 0) | 142 | if (ret < 0) |
143 | trace_rxrpc_tx_fail(chan->call_debug_id, serial, ret, | 143 | trace_rxrpc_tx_fail(chan->call_debug_id, serial, ret, |
144 | rxrpc_tx_point_call_final_resend); | 144 | rxrpc_tx_point_call_final_resend); |
@@ -252,7 +252,7 @@ static int rxrpc_abort_connection(struct rxrpc_connection *conn, | |||
252 | 252 | ||
253 | trace_rxrpc_tx_packet(conn->debug_id, &whdr, rxrpc_tx_point_conn_abort); | 253 | trace_rxrpc_tx_packet(conn->debug_id, &whdr, rxrpc_tx_point_conn_abort); |
254 | 254 | ||
255 | conn->params.peer->last_tx_at = ktime_get_real(); | 255 | conn->params.peer->last_tx_at = ktime_get_seconds(); |
256 | 256 | ||
257 | _leave(" = 0"); | 257 | _leave(" = 0"); |
258 | return 0; | 258 | return 0; |
diff --git a/net/rxrpc/net_ns.c b/net/rxrpc/net_ns.c index 5d6a773db973..417d80867c4f 100644 --- a/net/rxrpc/net_ns.c +++ b/net/rxrpc/net_ns.c | |||
@@ -85,12 +85,12 @@ static __net_init int rxrpc_init_net(struct net *net) | |||
85 | hash_init(rxnet->peer_hash); | 85 | hash_init(rxnet->peer_hash); |
86 | spin_lock_init(&rxnet->peer_hash_lock); | 86 | spin_lock_init(&rxnet->peer_hash_lock); |
87 | for (i = 0; i < ARRAY_SIZE(rxnet->peer_keepalive); i++) | 87 | for (i = 0; i < ARRAY_SIZE(rxnet->peer_keepalive); i++) |
88 | INIT_HLIST_HEAD(&rxnet->peer_keepalive[i]); | 88 | INIT_LIST_HEAD(&rxnet->peer_keepalive[i]); |
89 | INIT_HLIST_HEAD(&rxnet->peer_keepalive_new); | 89 | INIT_LIST_HEAD(&rxnet->peer_keepalive_new); |
90 | timer_setup(&rxnet->peer_keepalive_timer, | 90 | timer_setup(&rxnet->peer_keepalive_timer, |
91 | rxrpc_peer_keepalive_timeout, 0); | 91 | rxrpc_peer_keepalive_timeout, 0); |
92 | INIT_WORK(&rxnet->peer_keepalive_work, rxrpc_peer_keepalive_worker); | 92 | INIT_WORK(&rxnet->peer_keepalive_work, rxrpc_peer_keepalive_worker); |
93 | rxnet->peer_keepalive_base = ktime_add(ktime_get_real(), NSEC_PER_SEC); | 93 | rxnet->peer_keepalive_base = ktime_get_seconds(); |
94 | 94 | ||
95 | ret = -ENOMEM; | 95 | ret = -ENOMEM; |
96 | rxnet->proc_net = proc_net_mkdir(net, "rxrpc", net->proc_net); | 96 | rxnet->proc_net = proc_net_mkdir(net, "rxrpc", net->proc_net); |
diff --git a/net/rxrpc/output.c b/net/rxrpc/output.c index 801dbf3d3478..ccf5de160444 100644 --- a/net/rxrpc/output.c +++ b/net/rxrpc/output.c | |||
@@ -209,7 +209,7 @@ int rxrpc_send_ack_packet(struct rxrpc_call *call, bool ping, | |||
209 | now = ktime_get_real(); | 209 | now = ktime_get_real(); |
210 | if (ping) | 210 | if (ping) |
211 | call->ping_time = now; | 211 | call->ping_time = now; |
212 | conn->params.peer->last_tx_at = ktime_get_real(); | 212 | conn->params.peer->last_tx_at = ktime_get_seconds(); |
213 | if (ret < 0) | 213 | if (ret < 0) |
214 | trace_rxrpc_tx_fail(call->debug_id, serial, ret, | 214 | trace_rxrpc_tx_fail(call->debug_id, serial, ret, |
215 | rxrpc_tx_point_call_ack); | 215 | rxrpc_tx_point_call_ack); |
@@ -299,7 +299,7 @@ int rxrpc_send_abort_packet(struct rxrpc_call *call) | |||
299 | 299 | ||
300 | ret = kernel_sendmsg(conn->params.local->socket, | 300 | ret = kernel_sendmsg(conn->params.local->socket, |
301 | &msg, iov, 1, sizeof(pkt)); | 301 | &msg, iov, 1, sizeof(pkt)); |
302 | conn->params.peer->last_tx_at = ktime_get_real(); | 302 | conn->params.peer->last_tx_at = ktime_get_seconds(); |
303 | if (ret < 0) | 303 | if (ret < 0) |
304 | trace_rxrpc_tx_fail(call->debug_id, serial, ret, | 304 | trace_rxrpc_tx_fail(call->debug_id, serial, ret, |
305 | rxrpc_tx_point_call_abort); | 305 | rxrpc_tx_point_call_abort); |
@@ -397,7 +397,7 @@ int rxrpc_send_data_packet(struct rxrpc_call *call, struct sk_buff *skb, | |||
397 | * message and update the peer record | 397 | * message and update the peer record |
398 | */ | 398 | */ |
399 | ret = kernel_sendmsg(conn->params.local->socket, &msg, iov, 2, len); | 399 | ret = kernel_sendmsg(conn->params.local->socket, &msg, iov, 2, len); |
400 | conn->params.peer->last_tx_at = ktime_get_real(); | 400 | conn->params.peer->last_tx_at = ktime_get_seconds(); |
401 | 401 | ||
402 | up_read(&conn->params.local->defrag_sem); | 402 | up_read(&conn->params.local->defrag_sem); |
403 | if (ret < 0) | 403 | if (ret < 0) |
@@ -466,7 +466,7 @@ send_fragmentable: | |||
466 | if (ret == 0) { | 466 | if (ret == 0) { |
467 | ret = kernel_sendmsg(conn->params.local->socket, &msg, | 467 | ret = kernel_sendmsg(conn->params.local->socket, &msg, |
468 | iov, 2, len); | 468 | iov, 2, len); |
469 | conn->params.peer->last_tx_at = ktime_get_real(); | 469 | conn->params.peer->last_tx_at = ktime_get_seconds(); |
470 | 470 | ||
471 | opt = IP_PMTUDISC_DO; | 471 | opt = IP_PMTUDISC_DO; |
472 | kernel_setsockopt(conn->params.local->socket, SOL_IP, | 472 | kernel_setsockopt(conn->params.local->socket, SOL_IP, |
@@ -484,7 +484,7 @@ send_fragmentable: | |||
484 | if (ret == 0) { | 484 | if (ret == 0) { |
485 | ret = kernel_sendmsg(conn->params.local->socket, &msg, | 485 | ret = kernel_sendmsg(conn->params.local->socket, &msg, |
486 | iov, 2, len); | 486 | iov, 2, len); |
487 | conn->params.peer->last_tx_at = ktime_get_real(); | 487 | conn->params.peer->last_tx_at = ktime_get_seconds(); |
488 | 488 | ||
489 | opt = IPV6_PMTUDISC_DO; | 489 | opt = IPV6_PMTUDISC_DO; |
490 | kernel_setsockopt(conn->params.local->socket, | 490 | kernel_setsockopt(conn->params.local->socket, |
@@ -617,6 +617,6 @@ void rxrpc_send_keepalive(struct rxrpc_peer *peer) | |||
617 | trace_rxrpc_tx_packet(peer->debug_id, &whdr, | 617 | trace_rxrpc_tx_packet(peer->debug_id, &whdr, |
618 | rxrpc_tx_point_version_keepalive); | 618 | rxrpc_tx_point_version_keepalive); |
619 | 619 | ||
620 | peer->last_tx_at = ktime_get_real(); | 620 | peer->last_tx_at = ktime_get_seconds(); |
621 | _leave(""); | 621 | _leave(""); |
622 | } | 622 | } |
diff --git a/net/rxrpc/peer_event.c b/net/rxrpc/peer_event.c index 0ed8b651cec2..4f9da2f51c69 100644 --- a/net/rxrpc/peer_event.c +++ b/net/rxrpc/peer_event.c | |||
@@ -350,97 +350,117 @@ void rxrpc_peer_add_rtt(struct rxrpc_call *call, enum rxrpc_rtt_rx_trace why, | |||
350 | } | 350 | } |
351 | 351 | ||
352 | /* | 352 | /* |
353 | * Perform keep-alive pings with VERSION packets to keep any NAT alive. | 353 | * Perform keep-alive pings. |
354 | */ | 354 | */ |
355 | void rxrpc_peer_keepalive_worker(struct work_struct *work) | 355 | static void rxrpc_peer_keepalive_dispatch(struct rxrpc_net *rxnet, |
356 | struct list_head *collector, | ||
357 | time64_t base, | ||
358 | u8 cursor) | ||
356 | { | 359 | { |
357 | struct rxrpc_net *rxnet = | ||
358 | container_of(work, struct rxrpc_net, peer_keepalive_work); | ||
359 | struct rxrpc_peer *peer; | 360 | struct rxrpc_peer *peer; |
360 | unsigned long delay; | 361 | const u8 mask = ARRAY_SIZE(rxnet->peer_keepalive) - 1; |
361 | ktime_t base, now = ktime_get_real(); | 362 | time64_t keepalive_at; |
362 | s64 diff; | 363 | int slot; |
363 | u8 cursor, slot; | ||
364 | 364 | ||
365 | base = rxnet->peer_keepalive_base; | 365 | spin_lock_bh(&rxnet->peer_hash_lock); |
366 | cursor = rxnet->peer_keepalive_cursor; | ||
367 | 366 | ||
368 | _enter("%u,%lld", cursor, ktime_sub(now, base)); | 367 | while (!list_empty(collector)) { |
368 | peer = list_entry(collector->next, | ||
369 | struct rxrpc_peer, keepalive_link); | ||
369 | 370 | ||
370 | next_bucket: | 371 | list_del_init(&peer->keepalive_link); |
371 | diff = ktime_to_ns(ktime_sub(now, base)); | 372 | if (!rxrpc_get_peer_maybe(peer)) |
372 | if (diff < 0) | 373 | continue; |
373 | goto resched; | ||
374 | 374 | ||
375 | _debug("at %u", cursor); | ||
376 | spin_lock_bh(&rxnet->peer_hash_lock); | ||
377 | next_peer: | ||
378 | if (!rxnet->live) { | ||
379 | spin_unlock_bh(&rxnet->peer_hash_lock); | 375 | spin_unlock_bh(&rxnet->peer_hash_lock); |
380 | goto out; | ||
381 | } | ||
382 | 376 | ||
383 | /* Everything in the bucket at the cursor is processed this second; the | 377 | keepalive_at = peer->last_tx_at + RXRPC_KEEPALIVE_TIME; |
384 | * bucket at cursor + 1 goes now + 1s and so on... | 378 | slot = keepalive_at - base; |
385 | */ | 379 | _debug("%02x peer %u t=%d {%pISp}", |
386 | if (hlist_empty(&rxnet->peer_keepalive[cursor])) { | 380 | cursor, peer->debug_id, slot, &peer->srx.transport); |
387 | if (hlist_empty(&rxnet->peer_keepalive_new)) { | 381 | |
388 | spin_unlock_bh(&rxnet->peer_hash_lock); | 382 | if (keepalive_at <= base || |
389 | goto emptied_bucket; | 383 | keepalive_at > base + RXRPC_KEEPALIVE_TIME) { |
384 | rxrpc_send_keepalive(peer); | ||
385 | slot = RXRPC_KEEPALIVE_TIME; | ||
390 | } | 386 | } |
391 | 387 | ||
392 | hlist_move_list(&rxnet->peer_keepalive_new, | 388 | /* A transmission to this peer occurred since last we examined |
393 | &rxnet->peer_keepalive[cursor]); | 389 | * it so put it into the appropriate future bucket. |
390 | */ | ||
391 | slot += cursor; | ||
392 | slot &= mask; | ||
393 | spin_lock_bh(&rxnet->peer_hash_lock); | ||
394 | list_add_tail(&peer->keepalive_link, | ||
395 | &rxnet->peer_keepalive[slot & mask]); | ||
396 | rxrpc_put_peer(peer); | ||
394 | } | 397 | } |
395 | 398 | ||
396 | peer = hlist_entry(rxnet->peer_keepalive[cursor].first, | ||
397 | struct rxrpc_peer, keepalive_link); | ||
398 | hlist_del_init(&peer->keepalive_link); | ||
399 | if (!rxrpc_get_peer_maybe(peer)) | ||
400 | goto next_peer; | ||
401 | |||
402 | spin_unlock_bh(&rxnet->peer_hash_lock); | 399 | spin_unlock_bh(&rxnet->peer_hash_lock); |
400 | } | ||
403 | 401 | ||
404 | _debug("peer %u {%pISp}", peer->debug_id, &peer->srx.transport); | 402 | /* |
403 | * Perform keep-alive pings with VERSION packets to keep any NAT alive. | ||
404 | */ | ||
405 | void rxrpc_peer_keepalive_worker(struct work_struct *work) | ||
406 | { | ||
407 | struct rxrpc_net *rxnet = | ||
408 | container_of(work, struct rxrpc_net, peer_keepalive_work); | ||
409 | const u8 mask = ARRAY_SIZE(rxnet->peer_keepalive) - 1; | ||
410 | time64_t base, now, delay; | ||
411 | u8 cursor, stop; | ||
412 | LIST_HEAD(collector); | ||
405 | 413 | ||
406 | recalc: | 414 | now = ktime_get_seconds(); |
407 | diff = ktime_divns(ktime_sub(peer->last_tx_at, base), NSEC_PER_SEC); | 415 | base = rxnet->peer_keepalive_base; |
408 | if (diff < -30 || diff > 30) | 416 | cursor = rxnet->peer_keepalive_cursor; |
409 | goto send; /* LSW of 64-bit time probably wrapped on 32-bit */ | 417 | _enter("%lld,%u", base - now, cursor); |
410 | diff += RXRPC_KEEPALIVE_TIME - 1; | ||
411 | if (diff < 0) | ||
412 | goto send; | ||
413 | 418 | ||
414 | slot = (diff > RXRPC_KEEPALIVE_TIME - 1) ? RXRPC_KEEPALIVE_TIME - 1 : diff; | 419 | if (!rxnet->live) |
415 | if (slot == 0) | 420 | return; |
416 | goto send; | ||
417 | 421 | ||
418 | /* A transmission to this peer occurred since last we examined it so | 422 | /* Remove to a temporary list all the peers that are currently lodged |
419 | * put it into the appropriate future bucket. | 423 | * in expired buckets plus all new peers. |
424 | * | ||
425 | * Everything in the bucket at the cursor is processed this | ||
426 | * second; the bucket at cursor + 1 goes at now + 1s and so | ||
427 | * on... | ||
420 | */ | 428 | */ |
421 | slot = (slot + cursor) % ARRAY_SIZE(rxnet->peer_keepalive); | ||
422 | spin_lock_bh(&rxnet->peer_hash_lock); | 429 | spin_lock_bh(&rxnet->peer_hash_lock); |
423 | hlist_add_head(&peer->keepalive_link, &rxnet->peer_keepalive[slot]); | 430 | list_splice_init(&rxnet->peer_keepalive_new, &collector); |
424 | rxrpc_put_peer(peer); | 431 | |
425 | goto next_peer; | 432 | stop = cursor + ARRAY_SIZE(rxnet->peer_keepalive); |
426 | 433 | while (base <= now && (s8)(cursor - stop) < 0) { | |
427 | send: | 434 | list_splice_tail_init(&rxnet->peer_keepalive[cursor & mask], |
428 | rxrpc_send_keepalive(peer); | 435 | &collector); |
429 | now = ktime_get_real(); | 436 | base++; |
430 | goto recalc; | 437 | cursor++; |
438 | } | ||
431 | 439 | ||
432 | emptied_bucket: | 440 | base = now; |
433 | cursor++; | 441 | spin_unlock_bh(&rxnet->peer_hash_lock); |
434 | if (cursor >= ARRAY_SIZE(rxnet->peer_keepalive)) | ||
435 | cursor = 0; | ||
436 | base = ktime_add_ns(base, NSEC_PER_SEC); | ||
437 | goto next_bucket; | ||
438 | 442 | ||
439 | resched: | ||
440 | rxnet->peer_keepalive_base = base; | 443 | rxnet->peer_keepalive_base = base; |
441 | rxnet->peer_keepalive_cursor = cursor; | 444 | rxnet->peer_keepalive_cursor = cursor; |
442 | delay = nsecs_to_jiffies(-diff) + 1; | 445 | rxrpc_peer_keepalive_dispatch(rxnet, &collector, base, cursor); |
443 | timer_reduce(&rxnet->peer_keepalive_timer, jiffies + delay); | 446 | ASSERT(list_empty(&collector)); |
444 | out: | 447 | |
448 | /* Schedule the timer for the next occupied timeslot. */ | ||
449 | cursor = rxnet->peer_keepalive_cursor; | ||
450 | stop = cursor + RXRPC_KEEPALIVE_TIME - 1; | ||
451 | for (; (s8)(cursor - stop) < 0; cursor++) { | ||
452 | if (!list_empty(&rxnet->peer_keepalive[cursor & mask])) | ||
453 | break; | ||
454 | base++; | ||
455 | } | ||
456 | |||
457 | now = ktime_get_seconds(); | ||
458 | delay = base - now; | ||
459 | if (delay < 1) | ||
460 | delay = 1; | ||
461 | delay *= HZ; | ||
462 | if (rxnet->live) | ||
463 | timer_reduce(&rxnet->peer_keepalive_timer, jiffies + delay); | ||
464 | |||
445 | _leave(""); | 465 | _leave(""); |
446 | } | 466 | } |
diff --git a/net/rxrpc/peer_object.c b/net/rxrpc/peer_object.c index 1b7e8107b3ae..24ec7cdcf332 100644 --- a/net/rxrpc/peer_object.c +++ b/net/rxrpc/peer_object.c | |||
@@ -322,7 +322,7 @@ struct rxrpc_peer *rxrpc_lookup_incoming_peer(struct rxrpc_local *local, | |||
322 | if (!peer) { | 322 | if (!peer) { |
323 | peer = prealloc; | 323 | peer = prealloc; |
324 | hash_add_rcu(rxnet->peer_hash, &peer->hash_link, hash_key); | 324 | hash_add_rcu(rxnet->peer_hash, &peer->hash_link, hash_key); |
325 | hlist_add_head(&peer->keepalive_link, &rxnet->peer_keepalive_new); | 325 | list_add_tail(&peer->keepalive_link, &rxnet->peer_keepalive_new); |
326 | } | 326 | } |
327 | 327 | ||
328 | spin_unlock(&rxnet->peer_hash_lock); | 328 | spin_unlock(&rxnet->peer_hash_lock); |
@@ -367,8 +367,8 @@ struct rxrpc_peer *rxrpc_lookup_peer(struct rxrpc_local *local, | |||
367 | if (!peer) { | 367 | if (!peer) { |
368 | hash_add_rcu(rxnet->peer_hash, | 368 | hash_add_rcu(rxnet->peer_hash, |
369 | &candidate->hash_link, hash_key); | 369 | &candidate->hash_link, hash_key); |
370 | hlist_add_head(&candidate->keepalive_link, | 370 | list_add_tail(&candidate->keepalive_link, |
371 | &rxnet->peer_keepalive_new); | 371 | &rxnet->peer_keepalive_new); |
372 | } | 372 | } |
373 | 373 | ||
374 | spin_unlock_bh(&rxnet->peer_hash_lock); | 374 | spin_unlock_bh(&rxnet->peer_hash_lock); |
@@ -441,7 +441,7 @@ static void __rxrpc_put_peer(struct rxrpc_peer *peer) | |||
441 | 441 | ||
442 | spin_lock_bh(&rxnet->peer_hash_lock); | 442 | spin_lock_bh(&rxnet->peer_hash_lock); |
443 | hash_del_rcu(&peer->hash_link); | 443 | hash_del_rcu(&peer->hash_link); |
444 | hlist_del_init(&peer->keepalive_link); | 444 | list_del_init(&peer->keepalive_link); |
445 | spin_unlock_bh(&rxnet->peer_hash_lock); | 445 | spin_unlock_bh(&rxnet->peer_hash_lock); |
446 | 446 | ||
447 | kfree_rcu(peer, rcu); | 447 | kfree_rcu(peer, rcu); |
diff --git a/net/rxrpc/rxkad.c b/net/rxrpc/rxkad.c index eaf8f4f446b0..cea16838d588 100644 --- a/net/rxrpc/rxkad.c +++ b/net/rxrpc/rxkad.c | |||
@@ -670,7 +670,7 @@ static int rxkad_issue_challenge(struct rxrpc_connection *conn) | |||
670 | return -EAGAIN; | 670 | return -EAGAIN; |
671 | } | 671 | } |
672 | 672 | ||
673 | conn->params.peer->last_tx_at = ktime_get_real(); | 673 | conn->params.peer->last_tx_at = ktime_get_seconds(); |
674 | trace_rxrpc_tx_packet(conn->debug_id, &whdr, | 674 | trace_rxrpc_tx_packet(conn->debug_id, &whdr, |
675 | rxrpc_tx_point_rxkad_challenge); | 675 | rxrpc_tx_point_rxkad_challenge); |
676 | _leave(" = 0"); | 676 | _leave(" = 0"); |
@@ -728,8 +728,7 @@ static int rxkad_send_response(struct rxrpc_connection *conn, | |||
728 | return -EAGAIN; | 728 | return -EAGAIN; |
729 | } | 729 | } |
730 | 730 | ||
731 | conn->params.peer->last_tx_at = ktime_get_real(); | 731 | conn->params.peer->last_tx_at = ktime_get_seconds(); |
732 | trace_rxrpc_tx_packet(0, &whdr, rxrpc_tx_point_rxkad_response); | ||
733 | _leave(" = 0"); | 732 | _leave(" = 0"); |
734 | return 0; | 733 | return 0; |
735 | } | 734 | } |
diff --git a/net/smc/af_smc.c b/net/smc/af_smc.c index 0fc94f296e54..2d8a1e15e4f9 100644 --- a/net/smc/af_smc.c +++ b/net/smc/af_smc.c | |||
@@ -1305,6 +1305,8 @@ static void smc_tcp_listen_work(struct work_struct *work) | |||
1305 | sock_hold(lsk); /* sock_put in smc_listen_work */ | 1305 | sock_hold(lsk); /* sock_put in smc_listen_work */ |
1306 | INIT_WORK(&new_smc->smc_listen_work, smc_listen_work); | 1306 | INIT_WORK(&new_smc->smc_listen_work, smc_listen_work); |
1307 | smc_copy_sock_settings_to_smc(new_smc); | 1307 | smc_copy_sock_settings_to_smc(new_smc); |
1308 | new_smc->sk.sk_sndbuf = lsmc->sk.sk_sndbuf; | ||
1309 | new_smc->sk.sk_rcvbuf = lsmc->sk.sk_rcvbuf; | ||
1308 | sock_hold(&new_smc->sk); /* sock_put in passive closing */ | 1310 | sock_hold(&new_smc->sk); /* sock_put in passive closing */ |
1309 | if (!schedule_work(&new_smc->smc_listen_work)) | 1311 | if (!schedule_work(&new_smc->smc_listen_work)) |
1310 | sock_put(&new_smc->sk); | 1312 | sock_put(&new_smc->sk); |
@@ -1581,8 +1583,7 @@ static int smc_shutdown(struct socket *sock, int how) | |||
1581 | lock_sock(sk); | 1583 | lock_sock(sk); |
1582 | 1584 | ||
1583 | rc = -ENOTCONN; | 1585 | rc = -ENOTCONN; |
1584 | if ((sk->sk_state != SMC_LISTEN) && | 1586 | if ((sk->sk_state != SMC_ACTIVE) && |
1585 | (sk->sk_state != SMC_ACTIVE) && | ||
1586 | (sk->sk_state != SMC_PEERCLOSEWAIT1) && | 1587 | (sk->sk_state != SMC_PEERCLOSEWAIT1) && |
1587 | (sk->sk_state != SMC_PEERCLOSEWAIT2) && | 1588 | (sk->sk_state != SMC_PEERCLOSEWAIT2) && |
1588 | (sk->sk_state != SMC_APPCLOSEWAIT1) && | 1589 | (sk->sk_state != SMC_APPCLOSEWAIT1) && |
@@ -1706,12 +1707,16 @@ static int smc_ioctl(struct socket *sock, unsigned int cmd, | |||
1706 | 1707 | ||
1707 | smc = smc_sk(sock->sk); | 1708 | smc = smc_sk(sock->sk); |
1708 | conn = &smc->conn; | 1709 | conn = &smc->conn; |
1710 | lock_sock(&smc->sk); | ||
1709 | if (smc->use_fallback) { | 1711 | if (smc->use_fallback) { |
1710 | if (!smc->clcsock) | 1712 | if (!smc->clcsock) { |
1713 | release_sock(&smc->sk); | ||
1711 | return -EBADF; | 1714 | return -EBADF; |
1712 | return smc->clcsock->ops->ioctl(smc->clcsock, cmd, arg); | 1715 | } |
1716 | answ = smc->clcsock->ops->ioctl(smc->clcsock, cmd, arg); | ||
1717 | release_sock(&smc->sk); | ||
1718 | return answ; | ||
1713 | } | 1719 | } |
1714 | lock_sock(&smc->sk); | ||
1715 | switch (cmd) { | 1720 | switch (cmd) { |
1716 | case SIOCINQ: /* same as FIONREAD */ | 1721 | case SIOCINQ: /* same as FIONREAD */ |
1717 | if (smc->sk.sk_state == SMC_LISTEN) { | 1722 | if (smc->sk.sk_state == SMC_LISTEN) { |
diff --git a/net/tipc/net.c b/net/tipc/net.c index a7f6964c3a4b..62199cf5a56c 100644 --- a/net/tipc/net.c +++ b/net/tipc/net.c | |||
@@ -123,15 +123,13 @@ void tipc_net_finalize(struct net *net, u32 addr) | |||
123 | { | 123 | { |
124 | struct tipc_net *tn = tipc_net(net); | 124 | struct tipc_net *tn = tipc_net(net); |
125 | 125 | ||
126 | spin_lock_bh(&tn->node_list_lock); | 126 | if (!cmpxchg(&tn->node_addr, 0, addr)) { |
127 | if (!tipc_own_addr(net)) { | ||
128 | tipc_set_node_addr(net, addr); | 127 | tipc_set_node_addr(net, addr); |
129 | tipc_named_reinit(net); | 128 | tipc_named_reinit(net); |
130 | tipc_sk_reinit(net); | 129 | tipc_sk_reinit(net); |
131 | tipc_nametbl_publish(net, TIPC_CFG_SRV, addr, addr, | 130 | tipc_nametbl_publish(net, TIPC_CFG_SRV, addr, addr, |
132 | TIPC_CLUSTER_SCOPE, 0, addr); | 131 | TIPC_CLUSTER_SCOPE, 0, addr); |
133 | } | 132 | } |
134 | spin_unlock_bh(&tn->node_list_lock); | ||
135 | } | 133 | } |
136 | 134 | ||
137 | void tipc_net_stop(struct net *net) | 135 | void tipc_net_stop(struct net *net) |
diff --git a/net/vmw_vsock/af_vsock.c b/net/vmw_vsock/af_vsock.c index c1076c19b858..ab27a2872935 100644 --- a/net/vmw_vsock/af_vsock.c +++ b/net/vmw_vsock/af_vsock.c | |||
@@ -451,14 +451,14 @@ static int vsock_send_shutdown(struct sock *sk, int mode) | |||
451 | return transport->shutdown(vsock_sk(sk), mode); | 451 | return transport->shutdown(vsock_sk(sk), mode); |
452 | } | 452 | } |
453 | 453 | ||
454 | void vsock_pending_work(struct work_struct *work) | 454 | static void vsock_pending_work(struct work_struct *work) |
455 | { | 455 | { |
456 | struct sock *sk; | 456 | struct sock *sk; |
457 | struct sock *listener; | 457 | struct sock *listener; |
458 | struct vsock_sock *vsk; | 458 | struct vsock_sock *vsk; |
459 | bool cleanup; | 459 | bool cleanup; |
460 | 460 | ||
461 | vsk = container_of(work, struct vsock_sock, dwork.work); | 461 | vsk = container_of(work, struct vsock_sock, pending_work.work); |
462 | sk = sk_vsock(vsk); | 462 | sk = sk_vsock(vsk); |
463 | listener = vsk->listener; | 463 | listener = vsk->listener; |
464 | cleanup = true; | 464 | cleanup = true; |
@@ -498,7 +498,6 @@ out: | |||
498 | sock_put(sk); | 498 | sock_put(sk); |
499 | sock_put(listener); | 499 | sock_put(listener); |
500 | } | 500 | } |
501 | EXPORT_SYMBOL_GPL(vsock_pending_work); | ||
502 | 501 | ||
503 | /**** SOCKET OPERATIONS ****/ | 502 | /**** SOCKET OPERATIONS ****/ |
504 | 503 | ||
@@ -597,6 +596,8 @@ static int __vsock_bind(struct sock *sk, struct sockaddr_vm *addr) | |||
597 | return retval; | 596 | return retval; |
598 | } | 597 | } |
599 | 598 | ||
599 | static void vsock_connect_timeout(struct work_struct *work); | ||
600 | |||
600 | struct sock *__vsock_create(struct net *net, | 601 | struct sock *__vsock_create(struct net *net, |
601 | struct socket *sock, | 602 | struct socket *sock, |
602 | struct sock *parent, | 603 | struct sock *parent, |
@@ -638,6 +639,8 @@ struct sock *__vsock_create(struct net *net, | |||
638 | vsk->sent_request = false; | 639 | vsk->sent_request = false; |
639 | vsk->ignore_connecting_rst = false; | 640 | vsk->ignore_connecting_rst = false; |
640 | vsk->peer_shutdown = 0; | 641 | vsk->peer_shutdown = 0; |
642 | INIT_DELAYED_WORK(&vsk->connect_work, vsock_connect_timeout); | ||
643 | INIT_DELAYED_WORK(&vsk->pending_work, vsock_pending_work); | ||
641 | 644 | ||
642 | psk = parent ? vsock_sk(parent) : NULL; | 645 | psk = parent ? vsock_sk(parent) : NULL; |
643 | if (parent) { | 646 | if (parent) { |
@@ -1117,7 +1120,7 @@ static void vsock_connect_timeout(struct work_struct *work) | |||
1117 | struct vsock_sock *vsk; | 1120 | struct vsock_sock *vsk; |
1118 | int cancel = 0; | 1121 | int cancel = 0; |
1119 | 1122 | ||
1120 | vsk = container_of(work, struct vsock_sock, dwork.work); | 1123 | vsk = container_of(work, struct vsock_sock, connect_work.work); |
1121 | sk = sk_vsock(vsk); | 1124 | sk = sk_vsock(vsk); |
1122 | 1125 | ||
1123 | lock_sock(sk); | 1126 | lock_sock(sk); |
@@ -1221,9 +1224,7 @@ static int vsock_stream_connect(struct socket *sock, struct sockaddr *addr, | |||
1221 | * timeout fires. | 1224 | * timeout fires. |
1222 | */ | 1225 | */ |
1223 | sock_hold(sk); | 1226 | sock_hold(sk); |
1224 | INIT_DELAYED_WORK(&vsk->dwork, | 1227 | schedule_delayed_work(&vsk->connect_work, timeout); |
1225 | vsock_connect_timeout); | ||
1226 | schedule_delayed_work(&vsk->dwork, timeout); | ||
1227 | 1228 | ||
1228 | /* Skip ahead to preserve error code set above. */ | 1229 | /* Skip ahead to preserve error code set above. */ |
1229 | goto out_wait; | 1230 | goto out_wait; |
diff --git a/net/vmw_vsock/vmci_transport.c b/net/vmw_vsock/vmci_transport.c index a7a73ffe675b..cb332adb84cd 100644 --- a/net/vmw_vsock/vmci_transport.c +++ b/net/vmw_vsock/vmci_transport.c | |||
@@ -1094,8 +1094,7 @@ static int vmci_transport_recv_listen(struct sock *sk, | |||
1094 | vpending->listener = sk; | 1094 | vpending->listener = sk; |
1095 | sock_hold(sk); | 1095 | sock_hold(sk); |
1096 | sock_hold(pending); | 1096 | sock_hold(pending); |
1097 | INIT_DELAYED_WORK(&vpending->dwork, vsock_pending_work); | 1097 | schedule_delayed_work(&vpending->pending_work, HZ); |
1098 | schedule_delayed_work(&vpending->dwork, HZ); | ||
1099 | 1098 | ||
1100 | out: | 1099 | out: |
1101 | return err; | 1100 | return err; |