1 |
commit: 1e9d12596e3b32b5f8db872785dba97e0f54d942 |
2 |
Author: Mike Pagano <mpagano <AT> gentoo <DOT> org> |
3 |
AuthorDate: Tue Jun 4 11:08:46 2019 +0000 |
4 |
Commit: Mike Pagano <mpagano <AT> gentoo <DOT> org> |
5 |
CommitDate: Tue Jun 4 11:08:46 2019 +0000 |
6 |
URL: https://gitweb.gentoo.org/proj/linux-patches.git/commit/?id=1e9d1259 |
7 |
|
8 |
Linux patch 5.1.7 |
9 |
|
10 |
Signed-off-by: Mike Pagano <mpagano <AT> gentoo.org> |
11 |
|
12 |
0000_README | 4 + |
13 |
1006_linux-5.1.7.patch | 1551 ++++++++++++++++++++++++++++++++++++++++++++++++ |
14 |
2 files changed, 1555 insertions(+) |
15 |
|
16 |
diff --git a/0000_README b/0000_README |
17 |
index 7713f53..7c0827d 100644 |
18 |
--- a/0000_README |
19 |
+++ b/0000_README |
20 |
@@ -67,6 +67,10 @@ Patch: 1005_linux-5.1.6.patch |
21 |
From: http://www.kernel.org |
22 |
Desc: Linux 5.1.6 |
23 |
|
24 |
+Patch: 1006_linux-5.1.7.patch |
25 |
+From: http://www.kernel.org |
26 |
+Desc: Linux 5.1.7 |
27 |
+ |
28 |
Patch: 1500_XATTR_USER_PREFIX.patch |
29 |
From: https://bugs.gentoo.org/show_bug.cgi?id=470644 |
30 |
Desc: Support for namespace user.pax.* on tmpfs. |
31 |
|
32 |
diff --git a/1006_linux-5.1.7.patch b/1006_linux-5.1.7.patch |
33 |
new file mode 100644 |
34 |
index 0000000..6a91998 |
35 |
--- /dev/null |
36 |
+++ b/1006_linux-5.1.7.patch |
37 |
@@ -0,0 +1,1551 @@ |
38 |
+diff --git a/Makefile b/Makefile |
39 |
+index d8bdd2bb55dc..299578ce385a 100644 |
40 |
+--- a/Makefile |
41 |
++++ b/Makefile |
42 |
+@@ -1,7 +1,7 @@ |
43 |
+ # SPDX-License-Identifier: GPL-2.0 |
44 |
+ VERSION = 5 |
45 |
+ PATCHLEVEL = 1 |
46 |
+-SUBLEVEL = 6 |
47 |
++SUBLEVEL = 7 |
48 |
+ EXTRAVERSION = |
49 |
+ NAME = Shy Crocodile |
50 |
+ |
51 |
+diff --git a/drivers/crypto/vmx/ghash.c b/drivers/crypto/vmx/ghash.c |
52 |
+index dd8b8716467a..2d1a8cd35509 100644 |
53 |
+--- a/drivers/crypto/vmx/ghash.c |
54 |
++++ b/drivers/crypto/vmx/ghash.c |
55 |
+@@ -1,22 +1,14 @@ |
56 |
++// SPDX-License-Identifier: GPL-2.0 |
57 |
+ /** |
58 |
+ * GHASH routines supporting VMX instructions on the Power 8 |
59 |
+ * |
60 |
+- * Copyright (C) 2015 International Business Machines Inc. |
61 |
+- * |
62 |
+- * This program is free software; you can redistribute it and/or modify |
63 |
+- * it under the terms of the GNU General Public License as published by |
64 |
+- * the Free Software Foundation; version 2 only. |
65 |
+- * |
66 |
+- * This program is distributed in the hope that it will be useful, |
67 |
+- * but WITHOUT ANY WARRANTY; without even the implied warranty of |
68 |
+- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
69 |
+- * GNU General Public License for more details. |
70 |
+- * |
71 |
+- * You should have received a copy of the GNU General Public License |
72 |
+- * along with this program; if not, write to the Free Software |
73 |
+- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
74 |
++ * Copyright (C) 2015, 2019 International Business Machines Inc. |
75 |
+ * |
76 |
+ * Author: Marcelo Henrique Cerri <mhcerri@××××××.com> |
77 |
++ * |
78 |
++ * Extended by Daniel Axtens <dja@××××××.net> to replace the fallback |
79 |
++ * mechanism. The new approach is based on arm64 code, which is: |
80 |
++ * Copyright (C) 2014 - 2018 Linaro Ltd. <ard.biesheuvel@××××××.org> |
81 |
+ */ |
82 |
+ |
83 |
+ #include <linux/types.h> |
84 |
+@@ -39,71 +31,25 @@ void gcm_ghash_p8(u64 Xi[2], const u128 htable[16], |
85 |
+ const u8 *in, size_t len); |
86 |
+ |
87 |
+ struct p8_ghash_ctx { |
88 |
++ /* key used by vector asm */ |
89 |
+ u128 htable[16]; |
90 |
+- struct crypto_shash *fallback; |
91 |
++ /* key used by software fallback */ |
92 |
++ be128 key; |
93 |
+ }; |
94 |
+ |
95 |
+ struct p8_ghash_desc_ctx { |
96 |
+ u64 shash[2]; |
97 |
+ u8 buffer[GHASH_DIGEST_SIZE]; |
98 |
+ int bytes; |
99 |
+- struct shash_desc fallback_desc; |
100 |
+ }; |
101 |
+ |
102 |
+-static int p8_ghash_init_tfm(struct crypto_tfm *tfm) |
103 |
+-{ |
104 |
+- const char *alg = "ghash-generic"; |
105 |
+- struct crypto_shash *fallback; |
106 |
+- struct crypto_shash *shash_tfm = __crypto_shash_cast(tfm); |
107 |
+- struct p8_ghash_ctx *ctx = crypto_tfm_ctx(tfm); |
108 |
+- |
109 |
+- fallback = crypto_alloc_shash(alg, 0, CRYPTO_ALG_NEED_FALLBACK); |
110 |
+- if (IS_ERR(fallback)) { |
111 |
+- printk(KERN_ERR |
112 |
+- "Failed to allocate transformation for '%s': %ld\n", |
113 |
+- alg, PTR_ERR(fallback)); |
114 |
+- return PTR_ERR(fallback); |
115 |
+- } |
116 |
+- |
117 |
+- crypto_shash_set_flags(fallback, |
118 |
+- crypto_shash_get_flags((struct crypto_shash |
119 |
+- *) tfm)); |
120 |
+- |
121 |
+- /* Check if the descsize defined in the algorithm is still enough. */ |
122 |
+- if (shash_tfm->descsize < sizeof(struct p8_ghash_desc_ctx) |
123 |
+- + crypto_shash_descsize(fallback)) { |
124 |
+- printk(KERN_ERR |
125 |
+- "Desc size of the fallback implementation (%s) does not match the expected value: %lu vs %u\n", |
126 |
+- alg, |
127 |
+- shash_tfm->descsize - sizeof(struct p8_ghash_desc_ctx), |
128 |
+- crypto_shash_descsize(fallback)); |
129 |
+- return -EINVAL; |
130 |
+- } |
131 |
+- ctx->fallback = fallback; |
132 |
+- |
133 |
+- return 0; |
134 |
+-} |
135 |
+- |
136 |
+-static void p8_ghash_exit_tfm(struct crypto_tfm *tfm) |
137 |
+-{ |
138 |
+- struct p8_ghash_ctx *ctx = crypto_tfm_ctx(tfm); |
139 |
+- |
140 |
+- if (ctx->fallback) { |
141 |
+- crypto_free_shash(ctx->fallback); |
142 |
+- ctx->fallback = NULL; |
143 |
+- } |
144 |
+-} |
145 |
+- |
146 |
+ static int p8_ghash_init(struct shash_desc *desc) |
147 |
+ { |
148 |
+- struct p8_ghash_ctx *ctx = crypto_tfm_ctx(crypto_shash_tfm(desc->tfm)); |
149 |
+ struct p8_ghash_desc_ctx *dctx = shash_desc_ctx(desc); |
150 |
+ |
151 |
+ dctx->bytes = 0; |
152 |
+ memset(dctx->shash, 0, GHASH_DIGEST_SIZE); |
153 |
+- dctx->fallback_desc.tfm = ctx->fallback; |
154 |
+- dctx->fallback_desc.flags = desc->flags; |
155 |
+- return crypto_shash_init(&dctx->fallback_desc); |
156 |
++ return 0; |
157 |
+ } |
158 |
+ |
159 |
+ static int p8_ghash_setkey(struct crypto_shash *tfm, const u8 *key, |
160 |
+@@ -121,7 +67,51 @@ static int p8_ghash_setkey(struct crypto_shash *tfm, const u8 *key, |
161 |
+ disable_kernel_vsx(); |
162 |
+ pagefault_enable(); |
163 |
+ preempt_enable(); |
164 |
+- return crypto_shash_setkey(ctx->fallback, key, keylen); |
165 |
++ |
166 |
++ memcpy(&ctx->key, key, GHASH_BLOCK_SIZE); |
167 |
++ |
168 |
++ return 0; |
169 |
++} |
170 |
++ |
171 |
++static inline void __ghash_block(struct p8_ghash_ctx *ctx, |
172 |
++ struct p8_ghash_desc_ctx *dctx) |
173 |
++{ |
174 |
++ if (!IN_INTERRUPT) { |
175 |
++ preempt_disable(); |
176 |
++ pagefault_disable(); |
177 |
++ enable_kernel_vsx(); |
178 |
++ gcm_ghash_p8(dctx->shash, ctx->htable, |
179 |
++ dctx->buffer, GHASH_DIGEST_SIZE); |
180 |
++ disable_kernel_vsx(); |
181 |
++ pagefault_enable(); |
182 |
++ preempt_enable(); |
183 |
++ } else { |
184 |
++ crypto_xor((u8 *)dctx->shash, dctx->buffer, GHASH_BLOCK_SIZE); |
185 |
++ gf128mul_lle((be128 *)dctx->shash, &ctx->key); |
186 |
++ } |
187 |
++} |
188 |
++ |
189 |
++static inline void __ghash_blocks(struct p8_ghash_ctx *ctx, |
190 |
++ struct p8_ghash_desc_ctx *dctx, |
191 |
++ const u8 *src, unsigned int srclen) |
192 |
++{ |
193 |
++ if (!IN_INTERRUPT) { |
194 |
++ preempt_disable(); |
195 |
++ pagefault_disable(); |
196 |
++ enable_kernel_vsx(); |
197 |
++ gcm_ghash_p8(dctx->shash, ctx->htable, |
198 |
++ src, srclen); |
199 |
++ disable_kernel_vsx(); |
200 |
++ pagefault_enable(); |
201 |
++ preempt_enable(); |
202 |
++ } else { |
203 |
++ while (srclen >= GHASH_BLOCK_SIZE) { |
204 |
++ crypto_xor((u8 *)dctx->shash, src, GHASH_BLOCK_SIZE); |
205 |
++ gf128mul_lle((be128 *)dctx->shash, &ctx->key); |
206 |
++ srclen -= GHASH_BLOCK_SIZE; |
207 |
++ src += GHASH_BLOCK_SIZE; |
208 |
++ } |
209 |
++ } |
210 |
+ } |
211 |
+ |
212 |
+ static int p8_ghash_update(struct shash_desc *desc, |
213 |
+@@ -131,49 +121,33 @@ static int p8_ghash_update(struct shash_desc *desc, |
214 |
+ struct p8_ghash_ctx *ctx = crypto_tfm_ctx(crypto_shash_tfm(desc->tfm)); |
215 |
+ struct p8_ghash_desc_ctx *dctx = shash_desc_ctx(desc); |
216 |
+ |
217 |
+- if (IN_INTERRUPT) { |
218 |
+- return crypto_shash_update(&dctx->fallback_desc, src, |
219 |
+- srclen); |
220 |
+- } else { |
221 |
+- if (dctx->bytes) { |
222 |
+- if (dctx->bytes + srclen < GHASH_DIGEST_SIZE) { |
223 |
+- memcpy(dctx->buffer + dctx->bytes, src, |
224 |
+- srclen); |
225 |
+- dctx->bytes += srclen; |
226 |
+- return 0; |
227 |
+- } |
228 |
++ if (dctx->bytes) { |
229 |
++ if (dctx->bytes + srclen < GHASH_DIGEST_SIZE) { |
230 |
+ memcpy(dctx->buffer + dctx->bytes, src, |
231 |
+- GHASH_DIGEST_SIZE - dctx->bytes); |
232 |
+- preempt_disable(); |
233 |
+- pagefault_disable(); |
234 |
+- enable_kernel_vsx(); |
235 |
+- gcm_ghash_p8(dctx->shash, ctx->htable, |
236 |
+- dctx->buffer, GHASH_DIGEST_SIZE); |
237 |
+- disable_kernel_vsx(); |
238 |
+- pagefault_enable(); |
239 |
+- preempt_enable(); |
240 |
+- src += GHASH_DIGEST_SIZE - dctx->bytes; |
241 |
+- srclen -= GHASH_DIGEST_SIZE - dctx->bytes; |
242 |
+- dctx->bytes = 0; |
243 |
+- } |
244 |
+- len = srclen & ~(GHASH_DIGEST_SIZE - 1); |
245 |
+- if (len) { |
246 |
+- preempt_disable(); |
247 |
+- pagefault_disable(); |
248 |
+- enable_kernel_vsx(); |
249 |
+- gcm_ghash_p8(dctx->shash, ctx->htable, src, len); |
250 |
+- disable_kernel_vsx(); |
251 |
+- pagefault_enable(); |
252 |
+- preempt_enable(); |
253 |
+- src += len; |
254 |
+- srclen -= len; |
255 |
+- } |
256 |
+- if (srclen) { |
257 |
+- memcpy(dctx->buffer, src, srclen); |
258 |
+- dctx->bytes = srclen; |
259 |
++ srclen); |
260 |
++ dctx->bytes += srclen; |
261 |
++ return 0; |
262 |
+ } |
263 |
+- return 0; |
264 |
++ memcpy(dctx->buffer + dctx->bytes, src, |
265 |
++ GHASH_DIGEST_SIZE - dctx->bytes); |
266 |
++ |
267 |
++ __ghash_block(ctx, dctx); |
268 |
++ |
269 |
++ src += GHASH_DIGEST_SIZE - dctx->bytes; |
270 |
++ srclen -= GHASH_DIGEST_SIZE - dctx->bytes; |
271 |
++ dctx->bytes = 0; |
272 |
++ } |
273 |
++ len = srclen & ~(GHASH_DIGEST_SIZE - 1); |
274 |
++ if (len) { |
275 |
++ __ghash_blocks(ctx, dctx, src, len); |
276 |
++ src += len; |
277 |
++ srclen -= len; |
278 |
+ } |
279 |
++ if (srclen) { |
280 |
++ memcpy(dctx->buffer, src, srclen); |
281 |
++ dctx->bytes = srclen; |
282 |
++ } |
283 |
++ return 0; |
284 |
+ } |
285 |
+ |
286 |
+ static int p8_ghash_final(struct shash_desc *desc, u8 *out) |
287 |
+@@ -182,25 +156,14 @@ static int p8_ghash_final(struct shash_desc *desc, u8 *out) |
288 |
+ struct p8_ghash_ctx *ctx = crypto_tfm_ctx(crypto_shash_tfm(desc->tfm)); |
289 |
+ struct p8_ghash_desc_ctx *dctx = shash_desc_ctx(desc); |
290 |
+ |
291 |
+- if (IN_INTERRUPT) { |
292 |
+- return crypto_shash_final(&dctx->fallback_desc, out); |
293 |
+- } else { |
294 |
+- if (dctx->bytes) { |
295 |
+- for (i = dctx->bytes; i < GHASH_DIGEST_SIZE; i++) |
296 |
+- dctx->buffer[i] = 0; |
297 |
+- preempt_disable(); |
298 |
+- pagefault_disable(); |
299 |
+- enable_kernel_vsx(); |
300 |
+- gcm_ghash_p8(dctx->shash, ctx->htable, |
301 |
+- dctx->buffer, GHASH_DIGEST_SIZE); |
302 |
+- disable_kernel_vsx(); |
303 |
+- pagefault_enable(); |
304 |
+- preempt_enable(); |
305 |
+- dctx->bytes = 0; |
306 |
+- } |
307 |
+- memcpy(out, dctx->shash, GHASH_DIGEST_SIZE); |
308 |
+- return 0; |
309 |
++ if (dctx->bytes) { |
310 |
++ for (i = dctx->bytes; i < GHASH_DIGEST_SIZE; i++) |
311 |
++ dctx->buffer[i] = 0; |
312 |
++ __ghash_block(ctx, dctx); |
313 |
++ dctx->bytes = 0; |
314 |
+ } |
315 |
++ memcpy(out, dctx->shash, GHASH_DIGEST_SIZE); |
316 |
++ return 0; |
317 |
+ } |
318 |
+ |
319 |
+ struct shash_alg p8_ghash_alg = { |
320 |
+@@ -215,11 +178,8 @@ struct shash_alg p8_ghash_alg = { |
321 |
+ .cra_name = "ghash", |
322 |
+ .cra_driver_name = "p8_ghash", |
323 |
+ .cra_priority = 1000, |
324 |
+- .cra_flags = CRYPTO_ALG_NEED_FALLBACK, |
325 |
+ .cra_blocksize = GHASH_BLOCK_SIZE, |
326 |
+ .cra_ctxsize = sizeof(struct p8_ghash_ctx), |
327 |
+ .cra_module = THIS_MODULE, |
328 |
+- .cra_init = p8_ghash_init_tfm, |
329 |
+- .cra_exit = p8_ghash_exit_tfm, |
330 |
+ }, |
331 |
+ }; |
332 |
+diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c |
333 |
+index ee610721098e..f96efa363d34 100644 |
334 |
+--- a/drivers/net/bonding/bond_main.c |
335 |
++++ b/drivers/net/bonding/bond_main.c |
336 |
+@@ -3122,13 +3122,18 @@ static int bond_slave_netdev_event(unsigned long event, |
337 |
+ case NETDEV_CHANGE: |
338 |
+ /* For 802.3ad mode only: |
339 |
+ * Getting invalid Speed/Duplex values here will put slave |
340 |
+- * in weird state. So mark it as link-fail for the time |
341 |
+- * being and let link-monitoring (miimon) set it right when |
342 |
+- * correct speeds/duplex are available. |
343 |
++ * in weird state. Mark it as link-fail if the link was |
344 |
++ * previously up or link-down if it hasn't yet come up, and |
345 |
++ * let link-monitoring (miimon) set it right when correct |
346 |
++ * speeds/duplex are available. |
347 |
+ */ |
348 |
+ if (bond_update_speed_duplex(slave) && |
349 |
+- BOND_MODE(bond) == BOND_MODE_8023AD) |
350 |
+- slave->link = BOND_LINK_FAIL; |
351 |
++ BOND_MODE(bond) == BOND_MODE_8023AD) { |
352 |
++ if (slave->last_link_up) |
353 |
++ slave->link = BOND_LINK_FAIL; |
354 |
++ else |
355 |
++ slave->link = BOND_LINK_DOWN; |
356 |
++ } |
357 |
+ |
358 |
+ if (BOND_MODE(bond) == BOND_MODE_8023AD) |
359 |
+ bond_3ad_adapter_speed_duplex_changed(slave); |
360 |
+diff --git a/drivers/net/dsa/mv88e6xxx/chip.c b/drivers/net/dsa/mv88e6xxx/chip.c |
361 |
+index f4e2db44ad91..720f1dde2c2d 100644 |
362 |
+--- a/drivers/net/dsa/mv88e6xxx/chip.c |
363 |
++++ b/drivers/net/dsa/mv88e6xxx/chip.c |
364 |
+@@ -910,7 +910,7 @@ static uint64_t _mv88e6xxx_get_ethtool_stat(struct mv88e6xxx_chip *chip, |
365 |
+ err = mv88e6xxx_port_read(chip, port, s->reg + 1, ®); |
366 |
+ if (err) |
367 |
+ return U64_MAX; |
368 |
+- high = reg; |
369 |
++ low |= ((u32)reg) << 16; |
370 |
+ } |
371 |
+ break; |
372 |
+ case STATS_TYPE_BANK1: |
373 |
+diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt.c b/drivers/net/ethernet/broadcom/bnxt/bnxt.c |
374 |
+index 52ade133b57c..30cafe4cdb6e 100644 |
375 |
+--- a/drivers/net/ethernet/broadcom/bnxt/bnxt.c |
376 |
++++ b/drivers/net/ethernet/broadcom/bnxt/bnxt.c |
377 |
+@@ -1640,6 +1640,8 @@ static int bnxt_rx_pkt(struct bnxt *bp, struct bnxt_cp_ring_info *cpr, |
378 |
+ skb = bnxt_copy_skb(bnapi, data_ptr, len, dma_addr); |
379 |
+ bnxt_reuse_rx_data(rxr, cons, data); |
380 |
+ if (!skb) { |
381 |
++ if (agg_bufs) |
382 |
++ bnxt_reuse_rx_agg_bufs(cpr, cp_cons, agg_bufs); |
383 |
+ rc = -ENOMEM; |
384 |
+ goto next_rx; |
385 |
+ } |
386 |
+@@ -6340,7 +6342,7 @@ static int bnxt_alloc_ctx_mem(struct bnxt *bp) |
387 |
+ if (!ctx || (ctx->flags & BNXT_CTX_FLAG_INITED)) |
388 |
+ return 0; |
389 |
+ |
390 |
+- if (bp->flags & BNXT_FLAG_ROCE_CAP) { |
391 |
++ if ((bp->flags & BNXT_FLAG_ROCE_CAP) && !is_kdump_kernel()) { |
392 |
+ pg_lvl = 2; |
393 |
+ extra_qps = 65536; |
394 |
+ extra_srqs = 8192; |
395 |
+@@ -7512,22 +7514,23 @@ static void bnxt_clear_int_mode(struct bnxt *bp) |
396 |
+ bp->flags &= ~BNXT_FLAG_USING_MSIX; |
397 |
+ } |
398 |
+ |
399 |
+-int bnxt_reserve_rings(struct bnxt *bp) |
400 |
++int bnxt_reserve_rings(struct bnxt *bp, bool irq_re_init) |
401 |
+ { |
402 |
+ int tcs = netdev_get_num_tc(bp->dev); |
403 |
+- bool reinit_irq = false; |
404 |
++ bool irq_cleared = false; |
405 |
+ int rc; |
406 |
+ |
407 |
+ if (!bnxt_need_reserve_rings(bp)) |
408 |
+ return 0; |
409 |
+ |
410 |
+- if (BNXT_NEW_RM(bp) && (bnxt_get_num_msix(bp) != bp->total_irqs)) { |
411 |
++ if (irq_re_init && BNXT_NEW_RM(bp) && |
412 |
++ bnxt_get_num_msix(bp) != bp->total_irqs) { |
413 |
+ bnxt_ulp_irq_stop(bp); |
414 |
+ bnxt_clear_int_mode(bp); |
415 |
+- reinit_irq = true; |
416 |
++ irq_cleared = true; |
417 |
+ } |
418 |
+ rc = __bnxt_reserve_rings(bp); |
419 |
+- if (reinit_irq) { |
420 |
++ if (irq_cleared) { |
421 |
+ if (!rc) |
422 |
+ rc = bnxt_init_int_mode(bp); |
423 |
+ bnxt_ulp_irq_restart(bp, rc); |
424 |
+@@ -8426,7 +8429,7 @@ static int __bnxt_open_nic(struct bnxt *bp, bool irq_re_init, bool link_re_init) |
425 |
+ return rc; |
426 |
+ } |
427 |
+ } |
428 |
+- rc = bnxt_reserve_rings(bp); |
429 |
++ rc = bnxt_reserve_rings(bp, irq_re_init); |
430 |
+ if (rc) |
431 |
+ return rc; |
432 |
+ if ((bp->flags & BNXT_FLAG_RFS) && |
433 |
+@@ -10337,7 +10340,7 @@ static int bnxt_set_dflt_rings(struct bnxt *bp, bool sh) |
434 |
+ |
435 |
+ if (sh) |
436 |
+ bp->flags |= BNXT_FLAG_SHARED_RINGS; |
437 |
+- dflt_rings = netif_get_num_default_rss_queues(); |
438 |
++ dflt_rings = is_kdump_kernel() ? 1 : netif_get_num_default_rss_queues(); |
439 |
+ /* Reduce default rings on multi-port cards so that total default |
440 |
+ * rings do not exceed CPU count. |
441 |
+ */ |
442 |
+diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt.h b/drivers/net/ethernet/broadcom/bnxt/bnxt.h |
443 |
+index cf81ace7a6e6..0fb93280ad4e 100644 |
444 |
+--- a/drivers/net/ethernet/broadcom/bnxt/bnxt.h |
445 |
++++ b/drivers/net/ethernet/broadcom/bnxt/bnxt.h |
446 |
+@@ -20,6 +20,7 @@ |
447 |
+ |
448 |
+ #include <linux/interrupt.h> |
449 |
+ #include <linux/rhashtable.h> |
450 |
++#include <linux/crash_dump.h> |
451 |
+ #include <net/devlink.h> |
452 |
+ #include <net/dst_metadata.h> |
453 |
+ #include <net/xdp.h> |
454 |
+@@ -1367,7 +1368,8 @@ struct bnxt { |
455 |
+ #define BNXT_CHIP_TYPE_NITRO_A0(bp) ((bp)->flags & BNXT_FLAG_CHIP_NITRO_A0) |
456 |
+ #define BNXT_RX_PAGE_MODE(bp) ((bp)->flags & BNXT_FLAG_RX_PAGE_MODE) |
457 |
+ #define BNXT_SUPPORTS_TPA(bp) (!BNXT_CHIP_TYPE_NITRO_A0(bp) && \ |
458 |
+- !(bp->flags & BNXT_FLAG_CHIP_P5)) |
459 |
++ !(bp->flags & BNXT_FLAG_CHIP_P5) && \ |
460 |
++ !is_kdump_kernel()) |
461 |
+ |
462 |
+ /* Chip class phase 5 */ |
463 |
+ #define BNXT_CHIP_P5(bp) \ |
464 |
+@@ -1778,7 +1780,7 @@ unsigned int bnxt_get_avail_stat_ctxs_for_en(struct bnxt *bp); |
465 |
+ unsigned int bnxt_get_max_func_cp_rings(struct bnxt *bp); |
466 |
+ unsigned int bnxt_get_avail_cp_rings_for_en(struct bnxt *bp); |
467 |
+ int bnxt_get_avail_msix(struct bnxt *bp, int num); |
468 |
+-int bnxt_reserve_rings(struct bnxt *bp); |
469 |
++int bnxt_reserve_rings(struct bnxt *bp, bool irq_re_init); |
470 |
+ void bnxt_tx_disable(struct bnxt *bp); |
471 |
+ void bnxt_tx_enable(struct bnxt *bp); |
472 |
+ int bnxt_hwrm_set_pause(struct bnxt *); |
473 |
+diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c b/drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c |
474 |
+index adabbe94a259..e1460e391952 100644 |
475 |
+--- a/drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c |
476 |
++++ b/drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c |
477 |
+@@ -788,7 +788,7 @@ static int bnxt_set_channels(struct net_device *dev, |
478 |
+ */ |
479 |
+ } |
480 |
+ } else { |
481 |
+- rc = bnxt_reserve_rings(bp); |
482 |
++ rc = bnxt_reserve_rings(bp, true); |
483 |
+ } |
484 |
+ |
485 |
+ return rc; |
486 |
+diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt_ulp.c b/drivers/net/ethernet/broadcom/bnxt/bnxt_ulp.c |
487 |
+index cf475873ce81..bfa342a98d08 100644 |
488 |
+--- a/drivers/net/ethernet/broadcom/bnxt/bnxt_ulp.c |
489 |
++++ b/drivers/net/ethernet/broadcom/bnxt/bnxt_ulp.c |
490 |
+@@ -147,7 +147,7 @@ static int bnxt_req_msix_vecs(struct bnxt_en_dev *edev, int ulp_id, |
491 |
+ bnxt_close_nic(bp, true, false); |
492 |
+ rc = bnxt_open_nic(bp, true, false); |
493 |
+ } else { |
494 |
+- rc = bnxt_reserve_rings(bp); |
495 |
++ rc = bnxt_reserve_rings(bp, true); |
496 |
+ } |
497 |
+ } |
498 |
+ if (rc) { |
499 |
+diff --git a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_tc_flower.c b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_tc_flower.c |
500 |
+index 82a8d1970060..35462bccd91a 100644 |
501 |
+--- a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_tc_flower.c |
502 |
++++ b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_tc_flower.c |
503 |
+@@ -197,6 +197,9 @@ static void cxgb4_process_flow_match(struct net_device *dev, |
504 |
+ fs->val.ivlan = vlan_tci; |
505 |
+ fs->mask.ivlan = vlan_tci_mask; |
506 |
+ |
507 |
++ fs->val.ivlan_vld = 1; |
508 |
++ fs->mask.ivlan_vld = 1; |
509 |
++ |
510 |
+ /* Chelsio adapters use ivlan_vld bit to match vlan packets |
511 |
+ * as 802.1Q. Also, when vlan tag is present in packets, |
512 |
+ * ethtype match is used then to match on ethtype of inner |
513 |
+@@ -207,8 +210,6 @@ static void cxgb4_process_flow_match(struct net_device *dev, |
514 |
+ * ethtype value with ethtype of inner header. |
515 |
+ */ |
516 |
+ if (fs->val.ethtype == ETH_P_8021Q) { |
517 |
+- fs->val.ivlan_vld = 1; |
518 |
+- fs->mask.ivlan_vld = 1; |
519 |
+ fs->val.ethtype = 0; |
520 |
+ fs->mask.ethtype = 0; |
521 |
+ } |
522 |
+diff --git a/drivers/net/ethernet/chelsio/cxgb4/t4_hw.c b/drivers/net/ethernet/chelsio/cxgb4/t4_hw.c |
523 |
+index a3544041ad32..8d63eed628d7 100644 |
524 |
+--- a/drivers/net/ethernet/chelsio/cxgb4/t4_hw.c |
525 |
++++ b/drivers/net/ethernet/chelsio/cxgb4/t4_hw.c |
526 |
+@@ -7206,10 +7206,21 @@ int t4_fixup_host_params(struct adapter *adap, unsigned int page_size, |
527 |
+ unsigned int cache_line_size) |
528 |
+ { |
529 |
+ unsigned int page_shift = fls(page_size) - 1; |
530 |
++ unsigned int sge_hps = page_shift - 10; |
531 |
+ unsigned int stat_len = cache_line_size > 64 ? 128 : 64; |
532 |
+ unsigned int fl_align = cache_line_size < 32 ? 32 : cache_line_size; |
533 |
+ unsigned int fl_align_log = fls(fl_align) - 1; |
534 |
+ |
535 |
++ t4_write_reg(adap, SGE_HOST_PAGE_SIZE_A, |
536 |
++ HOSTPAGESIZEPF0_V(sge_hps) | |
537 |
++ HOSTPAGESIZEPF1_V(sge_hps) | |
538 |
++ HOSTPAGESIZEPF2_V(sge_hps) | |
539 |
++ HOSTPAGESIZEPF3_V(sge_hps) | |
540 |
++ HOSTPAGESIZEPF4_V(sge_hps) | |
541 |
++ HOSTPAGESIZEPF5_V(sge_hps) | |
542 |
++ HOSTPAGESIZEPF6_V(sge_hps) | |
543 |
++ HOSTPAGESIZEPF7_V(sge_hps)); |
544 |
++ |
545 |
+ if (is_t4(adap->params.chip)) { |
546 |
+ t4_set_reg_field(adap, SGE_CONTROL_A, |
547 |
+ INGPADBOUNDARY_V(INGPADBOUNDARY_M) | |
548 |
+diff --git a/drivers/net/ethernet/freescale/fec_main.c b/drivers/net/ethernet/freescale/fec_main.c |
549 |
+index a96ad20ee484..878ccce1dfcd 100644 |
550 |
+--- a/drivers/net/ethernet/freescale/fec_main.c |
551 |
++++ b/drivers/net/ethernet/freescale/fec_main.c |
552 |
+@@ -3556,7 +3556,7 @@ failed_init: |
553 |
+ if (fep->reg_phy) |
554 |
+ regulator_disable(fep->reg_phy); |
555 |
+ failed_reset: |
556 |
+- pm_runtime_put(&pdev->dev); |
557 |
++ pm_runtime_put_noidle(&pdev->dev); |
558 |
+ pm_runtime_disable(&pdev->dev); |
559 |
+ failed_regulator: |
560 |
+ clk_disable_unprepare(fep->clk_ahb); |
561 |
+diff --git a/drivers/net/ethernet/marvell/mvneta.c b/drivers/net/ethernet/marvell/mvneta.c |
562 |
+index c0a3718b2e2a..c7f4b72b3c07 100644 |
563 |
+--- a/drivers/net/ethernet/marvell/mvneta.c |
564 |
++++ b/drivers/net/ethernet/marvell/mvneta.c |
565 |
+@@ -4674,7 +4674,7 @@ static int mvneta_probe(struct platform_device *pdev) |
566 |
+ err = register_netdev(dev); |
567 |
+ if (err < 0) { |
568 |
+ dev_err(&pdev->dev, "failed to register\n"); |
569 |
+- goto err_free_stats; |
570 |
++ goto err_netdev; |
571 |
+ } |
572 |
+ |
573 |
+ netdev_info(dev, "Using %s mac address %pM\n", mac_from, |
574 |
+@@ -4685,14 +4685,12 @@ static int mvneta_probe(struct platform_device *pdev) |
575 |
+ return 0; |
576 |
+ |
577 |
+ err_netdev: |
578 |
+- unregister_netdev(dev); |
579 |
+ if (pp->bm_priv) { |
580 |
+ mvneta_bm_pool_destroy(pp->bm_priv, pp->pool_long, 1 << pp->id); |
581 |
+ mvneta_bm_pool_destroy(pp->bm_priv, pp->pool_short, |
582 |
+ 1 << pp->id); |
583 |
+ mvneta_bm_put(pp->bm_priv); |
584 |
+ } |
585 |
+-err_free_stats: |
586 |
+ free_percpu(pp->stats); |
587 |
+ err_free_ports: |
588 |
+ free_percpu(pp->ports); |
589 |
+diff --git a/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c b/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c |
590 |
+index 25fbed2b8d94..f4f076d7090e 100644 |
591 |
+--- a/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c |
592 |
++++ b/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c |
593 |
+@@ -1455,7 +1455,7 @@ static inline void mvpp2_xlg_max_rx_size_set(struct mvpp2_port *port) |
594 |
+ /* Set defaults to the MVPP2 port */ |
595 |
+ static void mvpp2_defaults_set(struct mvpp2_port *port) |
596 |
+ { |
597 |
+- int tx_port_num, val, queue, ptxq, lrxq; |
598 |
++ int tx_port_num, val, queue, lrxq; |
599 |
+ |
600 |
+ if (port->priv->hw_version == MVPP21) { |
601 |
+ /* Update TX FIFO MIN Threshold */ |
602 |
+@@ -1476,11 +1476,9 @@ static void mvpp2_defaults_set(struct mvpp2_port *port) |
603 |
+ mvpp2_write(port->priv, MVPP2_TXP_SCHED_FIXED_PRIO_REG, 0); |
604 |
+ |
605 |
+ /* Close bandwidth for all queues */ |
606 |
+- for (queue = 0; queue < MVPP2_MAX_TXQ; queue++) { |
607 |
+- ptxq = mvpp2_txq_phys(port->id, queue); |
608 |
++ for (queue = 0; queue < MVPP2_MAX_TXQ; queue++) |
609 |
+ mvpp2_write(port->priv, |
610 |
+- MVPP2_TXQ_SCHED_TOKEN_CNTR_REG(ptxq), 0); |
611 |
+- } |
612 |
++ MVPP2_TXQ_SCHED_TOKEN_CNTR_REG(queue), 0); |
613 |
+ |
614 |
+ /* Set refill period to 1 usec, refill tokens |
615 |
+ * and bucket size to maximum |
616 |
+@@ -2336,7 +2334,7 @@ static void mvpp2_txq_deinit(struct mvpp2_port *port, |
617 |
+ txq->descs_dma = 0; |
618 |
+ |
619 |
+ /* Set minimum bandwidth for disabled TXQs */ |
620 |
+- mvpp2_write(port->priv, MVPP2_TXQ_SCHED_TOKEN_CNTR_REG(txq->id), 0); |
621 |
++ mvpp2_write(port->priv, MVPP2_TXQ_SCHED_TOKEN_CNTR_REG(txq->log_id), 0); |
622 |
+ |
623 |
+ /* Set Tx descriptors queue starting address and size */ |
624 |
+ thread = mvpp2_cpu_to_thread(port->priv, get_cpu()); |
625 |
+diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c |
626 |
+index 46157e2a1e5a..1e2688e2ed47 100644 |
627 |
+--- a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c |
628 |
++++ b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c |
629 |
+@@ -3750,6 +3750,12 @@ static netdev_features_t mlx5e_fix_features(struct net_device *netdev, |
630 |
+ netdev_warn(netdev, "Disabling LRO, not supported in legacy RQ\n"); |
631 |
+ } |
632 |
+ |
633 |
++ if (MLX5E_GET_PFLAG(params, MLX5E_PFLAG_RX_CQE_COMPRESS)) { |
634 |
++ features &= ~NETIF_F_RXHASH; |
635 |
++ if (netdev->features & NETIF_F_RXHASH) |
636 |
++ netdev_warn(netdev, "Disabling rxhash, not supported when CQE compress is active\n"); |
637 |
++ } |
638 |
++ |
639 |
+ mutex_unlock(&priv->state_lock); |
640 |
+ |
641 |
+ return features; |
642 |
+@@ -3875,6 +3881,9 @@ int mlx5e_hwstamp_set(struct mlx5e_priv *priv, struct ifreq *ifr) |
643 |
+ memcpy(&priv->tstamp, &config, sizeof(config)); |
644 |
+ mutex_unlock(&priv->state_lock); |
645 |
+ |
646 |
++ /* might need to fix some features */ |
647 |
++ netdev_update_features(priv->netdev); |
648 |
++ |
649 |
+ return copy_to_user(ifr->ifr_data, &config, |
650 |
+ sizeof(config)) ? -EFAULT : 0; |
651 |
+ } |
652 |
+@@ -4734,6 +4743,10 @@ static void mlx5e_build_nic_netdev(struct net_device *netdev) |
653 |
+ if (!priv->channels.params.scatter_fcs_en) |
654 |
+ netdev->features &= ~NETIF_F_RXFCS; |
655 |
+ |
656 |
++ /* prefere CQE compression over rxhash */ |
657 |
++ if (MLX5E_GET_PFLAG(&priv->channels.params, MLX5E_PFLAG_RX_CQE_COMPRESS)) |
658 |
++ netdev->features &= ~NETIF_F_RXHASH; |
659 |
++ |
660 |
+ #define FT_CAP(f) MLX5_CAP_FLOWTABLE(mdev, flow_table_properties_nic_receive.f) |
661 |
+ if (FT_CAP(flow_modify_en) && |
662 |
+ FT_CAP(modify_root) && |
663 |
+diff --git a/drivers/net/ethernet/mellanox/mlx5/core/fs_core.c b/drivers/net/ethernet/mellanox/mlx5/core/fs_core.c |
664 |
+index 581cc145795d..e29e5beb239d 100644 |
665 |
+--- a/drivers/net/ethernet/mellanox/mlx5/core/fs_core.c |
666 |
++++ b/drivers/net/ethernet/mellanox/mlx5/core/fs_core.c |
667 |
+@@ -2286,7 +2286,7 @@ static struct mlx5_flow_root_namespace |
668 |
+ cmds = mlx5_fs_cmd_get_default_ipsec_fpga_cmds(table_type); |
669 |
+ |
670 |
+ /* Create the root namespace */ |
671 |
+- root_ns = kvzalloc(sizeof(*root_ns), GFP_KERNEL); |
672 |
++ root_ns = kzalloc(sizeof(*root_ns), GFP_KERNEL); |
673 |
+ if (!root_ns) |
674 |
+ return NULL; |
675 |
+ |
676 |
+@@ -2429,6 +2429,7 @@ static void cleanup_egress_acls_root_ns(struct mlx5_core_dev *dev) |
677 |
+ cleanup_root_ns(steering->esw_egress_root_ns[i]); |
678 |
+ |
679 |
+ kfree(steering->esw_egress_root_ns); |
680 |
++ steering->esw_egress_root_ns = NULL; |
681 |
+ } |
682 |
+ |
683 |
+ static void cleanup_ingress_acls_root_ns(struct mlx5_core_dev *dev) |
684 |
+@@ -2443,6 +2444,7 @@ static void cleanup_ingress_acls_root_ns(struct mlx5_core_dev *dev) |
685 |
+ cleanup_root_ns(steering->esw_ingress_root_ns[i]); |
686 |
+ |
687 |
+ kfree(steering->esw_ingress_root_ns); |
688 |
++ steering->esw_ingress_root_ns = NULL; |
689 |
+ } |
690 |
+ |
691 |
+ void mlx5_cleanup_fs(struct mlx5_core_dev *dev) |
692 |
+@@ -2611,6 +2613,7 @@ cleanup_root_ns: |
693 |
+ for (i--; i >= 0; i--) |
694 |
+ cleanup_root_ns(steering->esw_egress_root_ns[i]); |
695 |
+ kfree(steering->esw_egress_root_ns); |
696 |
++ steering->esw_egress_root_ns = NULL; |
697 |
+ return err; |
698 |
+ } |
699 |
+ |
700 |
+@@ -2638,6 +2641,7 @@ cleanup_root_ns: |
701 |
+ for (i--; i >= 0; i--) |
702 |
+ cleanup_root_ns(steering->esw_ingress_root_ns[i]); |
703 |
+ kfree(steering->esw_ingress_root_ns); |
704 |
++ steering->esw_ingress_root_ns = NULL; |
705 |
+ return err; |
706 |
+ } |
707 |
+ |
708 |
+diff --git a/drivers/net/ethernet/mellanox/mlxsw/spectrum_acl_erp.c b/drivers/net/ethernet/mellanox/mlxsw/spectrum_acl_erp.c |
709 |
+index c1a9cc9a3292..4c98950380d5 100644 |
710 |
+--- a/drivers/net/ethernet/mellanox/mlxsw/spectrum_acl_erp.c |
711 |
++++ b/drivers/net/ethernet/mellanox/mlxsw/spectrum_acl_erp.c |
712 |
+@@ -1171,13 +1171,12 @@ mlxsw_sp_acl_erp_delta_fill(const struct mlxsw_sp_acl_erp_key *parent_key, |
713 |
+ return -EINVAL; |
714 |
+ } |
715 |
+ if (si == -1) { |
716 |
+- /* The masks are the same, this cannot happen. |
717 |
+- * That means the caller is broken. |
718 |
++ /* The masks are the same, this can happen in case eRPs with |
719 |
++ * the same mask were created in both A-TCAM and C-TCAM. |
720 |
++ * The only possible condition under which this can happen |
721 |
++ * is identical rule insertion. Delta is not possible here. |
722 |
+ */ |
723 |
+- WARN_ON(1); |
724 |
+- *delta_start = 0; |
725 |
+- *delta_mask = 0; |
726 |
+- return 0; |
727 |
++ return -EINVAL; |
728 |
+ } |
729 |
+ pmask = (unsigned char) parent_key->mask[__MASK_IDX(si)]; |
730 |
+ mask = (unsigned char) key->mask[__MASK_IDX(si)]; |
731 |
+diff --git a/drivers/net/ethernet/realtek/r8169.c b/drivers/net/ethernet/realtek/r8169.c |
732 |
+index ed651dde6ef9..6d176be51a6b 100644 |
733 |
+--- a/drivers/net/ethernet/realtek/r8169.c |
734 |
++++ b/drivers/net/ethernet/realtek/r8169.c |
735 |
+@@ -6914,6 +6914,8 @@ static int rtl8169_resume(struct device *device) |
736 |
+ struct net_device *dev = dev_get_drvdata(device); |
737 |
+ struct rtl8169_private *tp = netdev_priv(dev); |
738 |
+ |
739 |
++ rtl_rar_set(tp, dev->dev_addr); |
740 |
++ |
741 |
+ clk_prepare_enable(tp->clk); |
742 |
+ |
743 |
+ if (netif_running(dev)) |
744 |
+@@ -6947,6 +6949,7 @@ static int rtl8169_runtime_resume(struct device *device) |
745 |
+ { |
746 |
+ struct net_device *dev = dev_get_drvdata(device); |
747 |
+ struct rtl8169_private *tp = netdev_priv(dev); |
748 |
++ |
749 |
+ rtl_rar_set(tp, dev->dev_addr); |
750 |
+ |
751 |
+ if (!tp->TxDescArray) |
752 |
+diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_ethtool.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_ethtool.c |
753 |
+index 3c749c327cbd..e09522c5509a 100644 |
754 |
+--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_ethtool.c |
755 |
++++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_ethtool.c |
756 |
+@@ -460,7 +460,7 @@ stmmac_get_pauseparam(struct net_device *netdev, |
757 |
+ } else { |
758 |
+ if (!linkmode_test_bit(ETHTOOL_LINK_MODE_Pause_BIT, |
759 |
+ netdev->phydev->supported) || |
760 |
+- linkmode_test_bit(ETHTOOL_LINK_MODE_Asym_Pause_BIT, |
761 |
++ !linkmode_test_bit(ETHTOOL_LINK_MODE_Asym_Pause_BIT, |
762 |
+ netdev->phydev->supported)) |
763 |
+ return; |
764 |
+ } |
765 |
+@@ -491,7 +491,7 @@ stmmac_set_pauseparam(struct net_device *netdev, |
766 |
+ } else { |
767 |
+ if (!linkmode_test_bit(ETHTOOL_LINK_MODE_Pause_BIT, |
768 |
+ phy->supported) || |
769 |
+- linkmode_test_bit(ETHTOOL_LINK_MODE_Asym_Pause_BIT, |
770 |
++ !linkmode_test_bit(ETHTOOL_LINK_MODE_Asym_Pause_BIT, |
771 |
+ phy->supported)) |
772 |
+ return -EOPNOTSUPP; |
773 |
+ } |
774 |
+diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c |
775 |
+index 48712437d0da..3c409862c52e 100644 |
776 |
+--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c |
777 |
++++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c |
778 |
+@@ -2208,6 +2208,10 @@ static int stmmac_init_dma_engine(struct stmmac_priv *priv) |
779 |
+ if (priv->plat->axi) |
780 |
+ stmmac_axi(priv, priv->ioaddr, priv->plat->axi); |
781 |
+ |
782 |
++ /* DMA CSR Channel configuration */ |
783 |
++ for (chan = 0; chan < dma_csr_ch; chan++) |
784 |
++ stmmac_init_chan(priv, priv->ioaddr, priv->plat->dma_cfg, chan); |
785 |
++ |
786 |
+ /* DMA RX Channel Configuration */ |
787 |
+ for (chan = 0; chan < rx_channels_count; chan++) { |
788 |
+ rx_q = &priv->rx_queue[chan]; |
789 |
+@@ -2233,10 +2237,6 @@ static int stmmac_init_dma_engine(struct stmmac_priv *priv) |
790 |
+ tx_q->tx_tail_addr, chan); |
791 |
+ } |
792 |
+ |
793 |
+- /* DMA CSR Channel configuration */ |
794 |
+- for (chan = 0; chan < dma_csr_ch; chan++) |
795 |
+- stmmac_init_chan(priv, priv->ioaddr, priv->plat->dma_cfg, chan); |
796 |
+- |
797 |
+ return ret; |
798 |
+ } |
799 |
+ |
800 |
+diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c |
801 |
+index bdd351597b55..093a223fe408 100644 |
802 |
+--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c |
803 |
++++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c |
804 |
+@@ -267,7 +267,8 @@ int stmmac_mdio_reset(struct mii_bus *bus) |
805 |
+ of_property_read_u32_array(np, |
806 |
+ "snps,reset-delays-us", data->delays, 3); |
807 |
+ |
808 |
+- if (gpio_request(data->reset_gpio, "mdio-reset")) |
809 |
++ if (devm_gpio_request(priv->device, data->reset_gpio, |
810 |
++ "mdio-reset")) |
811 |
+ return 0; |
812 |
+ } |
813 |
+ |
814 |
+diff --git a/drivers/net/phy/marvell10g.c b/drivers/net/phy/marvell10g.c |
815 |
+index 100b401b1f4a..754cde873dde 100644 |
816 |
+--- a/drivers/net/phy/marvell10g.c |
817 |
++++ b/drivers/net/phy/marvell10g.c |
818 |
+@@ -31,6 +31,9 @@ |
819 |
+ #define MV_PHY_ALASKA_NBT_QUIRK_REV (MARVELL_PHY_ID_88X3310 | 0xa) |
820 |
+ |
821 |
+ enum { |
822 |
++ MV_PMA_BOOT = 0xc050, |
823 |
++ MV_PMA_BOOT_FATAL = BIT(0), |
824 |
++ |
825 |
+ MV_PCS_BASE_T = 0x0000, |
826 |
+ MV_PCS_BASE_R = 0x1000, |
827 |
+ MV_PCS_1000BASEX = 0x2000, |
828 |
+@@ -211,6 +214,16 @@ static int mv3310_probe(struct phy_device *phydev) |
829 |
+ (phydev->c45_ids.devices_in_package & mmd_mask) != mmd_mask) |
830 |
+ return -ENODEV; |
831 |
+ |
832 |
++ ret = phy_read_mmd(phydev, MDIO_MMD_PMAPMD, MV_PMA_BOOT); |
833 |
++ if (ret < 0) |
834 |
++ return ret; |
835 |
++ |
836 |
++ if (ret & MV_PMA_BOOT_FATAL) { |
837 |
++ dev_warn(&phydev->mdio.dev, |
838 |
++ "PHY failed to boot firmware, status=%04x\n", ret); |
839 |
++ return -ENODEV; |
840 |
++ } |
841 |
++ |
842 |
+ priv = devm_kzalloc(&phydev->mdio.dev, sizeof(*priv), GFP_KERNEL); |
843 |
+ if (!priv) |
844 |
+ return -ENOMEM; |
845 |
+diff --git a/drivers/net/usb/usbnet.c b/drivers/net/usb/usbnet.c |
846 |
+index 504282af27e5..921cc0571bd0 100644 |
847 |
+--- a/drivers/net/usb/usbnet.c |
848 |
++++ b/drivers/net/usb/usbnet.c |
849 |
+@@ -506,6 +506,7 @@ static int rx_submit (struct usbnet *dev, struct urb *urb, gfp_t flags) |
850 |
+ |
851 |
+ if (netif_running (dev->net) && |
852 |
+ netif_device_present (dev->net) && |
853 |
++ test_bit(EVENT_DEV_OPEN, &dev->flags) && |
854 |
+ !test_bit (EVENT_RX_HALT, &dev->flags) && |
855 |
+ !test_bit (EVENT_DEV_ASLEEP, &dev->flags)) { |
856 |
+ switch (retval = usb_submit_urb (urb, GFP_ATOMIC)) { |
857 |
+@@ -1431,6 +1432,11 @@ netdev_tx_t usbnet_start_xmit (struct sk_buff *skb, |
858 |
+ spin_unlock_irqrestore(&dev->txq.lock, flags); |
859 |
+ goto drop; |
860 |
+ } |
861 |
++ if (netif_queue_stopped(net)) { |
862 |
++ usb_autopm_put_interface_async(dev->intf); |
863 |
++ spin_unlock_irqrestore(&dev->txq.lock, flags); |
864 |
++ goto drop; |
865 |
++ } |
866 |
+ |
867 |
+ #ifdef CONFIG_PM |
868 |
+ /* if this triggers the device is still a sleep */ |
869 |
+diff --git a/include/linux/siphash.h b/include/linux/siphash.h |
870 |
+index fa7a6b9cedbf..bf21591a9e5e 100644 |
871 |
+--- a/include/linux/siphash.h |
872 |
++++ b/include/linux/siphash.h |
873 |
+@@ -21,6 +21,11 @@ typedef struct { |
874 |
+ u64 key[2]; |
875 |
+ } siphash_key_t; |
876 |
+ |
877 |
++static inline bool siphash_key_is_zero(const siphash_key_t *key) |
878 |
++{ |
879 |
++ return !(key->key[0] | key->key[1]); |
880 |
++} |
881 |
++ |
882 |
+ u64 __siphash_aligned(const void *data, size_t len, const siphash_key_t *key); |
883 |
+ #ifndef CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS |
884 |
+ u64 __siphash_unaligned(const void *data, size_t len, const siphash_key_t *key); |
885 |
+diff --git a/include/net/netns/ipv4.h b/include/net/netns/ipv4.h |
886 |
+index 104a6669e344..7698460a3dd1 100644 |
887 |
+--- a/include/net/netns/ipv4.h |
888 |
++++ b/include/net/netns/ipv4.h |
889 |
+@@ -9,6 +9,7 @@ |
890 |
+ #include <linux/uidgid.h> |
891 |
+ #include <net/inet_frag.h> |
892 |
+ #include <linux/rcupdate.h> |
893 |
++#include <linux/siphash.h> |
894 |
+ |
895 |
+ struct tcpm_hash_bucket; |
896 |
+ struct ctl_table_header; |
897 |
+@@ -217,5 +218,6 @@ struct netns_ipv4 { |
898 |
+ unsigned int ipmr_seq; /* protected by rtnl_mutex */ |
899 |
+ |
900 |
+ atomic_t rt_genid; |
901 |
++ siphash_key_t ip_id_key; |
902 |
+ }; |
903 |
+ #endif |
904 |
+diff --git a/include/uapi/linux/tipc_config.h b/include/uapi/linux/tipc_config.h |
905 |
+index 4b2c93b1934c..4955e1a9f1bc 100644 |
906 |
+--- a/include/uapi/linux/tipc_config.h |
907 |
++++ b/include/uapi/linux/tipc_config.h |
908 |
+@@ -307,8 +307,10 @@ static inline int TLV_SET(void *tlv, __u16 type, void *data, __u16 len) |
909 |
+ tlv_ptr = (struct tlv_desc *)tlv; |
910 |
+ tlv_ptr->tlv_type = htons(type); |
911 |
+ tlv_ptr->tlv_len = htons(tlv_len); |
912 |
+- if (len && data) |
913 |
+- memcpy(TLV_DATA(tlv_ptr), data, tlv_len); |
914 |
++ if (len && data) { |
915 |
++ memcpy(TLV_DATA(tlv_ptr), data, len); |
916 |
++ memset(TLV_DATA(tlv_ptr) + len, 0, TLV_SPACE(len) - tlv_len); |
917 |
++ } |
918 |
+ return TLV_SPACE(len); |
919 |
+ } |
920 |
+ |
921 |
+@@ -405,8 +407,10 @@ static inline int TCM_SET(void *msg, __u16 cmd, __u16 flags, |
922 |
+ tcm_hdr->tcm_len = htonl(msg_len); |
923 |
+ tcm_hdr->tcm_type = htons(cmd); |
924 |
+ tcm_hdr->tcm_flags = htons(flags); |
925 |
+- if (data_len && data) |
926 |
++ if (data_len && data) { |
927 |
+ memcpy(TCM_DATA(msg), data, data_len); |
928 |
++ memset(TCM_DATA(msg) + data_len, 0, TCM_SPACE(data_len) - msg_len); |
929 |
++ } |
930 |
+ return TCM_SPACE(data_len); |
931 |
+ } |
932 |
+ |
933 |
+diff --git a/net/core/dev.c b/net/core/dev.c |
934 |
+index 255f99cb7c48..c6b2f6db0a9b 100644 |
935 |
+--- a/net/core/dev.c |
936 |
++++ b/net/core/dev.c |
937 |
+@@ -5804,7 +5804,6 @@ static struct sk_buff *napi_frags_skb(struct napi_struct *napi) |
938 |
+ skb_reset_mac_header(skb); |
939 |
+ skb_gro_reset_offset(skb); |
940 |
+ |
941 |
+- eth = skb_gro_header_fast(skb, 0); |
942 |
+ if (unlikely(skb_gro_header_hard(skb, hlen))) { |
943 |
+ eth = skb_gro_header_slow(skb, hlen, 0); |
944 |
+ if (unlikely(!eth)) { |
945 |
+@@ -5814,6 +5813,7 @@ static struct sk_buff *napi_frags_skb(struct napi_struct *napi) |
946 |
+ return NULL; |
947 |
+ } |
948 |
+ } else { |
949 |
++ eth = (const struct ethhdr *)skb->data; |
950 |
+ gro_pull_from_frag0(skb, hlen); |
951 |
+ NAPI_GRO_CB(skb)->frag0 += hlen; |
952 |
+ NAPI_GRO_CB(skb)->frag0_len -= hlen; |
953 |
+diff --git a/net/core/ethtool.c b/net/core/ethtool.c |
954 |
+index 36ed619faf36..014dcd63b451 100644 |
955 |
+--- a/net/core/ethtool.c |
956 |
++++ b/net/core/ethtool.c |
957 |
+@@ -3008,11 +3008,12 @@ ethtool_rx_flow_rule_create(const struct ethtool_rx_flow_spec_input *input) |
958 |
+ const struct ethtool_flow_ext *ext_h_spec = &fs->h_ext; |
959 |
+ const struct ethtool_flow_ext *ext_m_spec = &fs->m_ext; |
960 |
+ |
961 |
+- if (ext_m_spec->vlan_etype && |
962 |
+- ext_m_spec->vlan_tci) { |
963 |
++ if (ext_m_spec->vlan_etype) { |
964 |
+ match->key.vlan.vlan_tpid = ext_h_spec->vlan_etype; |
965 |
+ match->mask.vlan.vlan_tpid = ext_m_spec->vlan_etype; |
966 |
++ } |
967 |
+ |
968 |
++ if (ext_m_spec->vlan_tci) { |
969 |
+ match->key.vlan.vlan_id = |
970 |
+ ntohs(ext_h_spec->vlan_tci) & 0x0fff; |
971 |
+ match->mask.vlan.vlan_id = |
972 |
+@@ -3022,7 +3023,10 @@ ethtool_rx_flow_rule_create(const struct ethtool_rx_flow_spec_input *input) |
973 |
+ (ntohs(ext_h_spec->vlan_tci) & 0xe000) >> 13; |
974 |
+ match->mask.vlan.vlan_priority = |
975 |
+ (ntohs(ext_m_spec->vlan_tci) & 0xe000) >> 13; |
976 |
++ } |
977 |
+ |
978 |
++ if (ext_m_spec->vlan_etype || |
979 |
++ ext_m_spec->vlan_tci) { |
980 |
+ match->dissector.used_keys |= |
981 |
+ BIT(FLOW_DISSECTOR_KEY_VLAN); |
982 |
+ match->dissector.offset[FLOW_DISSECTOR_KEY_VLAN] = |
983 |
+diff --git a/net/core/skbuff.c b/net/core/skbuff.c |
984 |
+index 40796b8bf820..e5bfd42fd083 100644 |
985 |
+--- a/net/core/skbuff.c |
986 |
++++ b/net/core/skbuff.c |
987 |
+@@ -1001,7 +1001,11 @@ struct ubuf_info *sock_zerocopy_realloc(struct sock *sk, size_t size, |
988 |
+ uarg->len++; |
989 |
+ uarg->bytelen = bytelen; |
990 |
+ atomic_set(&sk->sk_zckey, ++next); |
991 |
+- sock_zerocopy_get(uarg); |
992 |
++ |
993 |
++ /* no extra ref when appending to datagram (MSG_MORE) */ |
994 |
++ if (sk->sk_type == SOCK_STREAM) |
995 |
++ sock_zerocopy_get(uarg); |
996 |
++ |
997 |
+ return uarg; |
998 |
+ } |
999 |
+ } |
1000 |
+diff --git a/net/ipv4/igmp.c b/net/ipv4/igmp.c |
1001 |
+index 6c2febc39dca..eb03153dfe12 100644 |
1002 |
+--- a/net/ipv4/igmp.c |
1003 |
++++ b/net/ipv4/igmp.c |
1004 |
+@@ -188,6 +188,17 @@ static void ip_ma_put(struct ip_mc_list *im) |
1005 |
+ pmc != NULL; \ |
1006 |
+ pmc = rtnl_dereference(pmc->next_rcu)) |
1007 |
+ |
1008 |
++static void ip_sf_list_clear_all(struct ip_sf_list *psf) |
1009 |
++{ |
1010 |
++ struct ip_sf_list *next; |
1011 |
++ |
1012 |
++ while (psf) { |
1013 |
++ next = psf->sf_next; |
1014 |
++ kfree(psf); |
1015 |
++ psf = next; |
1016 |
++ } |
1017 |
++} |
1018 |
++ |
1019 |
+ #ifdef CONFIG_IP_MULTICAST |
1020 |
+ |
1021 |
+ /* |
1022 |
+@@ -633,6 +644,13 @@ static void igmpv3_clear_zeros(struct ip_sf_list **ppsf) |
1023 |
+ } |
1024 |
+ } |
1025 |
+ |
1026 |
++static void kfree_pmc(struct ip_mc_list *pmc) |
1027 |
++{ |
1028 |
++ ip_sf_list_clear_all(pmc->sources); |
1029 |
++ ip_sf_list_clear_all(pmc->tomb); |
1030 |
++ kfree(pmc); |
1031 |
++} |
1032 |
++ |
1033 |
+ static void igmpv3_send_cr(struct in_device *in_dev) |
1034 |
+ { |
1035 |
+ struct ip_mc_list *pmc, *pmc_prev, *pmc_next; |
1036 |
+@@ -669,7 +687,7 @@ static void igmpv3_send_cr(struct in_device *in_dev) |
1037 |
+ else |
1038 |
+ in_dev->mc_tomb = pmc_next; |
1039 |
+ in_dev_put(pmc->interface); |
1040 |
+- kfree(pmc); |
1041 |
++ kfree_pmc(pmc); |
1042 |
+ } else |
1043 |
+ pmc_prev = pmc; |
1044 |
+ } |
1045 |
+@@ -1215,14 +1233,18 @@ static void igmpv3_del_delrec(struct in_device *in_dev, struct ip_mc_list *im) |
1046 |
+ im->interface = pmc->interface; |
1047 |
+ if (im->sfmode == MCAST_INCLUDE) { |
1048 |
+ im->tomb = pmc->tomb; |
1049 |
++ pmc->tomb = NULL; |
1050 |
++ |
1051 |
+ im->sources = pmc->sources; |
1052 |
++ pmc->sources = NULL; |
1053 |
++ |
1054 |
+ for (psf = im->sources; psf; psf = psf->sf_next) |
1055 |
+ psf->sf_crcount = in_dev->mr_qrv ?: net->ipv4.sysctl_igmp_qrv; |
1056 |
+ } else { |
1057 |
+ im->crcount = in_dev->mr_qrv ?: net->ipv4.sysctl_igmp_qrv; |
1058 |
+ } |
1059 |
+ in_dev_put(pmc->interface); |
1060 |
+- kfree(pmc); |
1061 |
++ kfree_pmc(pmc); |
1062 |
+ } |
1063 |
+ spin_unlock_bh(&im->lock); |
1064 |
+ } |
1065 |
+@@ -1243,21 +1265,18 @@ static void igmpv3_clear_delrec(struct in_device *in_dev) |
1066 |
+ nextpmc = pmc->next; |
1067 |
+ ip_mc_clear_src(pmc); |
1068 |
+ in_dev_put(pmc->interface); |
1069 |
+- kfree(pmc); |
1070 |
++ kfree_pmc(pmc); |
1071 |
+ } |
1072 |
+ /* clear dead sources, too */ |
1073 |
+ rcu_read_lock(); |
1074 |
+ for_each_pmc_rcu(in_dev, pmc) { |
1075 |
+- struct ip_sf_list *psf, *psf_next; |
1076 |
++ struct ip_sf_list *psf; |
1077 |
+ |
1078 |
+ spin_lock_bh(&pmc->lock); |
1079 |
+ psf = pmc->tomb; |
1080 |
+ pmc->tomb = NULL; |
1081 |
+ spin_unlock_bh(&pmc->lock); |
1082 |
+- for (; psf; psf = psf_next) { |
1083 |
+- psf_next = psf->sf_next; |
1084 |
+- kfree(psf); |
1085 |
+- } |
1086 |
++ ip_sf_list_clear_all(psf); |
1087 |
+ } |
1088 |
+ rcu_read_unlock(); |
1089 |
+ } |
1090 |
+@@ -2123,7 +2142,7 @@ static int ip_mc_add_src(struct in_device *in_dev, __be32 *pmca, int sfmode, |
1091 |
+ |
1092 |
+ static void ip_mc_clear_src(struct ip_mc_list *pmc) |
1093 |
+ { |
1094 |
+- struct ip_sf_list *psf, *nextpsf, *tomb, *sources; |
1095 |
++ struct ip_sf_list *tomb, *sources; |
1096 |
+ |
1097 |
+ spin_lock_bh(&pmc->lock); |
1098 |
+ tomb = pmc->tomb; |
1099 |
+@@ -2135,14 +2154,8 @@ static void ip_mc_clear_src(struct ip_mc_list *pmc) |
1100 |
+ pmc->sfcount[MCAST_EXCLUDE] = 1; |
1101 |
+ spin_unlock_bh(&pmc->lock); |
1102 |
+ |
1103 |
+- for (psf = tomb; psf; psf = nextpsf) { |
1104 |
+- nextpsf = psf->sf_next; |
1105 |
+- kfree(psf); |
1106 |
+- } |
1107 |
+- for (psf = sources; psf; psf = nextpsf) { |
1108 |
+- nextpsf = psf->sf_next; |
1109 |
+- kfree(psf); |
1110 |
+- } |
1111 |
++ ip_sf_list_clear_all(tomb); |
1112 |
++ ip_sf_list_clear_all(sources); |
1113 |
+ } |
1114 |
+ |
1115 |
+ /* Join a multicast group |
1116 |
+diff --git a/net/ipv4/ip_output.c b/net/ipv4/ip_output.c |
1117 |
+index e8bb2e85c5a4..ac770940adb9 100644 |
1118 |
+--- a/net/ipv4/ip_output.c |
1119 |
++++ b/net/ipv4/ip_output.c |
1120 |
+@@ -883,7 +883,7 @@ static int __ip_append_data(struct sock *sk, |
1121 |
+ int csummode = CHECKSUM_NONE; |
1122 |
+ struct rtable *rt = (struct rtable *)cork->dst; |
1123 |
+ unsigned int wmem_alloc_delta = 0; |
1124 |
+- bool paged, extra_uref; |
1125 |
++ bool paged, extra_uref = false; |
1126 |
+ u32 tskey = 0; |
1127 |
+ |
1128 |
+ skb = skb_peek_tail(queue); |
1129 |
+@@ -923,7 +923,7 @@ static int __ip_append_data(struct sock *sk, |
1130 |
+ uarg = sock_zerocopy_realloc(sk, length, skb_zcopy(skb)); |
1131 |
+ if (!uarg) |
1132 |
+ return -ENOBUFS; |
1133 |
+- extra_uref = true; |
1134 |
++ extra_uref = !skb; /* only extra ref if !MSG_MORE */ |
1135 |
+ if (rt->dst.dev->features & NETIF_F_SG && |
1136 |
+ csummode == CHECKSUM_PARTIAL) { |
1137 |
+ paged = true; |
1138 |
+diff --git a/net/ipv4/route.c b/net/ipv4/route.c |
1139 |
+index 6fdf1c195d8e..df6afb092936 100644 |
1140 |
+--- a/net/ipv4/route.c |
1141 |
++++ b/net/ipv4/route.c |
1142 |
+@@ -500,15 +500,17 @@ EXPORT_SYMBOL(ip_idents_reserve); |
1143 |
+ |
1144 |
+ void __ip_select_ident(struct net *net, struct iphdr *iph, int segs) |
1145 |
+ { |
1146 |
+- static u32 ip_idents_hashrnd __read_mostly; |
1147 |
+ u32 hash, id; |
1148 |
+ |
1149 |
+- net_get_random_once(&ip_idents_hashrnd, sizeof(ip_idents_hashrnd)); |
1150 |
++ /* Note the following code is not safe, but this is okay. */ |
1151 |
++ if (unlikely(siphash_key_is_zero(&net->ipv4.ip_id_key))) |
1152 |
++ get_random_bytes(&net->ipv4.ip_id_key, |
1153 |
++ sizeof(net->ipv4.ip_id_key)); |
1154 |
+ |
1155 |
+- hash = jhash_3words((__force u32)iph->daddr, |
1156 |
++ hash = siphash_3u32((__force u32)iph->daddr, |
1157 |
+ (__force u32)iph->saddr, |
1158 |
+- iph->protocol ^ net_hash_mix(net), |
1159 |
+- ip_idents_hashrnd); |
1160 |
++ iph->protocol, |
1161 |
++ &net->ipv4.ip_id_key); |
1162 |
+ id = ip_idents_reserve(hash, segs); |
1163 |
+ iph->id = htons(id); |
1164 |
+ } |
1165 |
+diff --git a/net/ipv6/ip6_output.c b/net/ipv6/ip6_output.c |
1166 |
+index e51f3c648b09..b5e0c85bcd57 100644 |
1167 |
+--- a/net/ipv6/ip6_output.c |
1168 |
++++ b/net/ipv6/ip6_output.c |
1169 |
+@@ -1275,7 +1275,7 @@ static int __ip6_append_data(struct sock *sk, |
1170 |
+ int csummode = CHECKSUM_NONE; |
1171 |
+ unsigned int maxnonfragsize, headersize; |
1172 |
+ unsigned int wmem_alloc_delta = 0; |
1173 |
+- bool paged, extra_uref; |
1174 |
++ bool paged, extra_uref = false; |
1175 |
+ |
1176 |
+ skb = skb_peek_tail(queue); |
1177 |
+ if (!skb) { |
1178 |
+@@ -1344,7 +1344,7 @@ emsgsize: |
1179 |
+ uarg = sock_zerocopy_realloc(sk, length, skb_zcopy(skb)); |
1180 |
+ if (!uarg) |
1181 |
+ return -ENOBUFS; |
1182 |
+- extra_uref = true; |
1183 |
++ extra_uref = !skb; /* only extra ref if !MSG_MORE */ |
1184 |
+ if (rt->dst.dev->features & NETIF_F_SG && |
1185 |
+ csummode == CHECKSUM_PARTIAL) { |
1186 |
+ paged = true; |
1187 |
+diff --git a/net/ipv6/output_core.c b/net/ipv6/output_core.c |
1188 |
+index 4fe7c90962dd..868ae23dbae1 100644 |
1189 |
+--- a/net/ipv6/output_core.c |
1190 |
++++ b/net/ipv6/output_core.c |
1191 |
+@@ -10,15 +10,25 @@ |
1192 |
+ #include <net/secure_seq.h> |
1193 |
+ #include <linux/netfilter.h> |
1194 |
+ |
1195 |
+-static u32 __ipv6_select_ident(struct net *net, u32 hashrnd, |
1196 |
++static u32 __ipv6_select_ident(struct net *net, |
1197 |
+ const struct in6_addr *dst, |
1198 |
+ const struct in6_addr *src) |
1199 |
+ { |
1200 |
++ const struct { |
1201 |
++ struct in6_addr dst; |
1202 |
++ struct in6_addr src; |
1203 |
++ } __aligned(SIPHASH_ALIGNMENT) combined = { |
1204 |
++ .dst = *dst, |
1205 |
++ .src = *src, |
1206 |
++ }; |
1207 |
+ u32 hash, id; |
1208 |
+ |
1209 |
+- hash = __ipv6_addr_jhash(dst, hashrnd); |
1210 |
+- hash = __ipv6_addr_jhash(src, hash); |
1211 |
+- hash ^= net_hash_mix(net); |
1212 |
++ /* Note the following code is not safe, but this is okay. */ |
1213 |
++ if (unlikely(siphash_key_is_zero(&net->ipv4.ip_id_key))) |
1214 |
++ get_random_bytes(&net->ipv4.ip_id_key, |
1215 |
++ sizeof(net->ipv4.ip_id_key)); |
1216 |
++ |
1217 |
++ hash = siphash(&combined, sizeof(combined), &net->ipv4.ip_id_key); |
1218 |
+ |
1219 |
+ /* Treat id of 0 as unset and if we get 0 back from ip_idents_reserve, |
1220 |
+ * set the hight order instead thus minimizing possible future |
1221 |
+@@ -41,7 +51,6 @@ static u32 __ipv6_select_ident(struct net *net, u32 hashrnd, |
1222 |
+ */ |
1223 |
+ __be32 ipv6_proxy_select_ident(struct net *net, struct sk_buff *skb) |
1224 |
+ { |
1225 |
+- static u32 ip6_proxy_idents_hashrnd __read_mostly; |
1226 |
+ struct in6_addr buf[2]; |
1227 |
+ struct in6_addr *addrs; |
1228 |
+ u32 id; |
1229 |
+@@ -53,11 +62,7 @@ __be32 ipv6_proxy_select_ident(struct net *net, struct sk_buff *skb) |
1230 |
+ if (!addrs) |
1231 |
+ return 0; |
1232 |
+ |
1233 |
+- net_get_random_once(&ip6_proxy_idents_hashrnd, |
1234 |
+- sizeof(ip6_proxy_idents_hashrnd)); |
1235 |
+- |
1236 |
+- id = __ipv6_select_ident(net, ip6_proxy_idents_hashrnd, |
1237 |
+- &addrs[1], &addrs[0]); |
1238 |
++ id = __ipv6_select_ident(net, &addrs[1], &addrs[0]); |
1239 |
+ return htonl(id); |
1240 |
+ } |
1241 |
+ EXPORT_SYMBOL_GPL(ipv6_proxy_select_ident); |
1242 |
+@@ -66,12 +71,9 @@ __be32 ipv6_select_ident(struct net *net, |
1243 |
+ const struct in6_addr *daddr, |
1244 |
+ const struct in6_addr *saddr) |
1245 |
+ { |
1246 |
+- static u32 ip6_idents_hashrnd __read_mostly; |
1247 |
+ u32 id; |
1248 |
+ |
1249 |
+- net_get_random_once(&ip6_idents_hashrnd, sizeof(ip6_idents_hashrnd)); |
1250 |
+- |
1251 |
+- id = __ipv6_select_ident(net, ip6_idents_hashrnd, daddr, saddr); |
1252 |
++ id = __ipv6_select_ident(net, daddr, saddr); |
1253 |
+ return htonl(id); |
1254 |
+ } |
1255 |
+ EXPORT_SYMBOL(ipv6_select_ident); |
1256 |
+diff --git a/net/ipv6/raw.c b/net/ipv6/raw.c |
1257 |
+index 5a426226c762..5cb14eabfc65 100644 |
1258 |
+--- a/net/ipv6/raw.c |
1259 |
++++ b/net/ipv6/raw.c |
1260 |
+@@ -287,7 +287,9 @@ static int rawv6_bind(struct sock *sk, struct sockaddr *uaddr, int addr_len) |
1261 |
+ /* Binding to link-local address requires an interface */ |
1262 |
+ if (!sk->sk_bound_dev_if) |
1263 |
+ goto out_unlock; |
1264 |
++ } |
1265 |
+ |
1266 |
++ if (sk->sk_bound_dev_if) { |
1267 |
+ err = -ENODEV; |
1268 |
+ dev = dev_get_by_index_rcu(sock_net(sk), |
1269 |
+ sk->sk_bound_dev_if); |
1270 |
+diff --git a/net/ipv6/route.c b/net/ipv6/route.c |
1271 |
+index e470589fb93b..ab348489bd8a 100644 |
1272 |
+--- a/net/ipv6/route.c |
1273 |
++++ b/net/ipv6/route.c |
1274 |
+@@ -2442,6 +2442,12 @@ static struct rt6_info *__ip6_route_redirect(struct net *net, |
1275 |
+ struct fib6_info *rt; |
1276 |
+ struct fib6_node *fn; |
1277 |
+ |
1278 |
++ /* l3mdev_update_flow overrides oif if the device is enslaved; in |
1279 |
++ * this case we must match on the real ingress device, so reset it |
1280 |
++ */ |
1281 |
++ if (fl6->flowi6_flags & FLOWI_FLAG_SKIP_NH_OIF) |
1282 |
++ fl6->flowi6_oif = skb->dev->ifindex; |
1283 |
++ |
1284 |
+ /* Get the "current" route for this destination and |
1285 |
+ * check if the redirect has come from appropriate router. |
1286 |
+ * |
1287 |
+diff --git a/net/llc/llc_output.c b/net/llc/llc_output.c |
1288 |
+index 94425e421213..9e4b6bcf6920 100644 |
1289 |
+--- a/net/llc/llc_output.c |
1290 |
++++ b/net/llc/llc_output.c |
1291 |
+@@ -72,6 +72,8 @@ int llc_build_and_send_ui_pkt(struct llc_sap *sap, struct sk_buff *skb, |
1292 |
+ rc = llc_mac_hdr_init(skb, skb->dev->dev_addr, dmac); |
1293 |
+ if (likely(!rc)) |
1294 |
+ rc = dev_queue_xmit(skb); |
1295 |
++ else |
1296 |
++ kfree_skb(skb); |
1297 |
+ return rc; |
1298 |
+ } |
1299 |
+ |
1300 |
+diff --git a/net/sched/act_api.c b/net/sched/act_api.c |
1301 |
+index 5a87e271d35a..5b56b1cb2417 100644 |
1302 |
+--- a/net/sched/act_api.c |
1303 |
++++ b/net/sched/act_api.c |
1304 |
+@@ -800,7 +800,7 @@ int tcf_action_dump(struct sk_buff *skb, struct tc_action *actions[], |
1305 |
+ |
1306 |
+ for (i = 0; i < TCA_ACT_MAX_PRIO && actions[i]; i++) { |
1307 |
+ a = actions[i]; |
1308 |
+- nest = nla_nest_start(skb, a->order); |
1309 |
++ nest = nla_nest_start(skb, i + 1); |
1310 |
+ if (nest == NULL) |
1311 |
+ goto nla_put_failure; |
1312 |
+ err = tcf_action_dump_1(skb, a, bind, ref); |
1313 |
+@@ -1300,7 +1300,6 @@ tca_action_gd(struct net *net, struct nlattr *nla, struct nlmsghdr *n, |
1314 |
+ ret = PTR_ERR(act); |
1315 |
+ goto err; |
1316 |
+ } |
1317 |
+- act->order = i; |
1318 |
+ attr_size += tcf_action_fill_size(act); |
1319 |
+ actions[i - 1] = act; |
1320 |
+ } |
1321 |
+diff --git a/net/tipc/core.c b/net/tipc/core.c |
1322 |
+index d7b0688c98dd..3ecca3b88bf8 100644 |
1323 |
+--- a/net/tipc/core.c |
1324 |
++++ b/net/tipc/core.c |
1325 |
+@@ -66,10 +66,6 @@ static int __net_init tipc_init_net(struct net *net) |
1326 |
+ INIT_LIST_HEAD(&tn->node_list); |
1327 |
+ spin_lock_init(&tn->node_list_lock); |
1328 |
+ |
1329 |
+- err = tipc_socket_init(); |
1330 |
+- if (err) |
1331 |
+- goto out_socket; |
1332 |
+- |
1333 |
+ err = tipc_sk_rht_init(net); |
1334 |
+ if (err) |
1335 |
+ goto out_sk_rht; |
1336 |
+@@ -79,9 +75,6 @@ static int __net_init tipc_init_net(struct net *net) |
1337 |
+ goto out_nametbl; |
1338 |
+ |
1339 |
+ INIT_LIST_HEAD(&tn->dist_queue); |
1340 |
+- err = tipc_topsrv_start(net); |
1341 |
+- if (err) |
1342 |
+- goto out_subscr; |
1343 |
+ |
1344 |
+ err = tipc_bcast_init(net); |
1345 |
+ if (err) |
1346 |
+@@ -90,25 +83,19 @@ static int __net_init tipc_init_net(struct net *net) |
1347 |
+ return 0; |
1348 |
+ |
1349 |
+ out_bclink: |
1350 |
+- tipc_bcast_stop(net); |
1351 |
+-out_subscr: |
1352 |
+ tipc_nametbl_stop(net); |
1353 |
+ out_nametbl: |
1354 |
+ tipc_sk_rht_destroy(net); |
1355 |
+ out_sk_rht: |
1356 |
+- tipc_socket_stop(); |
1357 |
+-out_socket: |
1358 |
+ return err; |
1359 |
+ } |
1360 |
+ |
1361 |
+ static void __net_exit tipc_exit_net(struct net *net) |
1362 |
+ { |
1363 |
+- tipc_topsrv_stop(net); |
1364 |
+ tipc_net_stop(net); |
1365 |
+ tipc_bcast_stop(net); |
1366 |
+ tipc_nametbl_stop(net); |
1367 |
+ tipc_sk_rht_destroy(net); |
1368 |
+- tipc_socket_stop(); |
1369 |
+ } |
1370 |
+ |
1371 |
+ static struct pernet_operations tipc_net_ops = { |
1372 |
+@@ -118,6 +105,11 @@ static struct pernet_operations tipc_net_ops = { |
1373 |
+ .size = sizeof(struct tipc_net), |
1374 |
+ }; |
1375 |
+ |
1376 |
++static struct pernet_operations tipc_topsrv_net_ops = { |
1377 |
++ .init = tipc_topsrv_init_net, |
1378 |
++ .exit = tipc_topsrv_exit_net, |
1379 |
++}; |
1380 |
++ |
1381 |
+ static int __init tipc_init(void) |
1382 |
+ { |
1383 |
+ int err; |
1384 |
+@@ -144,6 +136,14 @@ static int __init tipc_init(void) |
1385 |
+ if (err) |
1386 |
+ goto out_pernet; |
1387 |
+ |
1388 |
++ err = tipc_socket_init(); |
1389 |
++ if (err) |
1390 |
++ goto out_socket; |
1391 |
++ |
1392 |
++ err = register_pernet_subsys(&tipc_topsrv_net_ops); |
1393 |
++ if (err) |
1394 |
++ goto out_pernet_topsrv; |
1395 |
++ |
1396 |
+ err = tipc_bearer_setup(); |
1397 |
+ if (err) |
1398 |
+ goto out_bearer; |
1399 |
+@@ -151,6 +151,10 @@ static int __init tipc_init(void) |
1400 |
+ pr_info("Started in single node mode\n"); |
1401 |
+ return 0; |
1402 |
+ out_bearer: |
1403 |
++ unregister_pernet_subsys(&tipc_topsrv_net_ops); |
1404 |
++out_pernet_topsrv: |
1405 |
++ tipc_socket_stop(); |
1406 |
++out_socket: |
1407 |
+ unregister_pernet_subsys(&tipc_net_ops); |
1408 |
+ out_pernet: |
1409 |
+ tipc_unregister_sysctl(); |
1410 |
+@@ -166,6 +170,8 @@ out_netlink: |
1411 |
+ static void __exit tipc_exit(void) |
1412 |
+ { |
1413 |
+ tipc_bearer_cleanup(); |
1414 |
++ unregister_pernet_subsys(&tipc_topsrv_net_ops); |
1415 |
++ tipc_socket_stop(); |
1416 |
+ unregister_pernet_subsys(&tipc_net_ops); |
1417 |
+ tipc_netlink_stop(); |
1418 |
+ tipc_netlink_compat_stop(); |
1419 |
+diff --git a/net/tipc/subscr.h b/net/tipc/subscr.h |
1420 |
+index d793b4343885..aa015c233898 100644 |
1421 |
+--- a/net/tipc/subscr.h |
1422 |
++++ b/net/tipc/subscr.h |
1423 |
+@@ -77,8 +77,9 @@ void tipc_sub_report_overlap(struct tipc_subscription *sub, |
1424 |
+ u32 found_lower, u32 found_upper, |
1425 |
+ u32 event, u32 port, u32 node, |
1426 |
+ u32 scope, int must); |
1427 |
+-int tipc_topsrv_start(struct net *net); |
1428 |
+-void tipc_topsrv_stop(struct net *net); |
1429 |
++ |
1430 |
++int __net_init tipc_topsrv_init_net(struct net *net); |
1431 |
++void __net_exit tipc_topsrv_exit_net(struct net *net); |
1432 |
+ |
1433 |
+ void tipc_sub_put(struct tipc_subscription *subscription); |
1434 |
+ void tipc_sub_get(struct tipc_subscription *subscription); |
1435 |
+diff --git a/net/tipc/topsrv.c b/net/tipc/topsrv.c |
1436 |
+index b45932d78004..f345662890a6 100644 |
1437 |
+--- a/net/tipc/topsrv.c |
1438 |
++++ b/net/tipc/topsrv.c |
1439 |
+@@ -635,7 +635,7 @@ static void tipc_topsrv_work_stop(struct tipc_topsrv *s) |
1440 |
+ destroy_workqueue(s->send_wq); |
1441 |
+ } |
1442 |
+ |
1443 |
+-int tipc_topsrv_start(struct net *net) |
1444 |
++static int tipc_topsrv_start(struct net *net) |
1445 |
+ { |
1446 |
+ struct tipc_net *tn = tipc_net(net); |
1447 |
+ const char name[] = "topology_server"; |
1448 |
+@@ -668,7 +668,7 @@ int tipc_topsrv_start(struct net *net) |
1449 |
+ return ret; |
1450 |
+ } |
1451 |
+ |
1452 |
+-void tipc_topsrv_stop(struct net *net) |
1453 |
++static void tipc_topsrv_stop(struct net *net) |
1454 |
+ { |
1455 |
+ struct tipc_topsrv *srv = tipc_topsrv(net); |
1456 |
+ struct socket *lsock = srv->listener; |
1457 |
+@@ -693,3 +693,13 @@ void tipc_topsrv_stop(struct net *net) |
1458 |
+ idr_destroy(&srv->conn_idr); |
1459 |
+ kfree(srv); |
1460 |
+ } |
1461 |
++ |
1462 |
++int __net_init tipc_topsrv_init_net(struct net *net) |
1463 |
++{ |
1464 |
++ return tipc_topsrv_start(net); |
1465 |
++} |
1466 |
++ |
1467 |
++void __net_exit tipc_topsrv_exit_net(struct net *net) |
1468 |
++{ |
1469 |
++ tipc_topsrv_stop(net); |
1470 |
++} |
1471 |
+diff --git a/net/tls/tls_device.c b/net/tls/tls_device.c |
1472 |
+index 14dedb24fa7b..0fd8f0997ff5 100644 |
1473 |
+--- a/net/tls/tls_device.c |
1474 |
++++ b/net/tls/tls_device.c |
1475 |
+@@ -943,12 +943,6 @@ void tls_device_offload_cleanup_rx(struct sock *sk) |
1476 |
+ if (!netdev) |
1477 |
+ goto out; |
1478 |
+ |
1479 |
+- if (!(netdev->features & NETIF_F_HW_TLS_RX)) { |
1480 |
+- pr_err_ratelimited("%s: device is missing NETIF_F_HW_TLS_RX cap\n", |
1481 |
+- __func__); |
1482 |
+- goto out; |
1483 |
+- } |
1484 |
+- |
1485 |
+ netdev->tlsdev_ops->tls_dev_del(netdev, tls_ctx, |
1486 |
+ TLS_OFFLOAD_CTX_DIR_RX); |
1487 |
+ |
1488 |
+@@ -1007,7 +1001,8 @@ static int tls_dev_event(struct notifier_block *this, unsigned long event, |
1489 |
+ { |
1490 |
+ struct net_device *dev = netdev_notifier_info_to_dev(ptr); |
1491 |
+ |
1492 |
+- if (!(dev->features & (NETIF_F_HW_TLS_RX | NETIF_F_HW_TLS_TX))) |
1493 |
++ if (!dev->tlsdev_ops && |
1494 |
++ !(dev->features & (NETIF_F_HW_TLS_RX | NETIF_F_HW_TLS_TX))) |
1495 |
+ return NOTIFY_DONE; |
1496 |
+ |
1497 |
+ switch (event) { |
1498 |
+diff --git a/net/tls/tls_sw.c b/net/tls/tls_sw.c |
1499 |
+index 29d6af43dd24..d350ff73a391 100644 |
1500 |
+--- a/net/tls/tls_sw.c |
1501 |
++++ b/net/tls/tls_sw.c |
1502 |
+@@ -1685,15 +1685,14 @@ int tls_sw_recvmsg(struct sock *sk, |
1503 |
+ copied = err; |
1504 |
+ } |
1505 |
+ |
1506 |
+- len = len - copied; |
1507 |
+- if (len) { |
1508 |
+- target = sock_rcvlowat(sk, flags & MSG_WAITALL, len); |
1509 |
+- timeo = sock_rcvtimeo(sk, flags & MSG_DONTWAIT); |
1510 |
+- } else { |
1511 |
++ if (len <= copied) |
1512 |
+ goto recv_end; |
1513 |
+- } |
1514 |
+ |
1515 |
+- do { |
1516 |
++ target = sock_rcvlowat(sk, flags & MSG_WAITALL, len); |
1517 |
++ len = len - copied; |
1518 |
++ timeo = sock_rcvtimeo(sk, flags & MSG_DONTWAIT); |
1519 |
++ |
1520 |
++ while (len && (decrypted + copied < target || ctx->recv_pkt)) { |
1521 |
+ bool retain_skb = false; |
1522 |
+ bool zc = false; |
1523 |
+ int to_decrypt; |
1524 |
+@@ -1824,11 +1823,7 @@ pick_next_record: |
1525 |
+ } else { |
1526 |
+ break; |
1527 |
+ } |
1528 |
+- |
1529 |
+- /* If we have a new message from strparser, continue now. */ |
1530 |
+- if (decrypted >= target && !ctx->recv_pkt) |
1531 |
+- break; |
1532 |
+- } while (len); |
1533 |
++ } |
1534 |
+ |
1535 |
+ recv_end: |
1536 |
+ if (num_async) { |
1537 |
+diff --git a/tools/testing/selftests/net/tls.c b/tools/testing/selftests/net/tls.c |
1538 |
+index 47ddfc154036..278c86134556 100644 |
1539 |
+--- a/tools/testing/selftests/net/tls.c |
1540 |
++++ b/tools/testing/selftests/net/tls.c |
1541 |
+@@ -442,6 +442,21 @@ TEST_F(tls, multiple_send_single_recv) |
1542 |
+ EXPECT_EQ(memcmp(send_mem, recv_mem + send_len, send_len), 0); |
1543 |
+ } |
1544 |
+ |
1545 |
++TEST_F(tls, single_send_multiple_recv_non_align) |
1546 |
++{ |
1547 |
++ const unsigned int total_len = 15; |
1548 |
++ const unsigned int recv_len = 10; |
1549 |
++ char recv_mem[recv_len * 2]; |
1550 |
++ char send_mem[total_len]; |
1551 |
++ |
1552 |
++ EXPECT_GE(send(self->fd, send_mem, total_len, 0), 0); |
1553 |
++ memset(recv_mem, 0, total_len); |
1554 |
++ |
1555 |
++ EXPECT_EQ(recv(self->cfd, recv_mem, recv_len, 0), recv_len); |
1556 |
++ EXPECT_EQ(recv(self->cfd, recv_mem + recv_len, recv_len, 0), 5); |
1557 |
++ EXPECT_EQ(memcmp(send_mem, recv_mem, total_len), 0); |
1558 |
++} |
1559 |
++ |
1560 |
+ TEST_F(tls, recv_partial) |
1561 |
+ { |
1562 |
+ char const *test_str = "test_read_partial"; |
1563 |
+@@ -575,6 +590,25 @@ TEST_F(tls, recv_peek_large_buf_mult_recs) |
1564 |
+ EXPECT_EQ(memcmp(test_str, buf, len), 0); |
1565 |
+ } |
1566 |
+ |
1567 |
++TEST_F(tls, recv_lowat) |
1568 |
++{ |
1569 |
++ char send_mem[10] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 }; |
1570 |
++ char recv_mem[20]; |
1571 |
++ int lowat = 8; |
1572 |
++ |
1573 |
++ EXPECT_EQ(send(self->fd, send_mem, 10, 0), 10); |
1574 |
++ EXPECT_EQ(send(self->fd, send_mem, 5, 0), 5); |
1575 |
++ |
1576 |
++ memset(recv_mem, 0, 20); |
1577 |
++ EXPECT_EQ(setsockopt(self->cfd, SOL_SOCKET, SO_RCVLOWAT, |
1578 |
++ &lowat, sizeof(lowat)), 0); |
1579 |
++ EXPECT_EQ(recv(self->cfd, recv_mem, 1, MSG_WAITALL), 1); |
1580 |
++ EXPECT_EQ(recv(self->cfd, recv_mem + 1, 6, MSG_WAITALL), 6); |
1581 |
++ EXPECT_EQ(recv(self->cfd, recv_mem + 7, 10, 0), 8); |
1582 |
++ |
1583 |
++ EXPECT_EQ(memcmp(send_mem, recv_mem, 10), 0); |
1584 |
++ EXPECT_EQ(memcmp(send_mem, recv_mem + 10, 5), 0); |
1585 |
++} |
1586 |
+ |
1587 |
+ TEST_F(tls, pollin) |
1588 |
+ { |