History

Merge tag 'net-5.15-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net

Pull networking fixes from Jakub Kicinski: "Current release - regressions: - dsa: bcm_sf2: fix array overrun in bcm_sf2_num_active_ports() Previous releases - regressions: - introduce a shutdown method to mdio device drivers, and make DSA switch drivers compatible with masters disappearing on shutdown; preventing infinite reference wait - fix issues in mdiobus users related to ->shutdown vs ->remove - virtio-net: fix pages leaking when building skb in big mode - xen-netback: correct success/error reporting for the SKB-with-fraglist - dsa: tear down devlink port regions when tearing down the devlink port on error - nexthop: fix division by zero while replacing a resilient group - hns3: check queue, vf, vlan ids range before using Previous releases - always broken: - napi: fix race against netpoll causing NAPI getting stuck - mlx4_en: ensure link operstate is updated even if link comes up before netdev registration - bnxt_en: fix TX timeout when TX ring size is set to the smallest - enetc: fix illegal access when reading affinity_hint; prevent oops on sysfs access - mtk_eth_soc: avoid creating duplicate offload entries Misc: - core: correct the sock::sk_lock.owned lockdep annotations" * tag 'net-5.15-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net: (51 commits) atlantic: Fix issue in the pm resume flow. net/mlx4_en: Don't allow aRFS for encapsulated packets net: mscc: ocelot: fix forwarding from BLOCKING ports remaining enabled net: ethernet: mtk_eth_soc: avoid creating duplicate offload entries nfc: st-nci: Add SPI ID matching DT compatible MAINTAINERS: remove Guvenc Gulce as net/smc maintainer nexthop: Fix memory leaks in nexthop notification chain listeners mptcp: ensure tx skbs always have the MPTCP ext qed: rdma - don't wait for resources under hw error recovery flow s390/qeth: fix deadlock during failing recovery s390/qeth: Fix deadlock in remove_discipline s390/qeth: fix NULL deref in qeth_clear_working_pool_list() net: dsa: realtek: register the MDIO bus under devres net: dsa: don't allocate the slave_mii_bus using devres Doc: networking: Fox a typo in ice.rst net: dsa: fix dsa_tree_setup error path net/smc: fix 'workqueue leaked lock' in smc_conn_abort_work net/smc: add missing error check in smc_clc_prfx_set() net: hns3: fix a return value error in hclge_get_reset_status() net: hns3: check vlan id before using it ...

Linus Torvalds committed 5 years ago

Commit 9bc62af2 parents 1f82822 4d88c33105 files · +931 −284Browse files

Unified · Split

105 files
  1. Documentation/networking/device_drivers/ethernet/intel/ice.rst +1 −1
  2. MAINTAINERS +0 −1
  3. arch/s390/include/asm/ccwgroup.h +1 −1
  4. drivers/net/dsa/b53/b53_mdio.c +19 −2
  5. drivers/net/dsa/b53/b53_mmap.c +13 −0
  6. drivers/net/dsa/b53/b53_priv.h +5 −0
  7. drivers/net/dsa/b53/b53_spi.c +13 −0
  8. drivers/net/dsa/b53/b53_srab.c +19 −2
  9. drivers/net/dsa/bcm_sf2.c +13 −1
  10. drivers/net/dsa/dsa_loop.c +21 −1
  11. drivers/net/dsa/hirschmann/hellcreek.c +16 −0
  12. drivers/net/dsa/lan9303-core.c +6 −0
  13. drivers/net/dsa/lan9303.h +1 −0
  14. drivers/net/dsa/lan9303_i2c.c +20 −4
  15. drivers/net/dsa/lan9303_mdio.c +15 −0
  16. drivers/net/dsa/lantiq_gswip.c +18 −0
  17. drivers/net/dsa/microchip/ksz8795_spi.c +10 −1
  18. drivers/net/dsa/microchip/ksz8863_smi.c +13 −0
  19. drivers/net/dsa/microchip/ksz9477_i2c.c +12 −2
  20. drivers/net/dsa/microchip/ksz9477_spi.c +6 −2
  21. drivers/net/dsa/mt7530.c +18 −0
  22. drivers/net/dsa/mv88e6060.c +18 −0
  23. drivers/net/dsa/mv88e6xxx/chip.c +35 −3
  24. drivers/net/dsa/mv88e6xxx/devlink.c +9 −64
  25. drivers/net/dsa/mv88e6xxx/devlink.h +4 −2
  26. drivers/net/dsa/ocelot/felix.c +1 −1
  27. drivers/net/dsa/ocelot/felix.h +1 −1
  28. drivers/net/dsa/ocelot/felix_vsc9959.c +19 −3
  29. drivers/net/dsa/ocelot/seville_vsc9953.c +18 −2
  30. drivers/net/dsa/qca/ar9331.c +18 −0
  31. drivers/net/dsa/qca8k.c +18 −0
  32. drivers/net/dsa/realtek-smi-core.c +20 −2
  33. drivers/net/dsa/sja1105/sja1105_clocking.c +1 −1
  34. drivers/net/dsa/sja1105/sja1105_devlink.c +1 −1
  35. drivers/net/dsa/sja1105/sja1105_flower.c +1 −1
  36. drivers/net/dsa/sja1105/sja1105_main.c +19 −2
  37. drivers/net/dsa/sja1105/sja1105_mdio.c +1 −1
  38. drivers/net/dsa/sja1105/sja1105_spi.c +1 −1
  39. drivers/net/dsa/sja1105/sja1105_static_config.c +1 −1
  40. drivers/net/dsa/sja1105/sja1105_static_config.h +1 −1
  41. drivers/net/dsa/sja1105/sja1105_vl.c +1 −1
  42. drivers/net/dsa/sja1105/sja1105_vl.h +1 −1
  43. drivers/net/dsa/vitesse-vsc73xx-core.c +6 −0
  44. drivers/net/dsa/vitesse-vsc73xx-platform.c +21 −1
  45. drivers/net/dsa/vitesse-vsc73xx-spi.c +21 −1
  46. drivers/net/dsa/vitesse-vsc73xx.h +1 −0
  47. drivers/net/dsa/xrs700x/xrs700x.c +6 −0
  48. drivers/net/dsa/xrs700x/xrs700x.h +1 −0
  49. drivers/net/dsa/xrs700x/xrs700x_i2c.c +18 −0
  50. drivers/net/dsa/xrs700x/xrs700x_mdio.c +18 −0
  51. drivers/net/ethernet/aquantia/atlantic/aq_pci_func.c +2 −2
  52. drivers/net/ethernet/broadcom/bgmac-bcma.c +2 −0
  53. drivers/net/ethernet/broadcom/bnxt/bnxt.c +4 −4
  54. drivers/net/ethernet/broadcom/bnxt/bnxt.h +5 −0
  55. drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c +1 −1
  56. drivers/net/ethernet/freescale/enetc/enetc.c +2 −5
  57. drivers/net/ethernet/freescale/enetc/enetc_ierb.c +1 −1
  58. drivers/net/ethernet/freescale/enetc/enetc_ierb.h +1 −1
  59. drivers/net/ethernet/freescale/fec_main.c +0 −1
  60. drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_err.c +4 −4
  61. drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c +55 −25
  62. drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_mbx.c +9 −1
  63. drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_tm.c +1 −1
  64. drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.c +34 −18
  65. drivers/net/ethernet/intel/Kconfig +1 −0
  66. drivers/net/ethernet/mediatek/mtk_ppe_offload.c +3 −0
  67. drivers/net/ethernet/mellanox/mlx4/en_netdev.c +32 −18
  68. drivers/net/ethernet/mellanox/mlx4/mlx4_en.h +0 −1
  69. drivers/net/ethernet/mscc/ocelot.c +8 −13
  70. drivers/net/ethernet/mscc/ocelot_devlink.c +1 −1
  71. drivers/net/ethernet/mscc/ocelot_mrp.c +1 −1
  72. drivers/net/ethernet/mscc/ocelot_net.c +1 −1
  73. drivers/net/ethernet/qlogic/qed/qed_iwarp.c +8 −0
  74. drivers/net/ethernet/qlogic/qed/qed_roce.c +8 −0
  75. drivers/net/pcs/pcs-xpcs-nxp.c +1 −1
  76. drivers/net/phy/mdio_device.c +11 −0
  77. drivers/net/usb/hso.c +5 −7
  78. drivers/net/virtio_net.c +4 −0
  79. drivers/net/vxlan.c +1 −1
  80. drivers/net/xen-netback/netback.c +1 −1
  81. drivers/nfc/st-nci/spi.c +1 −0
  82. drivers/ptp/Kconfig +1 −0
  83. drivers/s390/cio/ccwgroup.c +8 −2
  84. drivers/s390/net/qeth_core.h +0 −1
  85. drivers/s390/net/qeth_core_main.c +9 −13
  86. drivers/s390/net/qeth_l2_main.c +0 −1
  87. drivers/s390/net/qeth_l3_main.c +0 −1
  88. include/linux/dsa/ocelot.h +1 −1
  89. include/linux/mdio.h +3 −0
  90. include/linux/packing.h +1 −1
  91. include/net/dsa.h +9 −0
  92. include/net/sock.h +1 −0
  93. lib/packing.c +1 −1
  94. net/core/dev.c +10 −6
  95. net/core/sock.c +23 −14
  96. net/dsa/dsa2.c +106 −8
  97. net/dsa/tag_ocelot.c +1 −1
  98. net/dsa/tag_ocelot_8021q.c +1 −1
  99. net/ipv4/nexthop.c +16 −5
  100. net/mptcp/protocol.c +2 −2
  101. net/smc/smc_clc.c +2 −1
  102. net/smc/smc_core.c +2 −0
  103. tools/testing/selftests/drivers/net/ocelot/tc_flower_chains.sh +1 −1
  104. tools/testing/selftests/net/af_unix/Makefile +1 −4
  105. tools/testing/selftests/net/af_unix/test_unix_oob.c +3 −2
Documentation/networking/device_drivers/ethernet/intel/ice.rst+1−1
@@ -851,7 +851,7 @@ NOTES: · 850 unmodified lines
851851 - 0x88A8 traffic will not be received unless VLAN stripping is disabled with
852852 the following command::
853853
854− # ethool -K <ethX> rxvlan off
854+ # ethtool -K <ethX> rxvlan off
855855
856856 - 0x88A8/0x8100 double VLANs cannot be used with 0x8100 or 0x8100/0x8100 VLANS
857857 configured on the same port. 0x88a8/0x8100 traffic will not be received if
MAINTAINERS+0−1
@@ -16955,7 +16955,6 @@ F: drivers/misc/sgi-xp/ · 16954 unmodified lines
1695516955
1695616956 SHARED MEMORY COMMUNICATIONS (SMC) SOCKETS
1695716957 M: Karsten Graul <kgraul@linux.ibm.com>
16958−M: Guvenc Gulce <guvenc@linux.ibm.com>
1695916958 L: linux-s390@vger.kernel.org
1696016959 S: Supported
1696116960 W: http://www.ibm.com/developerworks/linux/linux390/
arch/s390/include/asm/ccwgroup.h+1−1
@@ -55,7 +55,7 @@ int ccwgroup_create_dev(struct device *root, struct ccwgroup_driver *gdrv, · 54 unmodified lines
5555 int num_devices, const char *buf);
5656
5757 extern int ccwgroup_set_online(struct ccwgroup_device *gdev);
58−extern int ccwgroup_set_offline(struct ccwgroup_device *gdev);
58+int ccwgroup_set_offline(struct ccwgroup_device *gdev, bool call_gdrv);
5959
6060 extern int ccwgroup_probe_ccwdev(struct ccw_device *cdev);
6161 extern void ccwgroup_remove_ccwdev(struct ccw_device *cdev);
drivers/net/dsa/b53/b53_mdio.c+19−2
@@ -351,9 +351,25 @@ static int b53_mdio_probe(struct mdio_device *mdiodev) · 350 unmodified lines
351351 static void b53_mdio_remove(struct mdio_device *mdiodev)
352352 {
353353 struct b53_device *dev = dev_get_drvdata(&mdiodev->dev);
354− struct dsa_switch *ds = dev->ds;
355354
356− dsa_unregister_switch(ds);
355+ if (!dev)
356+ return;
357+
358+ b53_switch_remove(dev);
359+
360+ dev_set_drvdata(&mdiodev->dev, NULL);
361+}
362+
363+static void b53_mdio_shutdown(struct mdio_device *mdiodev)
364+{
365+ struct b53_device *dev = dev_get_drvdata(&mdiodev->dev);
366+
367+ if (!dev)
368+ return;
369+
370+ b53_switch_shutdown(dev);
371+
372+ dev_set_drvdata(&mdiodev->dev, NULL);
357373 }
358374
359375 static const struct of_device_id b53_of_match[] = {
@@ -373,6 +389,7 @@ MODULE_DEVICE_TABLE(of, b53_of_match); · 13 unmodified lines
373389 static struct mdio_driver b53_mdio_driver = {
374390 .probe = b53_mdio_probe,
375391 .remove = b53_mdio_remove,
392+ .shutdown = b53_mdio_shutdown,
376393 .mdiodrv.driver = {
377394 .name = "bcm53xx",
378395 .of_match_table = b53_of_match,
drivers/net/dsa/b53/b53_mmap.c+13−0
@@ -316,9 +316,21 @@ static int b53_mmap_remove(struct platform_device *pdev) · 315 unmodified lines
316316 if (dev)
317317 b53_switch_remove(dev);
318318
319+ platform_set_drvdata(pdev, NULL);
320+
319321 return 0;
320322 }
321323
324+static void b53_mmap_shutdown(struct platform_device *pdev)
325+{
326+ struct b53_device *dev = platform_get_drvdata(pdev);
327+
328+ if (dev)
329+ b53_switch_shutdown(dev);
330+
331+ platform_set_drvdata(pdev, NULL);
332+}
333+
322334 static const struct of_device_id b53_mmap_of_table[] = {
323335 { .compatible = "brcm,bcm3384-switch" },
324336 { .compatible = "brcm,bcm6328-switch" },
@@ -331,6 +343,7 @@ MODULE_DEVICE_TABLE(of, b53_mmap_of_table); · 6 unmodified lines
331343 static struct platform_driver b53_mmap_driver = {
332344 .probe = b53_mmap_probe,
333345 .remove = b53_mmap_remove,
346+ .shutdown = b53_mmap_shutdown,
334347 .driver = {
335348 .name = "b53-switch",
336349 .of_match_table = b53_mmap_of_table,
drivers/net/dsa/b53/b53_priv.h+5−0
@@ -228,6 +228,11 @@ static inline void b53_switch_remove(struct b53_device *dev) · 227 unmodified lines
228228 dsa_unregister_switch(dev->ds);
229229 }
230230
231+static inline void b53_switch_shutdown(struct b53_device *dev)
232+{
233+ dsa_switch_shutdown(dev->ds);
234+}
235+
231236 #define b53_build_op(type_op_size, val_type) \
232237 static inline int b53_##type_op_size(struct b53_device *dev, u8 page, \
233238 u8 reg, val_type val) \
drivers/net/dsa/b53/b53_spi.c+13−0
@@ -321,9 +321,21 @@ static int b53_spi_remove(struct spi_device *spi) · 320 unmodified lines
321321 if (dev)
322322 b53_switch_remove(dev);
323323
324+ spi_set_drvdata(spi, NULL);
325+
324326 return 0;
325327 }
326328
329+static void b53_spi_shutdown(struct spi_device *spi)
330+{
331+ struct b53_device *dev = spi_get_drvdata(spi);
332+
333+ if (dev)
334+ b53_switch_shutdown(dev);
335+
336+ spi_set_drvdata(spi, NULL);
337+}
338+
327339 static const struct of_device_id b53_spi_of_match[] = {
328340 { .compatible = "brcm,bcm5325" },
329341 { .compatible = "brcm,bcm5365" },
@@ -344,6 +356,7 @@ static struct spi_driver b53_spi_driver = { · 14 unmodified lines
344356 },
345357 .probe = b53_spi_probe,
346358 .remove = b53_spi_remove,
359+ .shutdown = b53_spi_shutdown,
347360 };
348361
349362 module_spi_driver(b53_spi_driver);
drivers/net/dsa/b53/b53_srab.c+19−2
@@ -629,17 +629,34 @@ static int b53_srab_probe(struct platform_device *pdev) · 628 unmodified lines
629629 static int b53_srab_remove(struct platform_device *pdev)
630630 {
631631 struct b53_device *dev = platform_get_drvdata(pdev);
632− struct b53_srab_priv *priv = dev->priv;
633632
634− b53_srab_intr_set(priv, false);
633+ if (!dev)
634+ return 0;
635+
636+ b53_srab_intr_set(dev->priv, false);
635637 b53_switch_remove(dev);
636638
639+ platform_set_drvdata(pdev, NULL);
640+
637641 return 0;
638642 }
639643
644+static void b53_srab_shutdown(struct platform_device *pdev)
645+{
646+ struct b53_device *dev = platform_get_drvdata(pdev);
647+
648+ if (!dev)
649+ return;
650+
651+ b53_switch_shutdown(dev);
652+
653+ platform_set_drvdata(pdev, NULL);
654+}
655+
640656 static struct platform_driver b53_srab_driver = {
641657 .probe = b53_srab_probe,
642658 .remove = b53_srab_remove,
659+ .shutdown = b53_srab_shutdown,
643660 .driver = {
644661 .name = "b53-srab-switch",
645662 .of_match_table = b53_srab_of_match,
drivers/net/dsa/bcm_sf2.c+13−1
@@ -68,7 +68,7 @@ static unsigned int bcm_sf2_num_active_ports(struct dsa_switch *ds) · 67 unmodified lines
6868 struct bcm_sf2_priv *priv = bcm_sf2_to_priv(ds);
6969 unsigned int port, count = 0;
7070
71− for (port = 0; port < ARRAY_SIZE(priv->port_sts); port++) {
71+ for (port = 0; port < ds->num_ports; port++) {
7272 if (dsa_is_cpu_port(ds, port))
7373 continue;
7474 if (priv->port_sts[port].enabled)
@@ -1512,6 +1512,9 @@ static int bcm_sf2_sw_remove(struct platform_device *pdev) · 1437 unmodified lines
15121512 {
15131513 struct bcm_sf2_priv *priv = platform_get_drvdata(pdev);
15141514
1515+ if (!priv)
1516+ return 0;
1517+
15151518 priv->wol_ports_mask = 0;
15161519 /* Disable interrupts */
15171520 bcm_sf2_intr_disable(priv);
@@ -1523,6 +1526,8 @@ static int bcm_sf2_sw_remove(struct platform_device *pdev) · 5 unmodified lines
15231526 if (priv->type == BCM7278_DEVICE_ID)
15241527 reset_control_assert(priv->rcdev);
15251528
1529+ platform_set_drvdata(pdev, NULL);
1530+
15261531 return 0;
15271532 }
15281533
@@ -1530,6 +1535,9 @@ static void bcm_sf2_sw_shutdown(struct platform_device *pdev) · 1 unmodified line
15301535 {
15311536 struct bcm_sf2_priv *priv = platform_get_drvdata(pdev);
15321537
1538+ if (!priv)
1539+ return;
1540+
15331541 /* For a kernel about to be kexec'd we want to keep the GPHY on for a
15341542 * successful MDIO bus scan to occur. If we did turn off the GPHY
15351543 * before (e.g: port_disable), this will also power it back on.
@@ -1538,6 +1546,10 @@ static void bcm_sf2_sw_shutdown(struct platform_device *pdev) · 2 unmodified lines
15381546 */
15391547 if (priv->hw_params.num_gphy == 1)
15401548 bcm_sf2_gphy_enable_set(priv->dev->ds, true);
1549+
1550+ dsa_switch_shutdown(priv->dev->ds);
1551+
1552+ platform_set_drvdata(pdev, NULL);
15411553 }
15421554
15431555 #ifdef CONFIG_PM_SLEEP
drivers/net/dsa/dsa_loop.c+21−1
@@ -340,10 +340,29 @@ static int dsa_loop_drv_probe(struct mdio_device *mdiodev) · 339 unmodified lines
340340 static void dsa_loop_drv_remove(struct mdio_device *mdiodev)
341341 {
342342 struct dsa_switch *ds = dev_get_drvdata(&mdiodev->dev);
343− struct dsa_loop_priv *ps = ds->priv;
343+ struct dsa_loop_priv *ps;
344+
345+ if (!ds)
346+ return;
347+
348+ ps = ds->priv;
344349
345350 dsa_unregister_switch(ds);
346351 dev_put(ps->netdev);
352+
353+ dev_set_drvdata(&mdiodev->dev, NULL);
354+}
355+
356+static void dsa_loop_drv_shutdown(struct mdio_device *mdiodev)
357+{
358+ struct dsa_switch *ds = dev_get_drvdata(&mdiodev->dev);
359+
360+ if (!ds)
361+ return;
362+
363+ dsa_switch_shutdown(ds);
364+
365+ dev_set_drvdata(&mdiodev->dev, NULL);
347366 }
348367
349368 static struct mdio_driver dsa_loop_drv = {
@@ -352,6 +371,7 @@ static struct mdio_driver dsa_loop_drv = { · 2 unmodified lines
352371 },
353372 .probe = dsa_loop_drv_probe,
354373 .remove = dsa_loop_drv_remove,
374+ .shutdown = dsa_loop_drv_shutdown,
355375 };
356376
357377 #define NUM_FIXED_PHYS (DSA_LOOP_NUM_PORTS - 2)
drivers/net/dsa/hirschmann/hellcreek.c+16−0
@@ -1916,6 +1916,9 @@ static int hellcreek_remove(struct platform_device *pdev) · 1915 unmodified lines
19161916 {
19171917 struct hellcreek *hellcreek = platform_get_drvdata(pdev);
19181918
1919+ if (!hellcreek)
1920+ return 0;
1921+
19191922 hellcreek_hwtstamp_free(hellcreek);
19201923 hellcreek_ptp_free(hellcreek);
19211924 dsa_unregister_switch(hellcreek->ds);
@@ -1924,6 +1927,18 @@ static int hellcreek_remove(struct platform_device *pdev) · 2 unmodified lines
19241927 return 0;
19251928 }
19261929
1930+static void hellcreek_shutdown(struct platform_device *pdev)
1931+{
1932+ struct hellcreek *hellcreek = platform_get_drvdata(pdev);
1933+
1934+ if (!hellcreek)
1935+ return;
1936+
1937+ dsa_switch_shutdown(hellcreek->ds);
1938+
1939+ platform_set_drvdata(pdev, NULL);
1940+}
1941+
19271942 static const struct hellcreek_platform_data de1soc_r1_pdata = {
19281943 .name = "r4c30",
19291944 .num_ports = 4,
@@ -1946,6 +1961,7 @@ MODULE_DEVICE_TABLE(of, hellcreek_of_match); · 16 unmodified lines
19461961 static struct platform_driver hellcreek_driver = {
19471962 .probe = hellcreek_probe,
19481963 .remove = hellcreek_remove,
1964+ .shutdown = hellcreek_shutdown,
19491965 .driver = {
19501966 .name = "hellcreek",
19511967 .of_match_table = hellcreek_of_match,
drivers/net/dsa/lan9303-core.c+6−0
@@ -1379,6 +1379,12 @@ int lan9303_remove(struct lan9303 *chip) · 1378 unmodified lines
13791379 }
13801380 EXPORT_SYMBOL(lan9303_remove);
13811381
1382+void lan9303_shutdown(struct lan9303 *chip)
1383+{
1384+ dsa_switch_shutdown(chip->ds);
1385+}
1386+EXPORT_SYMBOL(lan9303_shutdown);
1387+
13821388 MODULE_AUTHOR("Juergen Borleis <kernel@pengutronix.de>");
13831389 MODULE_DESCRIPTION("Core driver for SMSC/Microchip LAN9303 three port ethernet switch");
13841390 MODULE_LICENSE("GPL v2");
drivers/net/dsa/lan9303.h+1−0
@@ -10,3 +10,4 @@ extern const struct lan9303_phy_ops lan9303_indirect_phy_ops; · 9 unmodified lines
1010
1111 int lan9303_probe(struct lan9303 *chip, struct device_node *np);
1212 int lan9303_remove(struct lan9303 *chip);
13+void lan9303_shutdown(struct lan9303 *chip);
drivers/net/dsa/lan9303_i2c.c+20−4
@@ -67,13 +67,28 @@ static int lan9303_i2c_probe(struct i2c_client *client, · 66 unmodified lines
6767
6868 static int lan9303_i2c_remove(struct i2c_client *client)
6969 {
70− struct lan9303_i2c *sw_dev;
70+ struct lan9303_i2c *sw_dev = i2c_get_clientdata(client);
7171
72− sw_dev = i2c_get_clientdata(client);
7372 if (!sw_dev)
74− return -ENODEV;
73+ return 0;
74+
75+ lan9303_remove(&sw_dev->chip);
76+
77+ i2c_set_clientdata(client, NULL);
78+
79+ return 0;
80+}
81+
82+static void lan9303_i2c_shutdown(struct i2c_client *client)
83+{
84+ struct lan9303_i2c *sw_dev = i2c_get_clientdata(client);
85+
86+ if (!sw_dev)
87+ return;
88+
89+ lan9303_shutdown(&sw_dev->chip);
7590
76− return lan9303_remove(&sw_dev->chip);
91+ i2c_set_clientdata(client, NULL);
7792 }
7893
7994 /*-------------------------------------------------------------------------*/
@@ -97,6 +112,7 @@ static struct i2c_driver lan9303_i2c_driver = { · 17 unmodified lines
97112 },
98113 .probe = lan9303_i2c_probe,
99114 .remove = lan9303_i2c_remove,
115+ .shutdown = lan9303_i2c_shutdown,
100116 .id_table = lan9303_i2c_id,
101117 };
102118 module_i2c_driver(lan9303_i2c_driver);
drivers/net/dsa/lan9303_mdio.c+15−0
@@ -138,6 +138,20 @@ static void lan9303_mdio_remove(struct mdio_device *mdiodev) · 137 unmodified lines
138138 return;
139139
140140 lan9303_remove(&sw_dev->chip);
141+
142+ dev_set_drvdata(&mdiodev->dev, NULL);
143+}
144+
145+static void lan9303_mdio_shutdown(struct mdio_device *mdiodev)
146+{
147+ struct lan9303_mdio *sw_dev = dev_get_drvdata(&mdiodev->dev);
148+
149+ if (!sw_dev)
150+ return;
151+
152+ lan9303_shutdown(&sw_dev->chip);
153+
154+ dev_set_drvdata(&mdiodev->dev, NULL);
141155 }
142156
143157 /*-------------------------------------------------------------------------*/
@@ -155,6 +169,7 @@ static struct mdio_driver lan9303_mdio_driver = { · 11 unmodified lines
155169 },
156170 .probe = lan9303_mdio_probe,
157171 .remove = lan9303_mdio_remove,
172+ .shutdown = lan9303_mdio_shutdown,
158173 };
159174 mdio_module_driver(lan9303_mdio_driver);
160175
drivers/net/dsa/lantiq_gswip.c+18−0
@@ -2184,6 +2184,9 @@ static int gswip_remove(struct platform_device *pdev) · 2183 unmodified lines
21842184 struct gswip_priv *priv = platform_get_drvdata(pdev);
21852185 int i;
21862186
2187+ if (!priv)
2188+ return 0;
2189+
21872190 /* disable the switch */
21882191 gswip_mdio_mask(priv, GSWIP_MDIO_GLOB_ENABLE, 0, GSWIP_MDIO_GLOB);
21892192
@@ -2197,9 +2200,23 @@ static int gswip_remove(struct platform_device *pdev) · 7 unmodified lines
21972200 for (i = 0; i < priv->num_gphy_fw; i++)
21982201 gswip_gphy_fw_remove(priv, &priv->gphy_fw[i]);
21992202
2203+ platform_set_drvdata(pdev, NULL);
2204+
22002205 return 0;
22012206 }
22022207
2208+static void gswip_shutdown(struct platform_device *pdev)
2209+{
2210+ struct gswip_priv *priv = platform_get_drvdata(pdev);
2211+
2212+ if (!priv)
2213+ return;
2214+
2215+ dsa_switch_shutdown(priv->ds);
2216+
2217+ platform_set_drvdata(pdev, NULL);
2218+}
2219+
22032220 static const struct gswip_hw_info gswip_xrx200 = {
22042221 .max_ports = 7,
22052222 .cpu_port = 6,
@@ -2223,6 +2240,7 @@ MODULE_DEVICE_TABLE(of, gswip_of_match); · 17 unmodified lines
22232240 static struct platform_driver gswip_driver = {
22242241 .probe = gswip_probe,
22252242 .remove = gswip_remove,
2243+ .shutdown = gswip_shutdown,
22262244 .driver = {
22272245 .name = "gswip",
22282246 .of_match_table = gswip_of_match,
drivers/net/dsa/microchip/ksz8795_spi.c+10−1
@@ -94,6 +94,8 @@ static int ksz8795_spi_remove(struct spi_device *spi) · 93 unmodified lines
9494 if (dev)
9595 ksz_switch_remove(dev);
9696
97+ spi_set_drvdata(spi, NULL);
98+
9799 return 0;
98100 }
99101
@@ -101,8 +103,15 @@ static void ksz8795_spi_shutdown(struct spi_device *spi) · 1 unmodified line
101103 {
102104 struct ksz_device *dev = spi_get_drvdata(spi);
103105
104− if (dev && dev->dev_ops->shutdown)
106+ if (!dev)
107+ return;
108+
109+ if (dev->dev_ops->shutdown)
105110 dev->dev_ops->shutdown(dev);
111+
112+ dsa_switch_shutdown(dev->ds);
113+
114+ spi_set_drvdata(spi, NULL);
106115 }
107116
108117 static const struct of_device_id ksz8795_dt_ids[] = {
drivers/net/dsa/microchip/ksz8863_smi.c+13−0
@@ -191,6 +191,18 @@ static void ksz8863_smi_remove(struct mdio_device *mdiodev) · 190 unmodified lines
191191
192192 if (dev)
193193 ksz_switch_remove(dev);
194+
195+ dev_set_drvdata(&mdiodev->dev, NULL);
196+}
197+
198+static void ksz8863_smi_shutdown(struct mdio_device *mdiodev)
199+{
200+ struct ksz_device *dev = dev_get_drvdata(&mdiodev->dev);
201+
202+ if (dev)
203+ dsa_switch_shutdown(dev->ds);
204+
205+ dev_set_drvdata(&mdiodev->dev, NULL);
194206 }
195207
196208 static const struct of_device_id ksz8863_dt_ids[] = {
@@ -203,6 +215,7 @@ MODULE_DEVICE_TABLE(of, ksz8863_dt_ids); · 6 unmodified lines
203215 static struct mdio_driver ksz8863_driver = {
204216 .probe = ksz8863_smi_probe,
205217 .remove = ksz8863_smi_remove,
218+ .shutdown = ksz8863_smi_shutdown,
206219 .mdiodrv.driver = {
207220 .name = "ksz8863-switch",
208221 .of_match_table = ksz8863_dt_ids,
drivers/net/dsa/microchip/ksz9477_i2c.c+12−2
@@ -56,7 +56,10 @@ static int ksz9477_i2c_remove(struct i2c_client *i2c) · 55 unmodified lines
5656 {
5757 struct ksz_device *dev = i2c_get_clientdata(i2c);
5858
59− ksz_switch_remove(dev);
59+ if (dev)
60+ ksz_switch_remove(dev);
61+
62+ i2c_set_clientdata(i2c, NULL);
6063
6164 return 0;
6265 }
@@ -65,8 +68,15 @@ static void ksz9477_i2c_shutdown(struct i2c_client *i2c) · 2 unmodified lines
6568 {
6669 struct ksz_device *dev = i2c_get_clientdata(i2c);
6770
68− if (dev && dev->dev_ops->shutdown)
71+ if (!dev)
72+ return;
73+
74+ if (dev->dev_ops->shutdown)
6975 dev->dev_ops->shutdown(dev);
76+
77+ dsa_switch_shutdown(dev->ds);
78+
79+ i2c_set_clientdata(i2c, NULL);
7080 }
7181
7282 static const struct i2c_device_id ksz9477_i2c_id[] = {
drivers/net/dsa/microchip/ksz9477_spi.c+6−2
@@ -72,6 +72,8 @@ static int ksz9477_spi_remove(struct spi_device *spi) · 71 unmodified lines
7272 if (dev)
7373 ksz_switch_remove(dev);
7474
75+ spi_set_drvdata(spi, NULL);
76+
7577 return 0;
7678 }
7779
@@ -79,8 +81,10 @@ static void ksz9477_spi_shutdown(struct spi_device *spi) · 1 unmodified line
7981 {
8082 struct ksz_device *dev = spi_get_drvdata(spi);
8183
82− if (dev && dev->dev_ops->shutdown)
83− dev->dev_ops->shutdown(dev);
84+ if (dev)
85+ dsa_switch_shutdown(dev->ds);
86+
87+ spi_set_drvdata(spi, NULL);
8488 }
8589
8690 static const struct of_device_id ksz9477_dt_ids[] = {
drivers/net/dsa/mt7530.c+18−0
@@ -3286,6 +3286,9 @@ mt7530_remove(struct mdio_device *mdiodev) · 3285 unmodified lines
32863286 struct mt7530_priv *priv = dev_get_drvdata(&mdiodev->dev);
32873287 int ret = 0;
32883288
3289+ if (!priv)
3290+ return;
3291+
32893292 ret = regulator_disable(priv->core_pwr);
32903293 if (ret < 0)
32913294 dev_err(priv->dev,
@@ -3301,11 +3304,26 @@ mt7530_remove(struct mdio_device *mdiodev) · 9 unmodified lines
33013304
33023305 dsa_unregister_switch(priv->ds);
33033306 mutex_destroy(&priv->reg_mutex);
3307+
3308+ dev_set_drvdata(&mdiodev->dev, NULL);
3309+}
3310+
3311+static void mt7530_shutdown(struct mdio_device *mdiodev)
3312+{
3313+ struct mt7530_priv *priv = dev_get_drvdata(&mdiodev->dev);
3314+
3315+ if (!priv)
3316+ return;
3317+
3318+ dsa_switch_shutdown(priv->ds);
3319+
3320+ dev_set_drvdata(&mdiodev->dev, NULL);
33043321 }
33053322
33063323 static struct mdio_driver mt7530_mdio_driver = {
33073324 .probe = mt7530_probe,
33083325 .remove = mt7530_remove,
3326+ .shutdown = mt7530_shutdown,
33093327 .mdiodrv.driver = {
33103328 .name = "mt7530",
33113329 .of_match_table = mt7530_of_match,
drivers/net/dsa/mv88e6060.c+18−0
@@ -290,7 +290,24 @@ static void mv88e6060_remove(struct mdio_device *mdiodev) · 289 unmodified lines
290290 {
291291 struct dsa_switch *ds = dev_get_drvdata(&mdiodev->dev);
292292
293+ if (!ds)
294+ return;
295+
293296 dsa_unregister_switch(ds);
297+
298+ dev_set_drvdata(&mdiodev->dev, NULL);
299+}
300+
301+static void mv88e6060_shutdown(struct mdio_device *mdiodev)
302+{
303+ struct dsa_switch *ds = dev_get_drvdata(&mdiodev->dev);
304+
305+ if (!ds)
306+ return;
307+
308+ dsa_switch_shutdown(ds);
309+
310+ dev_set_drvdata(&mdiodev->dev, NULL);
294311 }
295312
296313 static const struct of_device_id mv88e6060_of_match[] = {
@@ -303,6 +320,7 @@ static const struct of_device_id mv88e6060_of_match[] = { · 6 unmodified lines
303320 static struct mdio_driver mv88e6060_driver = {
304321 .probe = mv88e6060_probe,
305322 .remove = mv88e6060_remove,
323+ .shutdown = mv88e6060_shutdown,
306324 .mdiodrv.driver = {
307325 .name = "mv88e6060",
308326 .of_match_table = mv88e6060_of_match,
drivers/net/dsa/mv88e6xxx/chip.c+35−3
@@ -3071,7 +3071,7 @@ static void mv88e6xxx_teardown(struct dsa_switch *ds) · 3070 unmodified lines
30713071 {
30723072 mv88e6xxx_teardown_devlink_params(ds);
30733073 dsa_devlink_resources_unregister(ds);
3074− mv88e6xxx_teardown_devlink_regions(ds);
3074+ mv88e6xxx_teardown_devlink_regions_global(ds);
30753075 }
30763076
30773077 static int mv88e6xxx_setup(struct dsa_switch *ds)
@@ -3215,7 +3215,7 @@ unlock: · 137 unmodified lines
32153215 if (err)
32163216 goto out_resources;
32173217
3218− err = mv88e6xxx_setup_devlink_regions(ds);
3218+ err = mv88e6xxx_setup_devlink_regions_global(ds);
32193219 if (err)
32203220 goto out_params;
32213221
@@ -3229,6 +3229,16 @@ out_resources: · 7 unmodified lines
32293229 return err;
32303230 }
32313231
3232+static int mv88e6xxx_port_setup(struct dsa_switch *ds, int port)
3233+{
3234+ return mv88e6xxx_setup_devlink_regions_port(ds, port);
3235+}
3236+
3237+static void mv88e6xxx_port_teardown(struct dsa_switch *ds, int port)
3238+{
3239+ mv88e6xxx_teardown_devlink_regions_port(ds, port);
3240+}
3241+
32323242 /* prod_id for switch families which do not have a PHY model number */
32333243 static const u16 family_prod_id_table[] = {
32343244 [MV88E6XXX_FAMILY_6341] = MV88E6XXX_PORT_SWITCH_ID_PROD_6341,
@@ -6116,6 +6126,8 @@ static const struct dsa_switch_ops mv88e6xxx_switch_ops = { · 2881 unmodified lines
61166126 .change_tag_protocol = mv88e6xxx_change_tag_protocol,
61176127 .setup = mv88e6xxx_setup,
61186128 .teardown = mv88e6xxx_teardown,
6129+ .port_setup = mv88e6xxx_port_setup,
6130+ .port_teardown = mv88e6xxx_port_teardown,
61196131 .phylink_validate = mv88e6xxx_validate,
61206132 .phylink_mac_link_state = mv88e6xxx_serdes_pcs_get_state,
61216133 .phylink_mac_config = mv88e6xxx_mac_config,
@@ -6389,7 +6401,12 @@ out: · 267 unmodified lines
63896401 static void mv88e6xxx_remove(struct mdio_device *mdiodev)
63906402 {
63916403 struct dsa_switch *ds = dev_get_drvdata(&mdiodev->dev);
6392− struct mv88e6xxx_chip *chip = ds->priv;
6404+ struct mv88e6xxx_chip *chip;
6405+
6406+ if (!ds)
6407+ return;
6408+
6409+ chip = ds->priv;
63936410
63946411 if (chip->info->ptp_support) {
63956412 mv88e6xxx_hwtstamp_free(chip);
@@ -6410,6 +6427,20 @@ static void mv88e6xxx_remove(struct mdio_device *mdiodev) · 14 unmodified lines
64106427 mv88e6xxx_g1_irq_free(chip);
64116428 else
64126429 mv88e6xxx_irq_poll_free(chip);
6430+
6431+ dev_set_drvdata(&mdiodev->dev, NULL);
6432+}
6433+
6434+static void mv88e6xxx_shutdown(struct mdio_device *mdiodev)
6435+{
6436+ struct dsa_switch *ds = dev_get_drvdata(&mdiodev->dev);
6437+
6438+ if (!ds)
6439+ return;
6440+
6441+ dsa_switch_shutdown(ds);
6442+
6443+ dev_set_drvdata(&mdiodev->dev, NULL);
64136444 }
64146445
64156446 static const struct of_device_id mv88e6xxx_of_match[] = {
@@ -6433,6 +6464,7 @@ MODULE_DEVICE_TABLE(of, mv88e6xxx_of_match); · 17 unmodified lines
64336464 static struct mdio_driver mv88e6xxx_driver = {
64346465 .probe = mv88e6xxx_probe,
64356466 .remove = mv88e6xxx_remove,
6467+ .shutdown = mv88e6xxx_shutdown,
64366468 .mdiodrv.driver = {
64376469 .name = "mv88e6085",
64386470 .of_match_table = mv88e6xxx_of_match,
drivers/net/dsa/mv88e6xxx/devlink.c+9−64
@@ -647,26 +647,25 @@ static struct mv88e6xxx_region mv88e6xxx_regions[] = { · 646 unmodified lines
647647 },
648648 };
649649
650−static void
651−mv88e6xxx_teardown_devlink_regions_global(struct mv88e6xxx_chip *chip)
650+void mv88e6xxx_teardown_devlink_regions_global(struct dsa_switch *ds)
652651 {
652+ struct mv88e6xxx_chip *chip = ds->priv;
653653 int i;
654654
655655 for (i = 0; i < ARRAY_SIZE(mv88e6xxx_regions); i++)
656656 dsa_devlink_region_destroy(chip->regions[i]);
657657 }
658658
659−static void
660−mv88e6xxx_teardown_devlink_regions_port(struct mv88e6xxx_chip *chip,
661− int port)
659+void mv88e6xxx_teardown_devlink_regions_port(struct dsa_switch *ds, int port)
662660 {
661+ struct mv88e6xxx_chip *chip = ds->priv;
662+
663663 dsa_devlink_region_destroy(chip->ports[port].region);
664664 }
665665
666−static int mv88e6xxx_setup_devlink_regions_port(struct dsa_switch *ds,
667− struct mv88e6xxx_chip *chip,
668− int port)
666+int mv88e6xxx_setup_devlink_regions_port(struct dsa_switch *ds, int port)
669667 {
668+ struct mv88e6xxx_chip *chip = ds->priv;
670669 struct devlink_region *region;
671670
672671 region = dsa_devlink_port_region_create(ds,
@@ -681,40 +680,10 @@ static int mv88e6xxx_setup_devlink_regions_port(struct dsa_switch *ds, · 8 unmodified lines
681680 return 0;
682681 }
683682
684−static void
685−mv88e6xxx_teardown_devlink_regions_ports(struct mv88e6xxx_chip *chip)
686−{
687− int port;
688−
689− for (port = 0; port < mv88e6xxx_num_ports(chip); port++)
690− mv88e6xxx_teardown_devlink_regions_port(chip, port);
691−}
692−
693−static int mv88e6xxx_setup_devlink_regions_ports(struct dsa_switch *ds,
694− struct mv88e6xxx_chip *chip)
695−{
696− int port;
697− int err;
698−
699− for (port = 0; port < mv88e6xxx_num_ports(chip); port++) {
700− err = mv88e6xxx_setup_devlink_regions_port(ds, chip, port);
701− if (err)
702− goto out;
703− }
704−
705− return 0;
706−
707−out:
708− while (port-- > 0)
709− mv88e6xxx_teardown_devlink_regions_port(chip, port);
710−
711− return err;
712−}
713−
714−static int mv88e6xxx_setup_devlink_regions_global(struct dsa_switch *ds,
715− struct mv88e6xxx_chip *chip)
683+int mv88e6xxx_setup_devlink_regions_global(struct dsa_switch *ds)
716684 {
717685 bool (*cond)(struct mv88e6xxx_chip *chip);
686+ struct mv88e6xxx_chip *chip = ds->priv;
718687 struct devlink_region_ops *ops;
719688 struct devlink_region *region;
720689 u64 size;
@@ -753,30 +722,6 @@ out: · 32 unmodified lines
753722 return PTR_ERR(region);
754723 }
755724
756−int mv88e6xxx_setup_devlink_regions(struct dsa_switch *ds)
757−{
758− struct mv88e6xxx_chip *chip = ds->priv;
759− int err;
760−
761− err = mv88e6xxx_setup_devlink_regions_global(ds, chip);
762− if (err)
763− return err;
764−
765− err = mv88e6xxx_setup_devlink_regions_ports(ds, chip);
766− if (err)
767− mv88e6xxx_teardown_devlink_regions_global(chip);
768−
769− return err;
770−}
771−
772−void mv88e6xxx_teardown_devlink_regions(struct dsa_switch *ds)
773−{
774− struct mv88e6xxx_chip *chip = ds->priv;
775−
776− mv88e6xxx_teardown_devlink_regions_ports(chip);
777− mv88e6xxx_teardown_devlink_regions_global(chip);
778−}
779−
780725 int mv88e6xxx_devlink_info_get(struct dsa_switch *ds,
781726 struct devlink_info_req *req,
782727 struct netlink_ext_ack *extack)
drivers/net/dsa/mv88e6xxx/devlink.h+4−2
@@ -12,8 +12,10 @@ int mv88e6xxx_devlink_param_get(struct dsa_switch *ds, u32 id, · 11 unmodified lines
1212 struct devlink_param_gset_ctx *ctx);
1313 int mv88e6xxx_devlink_param_set(struct dsa_switch *ds, u32 id,
1414 struct devlink_param_gset_ctx *ctx);
15−int mv88e6xxx_setup_devlink_regions(struct dsa_switch *ds);
16−void mv88e6xxx_teardown_devlink_regions(struct dsa_switch *ds);
15+int mv88e6xxx_setup_devlink_regions_global(struct dsa_switch *ds);
16+void mv88e6xxx_teardown_devlink_regions_global(struct dsa_switch *ds);
17+int mv88e6xxx_setup_devlink_regions_port(struct dsa_switch *ds, int port);
18+void mv88e6xxx_teardown_devlink_regions_port(struct dsa_switch *ds, int port);
1719
1820 int mv88e6xxx_devlink_info_get(struct dsa_switch *ds,
1921 struct devlink_info_req *req,
drivers/net/dsa/ocelot/felix.c+1−1
@@ -1,5 +1,5 @@
11 // SPDX-License-Identifier: GPL-2.0
2−/* Copyright 2019-2021 NXP Semiconductors
2+/* Copyright 2019-2021 NXP
33 *
44 * This is an umbrella module for all network switches that are
55 * register-compatible with Ocelot and that perform I/O to their host CPU
drivers/net/dsa/ocelot/felix.h+1−1
@@ -1,5 +1,5 @@
11 /* SPDX-License-Identifier: GPL-2.0 */
2−/* Copyright 2019 NXP Semiconductors
2+/* Copyright 2019 NXP
33 */
44 #ifndef _MSCC_FELIX_H
55 #define _MSCC_FELIX_H
drivers/net/dsa/ocelot/felix_vsc9959.c+19−3
@@ -1,6 +1,6 @@
11 // SPDX-License-Identifier: (GPL-2.0 OR MIT)
22 /* Copyright 2017 Microsemi Corporation
3− * Copyright 2018-2019 NXP Semiconductors
3+ * Copyright 2018-2019 NXP
44 */
55 #include <linux/fsl/enetc_mdio.h>
66 #include <soc/mscc/ocelot_qsys.h>
@@ -1472,9 +1472,10 @@ err_pci_enable: · 1465 unmodified lines
14721472
14731473 static void felix_pci_remove(struct pci_dev *pdev)
14741474 {
1475− struct felix *felix;
1475+ struct felix *felix = pci_get_drvdata(pdev);
14761476
1477− felix = pci_get_drvdata(pdev);
1477+ if (!felix)
1478+ return;
14781479
14791480 dsa_unregister_switch(felix->ds);
14801481
@@ -1482,6 +1483,20 @@ static void felix_pci_remove(struct pci_dev *pdev) · 1 unmodified line
14821483 kfree(felix);
14831484
14841485 pci_disable_device(pdev);
1486+
1487+ pci_set_drvdata(pdev, NULL);
1488+}
1489+
1490+static void felix_pci_shutdown(struct pci_dev *pdev)
1491+{
1492+ struct felix *felix = pci_get_drvdata(pdev);
1493+
1494+ if (!felix)
1495+ return;
1496+
1497+ dsa_switch_shutdown(felix->ds);
1498+
1499+ pci_set_drvdata(pdev, NULL);
14851500 }
14861501
14871502 static struct pci_device_id felix_ids[] = {
@@ -1498,6 +1513,7 @@ static struct pci_driver felix_vsc9959_pci_driver = { · 10 unmodified lines
14981513 .id_table = felix_ids,
14991514 .probe = felix_pci_probe,
15001515 .remove = felix_pci_remove,
1516+ .shutdown = felix_pci_shutdown,
15011517 };
15021518 module_pci_driver(felix_vsc9959_pci_driver);
15031519
drivers/net/dsa/ocelot/seville_vsc9953.c+18−2
@@ -1245,18 +1245,33 @@ err_alloc_felix: · 1244 unmodified lines
12451245
12461246 static int seville_remove(struct platform_device *pdev)
12471247 {
1248− struct felix *felix;
1248+ struct felix *felix = platform_get_drvdata(pdev);
12491249
1250− felix = platform_get_drvdata(pdev);
1250+ if (!felix)
1251+ return 0;
12511252
12521253 dsa_unregister_switch(felix->ds);
12531254
12541255 kfree(felix->ds);
12551256 kfree(felix);
12561257
1258+ platform_set_drvdata(pdev, NULL);
1259+
12571260 return 0;
12581261 }
12591262
1263+static void seville_shutdown(struct platform_device *pdev)
1264+{
1265+ struct felix *felix = platform_get_drvdata(pdev);
1266+
1267+ if (!felix)
1268+ return;
1269+
1270+ dsa_switch_shutdown(felix->ds);
1271+
1272+ platform_set_drvdata(pdev, NULL);
1273+}
1274+
12601275 static const struct of_device_id seville_of_match[] = {
12611276 { .compatible = "mscc,vsc9953-switch" },
12621277 { },
@@ -1266,6 +1281,7 @@ MODULE_DEVICE_TABLE(of, seville_of_match); · 3 unmodified lines
12661281 static struct platform_driver seville_vsc9953_driver = {
12671282 .probe = seville_probe,
12681283 .remove = seville_remove,
1284+ .shutdown = seville_shutdown,
12691285 .driver = {
12701286 .name = "mscc_seville",
12711287 .of_match_table = of_match_ptr(seville_of_match),
drivers/net/dsa/qca/ar9331.c+18−0
@@ -1083,6 +1083,9 @@ static void ar9331_sw_remove(struct mdio_device *mdiodev) · 1082 unmodified lines
10831083 struct ar9331_sw_priv *priv = dev_get_drvdata(&mdiodev->dev);
10841084 unsigned int i;
10851085
1086+ if (!priv)
1087+ return;
1088+
10861089 for (i = 0; i < ARRAY_SIZE(priv->port); i++) {
10871090 struct ar9331_sw_port *port = &priv->port[i];
10881091
@@ -1094,6 +1097,20 @@ static void ar9331_sw_remove(struct mdio_device *mdiodev) · 5 unmodified lines
10941097 dsa_unregister_switch(&priv->ds);
10951098
10961099 reset_control_assert(priv->sw_reset);
1100+
1101+ dev_set_drvdata(&mdiodev->dev, NULL);
1102+}
1103+
1104+static void ar9331_sw_shutdown(struct mdio_device *mdiodev)
1105+{
1106+ struct ar9331_sw_priv *priv = dev_get_drvdata(&mdiodev->dev);
1107+
1108+ if (!priv)
1109+ return;
1110+
1111+ dsa_switch_shutdown(&priv->ds);
1112+
1113+ dev_set_drvdata(&mdiodev->dev, NULL);
10971114 }
10981115
10991116 static const struct of_device_id ar9331_sw_of_match[] = {
@@ -1104,6 +1121,7 @@ static const struct of_device_id ar9331_sw_of_match[] = { · 4 unmodified lines
11041121 static struct mdio_driver ar9331_sw_mdio_driver = {
11051122 .probe = ar9331_sw_probe,
11061123 .remove = ar9331_sw_remove,
1124+ .shutdown = ar9331_sw_shutdown,
11071125 .mdiodrv.driver = {
11081126 .name = AR9331_SW_NAME,
11091127 .of_match_table = ar9331_sw_of_match,
drivers/net/dsa/qca8k.c+18−0
@@ -1880,10 +1880,27 @@ qca8k_sw_remove(struct mdio_device *mdiodev) · 1879 unmodified lines
18801880 struct qca8k_priv *priv = dev_get_drvdata(&mdiodev->dev);
18811881 int i;
18821882
1883+ if (!priv)
1884+ return;
1885+
18831886 for (i = 0; i < QCA8K_NUM_PORTS; i++)
18841887 qca8k_port_set_status(priv, i, 0);
18851888
18861889 dsa_unregister_switch(priv->ds);
1890+
1891+ dev_set_drvdata(&mdiodev->dev, NULL);
1892+}
1893+
1894+static void qca8k_sw_shutdown(struct mdio_device *mdiodev)
1895+{
1896+ struct qca8k_priv *priv = dev_get_drvdata(&mdiodev->dev);
1897+
1898+ if (!priv)
1899+ return;
1900+
1901+ dsa_switch_shutdown(priv->ds);
1902+
1903+ dev_set_drvdata(&mdiodev->dev, NULL);
18871904 }
18881905
18891906 #ifdef CONFIG_PM_SLEEP
@@ -1940,6 +1957,7 @@ static const struct of_device_id qca8k_of_match[] = { · 50 unmodified lines
19401957 static struct mdio_driver qca8kmdio_driver = {
19411958 .probe = qca8k_sw_probe,
19421959 .remove = qca8k_sw_remove,
1960+ .shutdown = qca8k_sw_shutdown,
19431961 .mdiodrv.driver = {
19441962 .name = "qca8k",
19451963 .of_match_table = qca8k_of_match,
drivers/net/dsa/realtek-smi-core.c+20−2
@@ -368,7 +368,7 @@ int realtek_smi_setup_mdio(struct realtek_smi *smi) · 367 unmodified lines
368368 smi->slave_mii_bus->parent = smi->dev;
369369 smi->ds->slave_mii_bus = smi->slave_mii_bus;
370370
371− ret = of_mdiobus_register(smi->slave_mii_bus, mdio_np);
371+ ret = devm_of_mdiobus_register(smi->dev, smi->slave_mii_bus, mdio_np);
372372 if (ret) {
373373 dev_err(smi->dev, "unable to register MDIO bus %s\n",
374374 smi->slave_mii_bus->id);
@@ -464,16 +464,33 @@ static int realtek_smi_probe(struct platform_device *pdev) · 89 unmodified lines
464464
465465 static int realtek_smi_remove(struct platform_device *pdev)
466466 {
467− struct realtek_smi *smi = dev_get_drvdata(&pdev->dev);
467+ struct realtek_smi *smi = platform_get_drvdata(pdev);
468+
469+ if (!smi)
470+ return 0;
468471
469472 dsa_unregister_switch(smi->ds);
470473 if (smi->slave_mii_bus)
471474 of_node_put(smi->slave_mii_bus->dev.of_node);
472475 gpiod_set_value(smi->reset, 1);
473476
477+ platform_set_drvdata(pdev, NULL);
478+
474479 return 0;
475480 }
476481
482+static void realtek_smi_shutdown(struct platform_device *pdev)
483+{
484+ struct realtek_smi *smi = platform_get_drvdata(pdev);
485+
486+ if (!smi)
487+ return;
488+
489+ dsa_switch_shutdown(smi->ds);
490+
491+ platform_set_drvdata(pdev, NULL);
492+}
493+
477494 static const struct of_device_id realtek_smi_of_match[] = {
478495 {
479496 .compatible = "realtek,rtl8366rb",
@@ -495,6 +512,7 @@ static struct platform_driver realtek_smi_driver = { · 15 unmodified lines
495512 },
496513 .probe = realtek_smi_probe,
497514 .remove = realtek_smi_remove,
515+ .shutdown = realtek_smi_shutdown,
498516 };
499517 module_platform_driver(realtek_smi_driver);
500518
drivers/net/dsa/sja1105/sja1105_clocking.c+1−1
@@ -1,5 +1,5 @@
11 // SPDX-License-Identifier: BSD-3-Clause
2−/* Copyright (c) 2016-2018, NXP Semiconductors
2+/* Copyright 2016-2018 NXP
33 * Copyright (c) 2018-2019, Vladimir Oltean <olteanv@gmail.com>
44 */
55 #include <linux/packing.h>
drivers/net/dsa/sja1105/sja1105_devlink.c+1−1
@@ -1,6 +1,6 @@
11 // SPDX-License-Identifier: GPL-2.0
22 /* Copyright (c) 2018-2019, Vladimir Oltean <olteanv@gmail.com>
3− * Copyright 2020 NXP Semiconductors
3+ * Copyright 2020 NXP
44 */
55 #include "sja1105.h"
66
drivers/net/dsa/sja1105/sja1105_flower.c+1−1
@@ -1,5 +1,5 @@
11 // SPDX-License-Identifier: GPL-2.0
2−/* Copyright 2020, NXP Semiconductors
2+/* Copyright 2020 NXP
33 */
44 #include "sja1105.h"
55 #include "sja1105_vl.h"
drivers/net/dsa/sja1105/sja1105_main.c+19−2
@@ -3335,13 +3335,29 @@ static int sja1105_probe(struct spi_device *spi) · 3334 unmodified lines
33353335 static int sja1105_remove(struct spi_device *spi)
33363336 {
33373337 struct sja1105_private *priv = spi_get_drvdata(spi);
3338− struct dsa_switch *ds = priv->ds;
33393338
3340− dsa_unregister_switch(ds);
3339+ if (!priv)
3340+ return 0;
3341+
3342+ dsa_unregister_switch(priv->ds);
3343+
3344+ spi_set_drvdata(spi, NULL);
33413345
33423346 return 0;
33433347 }
33443348
3349+static void sja1105_shutdown(struct spi_device *spi)
3350+{
3351+ struct sja1105_private *priv = spi_get_drvdata(spi);
3352+
3353+ if (!priv)
3354+ return;
3355+
3356+ dsa_switch_shutdown(priv->ds);
3357+
3358+ spi_set_drvdata(spi, NULL);
3359+}
3360+
33453361 static const struct of_device_id sja1105_dt_ids[] = {
33463362 { .compatible = "nxp,sja1105e", .data = &sja1105e_info },
33473363 { .compatible = "nxp,sja1105t", .data = &sja1105t_info },
@@ -3365,6 +3381,7 @@ static struct spi_driver sja1105_driver = { · 17 unmodified lines
33653381 },
33663382 .probe = sja1105_probe,
33673383 .remove = sja1105_remove,
3384+ .shutdown = sja1105_shutdown,
33683385 };
33693386
33703387 module_spi_driver(sja1105_driver);
drivers/net/dsa/sja1105/sja1105_mdio.c+1−1
@@ -1,5 +1,5 @@
11 // SPDX-License-Identifier: GPL-2.0
2−/* Copyright 2021, NXP Semiconductors
2+/* Copyright 2021 NXP
33 */
44 #include <linux/pcs/pcs-xpcs.h>
55 #include <linux/of_mdio.h>
drivers/net/dsa/sja1105/sja1105_spi.c+1−1
@@ -1,5 +1,5 @@
11 // SPDX-License-Identifier: BSD-3-Clause
2−/* Copyright (c) 2016-2018, NXP Semiconductors
2+/* Copyright 2016-2018 NXP
33 * Copyright (c) 2018, Sensor-Technik Wiedemann GmbH
44 * Copyright (c) 2018-2019, Vladimir Oltean <olteanv@gmail.com>
55 */
drivers/net/dsa/sja1105/sja1105_static_config.c+1−1
@@ -1,5 +1,5 @@
11 // SPDX-License-Identifier: BSD-3-Clause
2−/* Copyright (c) 2016-2018, NXP Semiconductors
2+/* Copyright 2016-2018 NXP
33 * Copyright (c) 2018-2019, Vladimir Oltean <olteanv@gmail.com>
44 */
55 #include "sja1105_static_config.h"
drivers/net/dsa/sja1105/sja1105_static_config.h+1−1
@@ -1,5 +1,5 @@
11 /* SPDX-License-Identifier: BSD-3-Clause */
2−/* Copyright (c) 2016-2018, NXP Semiconductors
2+/* Copyright 2016-2018 NXP
33 * Copyright (c) 2018-2019, Vladimir Oltean <olteanv@gmail.com>
44 */
55 #ifndef _SJA1105_STATIC_CONFIG_H
drivers/net/dsa/sja1105/sja1105_vl.c+1−1
@@ -1,5 +1,5 @@
11 // SPDX-License-Identifier: GPL-2.0
2−/* Copyright 2020, NXP Semiconductors
2+/* Copyright 2020 NXP
33 */
44 #include <net/tc_act/tc_gate.h>
55 #include <linux/dsa/8021q.h>
drivers/net/dsa/sja1105/sja1105_vl.h+1−1
@@ -1,5 +1,5 @@
11 /* SPDX-License-Identifier: GPL-2.0 */
2−/* Copyright 2020, NXP Semiconductors
2+/* Copyright 2020 NXP
33 */
44 #ifndef _SJA1105_VL_H
55 #define _SJA1105_VL_H
drivers/net/dsa/vitesse-vsc73xx-core.c+6−0
@@ -1225,6 +1225,12 @@ int vsc73xx_remove(struct vsc73xx *vsc) · 1224 unmodified lines
12251225 }
12261226 EXPORT_SYMBOL(vsc73xx_remove);
12271227
1228+void vsc73xx_shutdown(struct vsc73xx *vsc)
1229+{
1230+ dsa_switch_shutdown(vsc->ds);
1231+}
1232+EXPORT_SYMBOL(vsc73xx_shutdown);
1233+
12281234 MODULE_AUTHOR("Linus Walleij <linus.walleij@linaro.org>");
12291235 MODULE_DESCRIPTION("Vitesse VSC7385/7388/7395/7398 driver");
12301236 MODULE_LICENSE("GPL v2");
drivers/net/dsa/vitesse-vsc73xx-platform.c+21−1
@@ -116,7 +116,26 @@ static int vsc73xx_platform_remove(struct platform_device *pdev) · 115 unmodified lines
116116 {
117117 struct vsc73xx_platform *vsc_platform = platform_get_drvdata(pdev);
118118
119− return vsc73xx_remove(&vsc_platform->vsc);
119+ if (!vsc_platform)
120+ return 0;
121+
122+ vsc73xx_remove(&vsc_platform->vsc);
123+
124+ platform_set_drvdata(pdev, NULL);
125+
126+ return 0;
127+}
128+
129+static void vsc73xx_platform_shutdown(struct platform_device *pdev)
130+{
131+ struct vsc73xx_platform *vsc_platform = platform_get_drvdata(pdev);
132+
133+ if (!vsc_platform)
134+ return;
135+
136+ vsc73xx_shutdown(&vsc_platform->vsc);
137+
138+ platform_set_drvdata(pdev, NULL);
120139 }
121140
122141 static const struct vsc73xx_ops vsc73xx_platform_ops = {
@@ -144,6 +163,7 @@ MODULE_DEVICE_TABLE(of, vsc73xx_of_match); · 21 unmodified lines
144163 static struct platform_driver vsc73xx_platform_driver = {
145164 .probe = vsc73xx_platform_probe,
146165 .remove = vsc73xx_platform_remove,
166+ .shutdown = vsc73xx_platform_shutdown,
147167 .driver = {
148168 .name = "vsc73xx-platform",
149169 .of_match_table = vsc73xx_of_match,
drivers/net/dsa/vitesse-vsc73xx-spi.c+21−1
@@ -163,7 +163,26 @@ static int vsc73xx_spi_remove(struct spi_device *spi) · 162 unmodified lines
163163 {
164164 struct vsc73xx_spi *vsc_spi = spi_get_drvdata(spi);
165165
166− return vsc73xx_remove(&vsc_spi->vsc);
166+ if (!vsc_spi)
167+ return 0;
168+
169+ vsc73xx_remove(&vsc_spi->vsc);
170+
171+ spi_set_drvdata(spi, NULL);
172+
173+ return 0;
174+}
175+
176+static void vsc73xx_spi_shutdown(struct spi_device *spi)
177+{
178+ struct vsc73xx_spi *vsc_spi = spi_get_drvdata(spi);
179+
180+ if (!vsc_spi)
181+ return;
182+
183+ vsc73xx_shutdown(&vsc_spi->vsc);
184+
185+ spi_set_drvdata(spi, NULL);
167186 }
168187
169188 static const struct vsc73xx_ops vsc73xx_spi_ops = {
@@ -191,6 +210,7 @@ MODULE_DEVICE_TABLE(of, vsc73xx_of_match); · 21 unmodified lines
191210 static struct spi_driver vsc73xx_spi_driver = {
192211 .probe = vsc73xx_spi_probe,
193212 .remove = vsc73xx_spi_remove,
213+ .shutdown = vsc73xx_spi_shutdown,
194214 .driver = {
195215 .name = "vsc73xx-spi",
196216 .of_match_table = vsc73xx_of_match,
drivers/net/dsa/vitesse-vsc73xx.h+1−0
@@ -27,3 +27,4 @@ struct vsc73xx_ops { · 26 unmodified lines
2727 int vsc73xx_is_addr_valid(u8 block, u8 subblock);
2828 int vsc73xx_probe(struct vsc73xx *vsc);
2929 int vsc73xx_remove(struct vsc73xx *vsc);
30+void vsc73xx_shutdown(struct vsc73xx *vsc);
drivers/net/dsa/xrs700x/xrs700x.c+6−0
@@ -822,6 +822,12 @@ void xrs700x_switch_remove(struct xrs700x *priv) · 821 unmodified lines
822822 }
823823 EXPORT_SYMBOL(xrs700x_switch_remove);
824824
825+void xrs700x_switch_shutdown(struct xrs700x *priv)
826+{
827+ dsa_switch_shutdown(priv->ds);
828+}
829+EXPORT_SYMBOL(xrs700x_switch_shutdown);
830+
825831 MODULE_AUTHOR("George McCollister <george.mccollister@gmail.com>");
826832 MODULE_DESCRIPTION("Arrow SpeedChips XRS700x DSA driver");
827833 MODULE_LICENSE("GPL v2");
drivers/net/dsa/xrs700x/xrs700x.h+1−0
@@ -40,3 +40,4 @@ struct xrs700x { · 39 unmodified lines
4040 struct xrs700x *xrs700x_switch_alloc(struct device *base, void *devpriv);
4141 int xrs700x_switch_register(struct xrs700x *priv);
4242 void xrs700x_switch_remove(struct xrs700x *priv);
43+void xrs700x_switch_shutdown(struct xrs700x *priv);
drivers/net/dsa/xrs700x/xrs700x_i2c.c+18−0
@@ -109,11 +109,28 @@ static int xrs700x_i2c_remove(struct i2c_client *i2c) · 108 unmodified lines
109109 {
110110 struct xrs700x *priv = i2c_get_clientdata(i2c);
111111
112+ if (!priv)
113+ return 0;
114+
112115 xrs700x_switch_remove(priv);
113116
117+ i2c_set_clientdata(i2c, NULL);
118+
114119 return 0;
115120 }
116121
122+static void xrs700x_i2c_shutdown(struct i2c_client *i2c)
123+{
124+ struct xrs700x *priv = i2c_get_clientdata(i2c);
125+
126+ if (!priv)
127+ return;
128+
129+ xrs700x_switch_shutdown(priv);
130+
131+ i2c_set_clientdata(i2c, NULL);
132+}
133+
117134 static const struct i2c_device_id xrs700x_i2c_id[] = {
118135 { "xrs700x-switch", 0 },
119136 {},
@@ -137,6 +154,7 @@ static struct i2c_driver xrs700x_i2c_driver = { · 17 unmodified lines
137154 },
138155 .probe = xrs700x_i2c_probe,
139156 .remove = xrs700x_i2c_remove,
157+ .shutdown = xrs700x_i2c_shutdown,
140158 .id_table = xrs700x_i2c_id,
141159 };
142160
drivers/net/dsa/xrs700x/xrs700x_mdio.c+18−0
@@ -136,7 +136,24 @@ static void xrs700x_mdio_remove(struct mdio_device *mdiodev) · 135 unmodified lines
136136 {
137137 struct xrs700x *priv = dev_get_drvdata(&mdiodev->dev);
138138
139+ if (!priv)
140+ return;
141+
139142 xrs700x_switch_remove(priv);
143+
144+ dev_set_drvdata(&mdiodev->dev, NULL);
145+}
146+
147+static void xrs700x_mdio_shutdown(struct mdio_device *mdiodev)
148+{
149+ struct xrs700x *priv = dev_get_drvdata(&mdiodev->dev);
150+
151+ if (!priv)
152+ return;
153+
154+ xrs700x_switch_shutdown(priv);
155+
156+ dev_set_drvdata(&mdiodev->dev, NULL);
140157 }
141158
142159 static const struct of_device_id __maybe_unused xrs700x_mdio_dt_ids[] = {
@@ -155,6 +172,7 @@ static struct mdio_driver xrs700x_mdio_driver = { · 12 unmodified lines
155172 },
156173 .probe = xrs700x_mdio_probe,
157174 .remove = xrs700x_mdio_remove,
175+ .shutdown = xrs700x_mdio_shutdown,
158176 };
159177
160178 mdio_module_driver(xrs700x_mdio_driver);
drivers/net/ethernet/aquantia/atlantic/aq_pci_func.c+2−2
@@ -413,13 +413,13 @@ static int atl_resume_common(struct device *dev, bool deep) · 412 unmodified lines
413413 if (deep) {
414414 /* Reinitialize Nic/Vecs objects */
415415 aq_nic_deinit(nic, !nic->aq_hw->aq_nic_cfg->wol);
416+ }
416417
418+ if (netif_running(nic->ndev)) {
417419 ret = aq_nic_init(nic);
418420 if (ret)
419421 goto err_exit;
420− }
421422
422− if (netif_running(nic->ndev)) {
423423 ret = aq_nic_start(nic);
424424 if (ret)
425425 goto err_exit;
drivers/net/ethernet/broadcom/bgmac-bcma.c+2−0
@@ -129,6 +129,8 @@ static int bgmac_probe(struct bcma_device *core) · 128 unmodified lines
129129 bcma_set_drvdata(core, bgmac);
130130
131131 err = of_get_mac_address(bgmac->dev->of_node, bgmac->net_dev->dev_addr);
132+ if (err == -EPROBE_DEFER)
133+ return err;
132134
133135 /* If no MAC address assigned via device tree, check SPROM */
134136 if (err) {
drivers/net/ethernet/broadcom/bnxt/bnxt.c+4−4
@@ -391,7 +391,7 @@ static bool bnxt_txr_netif_try_stop_queue(struct bnxt *bp, · 390 unmodified lines
391391 * netif_tx_queue_stopped().
392392 */
393393 smp_mb();
394− if (bnxt_tx_avail(bp, txr) > bp->tx_wake_thresh) {
394+ if (bnxt_tx_avail(bp, txr) >= bp->tx_wake_thresh) {
395395 netif_tx_wake_queue(txq);
396396 return false;
397397 }
@@ -764,7 +764,7 @@ next_tx_int: · 366 unmodified lines
764764 smp_mb();
765765
766766 if (unlikely(netif_tx_queue_stopped(txq)) &&
767− bnxt_tx_avail(bp, txr) > bp->tx_wake_thresh &&
767+ bnxt_tx_avail(bp, txr) >= bp->tx_wake_thresh &&
768768 READ_ONCE(txr->dev_state) != BNXT_DEV_STATE_CLOSING)
769769 netif_tx_wake_queue(txq);
770770 }
@@ -2416,7 +2416,7 @@ static int __bnxt_poll_work(struct bnxt *bp, struct bnxt_cp_ring_info *cpr, · 1645 unmodified lines
24162416 if (TX_CMP_TYPE(txcmp) == CMP_TYPE_TX_L2_CMP) {
24172417 tx_pkts++;
24182418 /* return full budget so NAPI will complete. */
2419− if (unlikely(tx_pkts > bp->tx_wake_thresh)) {
2419+ if (unlikely(tx_pkts >= bp->tx_wake_thresh)) {
24202420 rx_pkts = budget;
24212421 raw_cons = NEXT_RAW_CMP(raw_cons);
24222422 if (budget)
@@ -3640,7 +3640,7 @@ static int bnxt_init_tx_rings(struct bnxt *bp) · 1217 unmodified lines
36403640 u16 i;
36413641
36423642 bp->tx_wake_thresh = max_t(int, bp->tx_ring_size / 2,
3643− MAX_SKB_FRAGS + 1);
3643+ BNXT_MIN_TX_DESC_CNT);
36443644
36453645 for (i = 0; i < bp->tx_nr_rings; i++) {
36463646 struct bnxt_tx_ring_info *txr = &bp->tx_ring[i];
drivers/net/ethernet/broadcom/bnxt/bnxt.h+5−0
@@ -629,6 +629,11 @@ struct nqe_cn { · 628 unmodified lines
629629 #define BNXT_MAX_RX_JUM_DESC_CNT (RX_DESC_CNT * MAX_RX_AGG_PAGES - 1)
630630 #define BNXT_MAX_TX_DESC_CNT (TX_DESC_CNT * MAX_TX_PAGES - 1)
631631
632+/* Minimum TX BDs for a TX packet with MAX_SKB_FRAGS + 1. We need one extra
633+ * BD because the first TX BD is always a long BD.
634+ */
635+#define BNXT_MIN_TX_DESC_CNT (MAX_SKB_FRAGS + 2)
636+
632637 #define RX_RING(x) (((x) & ~(RX_DESC_CNT - 1)) >> (BNXT_PAGE_SHIFT - 4))
633638 #define RX_IDX(x) ((x) & (RX_DESC_CNT - 1))
634639
drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c+1−1
@@ -798,7 +798,7 @@ static int bnxt_set_ringparam(struct net_device *dev, · 797 unmodified lines
798798
799799 if ((ering->rx_pending > BNXT_MAX_RX_DESC_CNT) ||
800800 (ering->tx_pending > BNXT_MAX_TX_DESC_CNT) ||
801− (ering->tx_pending <= MAX_SKB_FRAGS))
801+ (ering->tx_pending < BNXT_MIN_TX_DESC_CNT))
802802 return -EINVAL;
803803
804804 if (netif_running(dev))
drivers/net/ethernet/freescale/enetc/enetc.c+2−5
@@ -419,7 +419,7 @@ static void enetc_rx_dim_work(struct work_struct *w) · 418 unmodified lines
419419
420420 static void enetc_rx_net_dim(struct enetc_int_vector *v)
421421 {
422− struct dim_sample dim_sample;
422+ struct dim_sample dim_sample = {};
423423
424424 v->comp_cnt++;
425425
@@ -1879,7 +1879,6 @@ static void enetc_clear_bdrs(struct enetc_ndev_priv *priv) · 1453 unmodified lines
18791879 static int enetc_setup_irqs(struct enetc_ndev_priv *priv)
18801880 {
18811881 struct pci_dev *pdev = priv->si->pdev;
1882− cpumask_t cpu_mask;
18831882 int i, j, err;
18841883
18851884 for (i = 0; i < priv->bdr_int_num; i++) {
@@ -1908,9 +1907,7 @@ static int enetc_setup_irqs(struct enetc_ndev_priv *priv) · 22 unmodified lines
19081907
19091908 enetc_wr(hw, ENETC_SIMSITRV(idx), entry);
19101909 }
1911− cpumask_clear(&cpu_mask);
1912− cpumask_set_cpu(i % num_online_cpus(), &cpu_mask);
1913− irq_set_affinity_hint(irq, &cpu_mask);
1910+ irq_set_affinity_hint(irq, get_cpu_mask(i % num_online_cpus()));
19141911 }
19151912
19161913 return 0;
drivers/net/ethernet/freescale/enetc/enetc_ierb.c+1−1
@@ -1,5 +1,5 @@
11 // SPDX-License-Identifier: (GPL-2.0+ OR BSD-3-Clause)
2−/* Copyright 2021 NXP Semiconductors
2+/* Copyright 2021 NXP
33 *
44 * The Integrated Endpoint Register Block (IERB) is configured by pre-boot
55 * software and is supposed to be to ENETC what a NVRAM is to a 'real' PCIe
drivers/net/ethernet/freescale/enetc/enetc_ierb.h+1−1
@@ -1,5 +1,5 @@
11 /* SPDX-License-Identifier: (GPL-2.0+ OR BSD-3-Clause) */
2−/* Copyright 2021 NXP Semiconductors */
2+/* Copyright 2021 NXP */
33
44 #include <linux/pci.h>
55 #include <linux/platform_device.h>
drivers/net/ethernet/freescale/fec_main.c+0−1
@@ -4176,5 +4176,4 @@ static struct platform_driver fec_driver = { · 4175 unmodified lines
41764176
41774177 module_platform_driver(fec_driver);
41784178
4179−MODULE_ALIAS("platform:"DRIVER_NAME);
41804179 MODULE_LICENSE("GPL");
drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_err.c+4−4
@@ -2445,12 +2445,12 @@ static void hclge_handle_over_8bd_err(struct hclge_dev *hdev, · 2444 unmodified lines
24452445 return;
24462446 }
24472447
2448− dev_err(dev, "PPU_PF_ABNORMAL_INT_ST over_8bd_no_fe found, vf_id(%u), queue_id(%u)\n",
2448+ dev_err(dev, "PPU_PF_ABNORMAL_INT_ST over_8bd_no_fe found, vport(%u), queue_id(%u)\n",
24492449 vf_id, q_id);
24502450
24512451 if (vf_id) {
24522452 if (vf_id >= hdev->num_alloc_vport) {
2453− dev_err(dev, "invalid vf id(%u)\n", vf_id);
2453+ dev_err(dev, "invalid vport(%u)\n", vf_id);
24542454 return;
24552455 }
24562456
@@ -2463,8 +2463,8 @@ static void hclge_handle_over_8bd_err(struct hclge_dev *hdev, · 6 unmodified lines
24632463
24642464 ret = hclge_inform_reset_assert_to_vf(&hdev->vport[vf_id]);
24652465 if (ret)
2466− dev_err(dev, "inform reset to vf(%u) failed %d!\n",
2467− hdev->vport->vport_id, ret);
2466+ dev_err(dev, "inform reset to vport(%u) failed %d!\n",
2467+ vf_id, ret);
24682468 } else {
24692469 set_bit(HNAE3_FUNC_RESET, reset_requests);
24702470 }
drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c+55−25
@@ -3661,7 +3661,8 @@ static int hclge_set_all_vf_rst(struct hclge_dev *hdev, bool reset) · 3660 unmodified lines
36613661 if (ret) {
36623662 dev_err(&hdev->pdev->dev,
36633663 "set vf(%u) rst failed %d!\n",
3664− vport->vport_id, ret);
3664+ vport->vport_id - HCLGE_VF_VPORT_START_NUM,
3665+ ret);
36653666 return ret;
36663667 }
36673668
@@ -3676,7 +3677,8 @@ static int hclge_set_all_vf_rst(struct hclge_dev *hdev, bool reset) · 8 unmodified lines
36763677 if (ret)
36773678 dev_warn(&hdev->pdev->dev,
36783679 "inform reset to vf(%u) failed %d!\n",
3679− vport->vport_id, ret);
3680+ vport->vport_id - HCLGE_VF_VPORT_START_NUM,
3681+ ret);
36803682 }
36813683
36823684 return 0;
@@ -4741,6 +4743,24 @@ static int hclge_get_rss(struct hnae3_handle *handle, u32 *indir, · 1058 unmodified lines
47414743 return 0;
47424744 }
47434745
4746+static int hclge_parse_rss_hfunc(struct hclge_vport *vport, const u8 hfunc,
4747+ u8 *hash_algo)
4748+{
4749+ switch (hfunc) {
4750+ case ETH_RSS_HASH_TOP:
4751+ *hash_algo = HCLGE_RSS_HASH_ALGO_TOEPLITZ;
4752+ return 0;
4753+ case ETH_RSS_HASH_XOR:
4754+ *hash_algo = HCLGE_RSS_HASH_ALGO_SIMPLE;
4755+ return 0;
4756+ case ETH_RSS_HASH_NO_CHANGE:
4757+ *hash_algo = vport->rss_algo;
4758+ return 0;
4759+ default:
4760+ return -EINVAL;
4761+ }
4762+}
4763+
47444764 static int hclge_set_rss(struct hnae3_handle *handle, const u32 *indir,
47454765 const u8 *key, const u8 hfunc)
47464766 {
@@ -4750,30 +4770,27 @@ static int hclge_set_rss(struct hnae3_handle *handle, const u32 *indir, · 3 unmodified lines
47504770 u8 hash_algo;
47514771 int ret, i;
47524772
4773+ ret = hclge_parse_rss_hfunc(vport, hfunc, &hash_algo);
4774+ if (ret) {
4775+ dev_err(&hdev->pdev->dev, "invalid hfunc type %u\n", hfunc);
4776+ return ret;
4777+ }
4778+
47534779 /* Set the RSS Hash Key if specififed by the user */
47544780 if (key) {
4755− switch (hfunc) {
4756− case ETH_RSS_HASH_TOP:
4757− hash_algo = HCLGE_RSS_HASH_ALGO_TOEPLITZ;
4758− break;
4759− case ETH_RSS_HASH_XOR:
4760− hash_algo = HCLGE_RSS_HASH_ALGO_SIMPLE;
4761− break;
4762− case ETH_RSS_HASH_NO_CHANGE:
4763− hash_algo = vport->rss_algo;
4764− break;
4765− default:
4766− return -EINVAL;
4767− }
4768−
47694781 ret = hclge_set_rss_algo_key(hdev, hash_algo, key);
47704782 if (ret)
47714783 return ret;
47724784
47734785 /* Update the shadow RSS key with user specified qids */
47744786 memcpy(vport->rss_hash_key, key, HCLGE_RSS_KEY_SIZE);
4775− vport->rss_algo = hash_algo;
4787+ } else {
4788+ ret = hclge_set_rss_algo_key(hdev, hash_algo,
4789+ vport->rss_hash_key);
4790+ if (ret)
4791+ return ret;
47764792 }
4793+ vport->rss_algo = hash_algo;
47774794
47784795 /* Update the shadow RSS table with user specified qids */
47794796 for (i = 0; i < ae_dev->dev_specs.rss_ind_tbl_size; i++)
@@ -6627,10 +6644,13 @@ static int hclge_fd_parse_ring_cookie(struct hclge_dev *hdev, u64 ring_cookie, · 1847 unmodified lines
66276644 u8 vf = ethtool_get_flow_spec_ring_vf(ring_cookie);
66286645 u16 tqps;
66296646
6647+ /* To keep consistent with user's configuration, minus 1 when
6648+ * printing 'vf', because vf id from ethtool is added 1 for vf.
6649+ */
66306650 if (vf > hdev->num_req_vfs) {
66316651 dev_err(&hdev->pdev->dev,
6632− "Error: vf id (%u) > max vf num (%u)\n",
6633− vf, hdev->num_req_vfs);
6652+ "Error: vf id (%u) should be less than %u\n",
6653+ vf - 1, hdev->num_req_vfs);
66346654 return -EINVAL;
66356655 }
66366656
@@ -9797,6 +9817,9 @@ static int hclge_set_vlan_filter_hw(struct hclge_dev *hdev, __be16 proto, · 3160 unmodified lines
97979817 if (is_kill && !vlan_id)
97989818 return 0;
97999819
9820+ if (vlan_id >= VLAN_N_VID)
9821+ return -EINVAL;
9822+
98009823 ret = hclge_set_vf_vlan_common(hdev, vport_id, is_kill, vlan_id);
98019824 if (ret) {
98029825 dev_err(&hdev->pdev->dev,
@@ -10703,7 +10726,8 @@ static int hclge_reset_tqp_cmd_send(struct hclge_dev *hdev, u16 queue_id, · 900 unmodified lines
1070310726 return 0;
1070410727 }
1070510728
10706−static int hclge_get_reset_status(struct hclge_dev *hdev, u16 queue_id)
10729+static int hclge_get_reset_status(struct hclge_dev *hdev, u16 queue_id,
10730+ u8 *reset_status)
1070710731 {
1070810732 struct hclge_reset_tqp_queue_cmd *req;
1070910733 struct hclge_desc desc;
@@ -10721,7 +10745,9 @@ static int hclge_get_reset_status(struct hclge_dev *hdev, u16 queue_id) · 11 unmodified lines
1072110745 return ret;
1072210746 }
1072310747
10724− return hnae3_get_bit(req->ready_to_reset, HCLGE_TQP_RESET_B);
10748+ *reset_status = hnae3_get_bit(req->ready_to_reset, HCLGE_TQP_RESET_B);
10749+
10750+ return 0;
1072510751 }
1072610752
1072710753 u16 hclge_covert_handle_qid_global(struct hnae3_handle *handle, u16 queue_id)
@@ -10740,7 +10766,7 @@ static int hclge_reset_tqp_cmd(struct hnae3_handle *handle) · 12 unmodified lines
1074010766 struct hclge_vport *vport = hclge_get_vport(handle);
1074110767 struct hclge_dev *hdev = vport->back;
1074210768 u16 reset_try_times = 0;
10743− int reset_status;
10769+ u8 reset_status;
1074410770 u16 queue_gid;
1074510771 int ret;
1074610772 u16 i;
@@ -10756,7 +10782,11 @@ static int hclge_reset_tqp_cmd(struct hnae3_handle *handle) · 9 unmodified lines
1075610782 }
1075710783
1075810784 while (reset_try_times++ < HCLGE_TQP_RESET_TRY_TIMES) {
10759− reset_status = hclge_get_reset_status(hdev, queue_gid);
10785+ ret = hclge_get_reset_status(hdev, queue_gid,
10786+ &reset_status);
10787+ if (ret)
10788+ return ret;
10789+
1076010790 if (reset_status)
1076110791 break;
1076210792
@@ -11449,11 +11479,11 @@ static void hclge_clear_resetting_state(struct hclge_dev *hdev) · 686 unmodified lines
1144911479 struct hclge_vport *vport = &hdev->vport[i];
1145011480 int ret;
1145111481
11452− /* Send cmd to clear VF's FUNC_RST_ING */
11482+ /* Send cmd to clear vport's FUNC_RST_ING */
1145311483 ret = hclge_set_vf_rst(hdev, vport->vport_id, false);
1145411484 if (ret)
1145511485 dev_warn(&hdev->pdev->dev,
11456− "clear vf(%u) rst failed %d!\n",
11486+ "clear vport(%u) rst failed %d!\n",
1145711487 vport->vport_id, ret);
1145811488 }
1145911489 }
drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_mbx.c+9−1
@@ -566,7 +566,7 @@ static int hclge_reset_vf(struct hclge_vport *vport) · 565 unmodified lines
566566 struct hclge_dev *hdev = vport->back;
567567
568568 dev_warn(&hdev->pdev->dev, "PF received VF reset request from VF %u!",
569− vport->vport_id);
569+ vport->vport_id - HCLGE_VF_VPORT_START_NUM);
570570
571571 return hclge_func_reset_cmd(hdev, vport->vport_id);
572572 }
@@ -590,9 +590,17 @@ static void hclge_get_queue_id_in_pf(struct hclge_vport *vport, · 17 unmodified lines
590590 struct hclge_mbx_vf_to_pf_cmd *mbx_req,
591591 struct hclge_respond_to_vf_msg *resp_msg)
592592 {
593+ struct hnae3_handle *handle = &vport->nic;
594+ struct hclge_dev *hdev = vport->back;
593595 u16 queue_id, qid_in_pf;
594596
595597 memcpy(&queue_id, mbx_req->msg.data, sizeof(queue_id));
598+ if (queue_id >= handle->kinfo.num_tqps) {
599+ dev_err(&hdev->pdev->dev, "Invalid queue id(%u) from VF %u\n",
600+ queue_id, mbx_req->mbx_src_vfid);
601+ return;
602+ }
603+
596604 qid_in_pf = hclge_covert_handle_qid_global(&vport->nic, queue_id);
597605 memcpy(resp_msg->data, &qid_in_pf, sizeof(qid_in_pf));
598606 resp_msg->len = sizeof(qid_in_pf);
drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_tm.c+1−1
@@ -581,7 +581,7 @@ int hclge_tm_qs_shaper_cfg(struct hclge_vport *vport, int max_tx_rate) · 580 unmodified lines
581581 ret = hclge_cmd_send(&hdev->hw, &desc, 1);
582582 if (ret) {
583583 dev_err(&hdev->pdev->dev,
584− "vf%u, qs%u failed to set tx_rate:%d, ret=%d\n",
584+ "vport%u, qs%u failed to set tx_rate:%d, ret=%d\n",
585585 vport->vport_id, shap_cfg_cmd->qs_id,
586586 max_tx_rate, ret);
587587 return ret;
drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.c+34−18
@@ -816,40 +816,56 @@ static int hclgevf_get_rss(struct hnae3_handle *handle, u32 *indir, u8 *key, · 815 unmodified lines
816816 return 0;
817817 }
818818
819+static int hclgevf_parse_rss_hfunc(struct hclgevf_dev *hdev, const u8 hfunc,
820+ u8 *hash_algo)
821+{
822+ switch (hfunc) {
823+ case ETH_RSS_HASH_TOP:
824+ *hash_algo = HCLGEVF_RSS_HASH_ALGO_TOEPLITZ;
825+ return 0;
826+ case ETH_RSS_HASH_XOR:
827+ *hash_algo = HCLGEVF_RSS_HASH_ALGO_SIMPLE;
828+ return 0;
829+ case ETH_RSS_HASH_NO_CHANGE:
830+ *hash_algo = hdev->rss_cfg.hash_algo;
831+ return 0;
832+ default:
833+ return -EINVAL;
834+ }
835+}
836+
819837 static int hclgevf_set_rss(struct hnae3_handle *handle, const u32 *indir,
820838 const u8 *key, const u8 hfunc)
821839 {
822840 struct hclgevf_dev *hdev = hclgevf_ae_get_hdev(handle);
823841 struct hclgevf_rss_cfg *rss_cfg = &hdev->rss_cfg;
842+ u8 hash_algo;
824843 int ret, i;
825844
826845 if (hdev->ae_dev->dev_version >= HNAE3_DEVICE_VERSION_V2) {
846+ ret = hclgevf_parse_rss_hfunc(hdev, hfunc, &hash_algo);
847+ if (ret)
848+ return ret;
849+
827850 /* Set the RSS Hash Key if specififed by the user */
828851 if (key) {
829− switch (hfunc) {
830− case ETH_RSS_HASH_TOP:
831− rss_cfg->hash_algo =
832− HCLGEVF_RSS_HASH_ALGO_TOEPLITZ;
833− break;
834− case ETH_RSS_HASH_XOR:
835− rss_cfg->hash_algo =
836− HCLGEVF_RSS_HASH_ALGO_SIMPLE;
837− break;
838− case ETH_RSS_HASH_NO_CHANGE:
839− break;
840− default:
841− return -EINVAL;
842− }
843−
844− ret = hclgevf_set_rss_algo_key(hdev, rss_cfg->hash_algo,
845− key);
846− if (ret)
852+ ret = hclgevf_set_rss_algo_key(hdev, hash_algo, key);
853+ if (ret) {
854+ dev_err(&hdev->pdev->dev,
855+ "invalid hfunc type %u\n", hfunc);
847856 return ret;
857+ }
848858
849859 /* Update the shadow RSS key with user specified qids */
850860 memcpy(rss_cfg->rss_hash_key, key,
851861 HCLGEVF_RSS_KEY_SIZE);
862+ } else {
863+ ret = hclgevf_set_rss_algo_key(hdev, hash_algo,
864+ rss_cfg->rss_hash_key);
865+ if (ret)
866+ return ret;
852867 }
868+ rss_cfg->hash_algo = hash_algo;
853869 }
854870
855871 /* update the shadow RSS table with user specified qids */
drivers/net/ethernet/intel/Kconfig+1−0
@@ -335,6 +335,7 @@ config IGC · 334 unmodified lines
335335 tristate "Intel(R) Ethernet Controller I225-LM/I225-V support"
336336 default n
337337 depends on PCI
338+ depends on PTP_1588_CLOCK_OPTIONAL
338339 help
339340 This driver supports Intel(R) Ethernet Controller I225-LM/I225-V
340341 family of adapters.
drivers/net/ethernet/mediatek/mtk_ppe_offload.c+3−0
@@ -186,6 +186,9 @@ mtk_flow_offload_replace(struct mtk_eth *eth, struct flow_cls_offload *f) · 185 unmodified lines
186186 int hash;
187187 int i;
188188
189+ if (rhashtable_lookup(&eth->flow_table, &f->cookie, mtk_flow_ht_params))
190+ return -EEXIST;
191+
189192 if (flow_rule_match_key(rule, FLOW_DISSECTOR_KEY_META)) {
190193 struct flow_match_meta match;
191194
drivers/net/ethernet/mellanox/mlx4/en_netdev.c+32−18
@@ -372,6 +372,9 @@ mlx4_en_filter_rfs(struct net_device *net_dev, const struct sk_buff *skb, · 371 unmodified lines
372372 int nhoff = skb_network_offset(skb);
373373 int ret = 0;
374374
375+ if (skb->encapsulation)
376+ return -EPROTONOSUPPORT;
377+
375378 if (skb->protocol != htons(ETH_P_IP))
376379 return -EPROTONOSUPPORT;
377380
@@ -1269,7 +1272,6 @@ static void mlx4_en_do_set_rx_mode(struct work_struct *work) · 891 unmodified lines
12691272 if (!netif_carrier_ok(dev)) {
12701273 if (!mlx4_en_QUERY_PORT(mdev, priv->port)) {
12711274 if (priv->port_state.link_state) {
1272− priv->last_link_state = MLX4_DEV_EVENT_PORT_UP;
12731275 netif_carrier_on(dev);
12741276 en_dbg(LINK, priv, "Link Up\n");
12751277 }
@@ -1557,26 +1559,36 @@ static void mlx4_en_service_task(struct work_struct *work) · 281 unmodified lines
15571559 mutex_unlock(&mdev->state_lock);
15581560 }
15591561
1560−static void mlx4_en_linkstate(struct work_struct *work)
1562+static void mlx4_en_linkstate(struct mlx4_en_priv *priv)
1563+{
1564+ struct mlx4_en_port_state *port_state = &priv->port_state;
1565+ struct mlx4_en_dev *mdev = priv->mdev;
1566+ struct net_device *dev = priv->dev;
1567+ bool up;
1568+
1569+ if (mlx4_en_QUERY_PORT(mdev, priv->port))
1570+ port_state->link_state = MLX4_PORT_STATE_DEV_EVENT_PORT_DOWN;
1571+
1572+ up = port_state->link_state == MLX4_PORT_STATE_DEV_EVENT_PORT_UP;
1573+ if (up == netif_carrier_ok(dev))
1574+ netif_carrier_event(dev);
1575+ if (!up) {
1576+ en_info(priv, "Link Down\n");
1577+ netif_carrier_off(dev);
1578+ } else {
1579+ en_info(priv, "Link Up\n");
1580+ netif_carrier_on(dev);
1581+ }
1582+}
1583+
1584+static void mlx4_en_linkstate_work(struct work_struct *work)
15611585 {
15621586 struct mlx4_en_priv *priv = container_of(work, struct mlx4_en_priv,
15631587 linkstate_task);
15641588 struct mlx4_en_dev *mdev = priv->mdev;
1565− int linkstate = priv->link_state;
15661589
15671590 mutex_lock(&mdev->state_lock);
1568− /* If observable port state changed set carrier state and
1569− * report to system log */
1570− if (priv->last_link_state != linkstate) {
1571− if (linkstate == MLX4_DEV_EVENT_PORT_DOWN) {
1572− en_info(priv, "Link Down\n");
1573− netif_carrier_off(priv->dev);
1574− } else {
1575− en_info(priv, "Link Up\n");
1576− netif_carrier_on(priv->dev);
1577− }
1578− }
1579− priv->last_link_state = linkstate;
1591+ mlx4_en_linkstate(priv);
15801592 mutex_unlock(&mdev->state_lock);
15811593 }
15821594
@@ -2079,9 +2091,11 @@ static int mlx4_en_open(struct net_device *dev) · 496 unmodified lines
20792091 mlx4_en_clear_stats(dev);
20802092
20812093 err = mlx4_en_start_port(dev);
2082− if (err)
2094+ if (err) {
20832095 en_err(priv, "Failed starting port:%d\n", priv->port);
2084−
2096+ goto out;
2097+ }
2098+ mlx4_en_linkstate(priv);
20852099 out:
20862100 mutex_unlock(&mdev->state_lock);
20872101 return err;
@@ -3168,7 +3182,7 @@ int mlx4_en_init_netdev(struct mlx4_en_dev *mdev, int port, · 1080 unmodified lines
31683182 spin_lock_init(&priv->stats_lock);
31693183 INIT_WORK(&priv->rx_mode_task, mlx4_en_do_set_rx_mode);
31703184 INIT_WORK(&priv->restart_task, mlx4_en_restart);
3171− INIT_WORK(&priv->linkstate_task, mlx4_en_linkstate);
3185+ INIT_WORK(&priv->linkstate_task, mlx4_en_linkstate_work);
31723186 INIT_DELAYED_WORK(&priv->stats_task, mlx4_en_do_get_stats);
31733187 INIT_DELAYED_WORK(&priv->service_task, mlx4_en_service_task);
31743188 #ifdef CONFIG_RFS_ACCEL
drivers/net/ethernet/mellanox/mlx4/mlx4_en.h+0−1
@@ -552,7 +552,6 @@ struct mlx4_en_priv { · 551 unmodified lines
552552
553553 struct mlx4_hwq_resources res;
554554 int link_state;
555− int last_link_state;
556555 bool port_up;
557556 int port;
558557 int registered;
drivers/net/ethernet/mscc/ocelot.c+8−13
@@ -563,16 +563,6 @@ void ocelot_phylink_mac_link_up(struct ocelot *ocelot, int port, · 562 unmodified lines
563563 ocelot_port_writel(ocelot_port, DEV_MAC_ENA_CFG_RX_ENA |
564564 DEV_MAC_ENA_CFG_TX_ENA, DEV_MAC_ENA_CFG);
565565
566− /* Take MAC, Port, Phy (intern) and PCS (SGMII/Serdes) clock out of
567− * reset
568− */
569− ocelot_port_writel(ocelot_port, DEV_CLOCK_CFG_LINK_SPEED(speed),
570− DEV_CLOCK_CFG);
571−
572− /* No PFC */
573− ocelot_write_gix(ocelot, ANA_PFC_PFC_CFG_FC_LINK_SPEED(speed),
574− ANA_PFC_PFC_CFG, port);
575−
576566 /* Core: Enable port for frame transfer */
577567 ocelot_fields_write(ocelot, port,
578568 QSYS_SWITCH_PORT_MODE_PORT_ENA, 1);
@@ -1303,14 +1293,19 @@ static u32 ocelot_get_bond_mask(struct ocelot *ocelot, struct net_device *bond, · 724 unmodified lines
13031293 return mask;
13041294 }
13051295
1306−static u32 ocelot_get_bridge_fwd_mask(struct ocelot *ocelot,
1296+static u32 ocelot_get_bridge_fwd_mask(struct ocelot *ocelot, int src_port,
13071297 struct net_device *bridge)
13081298 {
1299+ struct ocelot_port *ocelot_port = ocelot->ports[src_port];
13091300 u32 mask = 0;
13101301 int port;
13111302
1303+ if (!ocelot_port || ocelot_port->bridge != bridge ||
1304+ ocelot_port->stp_state != BR_STATE_FORWARDING)
1305+ return 0;
1306+
13121307 for (port = 0; port < ocelot->num_phys_ports; port++) {
1313− struct ocelot_port *ocelot_port = ocelot->ports[port];
1308+ ocelot_port = ocelot->ports[port];
13141309
13151310 if (!ocelot_port)
13161311 continue;
@@ -1376,7 +1371,7 @@ void ocelot_apply_bridge_fwd_mask(struct ocelot *ocelot) · 59 unmodified lines
13761371 struct net_device *bridge = ocelot_port->bridge;
13771372 struct net_device *bond = ocelot_port->bond;
13781373
1379− mask = ocelot_get_bridge_fwd_mask(ocelot, bridge);
1374+ mask = ocelot_get_bridge_fwd_mask(ocelot, port, bridge);
13801375 mask |= cpu_fwd_mask;
13811376 mask &= ~BIT(port);
13821377 if (bond) {
drivers/net/ethernet/mscc/ocelot_devlink.c+1−1
@@ -1,5 +1,5 @@
11 // SPDX-License-Identifier: (GPL-2.0 OR MIT)
2−/* Copyright 2020-2021 NXP Semiconductors
2+/* Copyright 2020-2021 NXP
33 */
44 #include <net/devlink.h>
55 #include "ocelot.h"
drivers/net/ethernet/mscc/ocelot_mrp.c+1−1
@@ -2,7 +2,7 @@ · 1 unmodified line
22 /* Microsemi Ocelot Switch driver
33 *
44 * Copyright (c) 2017, 2019 Microsemi Corporation
5− * Copyright 2020-2021 NXP Semiconductors
5+ * Copyright 2020-2021 NXP
66 */
77
88 #include <linux/if_bridge.h>
drivers/net/ethernet/mscc/ocelot_net.c+1−1
@@ -5,7 +5,7 @@ · 4 unmodified lines
55 * mscc_ocelot_switch_lib.
66 *
77 * Copyright (c) 2017, 2019 Microsemi Corporation
8− * Copyright 2020-2021 NXP Semiconductors
8+ * Copyright 2020-2021 NXP
99 */
1010
1111 #include <linux/if_bridge.h>
drivers/net/ethernet/qlogic/qed/qed_iwarp.c+8−0
@@ -1297,6 +1297,14 @@ qed_iwarp_wait_cid_map_cleared(struct qed_hwfn *p_hwfn, struct qed_bmap *bmap) · 1296 unmodified lines
12971297 prev_weight = weight;
12981298
12991299 while (weight) {
1300+ /* If the HW device is during recovery, all resources are
1301+ * immediately reset without receiving a per-cid indication
1302+ * from HW. In this case we don't expect the cid_map to be
1303+ * cleared.
1304+ */
1305+ if (p_hwfn->cdev->recov_in_prog)
1306+ return 0;
1307+
13001308 msleep(QED_IWARP_MAX_CID_CLEAN_TIME);
13011309
13021310 weight = bitmap_weight(bmap->bitmap, bmap->max_count);
drivers/net/ethernet/qlogic/qed/qed_roce.c+8−0
@@ -77,6 +77,14 @@ void qed_roce_stop(struct qed_hwfn *p_hwfn) · 76 unmodified lines
7777 * Beyond the added delay we clear the bitmap anyway.
7878 */
7979 while (bitmap_weight(rcid_map->bitmap, rcid_map->max_count)) {
80+ /* If the HW device is during recovery, all resources are
81+ * immediately reset without receiving a per-cid indication
82+ * from HW. In this case we don't expect the cid bitmap to be
83+ * cleared.
84+ */
85+ if (p_hwfn->cdev->recov_in_prog)
86+ return;
87+
8088 msleep(100);
8189 if (wait_count++ > 20) {
8290 DP_NOTICE(p_hwfn, "cid bitmap wait timed out\n");
drivers/net/pcs/pcs-xpcs-nxp.c+1−1
@@ -1,5 +1,5 @@
11 // SPDX-License-Identifier: GPL-2.0
2−/* Copyright 2021 NXP Semiconductors
2+/* Copyright 2021 NXP
33 */
44 #include <linux/pcs/pcs-xpcs.h>
55 #include "pcs-xpcs.h"
drivers/net/phy/mdio_device.c+11−0
@@ -179,6 +179,16 @@ static int mdio_remove(struct device *dev) · 178 unmodified lines
179179 return 0;
180180 }
181181
182+static void mdio_shutdown(struct device *dev)
183+{
184+ struct mdio_device *mdiodev = to_mdio_device(dev);
185+ struct device_driver *drv = mdiodev->dev.driver;
186+ struct mdio_driver *mdiodrv = to_mdio_driver(drv);
187+
188+ if (mdiodrv->shutdown)
189+ mdiodrv->shutdown(mdiodev);
190+}
191+
182192 /**
183193 * mdio_driver_register - register an mdio_driver with the MDIO layer
184194 * @drv: new mdio_driver to register
@@ -193,6 +203,7 @@ int mdio_driver_register(struct mdio_driver *drv) · 8 unmodified lines
193203 mdiodrv->driver.bus = &mdio_bus_type;
194204 mdiodrv->driver.probe = mdio_probe;
195205 mdiodrv->driver.remove = mdio_remove;
206+ mdiodrv->driver.shutdown = mdio_shutdown;
196207
197208 retval = driver_register(&mdiodrv->driver);
198209 if (retval) {
drivers/net/usb/hso.c+5−7
@@ -2719,14 +2719,14 @@ struct hso_device *hso_create_mux_serial_device(struct usb_interface *interface, · 2718 unmodified lines
27192719
27202720 serial = kzalloc(sizeof(*serial), GFP_KERNEL);
27212721 if (!serial)
2722− goto exit;
2722+ goto err_free_dev;
27232723
27242724 hso_dev->port_data.dev_serial = serial;
27252725 serial->parent = hso_dev;
27262726
27272727 if (hso_serial_common_create
27282728 (serial, 1, CTRL_URB_RX_SIZE, CTRL_URB_TX_SIZE))
2729− goto exit;
2729+ goto err_free_serial;
27302730
27312731 serial->tx_data_length--;
27322732 serial->write_data = hso_mux_serial_write_data;
@@ -2742,11 +2742,9 @@ struct hso_device *hso_create_mux_serial_device(struct usb_interface *interface, · 9 unmodified lines
27422742 /* done, return it */
27432743 return hso_dev;
27442744
2745−exit:
2746− if (serial) {
2747− tty_unregister_device(tty_drv, serial->minor);
2748− kfree(serial);
2749− }
2745+err_free_serial:
2746+ kfree(serial);
2747+err_free_dev:
27502748 kfree(hso_dev);
27512749 return NULL;
27522750
drivers/net/virtio_net.c+4−0
@@ -423,6 +423,10 @@ static struct sk_buff *page_to_skb(struct virtnet_info *vi, · 422 unmodified lines
423423
424424 skb_reserve(skb, p - buf);
425425 skb_put(skb, len);
426+
427+ page = (struct page *)page->private;
428+ if (page)
429+ give_pages(rq, page);
426430 goto ok;
427431 }
428432
drivers/net/vxlan.c+1−1
@@ -4756,12 +4756,12 @@ static void __net_exit vxlan_exit_batch_net(struct list_head *net_list) · 4755 unmodified lines
47564756 LIST_HEAD(list);
47574757 unsigned int h;
47584758
4759− rtnl_lock();
47604759 list_for_each_entry(net, net_list, exit_list) {
47614760 struct vxlan_net *vn = net_generic(net, vxlan_net_id);
47624761
47634762 unregister_nexthop_notifier(net, &vn->nexthop_notifier_block);
47644763 }
4764+ rtnl_lock();
47654765 list_for_each_entry(net, net_list, exit_list)
47664766 vxlan_destroy_tunnels(net, &list);
47674767
drivers/net/xen-netback/netback.c+1−1
@@ -499,7 +499,7 @@ check_frags: · 498 unmodified lines
499499 * the header's copy failed, and they are
500500 * sharing a slot, send an error
501501 */
502− if (i == 0 && sharedslot)
502+ if (i == 0 && !first_shinfo && sharedslot)
503503 xenvif_idx_release(queue, pending_idx,
504504 XEN_NETIF_RSP_ERROR);
505505 else
drivers/nfc/st-nci/spi.c+1−0
@@ -278,6 +278,7 @@ static int st_nci_spi_remove(struct spi_device *dev) · 277 unmodified lines
278278
279279 static struct spi_device_id st_nci_spi_id_table[] = {
280280 {ST_NCI_SPI_DRIVER_NAME, 0},
281+ {"st21nfcb-spi", 0},
281282 {}
282283 };
283284 MODULE_DEVICE_TABLE(spi, st_nci_spi_id_table);
drivers/ptp/Kconfig+1−0
@@ -174,6 +174,7 @@ config PTP_1588_CLOCK_OCP · 173 unmodified lines
174174 depends on I2C && MTD
175175 depends on SERIAL_8250
176176 depends on !S390
177+ depends on COMMON_CLK
177178 select NET_DEVLINK
178179 help
179180 This driver adds support for an OpenCompute time card.
drivers/s390/cio/ccwgroup.c+8−2
@@ -77,12 +77,13 @@ EXPORT_SYMBOL(ccwgroup_set_online); · 76 unmodified lines
7777 /**
7878 * ccwgroup_set_offline() - disable a ccwgroup device
7979 * @gdev: target ccwgroup device
80+ * @call_gdrv: Call the registered gdrv set_offline function
8081 *
8182 * This function attempts to put the ccwgroup device into the offline state.
8283 * Returns:
8384 * %0 on success and a negative error value on failure.
8485 */
85−int ccwgroup_set_offline(struct ccwgroup_device *gdev)
86+int ccwgroup_set_offline(struct ccwgroup_device *gdev, bool call_gdrv)
8687 {
8788 struct ccwgroup_driver *gdrv = to_ccwgroupdrv(gdev->dev.driver);
8889 int ret = -EINVAL;
@@ -91,11 +92,16 @@ int ccwgroup_set_offline(struct ccwgroup_device *gdev) · 2 unmodified lines
9192 return -EAGAIN;
9293 if (gdev->state == CCWGROUP_OFFLINE)
9394 goto out;
95+ if (!call_gdrv) {
96+ ret = 0;
97+ goto offline;
98+ }
9499 if (gdrv->set_offline)
95100 ret = gdrv->set_offline(gdev);
96101 if (ret)
97102 goto out;
98103
104+offline:
99105 gdev->state = CCWGROUP_OFFLINE;
100106 out:
101107 atomic_set(&gdev->onoff, 0);
@@ -124,7 +130,7 @@ static ssize_t ccwgroup_online_store(struct device *dev, · 22 unmodified lines
124130 if (value == 1)
125131 ret = ccwgroup_set_online(gdev);
126132 else if (value == 0)
127− ret = ccwgroup_set_offline(gdev);
133+ ret = ccwgroup_set_offline(gdev, true);
128134 else
129135 ret = -EINVAL;
130136 out:
drivers/s390/net/qeth_core.h+0−1
@@ -858,7 +858,6 @@ struct qeth_card { · 857 unmodified lines
858858 struct napi_struct napi;
859859 struct qeth_rx rx;
860860 struct delayed_work buffer_reclaim_work;
861− struct work_struct close_dev_work;
862861 };
863862
864863 static inline bool qeth_card_hw_is_reachable(struct qeth_card *card)
drivers/s390/net/qeth_core_main.c+9−13
@@ -70,15 +70,6 @@ static void qeth_issue_next_read_cb(struct qeth_card *card, · 69 unmodified lines
7070 static int qeth_qdio_establish(struct qeth_card *);
7171 static void qeth_free_qdio_queues(struct qeth_card *card);
7272
73−static void qeth_close_dev_handler(struct work_struct *work)
74−{
75− struct qeth_card *card;
76−
77− card = container_of(work, struct qeth_card, close_dev_work);
78− QETH_CARD_TEXT(card, 2, "cldevhdl");
79− ccwgroup_set_offline(card->gdev);
80−}
81−
8273 static const char *qeth_get_cardname(struct qeth_card *card)
8374 {
8475 if (IS_VM_NIC(card)) {
@@ -202,6 +193,9 @@ static void qeth_clear_working_pool_list(struct qeth_card *card) · 117 unmodified lines
202193 &card->qdio.in_buf_pool.entry_list, list)
203194 list_del(&pool_entry->list);
204195
196+ if (!queue)
197+ return;
198+
205199 for (i = 0; i < ARRAY_SIZE(queue->bufs); i++)
206200 queue->bufs[i].pool_entry = NULL;
207201 }
@@ -792,10 +786,12 @@ static struct qeth_ipa_cmd *qeth_check_ipa_data(struct qeth_card *card, · 584 unmodified lines
792786 case IPA_CMD_STOPLAN:
793787 if (cmd->hdr.return_code == IPA_RC_VEPA_TO_VEB_TRANSITION) {
794788 dev_err(&card->gdev->dev,
795− "Interface %s is down because the adjacent port is no longer in reflective relay mode\n",
789+ "Adjacent port of interface %s is no longer in reflective relay mode, trigger recovery\n",
796790 netdev_name(card->dev));
797− schedule_work(&card->close_dev_work);
791+ /* Set offline, then probably fail to set online: */
792+ qeth_schedule_recovery(card);
798793 } else {
794+ /* stay online for subsequent STARTLAN */
799795 dev_warn(&card->gdev->dev,
800796 "The link for interface %s on CHPID 0x%X failed\n",
801797 netdev_name(card->dev), card->info.chpid);
@@ -1537,7 +1533,6 @@ static void qeth_setup_card(struct qeth_card *card) · 735 unmodified lines
15371533 INIT_LIST_HEAD(&card->ipato.entries);
15381534 qeth_init_qdio_info(card);
15391535 INIT_DELAYED_WORK(&card->buffer_reclaim_work, qeth_buffer_reclaim_work);
1540− INIT_WORK(&card->close_dev_work, qeth_close_dev_handler);
15411536 hash_init(card->rx_mode_addrs);
15421537 hash_init(card->local_addrs4);
15431538 hash_init(card->local_addrs6);
@@ -5519,7 +5514,8 @@ static int qeth_do_reset(void *data) · 3975 unmodified lines
55195514 dev_info(&card->gdev->dev,
55205515 "Device successfully recovered!\n");
55215516 } else {
5522− ccwgroup_set_offline(card->gdev);
5517+ qeth_set_offline(card, disc, true);
5518+ ccwgroup_set_offline(card->gdev, false);
55235519 dev_warn(&card->gdev->dev,
55245520 "The qeth device driver failed to recover an error on the device\n");
55255521 }
drivers/s390/net/qeth_l2_main.c+0−1
@@ -2307,7 +2307,6 @@ static void qeth_l2_remove_device(struct ccwgroup_device *gdev) · 2306 unmodified lines
23072307 if (gdev->state == CCWGROUP_ONLINE)
23082308 qeth_set_offline(card, card->discipline, false);
23092309
2310− cancel_work_sync(&card->close_dev_work);
23112310 if (card->dev->reg_state == NETREG_REGISTERED) {
23122311 priv = netdev_priv(card->dev);
23132312 if (priv->brport_features & BR_LEARNING_SYNC) {
drivers/s390/net/qeth_l3_main.c+0−1
@@ -1969,7 +1969,6 @@ static void qeth_l3_remove_device(struct ccwgroup_device *cgdev) · 1968 unmodified lines
19691969 if (cgdev->state == CCWGROUP_ONLINE)
19701970 qeth_set_offline(card, card->discipline, false);
19711971
1972− cancel_work_sync(&card->close_dev_work);
19731972 if (card->dev->reg_state == NETREG_REGISTERED)
19741973 unregister_netdev(card->dev);
19751974
include/linux/dsa/ocelot.h+1−1
@@ -1,5 +1,5 @@
11 /* SPDX-License-Identifier: GPL-2.0
2− * Copyright 2019-2021 NXP Semiconductors
2+ * Copyright 2019-2021 NXP
33 */
44
55 #ifndef _NET_DSA_TAG_OCELOT_H
include/linux/mdio.h+3−0
@@ -80,6 +80,9 @@ struct mdio_driver { · 79 unmodified lines
8080
8181 /* Clears up any memory if needed */
8282 void (*remove)(struct mdio_device *mdiodev);
83+
84+ /* Quiesces the device on system shutdown, turns off interrupts etc */
85+ void (*shutdown)(struct mdio_device *mdiodev);
8386 };
8487
8588 static inline struct mdio_driver *
include/linux/packing.h+1−1
@@ -1,5 +1,5 @@
11 /* SPDX-License-Identifier: BSD-3-Clause
2− * Copyright (c) 2016-2018, NXP Semiconductors
2+ * Copyright 2016-2018 NXP
33 * Copyright (c) 2018-2019, Vladimir Oltean <olteanv@gmail.com>
44 */
55 #ifndef _LINUX_PACKING_H
include/net/dsa.h+9−0
@@ -585,8 +585,16 @@ struct dsa_switch_ops { · 584 unmodified lines
585585 int (*change_tag_protocol)(struct dsa_switch *ds, int port,
586586 enum dsa_tag_protocol proto);
587587
588+ /* Optional switch-wide initialization and destruction methods */
588589 int (*setup)(struct dsa_switch *ds);
589590 void (*teardown)(struct dsa_switch *ds);
591+
592+ /* Per-port initialization and destruction methods. Mandatory if the
593+ * driver registers devlink port regions, optional otherwise.
594+ */
595+ int (*port_setup)(struct dsa_switch *ds, int port);
596+ void (*port_teardown)(struct dsa_switch *ds, int port);
597+
590598 u32 (*get_phy_flags)(struct dsa_switch *ds, int port);
591599
592600 /*
@@ -1046,6 +1054,7 @@ static inline int dsa_ndo_eth_ioctl(struct net_device *dev, struct ifreq *ifr, · 453 unmodified lines
10461054
10471055 void dsa_unregister_switch(struct dsa_switch *ds);
10481056 int dsa_register_switch(struct dsa_switch *ds);
1057+void dsa_switch_shutdown(struct dsa_switch *ds);
10491058 struct dsa_switch *dsa_switch_find(int tree_index, int sw_index);
10501059 #ifdef CONFIG_PM_SLEEP
10511060 int dsa_switch_suspend(struct dsa_switch *ds);
include/net/sock.h+1−0
@@ -1640,6 +1640,7 @@ static inline void unlock_sock_fast(struct sock *sk, bool slow) · 1639 unmodified lines
16401640 release_sock(sk);
16411641 __release(&sk->sk_lock.slock);
16421642 } else {
1643+ mutex_release(&sk->sk_lock.dep_map, _RET_IP_);
16431644 spin_unlock_bh(&sk->sk_lock.slock);
16441645 }
16451646 }
lib/packing.c+1−1
@@ -1,5 +1,5 @@
11 // SPDX-License-Identifier: BSD-3-Clause OR GPL-2.0
2−/* Copyright (c) 2016-2018, NXP Semiconductors
2+/* Copyright 2016-2018 NXP
33 * Copyright (c) 2018-2019, Vladimir Oltean <olteanv@gmail.com>
44 */
55 #include <linux/packing.h>
net/core/dev.c+10−6
@@ -6923,12 +6923,16 @@ EXPORT_SYMBOL(napi_disable); · 6922 unmodified lines
69236923 */
69246924 void napi_enable(struct napi_struct *n)
69256925 {
6926− BUG_ON(!test_bit(NAPI_STATE_SCHED, &n->state));
6927− smp_mb__before_atomic();
6928− clear_bit(NAPI_STATE_SCHED, &n->state);
6929− clear_bit(NAPI_STATE_NPSVC, &n->state);
6930− if (n->dev->threaded && n->thread)
6931− set_bit(NAPI_STATE_THREADED, &n->state);
6926+ unsigned long val, new;
6927+
6928+ do {
6929+ val = READ_ONCE(n->state);
6930+ BUG_ON(!test_bit(NAPI_STATE_SCHED, &val));
6931+
6932+ new = val & ~(NAPIF_STATE_SCHED | NAPIF_STATE_NPSVC);
6933+ if (n->dev->threaded && n->thread)
6934+ new |= NAPIF_STATE_THREADED;
6935+ } while (cmpxchg(&n->state, val, new) != val);
69326936 }
69336937 EXPORT_SYMBOL(napi_enable);
69346938
net/core/sock.c+23−14
@@ -3179,17 +3179,15 @@ EXPORT_SYMBOL(sock_init_data); · 3178 unmodified lines
31793179
31803180 void lock_sock_nested(struct sock *sk, int subclass)
31813181 {
3182+ /* The sk_lock has mutex_lock() semantics here. */
3183+ mutex_acquire(&sk->sk_lock.dep_map, subclass, 0, _RET_IP_);
3184+
31823185 might_sleep();
31833186 spin_lock_bh(&sk->sk_lock.slock);
31843187 if (sk->sk_lock.owned)
31853188 __lock_sock(sk);
31863189 sk->sk_lock.owned = 1;
3187− spin_unlock(&sk->sk_lock.slock);
3188− /*
3189− * The sk_lock has mutex_lock() semantics here:
3190− */
3191− mutex_acquire(&sk->sk_lock.dep_map, subclass, 0, _RET_IP_);
3192− local_bh_enable();
3190+ spin_unlock_bh(&sk->sk_lock.slock);
31933191 }
31943192 EXPORT_SYMBOL(lock_sock_nested);
31953193
@@ -3227,24 +3225,35 @@ EXPORT_SYMBOL(release_sock); · 31 unmodified lines
32273225 */
32283226 bool lock_sock_fast(struct sock *sk) __acquires(&sk->sk_lock.slock)
32293227 {
3228+ /* The sk_lock has mutex_lock() semantics here. */
3229+ mutex_acquire(&sk->sk_lock.dep_map, 0, 0, _RET_IP_);
3230+
32303231 might_sleep();
32313232 spin_lock_bh(&sk->sk_lock.slock);
32323233
3233− if (!sk->sk_lock.owned)
3234+ if (!sk->sk_lock.owned) {
32343235 /*
3235− * Note : We must disable BH
3236+ * Fast path return with bottom halves disabled and
3237+ * sock::sk_lock.slock held.
3238+ *
3239+ * The 'mutex' is not contended and holding
3240+ * sock::sk_lock.slock prevents all other lockers to
3241+ * proceed so the corresponding unlock_sock_fast() can
3242+ * avoid the slow path of release_sock() completely and
3243+ * just release slock.
3244+ *
3245+ * From a semantical POV this is equivalent to 'acquiring'
3246+ * the 'mutex', hence the corresponding lockdep
3247+ * mutex_release() has to happen in the fast path of
3248+ * unlock_sock_fast().
32363249 */
32373250 return false;
3251+ }
32383252
32393253 __lock_sock(sk);
32403254 sk->sk_lock.owned = 1;
3241− spin_unlock(&sk->sk_lock.slock);
3242− /*
3243− * The sk_lock has mutex_lock() semantics here:
3244− */
3245− mutex_acquire(&sk->sk_lock.dep_map, 0, 0, _RET_IP_);
32463255 __acquire(&sk->sk_lock.slock);
3247− local_bh_enable();
3256+ spin_unlock_bh(&sk->sk_lock.slock);
32483257 return true;
32493258 }
32503259 EXPORT_SYMBOL(lock_sock_fast);
net/dsa/dsa2.c+106−8
@@ -429,6 +429,7 @@ static int dsa_port_setup(struct dsa_port *dp) · 428 unmodified lines
429429 {
430430 struct devlink_port *dlp = &dp->devlink_port;
431431 bool dsa_port_link_registered = false;
432+ struct dsa_switch *ds = dp->ds;
432433 bool dsa_port_enabled = false;
433434 int err = 0;
434435
@@ -438,6 +439,12 @@ static int dsa_port_setup(struct dsa_port *dp) · 3 unmodified lines
438439 INIT_LIST_HEAD(&dp->fdbs);
439440 INIT_LIST_HEAD(&dp->mdbs);
440441
442+ if (ds->ops->port_setup) {
443+ err = ds->ops->port_setup(ds, dp->index);
444+ if (err)
445+ return err;
446+ }
447+
441448 switch (dp->type) {
442449 case DSA_PORT_TYPE_UNUSED:
443450 dsa_port_disable(dp);
@@ -480,8 +487,11 @@ static int dsa_port_setup(struct dsa_port *dp) · 36 unmodified lines
480487 dsa_port_disable(dp);
481488 if (err && dsa_port_link_registered)
482489 dsa_port_link_unregister_of(dp);
483− if (err)
490+ if (err) {
491+ if (ds->ops->port_teardown)
492+ ds->ops->port_teardown(ds, dp->index);
484493 return err;
494+ }
485495
486496 dp->setup = true;
487497
@@ -533,11 +543,15 @@ static int dsa_port_devlink_setup(struct dsa_port *dp) · 45 unmodified lines
533543 static void dsa_port_teardown(struct dsa_port *dp)
534544 {
535545 struct devlink_port *dlp = &dp->devlink_port;
546+ struct dsa_switch *ds = dp->ds;
536547 struct dsa_mac_addr *a, *tmp;
537548
538549 if (!dp->setup)
539550 return;
540551
552+ if (ds->ops->port_teardown)
553+ ds->ops->port_teardown(ds, dp->index);
554+
541555 devlink_port_type_clear(dlp);
542556
543557 switch (dp->type) {
@@ -581,6 +595,36 @@ static void dsa_port_devlink_teardown(struct dsa_port *dp) · 37 unmodified lines
581595 dp->devlink_port_setup = false;
582596 }
583597
598+/* Destroy the current devlink port, and create a new one which has the UNUSED
599+ * flavour. At this point, any call to ds->ops->port_setup has been already
600+ * balanced out by a call to ds->ops->port_teardown, so we know that any
601+ * devlink port regions the driver had are now unregistered. We then call its
602+ * ds->ops->port_setup again, in order for the driver to re-create them on the
603+ * new devlink port.
604+ */
605+static int dsa_port_reinit_as_unused(struct dsa_port *dp)
606+{
607+ struct dsa_switch *ds = dp->ds;
608+ int err;
609+
610+ dsa_port_devlink_teardown(dp);
611+ dp->type = DSA_PORT_TYPE_UNUSED;
612+ err = dsa_port_devlink_setup(dp);
613+ if (err)
614+ return err;
615+
616+ if (ds->ops->port_setup) {
617+ /* On error, leave the devlink port registered,
618+ * dsa_switch_teardown will clean it up later.
619+ */
620+ err = ds->ops->port_setup(ds, dp->index);
621+ if (err)
622+ return err;
623+ }
624+
625+ return 0;
626+}
627+
584628 static int dsa_devlink_info_get(struct devlink *dl,
585629 struct devlink_info_req *req,
586630 struct netlink_ext_ack *extack)
@@ -836,7 +880,7 @@ static int dsa_switch_setup(struct dsa_switch *ds) · 249 unmodified lines
836880 devlink_params_publish(ds->devlink);
837881
838882 if (!ds->slave_mii_bus && ds->ops->phy_read) {
839− ds->slave_mii_bus = devm_mdiobus_alloc(ds->dev);
883+ ds->slave_mii_bus = mdiobus_alloc();
840884 if (!ds->slave_mii_bus) {
841885 err = -ENOMEM;
842886 goto teardown;
@@ -846,13 +890,16 @@ static int dsa_switch_setup(struct dsa_switch *ds) · 3 unmodified lines
846890
847891 err = mdiobus_register(ds->slave_mii_bus);
848892 if (err < 0)
849− goto teardown;
893+ goto free_slave_mii_bus;
850894 }
851895
852896 ds->setup = true;
853897
854898 return 0;
855899
900+free_slave_mii_bus:
901+ if (ds->slave_mii_bus && ds->ops->phy_read)
902+ mdiobus_free(ds->slave_mii_bus);
856903 teardown:
857904 if (ds->ops->teardown)
858905 ds->ops->teardown(ds);
@@ -877,8 +924,11 @@ static void dsa_switch_teardown(struct dsa_switch *ds) · 18 unmodified lines
877924 if (!ds->setup)
878925 return;
879926
880− if (ds->slave_mii_bus && ds->ops->phy_read)
927+ if (ds->slave_mii_bus && ds->ops->phy_read) {
881928 mdiobus_unregister(ds->slave_mii_bus);
929+ mdiobus_free(ds->slave_mii_bus);
930+ ds->slave_mii_bus = NULL;
931+ }
882932
883933 dsa_switch_unregister_notifier(ds);
884934
@@ -938,12 +988,9 @@ static int dsa_tree_setup_switches(struct dsa_switch_tree *dst) · 53 unmodified lines
938988 list_for_each_entry(dp, &dst->ports, list) {
939989 err = dsa_port_setup(dp);
940990 if (err) {
941− dsa_port_devlink_teardown(dp);
942− dp->type = DSA_PORT_TYPE_UNUSED;
943− err = dsa_port_devlink_setup(dp);
991+ err = dsa_port_reinit_as_unused(dp);
944992 if (err)
945993 goto teardown;
946− continue;
947994 }
948995 }
949996
@@ -1048,6 +1095,7 @@ static int dsa_tree_setup(struct dsa_switch_tree *dst) · 98 unmodified lines
10481095 teardown_master:
10491096 dsa_tree_teardown_master(dst);
10501097 teardown_switches:
1098+ dsa_tree_teardown_ports(dst);
10511099 dsa_tree_teardown_switches(dst);
10521100 teardown_cpu_ports:
10531101 dsa_tree_teardown_cpu_ports(dst);
@@ -1562,3 +1610,53 @@ void dsa_unregister_switch(struct dsa_switch *ds) · 508 unmodified lines
15621610 mutex_unlock(&dsa2_mutex);
15631611 }
15641612 EXPORT_SYMBOL_GPL(dsa_unregister_switch);
1613+
1614+/* If the DSA master chooses to unregister its net_device on .shutdown, DSA is
1615+ * blocking that operation from completion, due to the dev_hold taken inside
1616+ * netdev_upper_dev_link. Unlink the DSA slave interfaces from being uppers of
1617+ * the DSA master, so that the system can reboot successfully.
1618+ */
1619+void dsa_switch_shutdown(struct dsa_switch *ds)
1620+{
1621+ struct net_device *master, *slave_dev;
1622+ LIST_HEAD(unregister_list);
1623+ struct dsa_port *dp;
1624+
1625+ mutex_lock(&dsa2_mutex);
1626+ rtnl_lock();
1627+
1628+ list_for_each_entry(dp, &ds->dst->ports, list) {
1629+ if (dp->ds != ds)
1630+ continue;
1631+
1632+ if (!dsa_port_is_user(dp))
1633+ continue;
1634+
1635+ master = dp->cpu_dp->master;
1636+ slave_dev = dp->slave;
1637+
1638+ netdev_upper_dev_unlink(master, slave_dev);
1639+ /* Just unlinking ourselves as uppers of the master is not
1640+ * sufficient. When the master net device unregisters, that will
1641+ * also call dev_close, which we will catch as NETDEV_GOING_DOWN
1642+ * and trigger a dev_close on our own devices (dsa_slave_close).
1643+ * In turn, that will call dev_mc_unsync on the master's net
1644+ * device. If the master is also a DSA switch port, this will
1645+ * trigger dsa_slave_set_rx_mode which will call dev_mc_sync on
1646+ * its own master. Lockdep will complain about the fact that
1647+ * all cascaded masters have the same dsa_master_addr_list_lock_key,
1648+ * which it normally would not do if the cascaded masters would
1649+ * be in a proper upper/lower relationship, which we've just
1650+ * destroyed.
1651+ * To suppress the lockdep warnings, let's actually unregister
1652+ * the DSA slave interfaces too, to avoid the nonsensical
1653+ * multicast address list synchronization on shutdown.
1654+ */
1655+ unregister_netdevice_queue(slave_dev, &unregister_list);
1656+ }
1657+ unregister_netdevice_many(&unregister_list);
1658+
1659+ rtnl_unlock();
1660+ mutex_unlock(&dsa2_mutex);
1661+}
1662+EXPORT_SYMBOL_GPL(dsa_switch_shutdown);
net/dsa/tag_ocelot.c+1−1
@@ -1,5 +1,5 @@
11 // SPDX-License-Identifier: GPL-2.0
2−/* Copyright 2019 NXP Semiconductors
2+/* Copyright 2019 NXP
33 */
44 #include <linux/dsa/ocelot.h>
55 #include <soc/mscc/ocelot.h>
net/dsa/tag_ocelot_8021q.c+1−1
@@ -1,5 +1,5 @@
11 // SPDX-License-Identifier: GPL-2.0
2−/* Copyright 2020-2021 NXP Semiconductors
2+/* Copyright 2020-2021 NXP
33 *
44 * An implementation of the software-defined tag_8021q.c tagger format, which
55 * also preserves full functionality under a vlan_filtering bridge. It does
net/ipv4/nexthop.c+16−5
@@ -1982,6 +1982,8 @@ static int replace_nexthop_grp(struct net *net, struct nexthop *old, · 1981 unmodified lines
19821982 rcu_assign_pointer(old->nh_grp, newg);
19831983
19841984 if (newg->resilient) {
1985+ /* Make sure concurrent readers are not using 'oldg' anymore. */
1986+ synchronize_net();
19851987 rcu_assign_pointer(oldg->res_table, tmp_table);
19861988 rcu_assign_pointer(oldg->spare->res_table, tmp_table);
19871989 }
@@ -3565,6 +3567,7 @@ static struct notifier_block nh_netdev_notifier = { · 1577 unmodified lines
35653567 };
35663568
35673569 static int nexthops_dump(struct net *net, struct notifier_block *nb,
3570+ enum nexthop_event_type event_type,
35683571 struct netlink_ext_ack *extack)
35693572 {
35703573 struct rb_root *root = &net->nexthop.rb_root;
@@ -3575,8 +3578,7 @@ static int nexthops_dump(struct net *net, struct notifier_block *nb, · 4 unmodified lines
35753578 struct nexthop *nh;
35763579
35773580 nh = rb_entry(node, struct nexthop, rb_node);
3578− err = call_nexthop_notifier(nb, net, NEXTHOP_EVENT_REPLACE, nh,
3579− extack);
3581+ err = call_nexthop_notifier(nb, net, event_type, nh, extack);
35803582 if (err)
35813583 break;
35823584 }
@@ -3590,7 +3592,7 @@ int register_nexthop_notifier(struct net *net, struct notifier_block *nb, · 7 unmodified lines
35903592 int err;
35913593
35923594 rtnl_lock();
3593− err = nexthops_dump(net, nb, extack);
3595+ err = nexthops_dump(net, nb, NEXTHOP_EVENT_REPLACE, extack);
35943596 if (err)
35953597 goto unlock;
35963598 err = blocking_notifier_chain_register(&net->nexthop.notifier_chain,
@@ -3603,8 +3605,17 @@ EXPORT_SYMBOL(register_nexthop_notifier); · 6 unmodified lines
36033605
36043606 int unregister_nexthop_notifier(struct net *net, struct notifier_block *nb)
36053607 {
3606− return blocking_notifier_chain_unregister(&net->nexthop.notifier_chain,
3607− nb);
3608+ int err;
3609+
3610+ rtnl_lock();
3611+ err = blocking_notifier_chain_unregister(&net->nexthop.notifier_chain,
3612+ nb);
3613+ if (err)
3614+ goto unlock;
3615+ nexthops_dump(net, nb, NEXTHOP_EVENT_DEL, NULL);
3616+unlock:
3617+ rtnl_unlock();
3618+ return err;
36083619 }
36093620 EXPORT_SYMBOL(unregister_nexthop_notifier);
36103621
net/mptcp/protocol.c+2−2
@@ -1316,7 +1316,7 @@ static int mptcp_sendmsg_frag(struct sock *sk, struct sock *ssk, · 1315 unmodified lines
13161316 goto alloc_skb;
13171317 }
13181318
1319− must_collapse = (info->size_goal - skb->len > 0) &&
1319+ must_collapse = (info->size_goal > skb->len) &&
13201320 (skb_shinfo(skb)->nr_frags < sysctl_max_skb_frags);
13211321 if (must_collapse) {
13221322 size_bias = skb->len;
@@ -1325,7 +1325,7 @@ static int mptcp_sendmsg_frag(struct sock *sk, struct sock *ssk, · 2 unmodified lines
13251325 }
13261326
13271327 alloc_skb:
1328− if (!must_collapse && !ssk->sk_tx_skb_cache &&
1328+ if (!must_collapse &&
13291329 !mptcp_alloc_tx_skb(sk, ssk, info->data_lock_held))
13301330 return 0;
13311331
net/smc/smc_clc.c+2−1
@@ -230,7 +230,8 @@ static int smc_clc_prfx_set(struct socket *clcsock, · 229 unmodified lines
230230 goto out_rel;
231231 }
232232 /* get address to which the internal TCP socket is bound */
233− kernel_getsockname(clcsock, (struct sockaddr *)&addrs);
233+ if (kernel_getsockname(clcsock, (struct sockaddr *)&addrs) < 0)
234+ goto out_rel;
234235 /* analyze IP specific data of net_device belonging to TCP socket */
235236 addr6 = (struct sockaddr_in6 *)&addrs;
236237 rcu_read_lock();
net/smc/smc_core.c+2−0
@@ -1474,7 +1474,9 @@ static void smc_conn_abort_work(struct work_struct *work) · 1473 unmodified lines
14741474 abort_work);
14751475 struct smc_sock *smc = container_of(conn, struct smc_sock, conn);
14761476
1477+ lock_sock(&smc->sk);
14771478 smc_conn_kill(conn, true);
1479+ release_sock(&smc->sk);
14781480 sock_put(&smc->sk); /* sock_hold done by schedulers of abort_work */
14791481 }
14801482
tools/testing/selftests/drivers/net/ocelot/tc_flower_chains.sh+1−1
@@ -1,6 +1,6 @@
11 #!/bin/bash
22 # SPDX-License-Identifier: GPL-2.0
3−# Copyright 2020 NXP Semiconductors
3+# Copyright 2020 NXP
44
55 WAIT_TIME=1
66 NUM_NETIFS=4
tools/testing/selftests/net/af_unix/Makefile+1−4
@@ -1,5 +1,2 @@
1−##TEST_GEN_FILES := test_unix_oob
2−TEST_PROGS := test_unix_oob
1+TEST_GEN_PROGS := test_unix_oob
32 include ../../lib.mk
4−
5−all: $(TEST_PROGS)
tools/testing/selftests/net/af_unix/test_unix_oob.c+3−2
@@ -271,8 +271,9 @@ main(int argc, char **argv) · 270 unmodified lines
271271 read_oob(pfd, &oob);
272272
273273 if (!signal_recvd || len != 127 || oob != '%' || atmark != 1) {
274− fprintf(stderr, "Test 3 failed, sigurg %d len %d OOB %c ",
275− "atmark %d\n", signal_recvd, len, oob, atmark);
274+ fprintf(stderr,
275+ "Test 3 failed, sigurg %d len %d OOB %c atmark %d\n",
276+ signal_recvd, len, oob, atmark);
276277 die(1);
277278 }
278279