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 ...
Unified · Split
| @@ -851,7 +851,7 @@ NOTES: · 850 unmodified lines | |||
| 851 | - 0x88A8 traffic will not be received unless VLAN stripping is disabled with | 851 | - 0x88A8 traffic will not be received unless VLAN stripping is disabled with |
| 852 | the following command:: | 852 | the following command:: |
| 853 | 853 | ||
| 854 | # ethool -K <ethX> rxvlan off | 854 | # ethtool -K <ethX> rxvlan off |
| 855 | 855 | ||
| 856 | - 0x88A8/0x8100 double VLANs cannot be used with 0x8100 or 0x8100/0x8100 VLANS | 856 | - 0x88A8/0x8100 double VLANs cannot be used with 0x8100 or 0x8100/0x8100 VLANS |
| 857 | configured on the same port. 0x88a8/0x8100 traffic will not be received if | 857 | configured on the same port. 0x88a8/0x8100 traffic will not be received if |
| @@ -16955,7 +16955,6 @@ F: drivers/misc/sgi-xp/ · 16954 unmodified lines | |||
| 16955 | 16955 | ||
| 16956 | SHARED MEMORY COMMUNICATIONS (SMC) SOCKETS | 16956 | SHARED MEMORY COMMUNICATIONS (SMC) SOCKETS |
| 16957 | M: Karsten Graul <kgraul@linux.ibm.com> | 16957 | M: Karsten Graul <kgraul@linux.ibm.com> |
| 16958 | M: Guvenc Gulce <guvenc@linux.ibm.com> | ||
| 16959 | L: linux-s390@vger.kernel.org | 16958 | L: linux-s390@vger.kernel.org |
| 16960 | S: Supported | 16959 | S: Supported |
| 16961 | W: http://www.ibm.com/developerworks/linux/linux390/ | 16960 | W: http://www.ibm.com/developerworks/linux/linux390/ |
| @@ -55,7 +55,7 @@ int ccwgroup_create_dev(struct device *root, struct ccwgroup_driver *gdrv, · 54 unmodified lines | |||
| 55 | int num_devices, const char *buf); | 55 | int num_devices, const char *buf); |
| 56 | 56 | ||
| 57 | extern int ccwgroup_set_online(struct ccwgroup_device *gdev); | 57 | 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); |
| 59 | 59 | ||
| 60 | extern int ccwgroup_probe_ccwdev(struct ccw_device *cdev); | 60 | extern int ccwgroup_probe_ccwdev(struct ccw_device *cdev); |
| 61 | extern void ccwgroup_remove_ccwdev(struct ccw_device *cdev); | 61 | extern void ccwgroup_remove_ccwdev(struct ccw_device *cdev); |
| @@ -351,9 +351,25 @@ static int b53_mdio_probe(struct mdio_device *mdiodev) · 350 unmodified lines | |||
| 351 | static void b53_mdio_remove(struct mdio_device *mdiodev) | 351 | static void b53_mdio_remove(struct mdio_device *mdiodev) |
| 352 | { | 352 | { |
| 353 | struct b53_device *dev = dev_get_drvdata(&mdiodev->dev); | 353 | struct b53_device *dev = dev_get_drvdata(&mdiodev->dev); |
| 354 | struct dsa_switch *ds = dev->ds; | ||
| 355 | 354 | ||
| 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); | ||
| 357 | } | 373 | } |
| 358 | 374 | ||
| 359 | static const struct of_device_id b53_of_match[] = { | 375 | static const struct of_device_id b53_of_match[] = { |
| @@ -373,6 +389,7 @@ MODULE_DEVICE_TABLE(of, b53_of_match); · 13 unmodified lines | |||
| 373 | static struct mdio_driver b53_mdio_driver = { | 389 | static struct mdio_driver b53_mdio_driver = { |
| 374 | .probe = b53_mdio_probe, | 390 | .probe = b53_mdio_probe, |
| 375 | .remove = b53_mdio_remove, | 391 | .remove = b53_mdio_remove, |
| 392 | .shutdown = b53_mdio_shutdown, | ||
| 376 | .mdiodrv.driver = { | 393 | .mdiodrv.driver = { |
| 377 | .name = "bcm53xx", | 394 | .name = "bcm53xx", |
| 378 | .of_match_table = b53_of_match, | 395 | .of_match_table = b53_of_match, |
| @@ -316,9 +316,21 @@ static int b53_mmap_remove(struct platform_device *pdev) · 315 unmodified lines | |||
| 316 | if (dev) | 316 | if (dev) |
| 317 | b53_switch_remove(dev); | 317 | b53_switch_remove(dev); |
| 318 | 318 | ||
| 319 | platform_set_drvdata(pdev, NULL); | ||
| 320 | |||
| 319 | return 0; | 321 | return 0; |
| 320 | } | 322 | } |
| 321 | 323 | ||
| 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 | |||
| 322 | static const struct of_device_id b53_mmap_of_table[] = { | 334 | static const struct of_device_id b53_mmap_of_table[] = { |
| 323 | { .compatible = "brcm,bcm3384-switch" }, | 335 | { .compatible = "brcm,bcm3384-switch" }, |
| 324 | { .compatible = "brcm,bcm6328-switch" }, | 336 | { .compatible = "brcm,bcm6328-switch" }, |
| @@ -331,6 +343,7 @@ MODULE_DEVICE_TABLE(of, b53_mmap_of_table); · 6 unmodified lines | |||
| 331 | static struct platform_driver b53_mmap_driver = { | 343 | static struct platform_driver b53_mmap_driver = { |
| 332 | .probe = b53_mmap_probe, | 344 | .probe = b53_mmap_probe, |
| 333 | .remove = b53_mmap_remove, | 345 | .remove = b53_mmap_remove, |
| 346 | .shutdown = b53_mmap_shutdown, | ||
| 334 | .driver = { | 347 | .driver = { |
| 335 | .name = "b53-switch", | 348 | .name = "b53-switch", |
| 336 | .of_match_table = b53_mmap_of_table, | 349 | .of_match_table = b53_mmap_of_table, |
| @@ -228,6 +228,11 @@ static inline void b53_switch_remove(struct b53_device *dev) · 227 unmodified lines | |||
| 228 | dsa_unregister_switch(dev->ds); | 228 | dsa_unregister_switch(dev->ds); |
| 229 | } | 229 | } |
| 230 | 230 | ||
| 231 | static inline void b53_switch_shutdown(struct b53_device *dev) | ||
| 232 | { | ||
| 233 | dsa_switch_shutdown(dev->ds); | ||
| 234 | } | ||
| 235 | |||
| 231 | #define b53_build_op(type_op_size, val_type) \ | 236 | #define b53_build_op(type_op_size, val_type) \ |
| 232 | static inline int b53_##type_op_size(struct b53_device *dev, u8 page, \ | 237 | static inline int b53_##type_op_size(struct b53_device *dev, u8 page, \ |
| 233 | u8 reg, val_type val) \ | 238 | u8 reg, val_type val) \ |
| @@ -321,9 +321,21 @@ static int b53_spi_remove(struct spi_device *spi) · 320 unmodified lines | |||
| 321 | if (dev) | 321 | if (dev) |
| 322 | b53_switch_remove(dev); | 322 | b53_switch_remove(dev); |
| 323 | 323 | ||
| 324 | spi_set_drvdata(spi, NULL); | ||
| 325 | |||
| 324 | return 0; | 326 | return 0; |
| 325 | } | 327 | } |
| 326 | 328 | ||
| 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 | |||
| 327 | static const struct of_device_id b53_spi_of_match[] = { | 339 | static const struct of_device_id b53_spi_of_match[] = { |
| 328 | { .compatible = "brcm,bcm5325" }, | 340 | { .compatible = "brcm,bcm5325" }, |
| 329 | { .compatible = "brcm,bcm5365" }, | 341 | { .compatible = "brcm,bcm5365" }, |
| @@ -344,6 +356,7 @@ static struct spi_driver b53_spi_driver = { · 14 unmodified lines | |||
| 344 | }, | 356 | }, |
| 345 | .probe = b53_spi_probe, | 357 | .probe = b53_spi_probe, |
| 346 | .remove = b53_spi_remove, | 358 | .remove = b53_spi_remove, |
| 359 | .shutdown = b53_spi_shutdown, | ||
| 347 | }; | 360 | }; |
| 348 | 361 | ||
| 349 | module_spi_driver(b53_spi_driver); | 362 | module_spi_driver(b53_spi_driver); |
| @@ -629,17 +629,34 @@ static int b53_srab_probe(struct platform_device *pdev) · 628 unmodified lines | |||
| 629 | static int b53_srab_remove(struct platform_device *pdev) | 629 | static int b53_srab_remove(struct platform_device *pdev) |
| 630 | { | 630 | { |
| 631 | struct b53_device *dev = platform_get_drvdata(pdev); | 631 | struct b53_device *dev = platform_get_drvdata(pdev); |
| 632 | struct b53_srab_priv *priv = dev->priv; | ||
| 633 | 632 | ||
| 634 | b53_srab_intr_set(priv, false); | 633 | if (!dev) |
| 634 | return 0; | ||
| 635 | |||
| 636 | b53_srab_intr_set(dev->priv, false); | ||
| 635 | b53_switch_remove(dev); | 637 | b53_switch_remove(dev); |
| 636 | 638 | ||
| 639 | platform_set_drvdata(pdev, NULL); | ||
| 640 | |||
| 637 | return 0; | 641 | return 0; |
| 638 | } | 642 | } |
| 639 | 643 | ||
| 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 | |||
| 640 | static struct platform_driver b53_srab_driver = { | 656 | static struct platform_driver b53_srab_driver = { |
| 641 | .probe = b53_srab_probe, | 657 | .probe = b53_srab_probe, |
| 642 | .remove = b53_srab_remove, | 658 | .remove = b53_srab_remove, |
| 659 | .shutdown = b53_srab_shutdown, | ||
| 643 | .driver = { | 660 | .driver = { |
| 644 | .name = "b53-srab-switch", | 661 | .name = "b53-srab-switch", |
| 645 | .of_match_table = b53_srab_of_match, | 662 | .of_match_table = b53_srab_of_match, |
| @@ -68,7 +68,7 @@ static unsigned int bcm_sf2_num_active_ports(struct dsa_switch *ds) · 67 unmodified lines | |||
| 68 | struct bcm_sf2_priv *priv = bcm_sf2_to_priv(ds); | 68 | struct bcm_sf2_priv *priv = bcm_sf2_to_priv(ds); |
| 69 | unsigned int port, count = 0; | 69 | unsigned int port, count = 0; |
| 70 | 70 | ||
| 71 | for (port = 0; port < ARRAY_SIZE(priv->port_sts); port++) { | 71 | for (port = 0; port < ds->num_ports; port++) { |
| 72 | if (dsa_is_cpu_port(ds, port)) | 72 | if (dsa_is_cpu_port(ds, port)) |
| 73 | continue; | 73 | continue; |
| 74 | if (priv->port_sts[port].enabled) | 74 | if (priv->port_sts[port].enabled) |
| @@ -1512,6 +1512,9 @@ static int bcm_sf2_sw_remove(struct platform_device *pdev) · 1437 unmodified lines | |||
| 1512 | { | 1512 | { |
| 1513 | struct bcm_sf2_priv *priv = platform_get_drvdata(pdev); | 1513 | struct bcm_sf2_priv *priv = platform_get_drvdata(pdev); |
| 1514 | 1514 | ||
| 1515 | if (!priv) | ||
| 1516 | return 0; | ||
| 1517 | |||
| 1515 | priv->wol_ports_mask = 0; | 1518 | priv->wol_ports_mask = 0; |
| 1516 | /* Disable interrupts */ | 1519 | /* Disable interrupts */ |
| 1517 | bcm_sf2_intr_disable(priv); | 1520 | bcm_sf2_intr_disable(priv); |
| @@ -1523,6 +1526,8 @@ static int bcm_sf2_sw_remove(struct platform_device *pdev) · 5 unmodified lines | |||
| 1523 | if (priv->type == BCM7278_DEVICE_ID) | 1526 | if (priv->type == BCM7278_DEVICE_ID) |
| 1524 | reset_control_assert(priv->rcdev); | 1527 | reset_control_assert(priv->rcdev); |
| 1525 | 1528 | ||
| 1529 | platform_set_drvdata(pdev, NULL); | ||
| 1530 | |||
| 1526 | return 0; | 1531 | return 0; |
| 1527 | } | 1532 | } |
| 1528 | 1533 | ||
| @@ -1530,6 +1535,9 @@ static void bcm_sf2_sw_shutdown(struct platform_device *pdev) · 1 unmodified line | |||
| 1530 | { | 1535 | { |
| 1531 | struct bcm_sf2_priv *priv = platform_get_drvdata(pdev); | 1536 | struct bcm_sf2_priv *priv = platform_get_drvdata(pdev); |
| 1532 | 1537 | ||
| 1538 | if (!priv) | ||
| 1539 | return; | ||
| 1540 | |||
| 1533 | /* For a kernel about to be kexec'd we want to keep the GPHY on for a | 1541 | /* For a kernel about to be kexec'd we want to keep the GPHY on for a |
| 1534 | * successful MDIO bus scan to occur. If we did turn off the GPHY | 1542 | * successful MDIO bus scan to occur. If we did turn off the GPHY |
| 1535 | * before (e.g: port_disable), this will also power it back on. | 1543 | * 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 | |||
| 1538 | */ | 1546 | */ |
| 1539 | if (priv->hw_params.num_gphy == 1) | 1547 | if (priv->hw_params.num_gphy == 1) |
| 1540 | bcm_sf2_gphy_enable_set(priv->dev->ds, true); | 1548 | bcm_sf2_gphy_enable_set(priv->dev->ds, true); |
| 1549 | |||
| 1550 | dsa_switch_shutdown(priv->dev->ds); | ||
| 1551 | |||
| 1552 | platform_set_drvdata(pdev, NULL); | ||
| 1541 | } | 1553 | } |
| 1542 | 1554 | ||
| 1543 | #ifdef CONFIG_PM_SLEEP | 1555 | #ifdef CONFIG_PM_SLEEP |
| @@ -340,10 +340,29 @@ static int dsa_loop_drv_probe(struct mdio_device *mdiodev) · 339 unmodified lines | |||
| 340 | static void dsa_loop_drv_remove(struct mdio_device *mdiodev) | 340 | static void dsa_loop_drv_remove(struct mdio_device *mdiodev) |
| 341 | { | 341 | { |
| 342 | struct dsa_switch *ds = dev_get_drvdata(&mdiodev->dev); | 342 | 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; | ||
| 344 | 349 | ||
| 345 | dsa_unregister_switch(ds); | 350 | dsa_unregister_switch(ds); |
| 346 | dev_put(ps->netdev); | 351 | 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); | ||
| 347 | } | 366 | } |
| 348 | 367 | ||
| 349 | static struct mdio_driver dsa_loop_drv = { | 368 | static struct mdio_driver dsa_loop_drv = { |
| @@ -352,6 +371,7 @@ static struct mdio_driver dsa_loop_drv = { · 2 unmodified lines | |||
| 352 | }, | 371 | }, |
| 353 | .probe = dsa_loop_drv_probe, | 372 | .probe = dsa_loop_drv_probe, |
| 354 | .remove = dsa_loop_drv_remove, | 373 | .remove = dsa_loop_drv_remove, |
| 374 | .shutdown = dsa_loop_drv_shutdown, | ||
| 355 | }; | 375 | }; |
| 356 | 376 | ||
| 357 | #define NUM_FIXED_PHYS (DSA_LOOP_NUM_PORTS - 2) | 377 | #define NUM_FIXED_PHYS (DSA_LOOP_NUM_PORTS - 2) |
| @@ -1916,6 +1916,9 @@ static int hellcreek_remove(struct platform_device *pdev) · 1915 unmodified lines | |||
| 1916 | { | 1916 | { |
| 1917 | struct hellcreek *hellcreek = platform_get_drvdata(pdev); | 1917 | struct hellcreek *hellcreek = platform_get_drvdata(pdev); |
| 1918 | 1918 | ||
| 1919 | if (!hellcreek) | ||
| 1920 | return 0; | ||
| 1921 | |||
| 1919 | hellcreek_hwtstamp_free(hellcreek); | 1922 | hellcreek_hwtstamp_free(hellcreek); |
| 1920 | hellcreek_ptp_free(hellcreek); | 1923 | hellcreek_ptp_free(hellcreek); |
| 1921 | dsa_unregister_switch(hellcreek->ds); | 1924 | dsa_unregister_switch(hellcreek->ds); |
| @@ -1924,6 +1927,18 @@ static int hellcreek_remove(struct platform_device *pdev) · 2 unmodified lines | |||
| 1924 | return 0; | 1927 | return 0; |
| 1925 | } | 1928 | } |
| 1926 | 1929 | ||
| 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 | |||
| 1927 | static const struct hellcreek_platform_data de1soc_r1_pdata = { | 1942 | static const struct hellcreek_platform_data de1soc_r1_pdata = { |
| 1928 | .name = "r4c30", | 1943 | .name = "r4c30", |
| 1929 | .num_ports = 4, | 1944 | .num_ports = 4, |
| @@ -1946,6 +1961,7 @@ MODULE_DEVICE_TABLE(of, hellcreek_of_match); · 16 unmodified lines | |||
| 1946 | static struct platform_driver hellcreek_driver = { | 1961 | static struct platform_driver hellcreek_driver = { |
| 1947 | .probe = hellcreek_probe, | 1962 | .probe = hellcreek_probe, |
| 1948 | .remove = hellcreek_remove, | 1963 | .remove = hellcreek_remove, |
| 1964 | .shutdown = hellcreek_shutdown, | ||
| 1949 | .driver = { | 1965 | .driver = { |
| 1950 | .name = "hellcreek", | 1966 | .name = "hellcreek", |
| 1951 | .of_match_table = hellcreek_of_match, | 1967 | .of_match_table = hellcreek_of_match, |
| @@ -1379,6 +1379,12 @@ int lan9303_remove(struct lan9303 *chip) · 1378 unmodified lines | |||
| 1379 | } | 1379 | } |
| 1380 | EXPORT_SYMBOL(lan9303_remove); | 1380 | EXPORT_SYMBOL(lan9303_remove); |
| 1381 | 1381 | ||
| 1382 | void lan9303_shutdown(struct lan9303 *chip) | ||
| 1383 | { | ||
| 1384 | dsa_switch_shutdown(chip->ds); | ||
| 1385 | } | ||
| 1386 | EXPORT_SYMBOL(lan9303_shutdown); | ||
| 1387 | |||
| 1382 | MODULE_AUTHOR("Juergen Borleis <kernel@pengutronix.de>"); | 1388 | MODULE_AUTHOR("Juergen Borleis <kernel@pengutronix.de>"); |
| 1383 | MODULE_DESCRIPTION("Core driver for SMSC/Microchip LAN9303 three port ethernet switch"); | 1389 | MODULE_DESCRIPTION("Core driver for SMSC/Microchip LAN9303 three port ethernet switch"); |
| 1384 | MODULE_LICENSE("GPL v2"); | 1390 | MODULE_LICENSE("GPL v2"); |
| @@ -10,3 +10,4 @@ extern const struct lan9303_phy_ops lan9303_indirect_phy_ops; · 9 unmodified lines | |||
| 10 | 10 | ||
| 11 | int lan9303_probe(struct lan9303 *chip, struct device_node *np); | 11 | int lan9303_probe(struct lan9303 *chip, struct device_node *np); |
| 12 | int lan9303_remove(struct lan9303 *chip); | 12 | int lan9303_remove(struct lan9303 *chip); |
| 13 | void lan9303_shutdown(struct lan9303 *chip); | ||
| @@ -67,13 +67,28 @@ static int lan9303_i2c_probe(struct i2c_client *client, · 66 unmodified lines | |||
| 67 | 67 | ||
| 68 | static int lan9303_i2c_remove(struct i2c_client *client) | 68 | static int lan9303_i2c_remove(struct i2c_client *client) |
| 69 | { | 69 | { |
| 70 | struct lan9303_i2c *sw_dev; | 70 | struct lan9303_i2c *sw_dev = i2c_get_clientdata(client); |
| 71 | 71 | ||
| 72 | sw_dev = i2c_get_clientdata(client); | ||
| 73 | if (!sw_dev) | 72 | 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); | ||
| 75 | 90 | ||
| 76 | return lan9303_remove(&sw_dev->chip); | 91 | i2c_set_clientdata(client, NULL); |
| 77 | } | 92 | } |
| 78 | 93 | ||
| 79 | /*-------------------------------------------------------------------------*/ | 94 | /*-------------------------------------------------------------------------*/ |
| @@ -97,6 +112,7 @@ static struct i2c_driver lan9303_i2c_driver = { · 17 unmodified lines | |||
| 97 | }, | 112 | }, |
| 98 | .probe = lan9303_i2c_probe, | 113 | .probe = lan9303_i2c_probe, |
| 99 | .remove = lan9303_i2c_remove, | 114 | .remove = lan9303_i2c_remove, |
| 115 | .shutdown = lan9303_i2c_shutdown, | ||
| 100 | .id_table = lan9303_i2c_id, | 116 | .id_table = lan9303_i2c_id, |
| 101 | }; | 117 | }; |
| 102 | module_i2c_driver(lan9303_i2c_driver); | 118 | module_i2c_driver(lan9303_i2c_driver); |
| @@ -138,6 +138,20 @@ static void lan9303_mdio_remove(struct mdio_device *mdiodev) · 137 unmodified lines | |||
| 138 | return; | 138 | return; |
| 139 | 139 | ||
| 140 | lan9303_remove(&sw_dev->chip); | 140 | 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); | ||
| 141 | } | 155 | } |
| 142 | 156 | ||
| 143 | /*-------------------------------------------------------------------------*/ | 157 | /*-------------------------------------------------------------------------*/ |
| @@ -155,6 +169,7 @@ static struct mdio_driver lan9303_mdio_driver = { · 11 unmodified lines | |||
| 155 | }, | 169 | }, |
| 156 | .probe = lan9303_mdio_probe, | 170 | .probe = lan9303_mdio_probe, |
| 157 | .remove = lan9303_mdio_remove, | 171 | .remove = lan9303_mdio_remove, |
| 172 | .shutdown = lan9303_mdio_shutdown, | ||
| 158 | }; | 173 | }; |
| 159 | mdio_module_driver(lan9303_mdio_driver); | 174 | mdio_module_driver(lan9303_mdio_driver); |
| 160 | 175 | ||
| @@ -2184,6 +2184,9 @@ static int gswip_remove(struct platform_device *pdev) · 2183 unmodified lines | |||
| 2184 | struct gswip_priv *priv = platform_get_drvdata(pdev); | 2184 | struct gswip_priv *priv = platform_get_drvdata(pdev); |
| 2185 | int i; | 2185 | int i; |
| 2186 | 2186 | ||
| 2187 | if (!priv) | ||
| 2188 | return 0; | ||
| 2189 | |||
| 2187 | /* disable the switch */ | 2190 | /* disable the switch */ |
| 2188 | gswip_mdio_mask(priv, GSWIP_MDIO_GLOB_ENABLE, 0, GSWIP_MDIO_GLOB); | 2191 | gswip_mdio_mask(priv, GSWIP_MDIO_GLOB_ENABLE, 0, GSWIP_MDIO_GLOB); |
| 2189 | 2192 | ||
| @@ -2197,9 +2200,23 @@ static int gswip_remove(struct platform_device *pdev) · 7 unmodified lines | |||
| 2197 | for (i = 0; i < priv->num_gphy_fw; i++) | 2200 | for (i = 0; i < priv->num_gphy_fw; i++) |
| 2198 | gswip_gphy_fw_remove(priv, &priv->gphy_fw[i]); | 2201 | gswip_gphy_fw_remove(priv, &priv->gphy_fw[i]); |
| 2199 | 2202 | ||
| 2203 | platform_set_drvdata(pdev, NULL); | ||
| 2204 | |||
| 2200 | return 0; | 2205 | return 0; |
| 2201 | } | 2206 | } |
| 2202 | 2207 | ||
| 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 | |||
| 2203 | static const struct gswip_hw_info gswip_xrx200 = { | 2220 | static const struct gswip_hw_info gswip_xrx200 = { |
| 2204 | .max_ports = 7, | 2221 | .max_ports = 7, |
| 2205 | .cpu_port = 6, | 2222 | .cpu_port = 6, |
| @@ -2223,6 +2240,7 @@ MODULE_DEVICE_TABLE(of, gswip_of_match); · 17 unmodified lines | |||
| 2223 | static struct platform_driver gswip_driver = { | 2240 | static struct platform_driver gswip_driver = { |
| 2224 | .probe = gswip_probe, | 2241 | .probe = gswip_probe, |
| 2225 | .remove = gswip_remove, | 2242 | .remove = gswip_remove, |
| 2243 | .shutdown = gswip_shutdown, | ||
| 2226 | .driver = { | 2244 | .driver = { |
| 2227 | .name = "gswip", | 2245 | .name = "gswip", |
| 2228 | .of_match_table = gswip_of_match, | 2246 | .of_match_table = gswip_of_match, |
| @@ -94,6 +94,8 @@ static int ksz8795_spi_remove(struct spi_device *spi) · 93 unmodified lines | |||
| 94 | if (dev) | 94 | if (dev) |
| 95 | ksz_switch_remove(dev); | 95 | ksz_switch_remove(dev); |
| 96 | 96 | ||
| 97 | spi_set_drvdata(spi, NULL); | ||
| 98 | |||
| 97 | return 0; | 99 | return 0; |
| 98 | } | 100 | } |
| 99 | 101 | ||
| @@ -101,8 +103,15 @@ static void ksz8795_spi_shutdown(struct spi_device *spi) · 1 unmodified line | |||
| 101 | { | 103 | { |
| 102 | struct ksz_device *dev = spi_get_drvdata(spi); | 104 | struct ksz_device *dev = spi_get_drvdata(spi); |
| 103 | 105 | ||
| 104 | if (dev && dev->dev_ops->shutdown) | 106 | if (!dev) |
| 107 | return; | ||
| 108 | |||
| 109 | if (dev->dev_ops->shutdown) | ||
| 105 | dev->dev_ops->shutdown(dev); | 110 | dev->dev_ops->shutdown(dev); |
| 111 | |||
| 112 | dsa_switch_shutdown(dev->ds); | ||
| 113 | |||
| 114 | spi_set_drvdata(spi, NULL); | ||
| 106 | } | 115 | } |
| 107 | 116 | ||
| 108 | static const struct of_device_id ksz8795_dt_ids[] = { | 117 | static const struct of_device_id ksz8795_dt_ids[] = { |
| @@ -191,6 +191,18 @@ static void ksz8863_smi_remove(struct mdio_device *mdiodev) · 190 unmodified lines | |||
| 191 | 191 | ||
| 192 | if (dev) | 192 | if (dev) |
| 193 | ksz_switch_remove(dev); | 193 | 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); | ||
| 194 | } | 206 | } |
| 195 | 207 | ||
| 196 | static const struct of_device_id ksz8863_dt_ids[] = { | 208 | static const struct of_device_id ksz8863_dt_ids[] = { |
| @@ -203,6 +215,7 @@ MODULE_DEVICE_TABLE(of, ksz8863_dt_ids); · 6 unmodified lines | |||
| 203 | static struct mdio_driver ksz8863_driver = { | 215 | static struct mdio_driver ksz8863_driver = { |
| 204 | .probe = ksz8863_smi_probe, | 216 | .probe = ksz8863_smi_probe, |
| 205 | .remove = ksz8863_smi_remove, | 217 | .remove = ksz8863_smi_remove, |
| 218 | .shutdown = ksz8863_smi_shutdown, | ||
| 206 | .mdiodrv.driver = { | 219 | .mdiodrv.driver = { |
| 207 | .name = "ksz8863-switch", | 220 | .name = "ksz8863-switch", |
| 208 | .of_match_table = ksz8863_dt_ids, | 221 | .of_match_table = ksz8863_dt_ids, |
| @@ -56,7 +56,10 @@ static int ksz9477_i2c_remove(struct i2c_client *i2c) · 55 unmodified lines | |||
| 56 | { | 56 | { |
| 57 | struct ksz_device *dev = i2c_get_clientdata(i2c); | 57 | struct ksz_device *dev = i2c_get_clientdata(i2c); |
| 58 | 58 | ||
| 59 | ksz_switch_remove(dev); | 59 | if (dev) |
| 60 | ksz_switch_remove(dev); | ||
| 61 | |||
| 62 | i2c_set_clientdata(i2c, NULL); | ||
| 60 | 63 | ||
| 61 | return 0; | 64 | return 0; |
| 62 | } | 65 | } |
| @@ -65,8 +68,15 @@ static void ksz9477_i2c_shutdown(struct i2c_client *i2c) · 2 unmodified lines | |||
| 65 | { | 68 | { |
| 66 | struct ksz_device *dev = i2c_get_clientdata(i2c); | 69 | struct ksz_device *dev = i2c_get_clientdata(i2c); |
| 67 | 70 | ||
| 68 | if (dev && dev->dev_ops->shutdown) | 71 | if (!dev) |
| 72 | return; | ||
| 73 | |||
| 74 | if (dev->dev_ops->shutdown) | ||
| 69 | dev->dev_ops->shutdown(dev); | 75 | dev->dev_ops->shutdown(dev); |
| 76 | |||
| 77 | dsa_switch_shutdown(dev->ds); | ||
| 78 | |||
| 79 | i2c_set_clientdata(i2c, NULL); | ||
| 70 | } | 80 | } |
| 71 | 81 | ||
| 72 | static const struct i2c_device_id ksz9477_i2c_id[] = { | 82 | static const struct i2c_device_id ksz9477_i2c_id[] = { |
| @@ -72,6 +72,8 @@ static int ksz9477_spi_remove(struct spi_device *spi) · 71 unmodified lines | |||
| 72 | if (dev) | 72 | if (dev) |
| 73 | ksz_switch_remove(dev); | 73 | ksz_switch_remove(dev); |
| 74 | 74 | ||
| 75 | spi_set_drvdata(spi, NULL); | ||
| 76 | |||
| 75 | return 0; | 77 | return 0; |
| 76 | } | 78 | } |
| 77 | 79 | ||
| @@ -79,8 +81,10 @@ static void ksz9477_spi_shutdown(struct spi_device *spi) · 1 unmodified line | |||
| 79 | { | 81 | { |
| 80 | struct ksz_device *dev = spi_get_drvdata(spi); | 82 | struct ksz_device *dev = spi_get_drvdata(spi); |
| 81 | 83 | ||
| 82 | if (dev && dev->dev_ops->shutdown) | 84 | if (dev) |
| 83 | dev->dev_ops->shutdown(dev); | 85 | dsa_switch_shutdown(dev->ds); |
| 86 | |||
| 87 | spi_set_drvdata(spi, NULL); | ||
| 84 | } | 88 | } |
| 85 | 89 | ||
| 86 | static const struct of_device_id ksz9477_dt_ids[] = { | 90 | static const struct of_device_id ksz9477_dt_ids[] = { |
| @@ -3286,6 +3286,9 @@ mt7530_remove(struct mdio_device *mdiodev) · 3285 unmodified lines | |||
| 3286 | struct mt7530_priv *priv = dev_get_drvdata(&mdiodev->dev); | 3286 | struct mt7530_priv *priv = dev_get_drvdata(&mdiodev->dev); |
| 3287 | int ret = 0; | 3287 | int ret = 0; |
| 3288 | 3288 | ||
| 3289 | if (!priv) | ||
| 3290 | return; | ||
| 3291 | |||
| 3289 | ret = regulator_disable(priv->core_pwr); | 3292 | ret = regulator_disable(priv->core_pwr); |
| 3290 | if (ret < 0) | 3293 | if (ret < 0) |
| 3291 | dev_err(priv->dev, | 3294 | dev_err(priv->dev, |
| @@ -3301,11 +3304,26 @@ mt7530_remove(struct mdio_device *mdiodev) · 9 unmodified lines | |||
| 3301 | 3304 | ||
| 3302 | dsa_unregister_switch(priv->ds); | 3305 | dsa_unregister_switch(priv->ds); |
| 3303 | mutex_destroy(&priv->reg_mutex); | 3306 | 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); | ||
| 3304 | } | 3321 | } |
| 3305 | 3322 | ||
| 3306 | static struct mdio_driver mt7530_mdio_driver = { | 3323 | static struct mdio_driver mt7530_mdio_driver = { |
| 3307 | .probe = mt7530_probe, | 3324 | .probe = mt7530_probe, |
| 3308 | .remove = mt7530_remove, | 3325 | .remove = mt7530_remove, |
| 3326 | .shutdown = mt7530_shutdown, | ||
| 3309 | .mdiodrv.driver = { | 3327 | .mdiodrv.driver = { |
| 3310 | .name = "mt7530", | 3328 | .name = "mt7530", |
| 3311 | .of_match_table = mt7530_of_match, | 3329 | .of_match_table = mt7530_of_match, |
| @@ -290,7 +290,24 @@ static void mv88e6060_remove(struct mdio_device *mdiodev) · 289 unmodified lines | |||
| 290 | { | 290 | { |
| 291 | struct dsa_switch *ds = dev_get_drvdata(&mdiodev->dev); | 291 | struct dsa_switch *ds = dev_get_drvdata(&mdiodev->dev); |
| 292 | 292 | ||
| 293 | if (!ds) | ||
| 294 | return; | ||
| 295 | |||
| 293 | dsa_unregister_switch(ds); | 296 | 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); | ||
| 294 | } | 311 | } |
| 295 | 312 | ||
| 296 | static const struct of_device_id mv88e6060_of_match[] = { | 313 | 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 | |||
| 303 | static struct mdio_driver mv88e6060_driver = { | 320 | static struct mdio_driver mv88e6060_driver = { |
| 304 | .probe = mv88e6060_probe, | 321 | .probe = mv88e6060_probe, |
| 305 | .remove = mv88e6060_remove, | 322 | .remove = mv88e6060_remove, |
| 323 | .shutdown = mv88e6060_shutdown, | ||
| 306 | .mdiodrv.driver = { | 324 | .mdiodrv.driver = { |
| 307 | .name = "mv88e6060", | 325 | .name = "mv88e6060", |
| 308 | .of_match_table = mv88e6060_of_match, | 326 | .of_match_table = mv88e6060_of_match, |
| @@ -3071,7 +3071,7 @@ static void mv88e6xxx_teardown(struct dsa_switch *ds) · 3070 unmodified lines | |||
| 3071 | { | 3071 | { |
| 3072 | mv88e6xxx_teardown_devlink_params(ds); | 3072 | mv88e6xxx_teardown_devlink_params(ds); |
| 3073 | dsa_devlink_resources_unregister(ds); | 3073 | dsa_devlink_resources_unregister(ds); |
| 3074 | mv88e6xxx_teardown_devlink_regions(ds); | 3074 | mv88e6xxx_teardown_devlink_regions_global(ds); |
| 3075 | } | 3075 | } |
| 3076 | 3076 | ||
| 3077 | static int mv88e6xxx_setup(struct dsa_switch *ds) | 3077 | static int mv88e6xxx_setup(struct dsa_switch *ds) |
| @@ -3215,7 +3215,7 @@ unlock: · 137 unmodified lines | |||
| 3215 | if (err) | 3215 | if (err) |
| 3216 | goto out_resources; | 3216 | goto out_resources; |
| 3217 | 3217 | ||
| 3218 | err = mv88e6xxx_setup_devlink_regions(ds); | 3218 | err = mv88e6xxx_setup_devlink_regions_global(ds); |
| 3219 | if (err) | 3219 | if (err) |
| 3220 | goto out_params; | 3220 | goto out_params; |
| 3221 | 3221 | ||
| @@ -3229,6 +3229,16 @@ out_resources: · 7 unmodified lines | |||
| 3229 | return err; | 3229 | return err; |
| 3230 | } | 3230 | } |
| 3231 | 3231 | ||
| 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 | |||
| 3232 | /* prod_id for switch families which do not have a PHY model number */ | 3242 | /* prod_id for switch families which do not have a PHY model number */ |
| 3233 | static const u16 family_prod_id_table[] = { | 3243 | static const u16 family_prod_id_table[] = { |
| 3234 | [MV88E6XXX_FAMILY_6341] = MV88E6XXX_PORT_SWITCH_ID_PROD_6341, | 3244 | [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 | |||
| 6116 | .change_tag_protocol = mv88e6xxx_change_tag_protocol, | 6126 | .change_tag_protocol = mv88e6xxx_change_tag_protocol, |
| 6117 | .setup = mv88e6xxx_setup, | 6127 | .setup = mv88e6xxx_setup, |
| 6118 | .teardown = mv88e6xxx_teardown, | 6128 | .teardown = mv88e6xxx_teardown, |
| 6129 | .port_setup = mv88e6xxx_port_setup, | ||
| 6130 | .port_teardown = mv88e6xxx_port_teardown, | ||
| 6119 | .phylink_validate = mv88e6xxx_validate, | 6131 | .phylink_validate = mv88e6xxx_validate, |
| 6120 | .phylink_mac_link_state = mv88e6xxx_serdes_pcs_get_state, | 6132 | .phylink_mac_link_state = mv88e6xxx_serdes_pcs_get_state, |
| 6121 | .phylink_mac_config = mv88e6xxx_mac_config, | 6133 | .phylink_mac_config = mv88e6xxx_mac_config, |
| @@ -6389,7 +6401,12 @@ out: · 267 unmodified lines | |||
| 6389 | static void mv88e6xxx_remove(struct mdio_device *mdiodev) | 6401 | static void mv88e6xxx_remove(struct mdio_device *mdiodev) |
| 6390 | { | 6402 | { |
| 6391 | struct dsa_switch *ds = dev_get_drvdata(&mdiodev->dev); | 6403 | 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; | ||
| 6393 | 6410 | ||
| 6394 | if (chip->info->ptp_support) { | 6411 | if (chip->info->ptp_support) { |
| 6395 | mv88e6xxx_hwtstamp_free(chip); | 6412 | mv88e6xxx_hwtstamp_free(chip); |
| @@ -6410,6 +6427,20 @@ static void mv88e6xxx_remove(struct mdio_device *mdiodev) · 14 unmodified lines | |||
| 6410 | mv88e6xxx_g1_irq_free(chip); | 6427 | mv88e6xxx_g1_irq_free(chip); |
| 6411 | else | 6428 | else |
| 6412 | mv88e6xxx_irq_poll_free(chip); | 6429 | 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); | ||
| 6413 | } | 6444 | } |
| 6414 | 6445 | ||
| 6415 | static const struct of_device_id mv88e6xxx_of_match[] = { | 6446 | static const struct of_device_id mv88e6xxx_of_match[] = { |
| @@ -6433,6 +6464,7 @@ MODULE_DEVICE_TABLE(of, mv88e6xxx_of_match); · 17 unmodified lines | |||
| 6433 | static struct mdio_driver mv88e6xxx_driver = { | 6464 | static struct mdio_driver mv88e6xxx_driver = { |
| 6434 | .probe = mv88e6xxx_probe, | 6465 | .probe = mv88e6xxx_probe, |
| 6435 | .remove = mv88e6xxx_remove, | 6466 | .remove = mv88e6xxx_remove, |
| 6467 | .shutdown = mv88e6xxx_shutdown, | ||
| 6436 | .mdiodrv.driver = { | 6468 | .mdiodrv.driver = { |
| 6437 | .name = "mv88e6085", | 6469 | .name = "mv88e6085", |
| 6438 | .of_match_table = mv88e6xxx_of_match, | 6470 | .of_match_table = mv88e6xxx_of_match, |
| @@ -647,26 +647,25 @@ static struct mv88e6xxx_region mv88e6xxx_regions[] = { · 646 unmodified lines | |||
| 647 | }, | 647 | }, |
| 648 | }; | 648 | }; |
| 649 | 649 | ||
| 650 | static void | 650 | void mv88e6xxx_teardown_devlink_regions_global(struct dsa_switch *ds) |
| 651 | mv88e6xxx_teardown_devlink_regions_global(struct mv88e6xxx_chip *chip) | ||
| 652 | { | 651 | { |
| 652 | struct mv88e6xxx_chip *chip = ds->priv; | ||
| 653 | int i; | 653 | int i; |
| 654 | 654 | ||
| 655 | for (i = 0; i < ARRAY_SIZE(mv88e6xxx_regions); i++) | 655 | for (i = 0; i < ARRAY_SIZE(mv88e6xxx_regions); i++) |
| 656 | dsa_devlink_region_destroy(chip->regions[i]); | 656 | dsa_devlink_region_destroy(chip->regions[i]); |
| 657 | } | 657 | } |
| 658 | 658 | ||
| 659 | static void | 659 | void mv88e6xxx_teardown_devlink_regions_port(struct dsa_switch *ds, int port) |
| 660 | mv88e6xxx_teardown_devlink_regions_port(struct mv88e6xxx_chip *chip, | ||
| 661 | int port) | ||
| 662 | { | 660 | { |
| 661 | struct mv88e6xxx_chip *chip = ds->priv; | ||
| 662 | |||
| 663 | dsa_devlink_region_destroy(chip->ports[port].region); | 663 | dsa_devlink_region_destroy(chip->ports[port].region); |
| 664 | } | 664 | } |
| 665 | 665 | ||
| 666 | static int mv88e6xxx_setup_devlink_regions_port(struct dsa_switch *ds, | 666 | int mv88e6xxx_setup_devlink_regions_port(struct dsa_switch *ds, int port) |
| 667 | struct mv88e6xxx_chip *chip, | ||
| 668 | int port) | ||
| 669 | { | 667 | { |
| 668 | struct mv88e6xxx_chip *chip = ds->priv; | ||
| 670 | struct devlink_region *region; | 669 | struct devlink_region *region; |
| 671 | 670 | ||
| 672 | region = dsa_devlink_port_region_create(ds, | 671 | 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 | |||
| 681 | return 0; | 680 | return 0; |
| 682 | } | 681 | } |
| 683 | 682 | ||
| 684 | static void | 683 | int mv88e6xxx_setup_devlink_regions_global(struct dsa_switch *ds) |
| 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) | ||
| 716 | { | 684 | { |
| 717 | bool (*cond)(struct mv88e6xxx_chip *chip); | 685 | bool (*cond)(struct mv88e6xxx_chip *chip); |
| 686 | struct mv88e6xxx_chip *chip = ds->priv; | ||
| 718 | struct devlink_region_ops *ops; | 687 | struct devlink_region_ops *ops; |
| 719 | struct devlink_region *region; | 688 | struct devlink_region *region; |
| 720 | u64 size; | 689 | u64 size; |
| @@ -753,30 +722,6 @@ out: · 32 unmodified lines | |||
| 753 | return PTR_ERR(region); | 722 | return PTR_ERR(region); |
| 754 | } | 723 | } |
| 755 | 724 | ||
| 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 | |||
| 780 | int mv88e6xxx_devlink_info_get(struct dsa_switch *ds, | 725 | int mv88e6xxx_devlink_info_get(struct dsa_switch *ds, |
| 781 | struct devlink_info_req *req, | 726 | struct devlink_info_req *req, |
| 782 | struct netlink_ext_ack *extack) | 727 | struct netlink_ext_ack *extack) |
| @@ -12,8 +12,10 @@ int mv88e6xxx_devlink_param_get(struct dsa_switch *ds, u32 id, · 11 unmodified lines | |||
| 12 | struct devlink_param_gset_ctx *ctx); | 12 | struct devlink_param_gset_ctx *ctx); |
| 13 | int mv88e6xxx_devlink_param_set(struct dsa_switch *ds, u32 id, | 13 | int mv88e6xxx_devlink_param_set(struct dsa_switch *ds, u32 id, |
| 14 | struct devlink_param_gset_ctx *ctx); | 14 | struct devlink_param_gset_ctx *ctx); |
| 15 | int mv88e6xxx_setup_devlink_regions(struct dsa_switch *ds); | 15 | int mv88e6xxx_setup_devlink_regions_global(struct dsa_switch *ds); |
| 16 | void mv88e6xxx_teardown_devlink_regions(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); | ||
| 17 | 19 | ||
| 18 | int mv88e6xxx_devlink_info_get(struct dsa_switch *ds, | 20 | int mv88e6xxx_devlink_info_get(struct dsa_switch *ds, |
| 19 | struct devlink_info_req *req, | 21 | struct devlink_info_req *req, |
| @@ -1,5 +1,5 @@ | |||
| 1 | // SPDX-License-Identifier: GPL-2.0 | 1 | // SPDX-License-Identifier: GPL-2.0 |
| 2 | /* Copyright 2019-2021 NXP Semiconductors | 2 | /* Copyright 2019-2021 NXP |
| 3 | * | 3 | * |
| 4 | * This is an umbrella module for all network switches that are | 4 | * This is an umbrella module for all network switches that are |
| 5 | * register-compatible with Ocelot and that perform I/O to their host CPU | 5 | * register-compatible with Ocelot and that perform I/O to their host CPU |
| @@ -1,5 +1,5 @@ | |||
| 1 | /* SPDX-License-Identifier: GPL-2.0 */ | 1 | /* SPDX-License-Identifier: GPL-2.0 */ |
| 2 | /* Copyright 2019 NXP Semiconductors | 2 | /* Copyright 2019 NXP |
| 3 | */ | 3 | */ |
| 4 | #ifndef _MSCC_FELIX_H | 4 | #ifndef _MSCC_FELIX_H |
| 5 | #define _MSCC_FELIX_H | 5 | #define _MSCC_FELIX_H |
| @@ -1,6 +1,6 @@ | |||
| 1 | // SPDX-License-Identifier: (GPL-2.0 OR MIT) | 1 | // SPDX-License-Identifier: (GPL-2.0 OR MIT) |
| 2 | /* Copyright 2017 Microsemi Corporation | 2 | /* Copyright 2017 Microsemi Corporation |
| 3 | * Copyright 2018-2019 NXP Semiconductors | 3 | * Copyright 2018-2019 NXP |
| 4 | */ | 4 | */ |
| 5 | #include <linux/fsl/enetc_mdio.h> | 5 | #include <linux/fsl/enetc_mdio.h> |
| 6 | #include <soc/mscc/ocelot_qsys.h> | 6 | #include <soc/mscc/ocelot_qsys.h> |
| @@ -1472,9 +1472,10 @@ err_pci_enable: · 1465 unmodified lines | |||
| 1472 | 1472 | ||
| 1473 | static void felix_pci_remove(struct pci_dev *pdev) | 1473 | static void felix_pci_remove(struct pci_dev *pdev) |
| 1474 | { | 1474 | { |
| 1475 | struct felix *felix; | 1475 | struct felix *felix = pci_get_drvdata(pdev); |
| 1476 | 1476 | ||
| 1477 | felix = pci_get_drvdata(pdev); | 1477 | if (!felix) |
| 1478 | return; | ||
| 1478 | 1479 | ||
| 1479 | dsa_unregister_switch(felix->ds); | 1480 | dsa_unregister_switch(felix->ds); |
| 1480 | 1481 | ||
| @@ -1482,6 +1483,20 @@ static void felix_pci_remove(struct pci_dev *pdev) · 1 unmodified line | |||
| 1482 | kfree(felix); | 1483 | kfree(felix); |
| 1483 | 1484 | ||
| 1484 | pci_disable_device(pdev); | 1485 | 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); | ||
| 1485 | } | 1500 | } |
| 1486 | 1501 | ||
| 1487 | static struct pci_device_id felix_ids[] = { | 1502 | static struct pci_device_id felix_ids[] = { |
| @@ -1498,6 +1513,7 @@ static struct pci_driver felix_vsc9959_pci_driver = { · 10 unmodified lines | |||
| 1498 | .id_table = felix_ids, | 1513 | .id_table = felix_ids, |
| 1499 | .probe = felix_pci_probe, | 1514 | .probe = felix_pci_probe, |
| 1500 | .remove = felix_pci_remove, | 1515 | .remove = felix_pci_remove, |
| 1516 | .shutdown = felix_pci_shutdown, | ||
| 1501 | }; | 1517 | }; |
| 1502 | module_pci_driver(felix_vsc9959_pci_driver); | 1518 | module_pci_driver(felix_vsc9959_pci_driver); |
| 1503 | 1519 | ||
| @@ -1245,18 +1245,33 @@ err_alloc_felix: · 1244 unmodified lines | |||
| 1245 | 1245 | ||
| 1246 | static int seville_remove(struct platform_device *pdev) | 1246 | static int seville_remove(struct platform_device *pdev) |
| 1247 | { | 1247 | { |
| 1248 | struct felix *felix; | 1248 | struct felix *felix = platform_get_drvdata(pdev); |
| 1249 | 1249 | ||
| 1250 | felix = platform_get_drvdata(pdev); | 1250 | if (!felix) |
| 1251 | return 0; | ||
| 1251 | 1252 | ||
| 1252 | dsa_unregister_switch(felix->ds); | 1253 | dsa_unregister_switch(felix->ds); |
| 1253 | 1254 | ||
| 1254 | kfree(felix->ds); | 1255 | kfree(felix->ds); |
| 1255 | kfree(felix); | 1256 | kfree(felix); |
| 1256 | 1257 | ||
| 1258 | platform_set_drvdata(pdev, NULL); | ||
| 1259 | |||
| 1257 | return 0; | 1260 | return 0; |
| 1258 | } | 1261 | } |
| 1259 | 1262 | ||
| 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 | |||
| 1260 | static const struct of_device_id seville_of_match[] = { | 1275 | static const struct of_device_id seville_of_match[] = { |
| 1261 | { .compatible = "mscc,vsc9953-switch" }, | 1276 | { .compatible = "mscc,vsc9953-switch" }, |
| 1262 | { }, | 1277 | { }, |
| @@ -1266,6 +1281,7 @@ MODULE_DEVICE_TABLE(of, seville_of_match); · 3 unmodified lines | |||
| 1266 | static struct platform_driver seville_vsc9953_driver = { | 1281 | static struct platform_driver seville_vsc9953_driver = { |
| 1267 | .probe = seville_probe, | 1282 | .probe = seville_probe, |
| 1268 | .remove = seville_remove, | 1283 | .remove = seville_remove, |
| 1284 | .shutdown = seville_shutdown, | ||
| 1269 | .driver = { | 1285 | .driver = { |
| 1270 | .name = "mscc_seville", | 1286 | .name = "mscc_seville", |
| 1271 | .of_match_table = of_match_ptr(seville_of_match), | 1287 | .of_match_table = of_match_ptr(seville_of_match), |
| @@ -1083,6 +1083,9 @@ static void ar9331_sw_remove(struct mdio_device *mdiodev) · 1082 unmodified lines | |||
| 1083 | struct ar9331_sw_priv *priv = dev_get_drvdata(&mdiodev->dev); | 1083 | struct ar9331_sw_priv *priv = dev_get_drvdata(&mdiodev->dev); |
| 1084 | unsigned int i; | 1084 | unsigned int i; |
| 1085 | 1085 | ||
| 1086 | if (!priv) | ||
| 1087 | return; | ||
| 1088 | |||
| 1086 | for (i = 0; i < ARRAY_SIZE(priv->port); i++) { | 1089 | for (i = 0; i < ARRAY_SIZE(priv->port); i++) { |
| 1087 | struct ar9331_sw_port *port = &priv->port[i]; | 1090 | struct ar9331_sw_port *port = &priv->port[i]; |
| 1088 | 1091 | ||
| @@ -1094,6 +1097,20 @@ static void ar9331_sw_remove(struct mdio_device *mdiodev) · 5 unmodified lines | |||
| 1094 | dsa_unregister_switch(&priv->ds); | 1097 | dsa_unregister_switch(&priv->ds); |
| 1095 | 1098 | ||
| 1096 | reset_control_assert(priv->sw_reset); | 1099 | 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); | ||
| 1097 | } | 1114 | } |
| 1098 | 1115 | ||
| 1099 | static const struct of_device_id ar9331_sw_of_match[] = { | 1116 | 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 | |||
| 1104 | static struct mdio_driver ar9331_sw_mdio_driver = { | 1121 | static struct mdio_driver ar9331_sw_mdio_driver = { |
| 1105 | .probe = ar9331_sw_probe, | 1122 | .probe = ar9331_sw_probe, |
| 1106 | .remove = ar9331_sw_remove, | 1123 | .remove = ar9331_sw_remove, |
| 1124 | .shutdown = ar9331_sw_shutdown, | ||
| 1107 | .mdiodrv.driver = { | 1125 | .mdiodrv.driver = { |
| 1108 | .name = AR9331_SW_NAME, | 1126 | .name = AR9331_SW_NAME, |
| 1109 | .of_match_table = ar9331_sw_of_match, | 1127 | .of_match_table = ar9331_sw_of_match, |
| @@ -1880,10 +1880,27 @@ qca8k_sw_remove(struct mdio_device *mdiodev) · 1879 unmodified lines | |||
| 1880 | struct qca8k_priv *priv = dev_get_drvdata(&mdiodev->dev); | 1880 | struct qca8k_priv *priv = dev_get_drvdata(&mdiodev->dev); |
| 1881 | int i; | 1881 | int i; |
| 1882 | 1882 | ||
| 1883 | if (!priv) | ||
| 1884 | return; | ||
| 1885 | |||
| 1883 | for (i = 0; i < QCA8K_NUM_PORTS; i++) | 1886 | for (i = 0; i < QCA8K_NUM_PORTS; i++) |
| 1884 | qca8k_port_set_status(priv, i, 0); | 1887 | qca8k_port_set_status(priv, i, 0); |
| 1885 | 1888 | ||
| 1886 | dsa_unregister_switch(priv->ds); | 1889 | 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); | ||
| 1887 | } | 1904 | } |
| 1888 | 1905 | ||
| 1889 | #ifdef CONFIG_PM_SLEEP | 1906 | #ifdef CONFIG_PM_SLEEP |
| @@ -1940,6 +1957,7 @@ static const struct of_device_id qca8k_of_match[] = { · 50 unmodified lines | |||
| 1940 | static struct mdio_driver qca8kmdio_driver = { | 1957 | static struct mdio_driver qca8kmdio_driver = { |
| 1941 | .probe = qca8k_sw_probe, | 1958 | .probe = qca8k_sw_probe, |
| 1942 | .remove = qca8k_sw_remove, | 1959 | .remove = qca8k_sw_remove, |
| 1960 | .shutdown = qca8k_sw_shutdown, | ||
| 1943 | .mdiodrv.driver = { | 1961 | .mdiodrv.driver = { |
| 1944 | .name = "qca8k", | 1962 | .name = "qca8k", |
| 1945 | .of_match_table = qca8k_of_match, | 1963 | .of_match_table = qca8k_of_match, |
| @@ -368,7 +368,7 @@ int realtek_smi_setup_mdio(struct realtek_smi *smi) · 367 unmodified lines | |||
| 368 | smi->slave_mii_bus->parent = smi->dev; | 368 | smi->slave_mii_bus->parent = smi->dev; |
| 369 | smi->ds->slave_mii_bus = smi->slave_mii_bus; | 369 | smi->ds->slave_mii_bus = smi->slave_mii_bus; |
| 370 | 370 | ||
| 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); |
| 372 | if (ret) { | 372 | if (ret) { |
| 373 | dev_err(smi->dev, "unable to register MDIO bus %s\n", | 373 | dev_err(smi->dev, "unable to register MDIO bus %s\n", |
| 374 | smi->slave_mii_bus->id); | 374 | smi->slave_mii_bus->id); |
| @@ -464,16 +464,33 @@ static int realtek_smi_probe(struct platform_device *pdev) · 89 unmodified lines | |||
| 464 | 464 | ||
| 465 | static int realtek_smi_remove(struct platform_device *pdev) | 465 | static int realtek_smi_remove(struct platform_device *pdev) |
| 466 | { | 466 | { |
| 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; | ||
| 468 | 471 | ||
| 469 | dsa_unregister_switch(smi->ds); | 472 | dsa_unregister_switch(smi->ds); |
| 470 | if (smi->slave_mii_bus) | 473 | if (smi->slave_mii_bus) |
| 471 | of_node_put(smi->slave_mii_bus->dev.of_node); | 474 | of_node_put(smi->slave_mii_bus->dev.of_node); |
| 472 | gpiod_set_value(smi->reset, 1); | 475 | gpiod_set_value(smi->reset, 1); |
| 473 | 476 | ||
| 477 | platform_set_drvdata(pdev, NULL); | ||
| 478 | |||
| 474 | return 0; | 479 | return 0; |
| 475 | } | 480 | } |
| 476 | 481 | ||
| 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 | |||
| 477 | static const struct of_device_id realtek_smi_of_match[] = { | 494 | static const struct of_device_id realtek_smi_of_match[] = { |
| 478 | { | 495 | { |
| 479 | .compatible = "realtek,rtl8366rb", | 496 | .compatible = "realtek,rtl8366rb", |
| @@ -495,6 +512,7 @@ static struct platform_driver realtek_smi_driver = { · 15 unmodified lines | |||
| 495 | }, | 512 | }, |
| 496 | .probe = realtek_smi_probe, | 513 | .probe = realtek_smi_probe, |
| 497 | .remove = realtek_smi_remove, | 514 | .remove = realtek_smi_remove, |
| 515 | .shutdown = realtek_smi_shutdown, | ||
| 498 | }; | 516 | }; |
| 499 | module_platform_driver(realtek_smi_driver); | 517 | module_platform_driver(realtek_smi_driver); |
| 500 | 518 | ||
| @@ -1,5 +1,5 @@ | |||
| 1 | // SPDX-License-Identifier: BSD-3-Clause | 1 | // SPDX-License-Identifier: BSD-3-Clause |
| 2 | /* Copyright (c) 2016-2018, NXP Semiconductors | 2 | /* Copyright 2016-2018 NXP |
| 3 | * Copyright (c) 2018-2019, Vladimir Oltean <olteanv@gmail.com> | 3 | * Copyright (c) 2018-2019, Vladimir Oltean <olteanv@gmail.com> |
| 4 | */ | 4 | */ |
| 5 | #include <linux/packing.h> | 5 | #include <linux/packing.h> |
| @@ -1,6 +1,6 @@ | |||
| 1 | // SPDX-License-Identifier: GPL-2.0 | 1 | // SPDX-License-Identifier: GPL-2.0 |
| 2 | /* Copyright (c) 2018-2019, Vladimir Oltean <olteanv@gmail.com> | 2 | /* Copyright (c) 2018-2019, Vladimir Oltean <olteanv@gmail.com> |
| 3 | * Copyright 2020 NXP Semiconductors | 3 | * Copyright 2020 NXP |
| 4 | */ | 4 | */ |
| 5 | #include "sja1105.h" | 5 | #include "sja1105.h" |
| 6 | 6 | ||
| @@ -1,5 +1,5 @@ | |||
| 1 | // SPDX-License-Identifier: GPL-2.0 | 1 | // SPDX-License-Identifier: GPL-2.0 |
| 2 | /* Copyright 2020, NXP Semiconductors | 2 | /* Copyright 2020 NXP |
| 3 | */ | 3 | */ |
| 4 | #include "sja1105.h" | 4 | #include "sja1105.h" |
| 5 | #include "sja1105_vl.h" | 5 | #include "sja1105_vl.h" |
| @@ -3335,13 +3335,29 @@ static int sja1105_probe(struct spi_device *spi) · 3334 unmodified lines | |||
| 3335 | static int sja1105_remove(struct spi_device *spi) | 3335 | static int sja1105_remove(struct spi_device *spi) |
| 3336 | { | 3336 | { |
| 3337 | struct sja1105_private *priv = spi_get_drvdata(spi); | 3337 | struct sja1105_private *priv = spi_get_drvdata(spi); |
| 3338 | struct dsa_switch *ds = priv->ds; | ||
| 3339 | 3338 | ||
| 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); | ||
| 3341 | 3345 | ||
| 3342 | return 0; | 3346 | return 0; |
| 3343 | } | 3347 | } |
| 3344 | 3348 | ||
| 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 | |||
| 3345 | static const struct of_device_id sja1105_dt_ids[] = { | 3361 | static const struct of_device_id sja1105_dt_ids[] = { |
| 3346 | { .compatible = "nxp,sja1105e", .data = &sja1105e_info }, | 3362 | { .compatible = "nxp,sja1105e", .data = &sja1105e_info }, |
| 3347 | { .compatible = "nxp,sja1105t", .data = &sja1105t_info }, | 3363 | { .compatible = "nxp,sja1105t", .data = &sja1105t_info }, |
| @@ -3365,6 +3381,7 @@ static struct spi_driver sja1105_driver = { · 17 unmodified lines | |||
| 3365 | }, | 3381 | }, |
| 3366 | .probe = sja1105_probe, | 3382 | .probe = sja1105_probe, |
| 3367 | .remove = sja1105_remove, | 3383 | .remove = sja1105_remove, |
| 3384 | .shutdown = sja1105_shutdown, | ||
| 3368 | }; | 3385 | }; |
| 3369 | 3386 | ||
| 3370 | module_spi_driver(sja1105_driver); | 3387 | module_spi_driver(sja1105_driver); |
| @@ -1,5 +1,5 @@ | |||
| 1 | // SPDX-License-Identifier: GPL-2.0 | 1 | // SPDX-License-Identifier: GPL-2.0 |
| 2 | /* Copyright 2021, NXP Semiconductors | 2 | /* Copyright 2021 NXP |
| 3 | */ | 3 | */ |
| 4 | #include <linux/pcs/pcs-xpcs.h> | 4 | #include <linux/pcs/pcs-xpcs.h> |
| 5 | #include <linux/of_mdio.h> | 5 | #include <linux/of_mdio.h> |
| @@ -1,5 +1,5 @@ | |||
| 1 | // SPDX-License-Identifier: BSD-3-Clause | 1 | // SPDX-License-Identifier: BSD-3-Clause |
| 2 | /* Copyright (c) 2016-2018, NXP Semiconductors | 2 | /* Copyright 2016-2018 NXP |
| 3 | * Copyright (c) 2018, Sensor-Technik Wiedemann GmbH | 3 | * Copyright (c) 2018, Sensor-Technik Wiedemann GmbH |
| 4 | * Copyright (c) 2018-2019, Vladimir Oltean <olteanv@gmail.com> | 4 | * Copyright (c) 2018-2019, Vladimir Oltean <olteanv@gmail.com> |
| 5 | */ | 5 | */ |
| @@ -1,5 +1,5 @@ | |||
| 1 | // SPDX-License-Identifier: BSD-3-Clause | 1 | // SPDX-License-Identifier: BSD-3-Clause |
| 2 | /* Copyright (c) 2016-2018, NXP Semiconductors | 2 | /* Copyright 2016-2018 NXP |
| 3 | * Copyright (c) 2018-2019, Vladimir Oltean <olteanv@gmail.com> | 3 | * Copyright (c) 2018-2019, Vladimir Oltean <olteanv@gmail.com> |
| 4 | */ | 4 | */ |
| 5 | #include "sja1105_static_config.h" | 5 | #include "sja1105_static_config.h" |
| @@ -1,5 +1,5 @@ | |||
| 1 | /* SPDX-License-Identifier: BSD-3-Clause */ | 1 | /* SPDX-License-Identifier: BSD-3-Clause */ |
| 2 | /* Copyright (c) 2016-2018, NXP Semiconductors | 2 | /* Copyright 2016-2018 NXP |
| 3 | * Copyright (c) 2018-2019, Vladimir Oltean <olteanv@gmail.com> | 3 | * Copyright (c) 2018-2019, Vladimir Oltean <olteanv@gmail.com> |
| 4 | */ | 4 | */ |
| 5 | #ifndef _SJA1105_STATIC_CONFIG_H | 5 | #ifndef _SJA1105_STATIC_CONFIG_H |
| @@ -1,5 +1,5 @@ | |||
| 1 | // SPDX-License-Identifier: GPL-2.0 | 1 | // SPDX-License-Identifier: GPL-2.0 |
| 2 | /* Copyright 2020, NXP Semiconductors | 2 | /* Copyright 2020 NXP |
| 3 | */ | 3 | */ |
| 4 | #include <net/tc_act/tc_gate.h> | 4 | #include <net/tc_act/tc_gate.h> |
| 5 | #include <linux/dsa/8021q.h> | 5 | #include <linux/dsa/8021q.h> |
| @@ -1,5 +1,5 @@ | |||
| 1 | /* SPDX-License-Identifier: GPL-2.0 */ | 1 | /* SPDX-License-Identifier: GPL-2.0 */ |
| 2 | /* Copyright 2020, NXP Semiconductors | 2 | /* Copyright 2020 NXP |
| 3 | */ | 3 | */ |
| 4 | #ifndef _SJA1105_VL_H | 4 | #ifndef _SJA1105_VL_H |
| 5 | #define _SJA1105_VL_H | 5 | #define _SJA1105_VL_H |
| @@ -1225,6 +1225,12 @@ int vsc73xx_remove(struct vsc73xx *vsc) · 1224 unmodified lines | |||
| 1225 | } | 1225 | } |
| 1226 | EXPORT_SYMBOL(vsc73xx_remove); | 1226 | EXPORT_SYMBOL(vsc73xx_remove); |
| 1227 | 1227 | ||
| 1228 | void vsc73xx_shutdown(struct vsc73xx *vsc) | ||
| 1229 | { | ||
| 1230 | dsa_switch_shutdown(vsc->ds); | ||
| 1231 | } | ||
| 1232 | EXPORT_SYMBOL(vsc73xx_shutdown); | ||
| 1233 | |||
| 1228 | MODULE_AUTHOR("Linus Walleij <linus.walleij@linaro.org>"); | 1234 | MODULE_AUTHOR("Linus Walleij <linus.walleij@linaro.org>"); |
| 1229 | MODULE_DESCRIPTION("Vitesse VSC7385/7388/7395/7398 driver"); | 1235 | MODULE_DESCRIPTION("Vitesse VSC7385/7388/7395/7398 driver"); |
| 1230 | MODULE_LICENSE("GPL v2"); | 1236 | MODULE_LICENSE("GPL v2"); |
| @@ -116,7 +116,26 @@ static int vsc73xx_platform_remove(struct platform_device *pdev) · 115 unmodified lines | |||
| 116 | { | 116 | { |
| 117 | struct vsc73xx_platform *vsc_platform = platform_get_drvdata(pdev); | 117 | struct vsc73xx_platform *vsc_platform = platform_get_drvdata(pdev); |
| 118 | 118 | ||
| 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); | ||
| 120 | } | 139 | } |
| 121 | 140 | ||
| 122 | static const struct vsc73xx_ops vsc73xx_platform_ops = { | 141 | static const struct vsc73xx_ops vsc73xx_platform_ops = { |
| @@ -144,6 +163,7 @@ MODULE_DEVICE_TABLE(of, vsc73xx_of_match); · 21 unmodified lines | |||
| 144 | static struct platform_driver vsc73xx_platform_driver = { | 163 | static struct platform_driver vsc73xx_platform_driver = { |
| 145 | .probe = vsc73xx_platform_probe, | 164 | .probe = vsc73xx_platform_probe, |
| 146 | .remove = vsc73xx_platform_remove, | 165 | .remove = vsc73xx_platform_remove, |
| 166 | .shutdown = vsc73xx_platform_shutdown, | ||
| 147 | .driver = { | 167 | .driver = { |
| 148 | .name = "vsc73xx-platform", | 168 | .name = "vsc73xx-platform", |
| 149 | .of_match_table = vsc73xx_of_match, | 169 | .of_match_table = vsc73xx_of_match, |
| @@ -163,7 +163,26 @@ static int vsc73xx_spi_remove(struct spi_device *spi) · 162 unmodified lines | |||
| 163 | { | 163 | { |
| 164 | struct vsc73xx_spi *vsc_spi = spi_get_drvdata(spi); | 164 | struct vsc73xx_spi *vsc_spi = spi_get_drvdata(spi); |
| 165 | 165 | ||
| 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); | ||
| 167 | } | 186 | } |
| 168 | 187 | ||
| 169 | static const struct vsc73xx_ops vsc73xx_spi_ops = { | 188 | static const struct vsc73xx_ops vsc73xx_spi_ops = { |
| @@ -191,6 +210,7 @@ MODULE_DEVICE_TABLE(of, vsc73xx_of_match); · 21 unmodified lines | |||
| 191 | static struct spi_driver vsc73xx_spi_driver = { | 210 | static struct spi_driver vsc73xx_spi_driver = { |
| 192 | .probe = vsc73xx_spi_probe, | 211 | .probe = vsc73xx_spi_probe, |
| 193 | .remove = vsc73xx_spi_remove, | 212 | .remove = vsc73xx_spi_remove, |
| 213 | .shutdown = vsc73xx_spi_shutdown, | ||
| 194 | .driver = { | 214 | .driver = { |
| 195 | .name = "vsc73xx-spi", | 215 | .name = "vsc73xx-spi", |
| 196 | .of_match_table = vsc73xx_of_match, | 216 | .of_match_table = vsc73xx_of_match, |
| @@ -27,3 +27,4 @@ struct vsc73xx_ops { · 26 unmodified lines | |||
| 27 | int vsc73xx_is_addr_valid(u8 block, u8 subblock); | 27 | int vsc73xx_is_addr_valid(u8 block, u8 subblock); |
| 28 | int vsc73xx_probe(struct vsc73xx *vsc); | 28 | int vsc73xx_probe(struct vsc73xx *vsc); |
| 29 | int vsc73xx_remove(struct vsc73xx *vsc); | 29 | int vsc73xx_remove(struct vsc73xx *vsc); |
| 30 | void vsc73xx_shutdown(struct vsc73xx *vsc); | ||
| @@ -822,6 +822,12 @@ void xrs700x_switch_remove(struct xrs700x *priv) · 821 unmodified lines | |||
| 822 | } | 822 | } |
| 823 | EXPORT_SYMBOL(xrs700x_switch_remove); | 823 | EXPORT_SYMBOL(xrs700x_switch_remove); |
| 824 | 824 | ||
| 825 | void xrs700x_switch_shutdown(struct xrs700x *priv) | ||
| 826 | { | ||
| 827 | dsa_switch_shutdown(priv->ds); | ||
| 828 | } | ||
| 829 | EXPORT_SYMBOL(xrs700x_switch_shutdown); | ||
| 830 | |||
| 825 | MODULE_AUTHOR("George McCollister <george.mccollister@gmail.com>"); | 831 | MODULE_AUTHOR("George McCollister <george.mccollister@gmail.com>"); |
| 826 | MODULE_DESCRIPTION("Arrow SpeedChips XRS700x DSA driver"); | 832 | MODULE_DESCRIPTION("Arrow SpeedChips XRS700x DSA driver"); |
| 827 | MODULE_LICENSE("GPL v2"); | 833 | MODULE_LICENSE("GPL v2"); |
| @@ -40,3 +40,4 @@ struct xrs700x { · 39 unmodified lines | |||
| 40 | struct xrs700x *xrs700x_switch_alloc(struct device *base, void *devpriv); | 40 | struct xrs700x *xrs700x_switch_alloc(struct device *base, void *devpriv); |
| 41 | int xrs700x_switch_register(struct xrs700x *priv); | 41 | int xrs700x_switch_register(struct xrs700x *priv); |
| 42 | void xrs700x_switch_remove(struct xrs700x *priv); | 42 | void xrs700x_switch_remove(struct xrs700x *priv); |
| 43 | void xrs700x_switch_shutdown(struct xrs700x *priv); | ||
| @@ -109,11 +109,28 @@ static int xrs700x_i2c_remove(struct i2c_client *i2c) · 108 unmodified lines | |||
| 109 | { | 109 | { |
| 110 | struct xrs700x *priv = i2c_get_clientdata(i2c); | 110 | struct xrs700x *priv = i2c_get_clientdata(i2c); |
| 111 | 111 | ||
| 112 | if (!priv) | ||
| 113 | return 0; | ||
| 114 | |||
| 112 | xrs700x_switch_remove(priv); | 115 | xrs700x_switch_remove(priv); |
| 113 | 116 | ||
| 117 | i2c_set_clientdata(i2c, NULL); | ||
| 118 | |||
| 114 | return 0; | 119 | return 0; |
| 115 | } | 120 | } |
| 116 | 121 | ||
| 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 | |||
| 117 | static const struct i2c_device_id xrs700x_i2c_id[] = { | 134 | static const struct i2c_device_id xrs700x_i2c_id[] = { |
| 118 | { "xrs700x-switch", 0 }, | 135 | { "xrs700x-switch", 0 }, |
| 119 | {}, | 136 | {}, |
| @@ -137,6 +154,7 @@ static struct i2c_driver xrs700x_i2c_driver = { · 17 unmodified lines | |||
| 137 | }, | 154 | }, |
| 138 | .probe = xrs700x_i2c_probe, | 155 | .probe = xrs700x_i2c_probe, |
| 139 | .remove = xrs700x_i2c_remove, | 156 | .remove = xrs700x_i2c_remove, |
| 157 | .shutdown = xrs700x_i2c_shutdown, | ||
| 140 | .id_table = xrs700x_i2c_id, | 158 | .id_table = xrs700x_i2c_id, |
| 141 | }; | 159 | }; |
| 142 | 160 | ||
| @@ -136,7 +136,24 @@ static void xrs700x_mdio_remove(struct mdio_device *mdiodev) · 135 unmodified lines | |||
| 136 | { | 136 | { |
| 137 | struct xrs700x *priv = dev_get_drvdata(&mdiodev->dev); | 137 | struct xrs700x *priv = dev_get_drvdata(&mdiodev->dev); |
| 138 | 138 | ||
| 139 | if (!priv) | ||
| 140 | return; | ||
| 141 | |||
| 139 | xrs700x_switch_remove(priv); | 142 | 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); | ||
| 140 | } | 157 | } |
| 141 | 158 | ||
| 142 | static const struct of_device_id __maybe_unused xrs700x_mdio_dt_ids[] = { | 159 | 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 | |||
| 155 | }, | 172 | }, |
| 156 | .probe = xrs700x_mdio_probe, | 173 | .probe = xrs700x_mdio_probe, |
| 157 | .remove = xrs700x_mdio_remove, | 174 | .remove = xrs700x_mdio_remove, |
| 175 | .shutdown = xrs700x_mdio_shutdown, | ||
| 158 | }; | 176 | }; |
| 159 | 177 | ||
| 160 | mdio_module_driver(xrs700x_mdio_driver); | 178 | mdio_module_driver(xrs700x_mdio_driver); |
| @@ -413,13 +413,13 @@ static int atl_resume_common(struct device *dev, bool deep) · 412 unmodified lines | |||
| 413 | if (deep) { | 413 | if (deep) { |
| 414 | /* Reinitialize Nic/Vecs objects */ | 414 | /* Reinitialize Nic/Vecs objects */ |
| 415 | aq_nic_deinit(nic, !nic->aq_hw->aq_nic_cfg->wol); | 415 | aq_nic_deinit(nic, !nic->aq_hw->aq_nic_cfg->wol); |
| 416 | } | ||
| 416 | 417 | ||
| 418 | if (netif_running(nic->ndev)) { | ||
| 417 | ret = aq_nic_init(nic); | 419 | ret = aq_nic_init(nic); |
| 418 | if (ret) | 420 | if (ret) |
| 419 | goto err_exit; | 421 | goto err_exit; |
| 420 | } | ||
| 421 | 422 | ||
| 422 | if (netif_running(nic->ndev)) { | ||
| 423 | ret = aq_nic_start(nic); | 423 | ret = aq_nic_start(nic); |
| 424 | if (ret) | 424 | if (ret) |
| 425 | goto err_exit; | 425 | goto err_exit; |
| @@ -129,6 +129,8 @@ static int bgmac_probe(struct bcma_device *core) · 128 unmodified lines | |||
| 129 | bcma_set_drvdata(core, bgmac); | 129 | bcma_set_drvdata(core, bgmac); |
| 130 | 130 | ||
| 131 | err = of_get_mac_address(bgmac->dev->of_node, bgmac->net_dev->dev_addr); | 131 | err = of_get_mac_address(bgmac->dev->of_node, bgmac->net_dev->dev_addr); |
| 132 | if (err == -EPROBE_DEFER) | ||
| 133 | return err; | ||
| 132 | 134 | ||
| 133 | /* If no MAC address assigned via device tree, check SPROM */ | 135 | /* If no MAC address assigned via device tree, check SPROM */ |
| 134 | if (err) { | 136 | if (err) { |
| @@ -391,7 +391,7 @@ static bool bnxt_txr_netif_try_stop_queue(struct bnxt *bp, · 390 unmodified lines | |||
| 391 | * netif_tx_queue_stopped(). | 391 | * netif_tx_queue_stopped(). |
| 392 | */ | 392 | */ |
| 393 | smp_mb(); | 393 | smp_mb(); |
| 394 | if (bnxt_tx_avail(bp, txr) > bp->tx_wake_thresh) { | 394 | if (bnxt_tx_avail(bp, txr) >= bp->tx_wake_thresh) { |
| 395 | netif_tx_wake_queue(txq); | 395 | netif_tx_wake_queue(txq); |
| 396 | return false; | 396 | return false; |
| 397 | } | 397 | } |
| @@ -764,7 +764,7 @@ next_tx_int: · 366 unmodified lines | |||
| 764 | smp_mb(); | 764 | smp_mb(); |
| 765 | 765 | ||
| 766 | if (unlikely(netif_tx_queue_stopped(txq)) && | 766 | 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 && |
| 768 | READ_ONCE(txr->dev_state) != BNXT_DEV_STATE_CLOSING) | 768 | READ_ONCE(txr->dev_state) != BNXT_DEV_STATE_CLOSING) |
| 769 | netif_tx_wake_queue(txq); | 769 | netif_tx_wake_queue(txq); |
| 770 | } | 770 | } |
| @@ -2416,7 +2416,7 @@ static int __bnxt_poll_work(struct bnxt *bp, struct bnxt_cp_ring_info *cpr, · 1645 unmodified lines | |||
| 2416 | if (TX_CMP_TYPE(txcmp) == CMP_TYPE_TX_L2_CMP) { | 2416 | if (TX_CMP_TYPE(txcmp) == CMP_TYPE_TX_L2_CMP) { |
| 2417 | tx_pkts++; | 2417 | tx_pkts++; |
| 2418 | /* return full budget so NAPI will complete. */ | 2418 | /* 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)) { |
| 2420 | rx_pkts = budget; | 2420 | rx_pkts = budget; |
| 2421 | raw_cons = NEXT_RAW_CMP(raw_cons); | 2421 | raw_cons = NEXT_RAW_CMP(raw_cons); |
| 2422 | if (budget) | 2422 | if (budget) |
| @@ -3640,7 +3640,7 @@ static int bnxt_init_tx_rings(struct bnxt *bp) · 1217 unmodified lines | |||
| 3640 | u16 i; | 3640 | u16 i; |
| 3641 | 3641 | ||
| 3642 | bp->tx_wake_thresh = max_t(int, bp->tx_ring_size / 2, | 3642 | bp->tx_wake_thresh = max_t(int, bp->tx_ring_size / 2, |
| 3643 | MAX_SKB_FRAGS + 1); | 3643 | BNXT_MIN_TX_DESC_CNT); |
| 3644 | 3644 | ||
| 3645 | for (i = 0; i < bp->tx_nr_rings; i++) { | 3645 | for (i = 0; i < bp->tx_nr_rings; i++) { |
| 3646 | struct bnxt_tx_ring_info *txr = &bp->tx_ring[i]; | 3646 | struct bnxt_tx_ring_info *txr = &bp->tx_ring[i]; |
| @@ -629,6 +629,11 @@ struct nqe_cn { · 628 unmodified lines | |||
| 629 | #define BNXT_MAX_RX_JUM_DESC_CNT (RX_DESC_CNT * MAX_RX_AGG_PAGES - 1) | 629 | #define BNXT_MAX_RX_JUM_DESC_CNT (RX_DESC_CNT * MAX_RX_AGG_PAGES - 1) |
| 630 | #define BNXT_MAX_TX_DESC_CNT (TX_DESC_CNT * MAX_TX_PAGES - 1) | 630 | #define BNXT_MAX_TX_DESC_CNT (TX_DESC_CNT * MAX_TX_PAGES - 1) |
| 631 | 631 | ||
| 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 | |||
| 632 | #define RX_RING(x) (((x) & ~(RX_DESC_CNT - 1)) >> (BNXT_PAGE_SHIFT - 4)) | 637 | #define RX_RING(x) (((x) & ~(RX_DESC_CNT - 1)) >> (BNXT_PAGE_SHIFT - 4)) |
| 633 | #define RX_IDX(x) ((x) & (RX_DESC_CNT - 1)) | 638 | #define RX_IDX(x) ((x) & (RX_DESC_CNT - 1)) |
| 634 | 639 | ||
| @@ -798,7 +798,7 @@ static int bnxt_set_ringparam(struct net_device *dev, · 797 unmodified lines | |||
| 798 | 798 | ||
| 799 | if ((ering->rx_pending > BNXT_MAX_RX_DESC_CNT) || | 799 | if ((ering->rx_pending > BNXT_MAX_RX_DESC_CNT) || |
| 800 | (ering->tx_pending > BNXT_MAX_TX_DESC_CNT) || | 800 | (ering->tx_pending > BNXT_MAX_TX_DESC_CNT) || |
| 801 | (ering->tx_pending <= MAX_SKB_FRAGS)) | 801 | (ering->tx_pending < BNXT_MIN_TX_DESC_CNT)) |
| 802 | return -EINVAL; | 802 | return -EINVAL; |
| 803 | 803 | ||
| 804 | if (netif_running(dev)) | 804 | if (netif_running(dev)) |
| @@ -419,7 +419,7 @@ static void enetc_rx_dim_work(struct work_struct *w) · 418 unmodified lines | |||
| 419 | 419 | ||
| 420 | static void enetc_rx_net_dim(struct enetc_int_vector *v) | 420 | static void enetc_rx_net_dim(struct enetc_int_vector *v) |
| 421 | { | 421 | { |
| 422 | struct dim_sample dim_sample; | 422 | struct dim_sample dim_sample = {}; |
| 423 | 423 | ||
| 424 | v->comp_cnt++; | 424 | v->comp_cnt++; |
| 425 | 425 | ||
| @@ -1879,7 +1879,6 @@ static void enetc_clear_bdrs(struct enetc_ndev_priv *priv) · 1453 unmodified lines | |||
| 1879 | static int enetc_setup_irqs(struct enetc_ndev_priv *priv) | 1879 | static int enetc_setup_irqs(struct enetc_ndev_priv *priv) |
| 1880 | { | 1880 | { |
| 1881 | struct pci_dev *pdev = priv->si->pdev; | 1881 | struct pci_dev *pdev = priv->si->pdev; |
| 1882 | cpumask_t cpu_mask; | ||
| 1883 | int i, j, err; | 1882 | int i, j, err; |
| 1884 | 1883 | ||
| 1885 | for (i = 0; i < priv->bdr_int_num; i++) { | 1884 | 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 | |||
| 1908 | 1907 | ||
| 1909 | enetc_wr(hw, ENETC_SIMSITRV(idx), entry); | 1908 | enetc_wr(hw, ENETC_SIMSITRV(idx), entry); |
| 1910 | } | 1909 | } |
| 1911 | cpumask_clear(&cpu_mask); | 1910 | irq_set_affinity_hint(irq, get_cpu_mask(i % num_online_cpus())); |
| 1912 | cpumask_set_cpu(i % num_online_cpus(), &cpu_mask); | ||
| 1913 | irq_set_affinity_hint(irq, &cpu_mask); | ||
| 1914 | } | 1911 | } |
| 1915 | 1912 | ||
| 1916 | return 0; | 1913 | return 0; |
| @@ -1,5 +1,5 @@ | |||
| 1 | // SPDX-License-Identifier: (GPL-2.0+ OR BSD-3-Clause) | 1 | // SPDX-License-Identifier: (GPL-2.0+ OR BSD-3-Clause) |
| 2 | /* Copyright 2021 NXP Semiconductors | 2 | /* Copyright 2021 NXP |
| 3 | * | 3 | * |
| 4 | * The Integrated Endpoint Register Block (IERB) is configured by pre-boot | 4 | * The Integrated Endpoint Register Block (IERB) is configured by pre-boot |
| 5 | * software and is supposed to be to ENETC what a NVRAM is to a 'real' PCIe | 5 | * software and is supposed to be to ENETC what a NVRAM is to a 'real' PCIe |
| @@ -1,5 +1,5 @@ | |||
| 1 | /* SPDX-License-Identifier: (GPL-2.0+ OR BSD-3-Clause) */ | 1 | /* SPDX-License-Identifier: (GPL-2.0+ OR BSD-3-Clause) */ |
| 2 | /* Copyright 2021 NXP Semiconductors */ | 2 | /* Copyright 2021 NXP */ |
| 3 | 3 | ||
| 4 | #include <linux/pci.h> | 4 | #include <linux/pci.h> |
| 5 | #include <linux/platform_device.h> | 5 | #include <linux/platform_device.h> |
| @@ -4176,5 +4176,4 @@ static struct platform_driver fec_driver = { · 4175 unmodified lines | |||
| 4176 | 4176 | ||
| 4177 | module_platform_driver(fec_driver); | 4177 | module_platform_driver(fec_driver); |
| 4178 | 4178 | ||
| 4179 | MODULE_ALIAS("platform:"DRIVER_NAME); | ||
| 4180 | MODULE_LICENSE("GPL"); | 4179 | MODULE_LICENSE("GPL"); |
| @@ -2445,12 +2445,12 @@ static void hclge_handle_over_8bd_err(struct hclge_dev *hdev, · 2444 unmodified lines | |||
| 2445 | return; | 2445 | return; |
| 2446 | } | 2446 | } |
| 2447 | 2447 | ||
| 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", |
| 2449 | vf_id, q_id); | 2449 | vf_id, q_id); |
| 2450 | 2450 | ||
| 2451 | if (vf_id) { | 2451 | if (vf_id) { |
| 2452 | if (vf_id >= hdev->num_alloc_vport) { | 2452 | 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); |
| 2454 | return; | 2454 | return; |
| 2455 | } | 2455 | } |
| 2456 | 2456 | ||
| @@ -2463,8 +2463,8 @@ static void hclge_handle_over_8bd_err(struct hclge_dev *hdev, · 6 unmodified lines | |||
| 2463 | 2463 | ||
| 2464 | ret = hclge_inform_reset_assert_to_vf(&hdev->vport[vf_id]); | 2464 | ret = hclge_inform_reset_assert_to_vf(&hdev->vport[vf_id]); |
| 2465 | if (ret) | 2465 | if (ret) |
| 2466 | dev_err(dev, "inform reset to vf(%u) failed %d!\n", | 2466 | dev_err(dev, "inform reset to vport(%u) failed %d!\n", |
| 2467 | hdev->vport->vport_id, ret); | 2467 | vf_id, ret); |
| 2468 | } else { | 2468 | } else { |
| 2469 | set_bit(HNAE3_FUNC_RESET, reset_requests); | 2469 | set_bit(HNAE3_FUNC_RESET, reset_requests); |
| 2470 | } | 2470 | } |
| @@ -3661,7 +3661,8 @@ static int hclge_set_all_vf_rst(struct hclge_dev *hdev, bool reset) · 3660 unmodified lines | |||
| 3661 | if (ret) { | 3661 | if (ret) { |
| 3662 | dev_err(&hdev->pdev->dev, | 3662 | dev_err(&hdev->pdev->dev, |
| 3663 | "set vf(%u) rst failed %d!\n", | 3663 | "set vf(%u) rst failed %d!\n", |
| 3664 | vport->vport_id, ret); | 3664 | vport->vport_id - HCLGE_VF_VPORT_START_NUM, |
| 3665 | ret); | ||
| 3665 | return ret; | 3666 | return ret; |
| 3666 | } | 3667 | } |
| 3667 | 3668 | ||
| @@ -3676,7 +3677,8 @@ static int hclge_set_all_vf_rst(struct hclge_dev *hdev, bool reset) · 8 unmodified lines | |||
| 3676 | if (ret) | 3677 | if (ret) |
| 3677 | dev_warn(&hdev->pdev->dev, | 3678 | dev_warn(&hdev->pdev->dev, |
| 3678 | "inform reset to vf(%u) failed %d!\n", | 3679 | "inform reset to vf(%u) failed %d!\n", |
| 3679 | vport->vport_id, ret); | 3680 | vport->vport_id - HCLGE_VF_VPORT_START_NUM, |
| 3681 | ret); | ||
| 3680 | } | 3682 | } |
| 3681 | 3683 | ||
| 3682 | return 0; | 3684 | return 0; |
| @@ -4741,6 +4743,24 @@ static int hclge_get_rss(struct hnae3_handle *handle, u32 *indir, · 1058 unmodified lines | |||
| 4741 | return 0; | 4743 | return 0; |
| 4742 | } | 4744 | } |
| 4743 | 4745 | ||
| 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 | |||
| 4744 | static int hclge_set_rss(struct hnae3_handle *handle, const u32 *indir, | 4764 | static int hclge_set_rss(struct hnae3_handle *handle, const u32 *indir, |
| 4745 | const u8 *key, const u8 hfunc) | 4765 | const u8 *key, const u8 hfunc) |
| 4746 | { | 4766 | { |
| @@ -4750,30 +4770,27 @@ static int hclge_set_rss(struct hnae3_handle *handle, const u32 *indir, · 3 unmodified lines | |||
| 4750 | u8 hash_algo; | 4770 | u8 hash_algo; |
| 4751 | int ret, i; | 4771 | int ret, i; |
| 4752 | 4772 | ||
| 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 | |||
| 4753 | /* Set the RSS Hash Key if specififed by the user */ | 4779 | /* Set the RSS Hash Key if specififed by the user */ |
| 4754 | if (key) { | 4780 | 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 | |||
| 4769 | ret = hclge_set_rss_algo_key(hdev, hash_algo, key); | 4781 | ret = hclge_set_rss_algo_key(hdev, hash_algo, key); |
| 4770 | if (ret) | 4782 | if (ret) |
| 4771 | return ret; | 4783 | return ret; |
| 4772 | 4784 | ||
| 4773 | /* Update the shadow RSS key with user specified qids */ | 4785 | /* Update the shadow RSS key with user specified qids */ |
| 4774 | memcpy(vport->rss_hash_key, key, HCLGE_RSS_KEY_SIZE); | 4786 | 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; | ||
| 4776 | } | 4792 | } |
| 4793 | vport->rss_algo = hash_algo; | ||
| 4777 | 4794 | ||
| 4778 | /* Update the shadow RSS table with user specified qids */ | 4795 | /* Update the shadow RSS table with user specified qids */ |
| 4779 | for (i = 0; i < ae_dev->dev_specs.rss_ind_tbl_size; i++) | 4796 | 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 | |||
| 6627 | u8 vf = ethtool_get_flow_spec_ring_vf(ring_cookie); | 6644 | u8 vf = ethtool_get_flow_spec_ring_vf(ring_cookie); |
| 6628 | u16 tqps; | 6645 | u16 tqps; |
| 6629 | 6646 | ||
| 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 | */ | ||
| 6630 | if (vf > hdev->num_req_vfs) { | 6650 | if (vf > hdev->num_req_vfs) { |
| 6631 | dev_err(&hdev->pdev->dev, | 6651 | dev_err(&hdev->pdev->dev, |
| 6632 | "Error: vf id (%u) > max vf num (%u)\n", | 6652 | "Error: vf id (%u) should be less than %u\n", |
| 6633 | vf, hdev->num_req_vfs); | 6653 | vf - 1, hdev->num_req_vfs); |
| 6634 | return -EINVAL; | 6654 | return -EINVAL; |
| 6635 | } | 6655 | } |
| 6636 | 6656 | ||
| @@ -9797,6 +9817,9 @@ static int hclge_set_vlan_filter_hw(struct hclge_dev *hdev, __be16 proto, · 3160 unmodified lines | |||
| 9797 | if (is_kill && !vlan_id) | 9817 | if (is_kill && !vlan_id) |
| 9798 | return 0; | 9818 | return 0; |
| 9799 | 9819 | ||
| 9820 | if (vlan_id >= VLAN_N_VID) | ||
| 9821 | return -EINVAL; | ||
| 9822 | |||
| 9800 | ret = hclge_set_vf_vlan_common(hdev, vport_id, is_kill, vlan_id); | 9823 | ret = hclge_set_vf_vlan_common(hdev, vport_id, is_kill, vlan_id); |
| 9801 | if (ret) { | 9824 | if (ret) { |
| 9802 | dev_err(&hdev->pdev->dev, | 9825 | 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 | |||
| 10703 | return 0; | 10726 | return 0; |
| 10704 | } | 10727 | } |
| 10705 | 10728 | ||
| 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) | ||
| 10707 | { | 10731 | { |
| 10708 | struct hclge_reset_tqp_queue_cmd *req; | 10732 | struct hclge_reset_tqp_queue_cmd *req; |
| 10709 | struct hclge_desc desc; | 10733 | struct hclge_desc desc; |
| @@ -10721,7 +10745,9 @@ static int hclge_get_reset_status(struct hclge_dev *hdev, u16 queue_id) · 11 unmodified lines | |||
| 10721 | return ret; | 10745 | return ret; |
| 10722 | } | 10746 | } |
| 10723 | 10747 | ||
| 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; | ||
| 10725 | } | 10751 | } |
| 10726 | 10752 | ||
| 10727 | u16 hclge_covert_handle_qid_global(struct hnae3_handle *handle, u16 queue_id) | 10753 | 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 | |||
| 10740 | struct hclge_vport *vport = hclge_get_vport(handle); | 10766 | struct hclge_vport *vport = hclge_get_vport(handle); |
| 10741 | struct hclge_dev *hdev = vport->back; | 10767 | struct hclge_dev *hdev = vport->back; |
| 10742 | u16 reset_try_times = 0; | 10768 | u16 reset_try_times = 0; |
| 10743 | int reset_status; | 10769 | u8 reset_status; |
| 10744 | u16 queue_gid; | 10770 | u16 queue_gid; |
| 10745 | int ret; | 10771 | int ret; |
| 10746 | u16 i; | 10772 | u16 i; |
| @@ -10756,7 +10782,11 @@ static int hclge_reset_tqp_cmd(struct hnae3_handle *handle) · 9 unmodified lines | |||
| 10756 | } | 10782 | } |
| 10757 | 10783 | ||
| 10758 | while (reset_try_times++ < HCLGE_TQP_RESET_TRY_TIMES) { | 10784 | 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 | |||
| 10760 | if (reset_status) | 10790 | if (reset_status) |
| 10761 | break; | 10791 | break; |
| 10762 | 10792 | ||
| @@ -11449,11 +11479,11 @@ static void hclge_clear_resetting_state(struct hclge_dev *hdev) · 686 unmodified lines | |||
| 11449 | struct hclge_vport *vport = &hdev->vport[i]; | 11479 | struct hclge_vport *vport = &hdev->vport[i]; |
| 11450 | int ret; | 11480 | int ret; |
| 11451 | 11481 | ||
| 11452 | /* Send cmd to clear VF's FUNC_RST_ING */ | 11482 | /* Send cmd to clear vport's FUNC_RST_ING */ |
| 11453 | ret = hclge_set_vf_rst(hdev, vport->vport_id, false); | 11483 | ret = hclge_set_vf_rst(hdev, vport->vport_id, false); |
| 11454 | if (ret) | 11484 | if (ret) |
| 11455 | dev_warn(&hdev->pdev->dev, | 11485 | dev_warn(&hdev->pdev->dev, |
| 11456 | "clear vf(%u) rst failed %d!\n", | 11486 | "clear vport(%u) rst failed %d!\n", |
| 11457 | vport->vport_id, ret); | 11487 | vport->vport_id, ret); |
| 11458 | } | 11488 | } |
| 11459 | } | 11489 | } |
| @@ -566,7 +566,7 @@ static int hclge_reset_vf(struct hclge_vport *vport) · 565 unmodified lines | |||
| 566 | struct hclge_dev *hdev = vport->back; | 566 | struct hclge_dev *hdev = vport->back; |
| 567 | 567 | ||
| 568 | dev_warn(&hdev->pdev->dev, "PF received VF reset request from VF %u!", | 568 | 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); |
| 570 | 570 | ||
| 571 | return hclge_func_reset_cmd(hdev, vport->vport_id); | 571 | return hclge_func_reset_cmd(hdev, vport->vport_id); |
| 572 | } | 572 | } |
| @@ -590,9 +590,17 @@ static void hclge_get_queue_id_in_pf(struct hclge_vport *vport, · 17 unmodified lines | |||
| 590 | struct hclge_mbx_vf_to_pf_cmd *mbx_req, | 590 | struct hclge_mbx_vf_to_pf_cmd *mbx_req, |
| 591 | struct hclge_respond_to_vf_msg *resp_msg) | 591 | struct hclge_respond_to_vf_msg *resp_msg) |
| 592 | { | 592 | { |
| 593 | struct hnae3_handle *handle = &vport->nic; | ||
| 594 | struct hclge_dev *hdev = vport->back; | ||
| 593 | u16 queue_id, qid_in_pf; | 595 | u16 queue_id, qid_in_pf; |
| 594 | 596 | ||
| 595 | memcpy(&queue_id, mbx_req->msg.data, sizeof(queue_id)); | 597 | 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 | |||
| 596 | qid_in_pf = hclge_covert_handle_qid_global(&vport->nic, queue_id); | 604 | qid_in_pf = hclge_covert_handle_qid_global(&vport->nic, queue_id); |
| 597 | memcpy(resp_msg->data, &qid_in_pf, sizeof(qid_in_pf)); | 605 | memcpy(resp_msg->data, &qid_in_pf, sizeof(qid_in_pf)); |
| 598 | resp_msg->len = sizeof(qid_in_pf); | 606 | resp_msg->len = sizeof(qid_in_pf); |
| @@ -581,7 +581,7 @@ int hclge_tm_qs_shaper_cfg(struct hclge_vport *vport, int max_tx_rate) · 580 unmodified lines | |||
| 581 | ret = hclge_cmd_send(&hdev->hw, &desc, 1); | 581 | ret = hclge_cmd_send(&hdev->hw, &desc, 1); |
| 582 | if (ret) { | 582 | if (ret) { |
| 583 | dev_err(&hdev->pdev->dev, | 583 | 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", |
| 585 | vport->vport_id, shap_cfg_cmd->qs_id, | 585 | vport->vport_id, shap_cfg_cmd->qs_id, |
| 586 | max_tx_rate, ret); | 586 | max_tx_rate, ret); |
| 587 | return ret; | 587 | return ret; |
| @@ -816,40 +816,56 @@ static int hclgevf_get_rss(struct hnae3_handle *handle, u32 *indir, u8 *key, · 815 unmodified lines | |||
| 816 | return 0; | 816 | return 0; |
| 817 | } | 817 | } |
| 818 | 818 | ||
| 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 | |||
| 819 | static int hclgevf_set_rss(struct hnae3_handle *handle, const u32 *indir, | 837 | static int hclgevf_set_rss(struct hnae3_handle *handle, const u32 *indir, |
| 820 | const u8 *key, const u8 hfunc) | 838 | const u8 *key, const u8 hfunc) |
| 821 | { | 839 | { |
| 822 | struct hclgevf_dev *hdev = hclgevf_ae_get_hdev(handle); | 840 | struct hclgevf_dev *hdev = hclgevf_ae_get_hdev(handle); |
| 823 | struct hclgevf_rss_cfg *rss_cfg = &hdev->rss_cfg; | 841 | struct hclgevf_rss_cfg *rss_cfg = &hdev->rss_cfg; |
| 842 | u8 hash_algo; | ||
| 824 | int ret, i; | 843 | int ret, i; |
| 825 | 844 | ||
| 826 | if (hdev->ae_dev->dev_version >= HNAE3_DEVICE_VERSION_V2) { | 845 | 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 | |||
| 827 | /* Set the RSS Hash Key if specififed by the user */ | 850 | /* Set the RSS Hash Key if specififed by the user */ |
| 828 | if (key) { | 851 | if (key) { |
| 829 | switch (hfunc) { | 852 | ret = hclgevf_set_rss_algo_key(hdev, hash_algo, key); |
| 830 | case ETH_RSS_HASH_TOP: | 853 | if (ret) { |
| 831 | rss_cfg->hash_algo = | 854 | dev_err(&hdev->pdev->dev, |
| 832 | HCLGEVF_RSS_HASH_ALGO_TOEPLITZ; | 855 | "invalid hfunc type %u\n", hfunc); |
| 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) | ||
| 847 | return ret; | 856 | return ret; |
| 857 | } | ||
| 848 | 858 | ||
| 849 | /* Update the shadow RSS key with user specified qids */ | 859 | /* Update the shadow RSS key with user specified qids */ |
| 850 | memcpy(rss_cfg->rss_hash_key, key, | 860 | memcpy(rss_cfg->rss_hash_key, key, |
| 851 | HCLGEVF_RSS_KEY_SIZE); | 861 | 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; | ||
| 852 | } | 867 | } |
| 868 | rss_cfg->hash_algo = hash_algo; | ||
| 853 | } | 869 | } |
| 854 | 870 | ||
| 855 | /* update the shadow RSS table with user specified qids */ | 871 | /* update the shadow RSS table with user specified qids */ |
| @@ -335,6 +335,7 @@ config IGC · 334 unmodified lines | |||
| 335 | tristate "Intel(R) Ethernet Controller I225-LM/I225-V support" | 335 | tristate "Intel(R) Ethernet Controller I225-LM/I225-V support" |
| 336 | default n | 336 | default n |
| 337 | depends on PCI | 337 | depends on PCI |
| 338 | depends on PTP_1588_CLOCK_OPTIONAL | ||
| 338 | help | 339 | help |
| 339 | This driver supports Intel(R) Ethernet Controller I225-LM/I225-V | 340 | This driver supports Intel(R) Ethernet Controller I225-LM/I225-V |
| 340 | family of adapters. | 341 | family of adapters. |
| @@ -186,6 +186,9 @@ mtk_flow_offload_replace(struct mtk_eth *eth, struct flow_cls_offload *f) · 185 unmodified lines | |||
| 186 | int hash; | 186 | int hash; |
| 187 | int i; | 187 | int i; |
| 188 | 188 | ||
| 189 | if (rhashtable_lookup(ð->flow_table, &f->cookie, mtk_flow_ht_params)) | ||
| 190 | return -EEXIST; | ||
| 191 | |||
| 189 | if (flow_rule_match_key(rule, FLOW_DISSECTOR_KEY_META)) { | 192 | if (flow_rule_match_key(rule, FLOW_DISSECTOR_KEY_META)) { |
| 190 | struct flow_match_meta match; | 193 | struct flow_match_meta match; |
| 191 | 194 | ||
| @@ -372,6 +372,9 @@ mlx4_en_filter_rfs(struct net_device *net_dev, const struct sk_buff *skb, · 371 unmodified lines | |||
| 372 | int nhoff = skb_network_offset(skb); | 372 | int nhoff = skb_network_offset(skb); |
| 373 | int ret = 0; | 373 | int ret = 0; |
| 374 | 374 | ||
| 375 | if (skb->encapsulation) | ||
| 376 | return -EPROTONOSUPPORT; | ||
| 377 | |||
| 375 | if (skb->protocol != htons(ETH_P_IP)) | 378 | if (skb->protocol != htons(ETH_P_IP)) |
| 376 | return -EPROTONOSUPPORT; | 379 | return -EPROTONOSUPPORT; |
| 377 | 380 | ||
| @@ -1269,7 +1272,6 @@ static void mlx4_en_do_set_rx_mode(struct work_struct *work) · 891 unmodified lines | |||
| 1269 | if (!netif_carrier_ok(dev)) { | 1272 | if (!netif_carrier_ok(dev)) { |
| 1270 | if (!mlx4_en_QUERY_PORT(mdev, priv->port)) { | 1273 | if (!mlx4_en_QUERY_PORT(mdev, priv->port)) { |
| 1271 | if (priv->port_state.link_state) { | 1274 | if (priv->port_state.link_state) { |
| 1272 | priv->last_link_state = MLX4_DEV_EVENT_PORT_UP; | ||
| 1273 | netif_carrier_on(dev); | 1275 | netif_carrier_on(dev); |
| 1274 | en_dbg(LINK, priv, "Link Up\n"); | 1276 | en_dbg(LINK, priv, "Link Up\n"); |
| 1275 | } | 1277 | } |
| @@ -1557,26 +1559,36 @@ static void mlx4_en_service_task(struct work_struct *work) · 281 unmodified lines | |||
| 1557 | mutex_unlock(&mdev->state_lock); | 1559 | mutex_unlock(&mdev->state_lock); |
| 1558 | } | 1560 | } |
| 1559 | 1561 | ||
| 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) | ||
| 1561 | { | 1585 | { |
| 1562 | struct mlx4_en_priv *priv = container_of(work, struct mlx4_en_priv, | 1586 | struct mlx4_en_priv *priv = container_of(work, struct mlx4_en_priv, |
| 1563 | linkstate_task); | 1587 | linkstate_task); |
| 1564 | struct mlx4_en_dev *mdev = priv->mdev; | 1588 | struct mlx4_en_dev *mdev = priv->mdev; |
| 1565 | int linkstate = priv->link_state; | ||
| 1566 | 1589 | ||
| 1567 | mutex_lock(&mdev->state_lock); | 1590 | mutex_lock(&mdev->state_lock); |
| 1568 | /* If observable port state changed set carrier state and | 1591 | mlx4_en_linkstate(priv); |
| 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; | ||
| 1580 | mutex_unlock(&mdev->state_lock); | 1592 | mutex_unlock(&mdev->state_lock); |
| 1581 | } | 1593 | } |
| 1582 | 1594 | ||
| @@ -2079,9 +2091,11 @@ static int mlx4_en_open(struct net_device *dev) · 496 unmodified lines | |||
| 2079 | mlx4_en_clear_stats(dev); | 2091 | mlx4_en_clear_stats(dev); |
| 2080 | 2092 | ||
| 2081 | err = mlx4_en_start_port(dev); | 2093 | err = mlx4_en_start_port(dev); |
| 2082 | if (err) | 2094 | if (err) { |
| 2083 | en_err(priv, "Failed starting port:%d\n", priv->port); | 2095 | en_err(priv, "Failed starting port:%d\n", priv->port); |
| 2084 | 2096 | goto out; | |
| 2097 | } | ||
| 2098 | mlx4_en_linkstate(priv); | ||
| 2085 | out: | 2099 | out: |
| 2086 | mutex_unlock(&mdev->state_lock); | 2100 | mutex_unlock(&mdev->state_lock); |
| 2087 | return err; | 2101 | return err; |
| @@ -3168,7 +3182,7 @@ int mlx4_en_init_netdev(struct mlx4_en_dev *mdev, int port, · 1080 unmodified lines | |||
| 3168 | spin_lock_init(&priv->stats_lock); | 3182 | spin_lock_init(&priv->stats_lock); |
| 3169 | INIT_WORK(&priv->rx_mode_task, mlx4_en_do_set_rx_mode); | 3183 | INIT_WORK(&priv->rx_mode_task, mlx4_en_do_set_rx_mode); |
| 3170 | INIT_WORK(&priv->restart_task, mlx4_en_restart); | 3184 | 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); |
| 3172 | INIT_DELAYED_WORK(&priv->stats_task, mlx4_en_do_get_stats); | 3186 | INIT_DELAYED_WORK(&priv->stats_task, mlx4_en_do_get_stats); |
| 3173 | INIT_DELAYED_WORK(&priv->service_task, mlx4_en_service_task); | 3187 | INIT_DELAYED_WORK(&priv->service_task, mlx4_en_service_task); |
| 3174 | #ifdef CONFIG_RFS_ACCEL | 3188 | #ifdef CONFIG_RFS_ACCEL |
| @@ -552,7 +552,6 @@ struct mlx4_en_priv { · 551 unmodified lines | |||
| 552 | 552 | ||
| 553 | struct mlx4_hwq_resources res; | 553 | struct mlx4_hwq_resources res; |
| 554 | int link_state; | 554 | int link_state; |
| 555 | int last_link_state; | ||
| 556 | bool port_up; | 555 | bool port_up; |
| 557 | int port; | 556 | int port; |
| 558 | int registered; | 557 | int registered; |
| @@ -563,16 +563,6 @@ void ocelot_phylink_mac_link_up(struct ocelot *ocelot, int port, · 562 unmodified lines | |||
| 563 | ocelot_port_writel(ocelot_port, DEV_MAC_ENA_CFG_RX_ENA | | 563 | ocelot_port_writel(ocelot_port, DEV_MAC_ENA_CFG_RX_ENA | |
| 564 | DEV_MAC_ENA_CFG_TX_ENA, DEV_MAC_ENA_CFG); | 564 | DEV_MAC_ENA_CFG_TX_ENA, DEV_MAC_ENA_CFG); |
| 565 | 565 | ||
| 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 | |||
| 576 | /* Core: Enable port for frame transfer */ | 566 | /* Core: Enable port for frame transfer */ |
| 577 | ocelot_fields_write(ocelot, port, | 567 | ocelot_fields_write(ocelot, port, |
| 578 | QSYS_SWITCH_PORT_MODE_PORT_ENA, 1); | 568 | 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 | |||
| 1303 | return mask; | 1293 | return mask; |
| 1304 | } | 1294 | } |
| 1305 | 1295 | ||
| 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, |
| 1307 | struct net_device *bridge) | 1297 | struct net_device *bridge) |
| 1308 | { | 1298 | { |
| 1299 | struct ocelot_port *ocelot_port = ocelot->ports[src_port]; | ||
| 1309 | u32 mask = 0; | 1300 | u32 mask = 0; |
| 1310 | int port; | 1301 | int port; |
| 1311 | 1302 | ||
| 1303 | if (!ocelot_port || ocelot_port->bridge != bridge || | ||
| 1304 | ocelot_port->stp_state != BR_STATE_FORWARDING) | ||
| 1305 | return 0; | ||
| 1306 | |||
| 1312 | for (port = 0; port < ocelot->num_phys_ports; port++) { | 1307 | for (port = 0; port < ocelot->num_phys_ports; port++) { |
| 1313 | struct ocelot_port *ocelot_port = ocelot->ports[port]; | 1308 | ocelot_port = ocelot->ports[port]; |
| 1314 | 1309 | ||
| 1315 | if (!ocelot_port) | 1310 | if (!ocelot_port) |
| 1316 | continue; | 1311 | continue; |
| @@ -1376,7 +1371,7 @@ void ocelot_apply_bridge_fwd_mask(struct ocelot *ocelot) · 59 unmodified lines | |||
| 1376 | struct net_device *bridge = ocelot_port->bridge; | 1371 | struct net_device *bridge = ocelot_port->bridge; |
| 1377 | struct net_device *bond = ocelot_port->bond; | 1372 | struct net_device *bond = ocelot_port->bond; |
| 1378 | 1373 | ||
| 1379 | mask = ocelot_get_bridge_fwd_mask(ocelot, bridge); | 1374 | mask = ocelot_get_bridge_fwd_mask(ocelot, port, bridge); |
| 1380 | mask |= cpu_fwd_mask; | 1375 | mask |= cpu_fwd_mask; |
| 1381 | mask &= ~BIT(port); | 1376 | mask &= ~BIT(port); |
| 1382 | if (bond) { | 1377 | if (bond) { |
| @@ -1,5 +1,5 @@ | |||
| 1 | // SPDX-License-Identifier: (GPL-2.0 OR MIT) | 1 | // SPDX-License-Identifier: (GPL-2.0 OR MIT) |
| 2 | /* Copyright 2020-2021 NXP Semiconductors | 2 | /* Copyright 2020-2021 NXP |
| 3 | */ | 3 | */ |
| 4 | #include <net/devlink.h> | 4 | #include <net/devlink.h> |
| 5 | #include "ocelot.h" | 5 | #include "ocelot.h" |
| @@ -2,7 +2,7 @@ · 1 unmodified line | |||
| 2 | /* Microsemi Ocelot Switch driver | 2 | /* Microsemi Ocelot Switch driver |
| 3 | * | 3 | * |
| 4 | * Copyright (c) 2017, 2019 Microsemi Corporation | 4 | * Copyright (c) 2017, 2019 Microsemi Corporation |
| 5 | * Copyright 2020-2021 NXP Semiconductors | 5 | * Copyright 2020-2021 NXP |
| 6 | */ | 6 | */ |
| 7 | 7 | ||
| 8 | #include <linux/if_bridge.h> | 8 | #include <linux/if_bridge.h> |
| @@ -5,7 +5,7 @@ · 4 unmodified lines | |||
| 5 | * mscc_ocelot_switch_lib. | 5 | * mscc_ocelot_switch_lib. |
| 6 | * | 6 | * |
| 7 | * Copyright (c) 2017, 2019 Microsemi Corporation | 7 | * Copyright (c) 2017, 2019 Microsemi Corporation |
| 8 | * Copyright 2020-2021 NXP Semiconductors | 8 | * Copyright 2020-2021 NXP |
| 9 | */ | 9 | */ |
| 10 | 10 | ||
| 11 | #include <linux/if_bridge.h> | 11 | #include <linux/if_bridge.h> |
| @@ -1297,6 +1297,14 @@ qed_iwarp_wait_cid_map_cleared(struct qed_hwfn *p_hwfn, struct qed_bmap *bmap) · 1296 unmodified lines | |||
| 1297 | prev_weight = weight; | 1297 | prev_weight = weight; |
| 1298 | 1298 | ||
| 1299 | while (weight) { | 1299 | 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 | |||
| 1300 | msleep(QED_IWARP_MAX_CID_CLEAN_TIME); | 1308 | msleep(QED_IWARP_MAX_CID_CLEAN_TIME); |
| 1301 | 1309 | ||
| 1302 | weight = bitmap_weight(bmap->bitmap, bmap->max_count); | 1310 | weight = bitmap_weight(bmap->bitmap, bmap->max_count); |
| @@ -77,6 +77,14 @@ void qed_roce_stop(struct qed_hwfn *p_hwfn) · 76 unmodified lines | |||
| 77 | * Beyond the added delay we clear the bitmap anyway. | 77 | * Beyond the added delay we clear the bitmap anyway. |
| 78 | */ | 78 | */ |
| 79 | while (bitmap_weight(rcid_map->bitmap, rcid_map->max_count)) { | 79 | 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 | |||
| 80 | msleep(100); | 88 | msleep(100); |
| 81 | if (wait_count++ > 20) { | 89 | if (wait_count++ > 20) { |
| 82 | DP_NOTICE(p_hwfn, "cid bitmap wait timed out\n"); | 90 | DP_NOTICE(p_hwfn, "cid bitmap wait timed out\n"); |
| @@ -1,5 +1,5 @@ | |||
| 1 | // SPDX-License-Identifier: GPL-2.0 | 1 | // SPDX-License-Identifier: GPL-2.0 |
| 2 | /* Copyright 2021 NXP Semiconductors | 2 | /* Copyright 2021 NXP |
| 3 | */ | 3 | */ |
| 4 | #include <linux/pcs/pcs-xpcs.h> | 4 | #include <linux/pcs/pcs-xpcs.h> |
| 5 | #include "pcs-xpcs.h" | 5 | #include "pcs-xpcs.h" |
| @@ -179,6 +179,16 @@ static int mdio_remove(struct device *dev) · 178 unmodified lines | |||
| 179 | return 0; | 179 | return 0; |
| 180 | } | 180 | } |
| 181 | 181 | ||
| 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 | |||
| 182 | /** | 192 | /** |
| 183 | * mdio_driver_register - register an mdio_driver with the MDIO layer | 193 | * mdio_driver_register - register an mdio_driver with the MDIO layer |
| 184 | * @drv: new mdio_driver to register | 194 | * @drv: new mdio_driver to register |
| @@ -193,6 +203,7 @@ int mdio_driver_register(struct mdio_driver *drv) · 8 unmodified lines | |||
| 193 | mdiodrv->driver.bus = &mdio_bus_type; | 203 | mdiodrv->driver.bus = &mdio_bus_type; |
| 194 | mdiodrv->driver.probe = mdio_probe; | 204 | mdiodrv->driver.probe = mdio_probe; |
| 195 | mdiodrv->driver.remove = mdio_remove; | 205 | mdiodrv->driver.remove = mdio_remove; |
| 206 | mdiodrv->driver.shutdown = mdio_shutdown; | ||
| 196 | 207 | ||
| 197 | retval = driver_register(&mdiodrv->driver); | 208 | retval = driver_register(&mdiodrv->driver); |
| 198 | if (retval) { | 209 | if (retval) { |
| @@ -2719,14 +2719,14 @@ struct hso_device *hso_create_mux_serial_device(struct usb_interface *interface, · 2718 unmodified lines | |||
| 2719 | 2719 | ||
| 2720 | serial = kzalloc(sizeof(*serial), GFP_KERNEL); | 2720 | serial = kzalloc(sizeof(*serial), GFP_KERNEL); |
| 2721 | if (!serial) | 2721 | if (!serial) |
| 2722 | goto exit; | 2722 | goto err_free_dev; |
| 2723 | 2723 | ||
| 2724 | hso_dev->port_data.dev_serial = serial; | 2724 | hso_dev->port_data.dev_serial = serial; |
| 2725 | serial->parent = hso_dev; | 2725 | serial->parent = hso_dev; |
| 2726 | 2726 | ||
| 2727 | if (hso_serial_common_create | 2727 | if (hso_serial_common_create |
| 2728 | (serial, 1, CTRL_URB_RX_SIZE, CTRL_URB_TX_SIZE)) | 2728 | (serial, 1, CTRL_URB_RX_SIZE, CTRL_URB_TX_SIZE)) |
| 2729 | goto exit; | 2729 | goto err_free_serial; |
| 2730 | 2730 | ||
| 2731 | serial->tx_data_length--; | 2731 | serial->tx_data_length--; |
| 2732 | serial->write_data = hso_mux_serial_write_data; | 2732 | 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 | |||
| 2742 | /* done, return it */ | 2742 | /* done, return it */ |
| 2743 | return hso_dev; | 2743 | return hso_dev; |
| 2744 | 2744 | ||
| 2745 | exit: | 2745 | err_free_serial: |
| 2746 | if (serial) { | 2746 | kfree(serial); |
| 2747 | tty_unregister_device(tty_drv, serial->minor); | 2747 | err_free_dev: |
| 2748 | kfree(serial); | ||
| 2749 | } | ||
| 2750 | kfree(hso_dev); | 2748 | kfree(hso_dev); |
| 2751 | return NULL; | 2749 | return NULL; |
| 2752 | 2750 | ||
| @@ -423,6 +423,10 @@ static struct sk_buff *page_to_skb(struct virtnet_info *vi, · 422 unmodified lines | |||
| 423 | 423 | ||
| 424 | skb_reserve(skb, p - buf); | 424 | skb_reserve(skb, p - buf); |
| 425 | skb_put(skb, len); | 425 | skb_put(skb, len); |
| 426 | |||
| 427 | page = (struct page *)page->private; | ||
| 428 | if (page) | ||
| 429 | give_pages(rq, page); | ||
| 426 | goto ok; | 430 | goto ok; |
| 427 | } | 431 | } |
| 428 | 432 | ||
| @@ -4756,12 +4756,12 @@ static void __net_exit vxlan_exit_batch_net(struct list_head *net_list) · 4755 unmodified lines | |||
| 4756 | LIST_HEAD(list); | 4756 | LIST_HEAD(list); |
| 4757 | unsigned int h; | 4757 | unsigned int h; |
| 4758 | 4758 | ||
| 4759 | rtnl_lock(); | ||
| 4760 | list_for_each_entry(net, net_list, exit_list) { | 4759 | list_for_each_entry(net, net_list, exit_list) { |
| 4761 | struct vxlan_net *vn = net_generic(net, vxlan_net_id); | 4760 | struct vxlan_net *vn = net_generic(net, vxlan_net_id); |
| 4762 | 4761 | ||
| 4763 | unregister_nexthop_notifier(net, &vn->nexthop_notifier_block); | 4762 | unregister_nexthop_notifier(net, &vn->nexthop_notifier_block); |
| 4764 | } | 4763 | } |
| 4764 | rtnl_lock(); | ||
| 4765 | list_for_each_entry(net, net_list, exit_list) | 4765 | list_for_each_entry(net, net_list, exit_list) |
| 4766 | vxlan_destroy_tunnels(net, &list); | 4766 | vxlan_destroy_tunnels(net, &list); |
| 4767 | 4767 | ||
| @@ -499,7 +499,7 @@ check_frags: · 498 unmodified lines | |||
| 499 | * the header's copy failed, and they are | 499 | * the header's copy failed, and they are |
| 500 | * sharing a slot, send an error | 500 | * sharing a slot, send an error |
| 501 | */ | 501 | */ |
| 502 | if (i == 0 && sharedslot) | 502 | if (i == 0 && !first_shinfo && sharedslot) |
| 503 | xenvif_idx_release(queue, pending_idx, | 503 | xenvif_idx_release(queue, pending_idx, |
| 504 | XEN_NETIF_RSP_ERROR); | 504 | XEN_NETIF_RSP_ERROR); |
| 505 | else | 505 | else |
| @@ -278,6 +278,7 @@ static int st_nci_spi_remove(struct spi_device *dev) · 277 unmodified lines | |||
| 278 | 278 | ||
| 279 | static struct spi_device_id st_nci_spi_id_table[] = { | 279 | static struct spi_device_id st_nci_spi_id_table[] = { |
| 280 | {ST_NCI_SPI_DRIVER_NAME, 0}, | 280 | {ST_NCI_SPI_DRIVER_NAME, 0}, |
| 281 | {"st21nfcb-spi", 0}, | ||
| 281 | {} | 282 | {} |
| 282 | }; | 283 | }; |
| 283 | MODULE_DEVICE_TABLE(spi, st_nci_spi_id_table); | 284 | MODULE_DEVICE_TABLE(spi, st_nci_spi_id_table); |
| @@ -174,6 +174,7 @@ config PTP_1588_CLOCK_OCP · 173 unmodified lines | |||
| 174 | depends on I2C && MTD | 174 | depends on I2C && MTD |
| 175 | depends on SERIAL_8250 | 175 | depends on SERIAL_8250 |
| 176 | depends on !S390 | 176 | depends on !S390 |
| 177 | depends on COMMON_CLK | ||
| 177 | select NET_DEVLINK | 178 | select NET_DEVLINK |
| 178 | help | 179 | help |
| 179 | This driver adds support for an OpenCompute time card. | 180 | This driver adds support for an OpenCompute time card. |
| @@ -77,12 +77,13 @@ EXPORT_SYMBOL(ccwgroup_set_online); · 76 unmodified lines | |||
| 77 | /** | 77 | /** |
| 78 | * ccwgroup_set_offline() - disable a ccwgroup device | 78 | * ccwgroup_set_offline() - disable a ccwgroup device |
| 79 | * @gdev: target ccwgroup device | 79 | * @gdev: target ccwgroup device |
| 80 | * @call_gdrv: Call the registered gdrv set_offline function | ||
| 80 | * | 81 | * |
| 81 | * This function attempts to put the ccwgroup device into the offline state. | 82 | * This function attempts to put the ccwgroup device into the offline state. |
| 82 | * Returns: | 83 | * Returns: |
| 83 | * %0 on success and a negative error value on failure. | 84 | * %0 on success and a negative error value on failure. |
| 84 | */ | 85 | */ |
| 85 | int ccwgroup_set_offline(struct ccwgroup_device *gdev) | 86 | int ccwgroup_set_offline(struct ccwgroup_device *gdev, bool call_gdrv) |
| 86 | { | 87 | { |
| 87 | struct ccwgroup_driver *gdrv = to_ccwgroupdrv(gdev->dev.driver); | 88 | struct ccwgroup_driver *gdrv = to_ccwgroupdrv(gdev->dev.driver); |
| 88 | int ret = -EINVAL; | 89 | int ret = -EINVAL; |
| @@ -91,11 +92,16 @@ int ccwgroup_set_offline(struct ccwgroup_device *gdev) · 2 unmodified lines | |||
| 91 | return -EAGAIN; | 92 | return -EAGAIN; |
| 92 | if (gdev->state == CCWGROUP_OFFLINE) | 93 | if (gdev->state == CCWGROUP_OFFLINE) |
| 93 | goto out; | 94 | goto out; |
| 95 | if (!call_gdrv) { | ||
| 96 | ret = 0; | ||
| 97 | goto offline; | ||
| 98 | } | ||
| 94 | if (gdrv->set_offline) | 99 | if (gdrv->set_offline) |
| 95 | ret = gdrv->set_offline(gdev); | 100 | ret = gdrv->set_offline(gdev); |
| 96 | if (ret) | 101 | if (ret) |
| 97 | goto out; | 102 | goto out; |
| 98 | 103 | ||
| 104 | offline: | ||
| 99 | gdev->state = CCWGROUP_OFFLINE; | 105 | gdev->state = CCWGROUP_OFFLINE; |
| 100 | out: | 106 | out: |
| 101 | atomic_set(&gdev->onoff, 0); | 107 | atomic_set(&gdev->onoff, 0); |
| @@ -124,7 +130,7 @@ static ssize_t ccwgroup_online_store(struct device *dev, · 22 unmodified lines | |||
| 124 | if (value == 1) | 130 | if (value == 1) |
| 125 | ret = ccwgroup_set_online(gdev); | 131 | ret = ccwgroup_set_online(gdev); |
| 126 | else if (value == 0) | 132 | else if (value == 0) |
| 127 | ret = ccwgroup_set_offline(gdev); | 133 | ret = ccwgroup_set_offline(gdev, true); |
| 128 | else | 134 | else |
| 129 | ret = -EINVAL; | 135 | ret = -EINVAL; |
| 130 | out: | 136 | out: |
| @@ -858,7 +858,6 @@ struct qeth_card { · 857 unmodified lines | |||
| 858 | struct napi_struct napi; | 858 | struct napi_struct napi; |
| 859 | struct qeth_rx rx; | 859 | struct qeth_rx rx; |
| 860 | struct delayed_work buffer_reclaim_work; | 860 | struct delayed_work buffer_reclaim_work; |
| 861 | struct work_struct close_dev_work; | ||
| 862 | }; | 861 | }; |
| 863 | 862 | ||
| 864 | static inline bool qeth_card_hw_is_reachable(struct qeth_card *card) | 863 | static inline bool qeth_card_hw_is_reachable(struct qeth_card *card) |
| @@ -70,15 +70,6 @@ static void qeth_issue_next_read_cb(struct qeth_card *card, · 69 unmodified lines | |||
| 70 | static int qeth_qdio_establish(struct qeth_card *); | 70 | static int qeth_qdio_establish(struct qeth_card *); |
| 71 | static void qeth_free_qdio_queues(struct qeth_card *card); | 71 | static void qeth_free_qdio_queues(struct qeth_card *card); |
| 72 | 72 | ||
| 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 | |||
| 82 | static const char *qeth_get_cardname(struct qeth_card *card) | 73 | static const char *qeth_get_cardname(struct qeth_card *card) |
| 83 | { | 74 | { |
| 84 | if (IS_VM_NIC(card)) { | 75 | if (IS_VM_NIC(card)) { |
| @@ -202,6 +193,9 @@ static void qeth_clear_working_pool_list(struct qeth_card *card) · 117 unmodified lines | |||
| 202 | &card->qdio.in_buf_pool.entry_list, list) | 193 | &card->qdio.in_buf_pool.entry_list, list) |
| 203 | list_del(&pool_entry->list); | 194 | list_del(&pool_entry->list); |
| 204 | 195 | ||
| 196 | if (!queue) | ||
| 197 | return; | ||
| 198 | |||
| 205 | for (i = 0; i < ARRAY_SIZE(queue->bufs); i++) | 199 | for (i = 0; i < ARRAY_SIZE(queue->bufs); i++) |
| 206 | queue->bufs[i].pool_entry = NULL; | 200 | queue->bufs[i].pool_entry = NULL; |
| 207 | } | 201 | } |
| @@ -792,10 +786,12 @@ static struct qeth_ipa_cmd *qeth_check_ipa_data(struct qeth_card *card, · 584 unmodified lines | |||
| 792 | case IPA_CMD_STOPLAN: | 786 | case IPA_CMD_STOPLAN: |
| 793 | if (cmd->hdr.return_code == IPA_RC_VEPA_TO_VEB_TRANSITION) { | 787 | if (cmd->hdr.return_code == IPA_RC_VEPA_TO_VEB_TRANSITION) { |
| 794 | dev_err(&card->gdev->dev, | 788 | 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", |
| 796 | netdev_name(card->dev)); | 790 | 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); | ||
| 798 | } else { | 793 | } else { |
| 794 | /* stay online for subsequent STARTLAN */ | ||
| 799 | dev_warn(&card->gdev->dev, | 795 | dev_warn(&card->gdev->dev, |
| 800 | "The link for interface %s on CHPID 0x%X failed\n", | 796 | "The link for interface %s on CHPID 0x%X failed\n", |
| 801 | netdev_name(card->dev), card->info.chpid); | 797 | netdev_name(card->dev), card->info.chpid); |
| @@ -1537,7 +1533,6 @@ static void qeth_setup_card(struct qeth_card *card) · 735 unmodified lines | |||
| 1537 | INIT_LIST_HEAD(&card->ipato.entries); | 1533 | INIT_LIST_HEAD(&card->ipato.entries); |
| 1538 | qeth_init_qdio_info(card); | 1534 | qeth_init_qdio_info(card); |
| 1539 | INIT_DELAYED_WORK(&card->buffer_reclaim_work, qeth_buffer_reclaim_work); | 1535 | INIT_DELAYED_WORK(&card->buffer_reclaim_work, qeth_buffer_reclaim_work); |
| 1540 | INIT_WORK(&card->close_dev_work, qeth_close_dev_handler); | ||
| 1541 | hash_init(card->rx_mode_addrs); | 1536 | hash_init(card->rx_mode_addrs); |
| 1542 | hash_init(card->local_addrs4); | 1537 | hash_init(card->local_addrs4); |
| 1543 | hash_init(card->local_addrs6); | 1538 | hash_init(card->local_addrs6); |
| @@ -5519,7 +5514,8 @@ static int qeth_do_reset(void *data) · 3975 unmodified lines | |||
| 5519 | dev_info(&card->gdev->dev, | 5514 | dev_info(&card->gdev->dev, |
| 5520 | "Device successfully recovered!\n"); | 5515 | "Device successfully recovered!\n"); |
| 5521 | } else { | 5516 | } else { |
| 5522 | ccwgroup_set_offline(card->gdev); | 5517 | qeth_set_offline(card, disc, true); |
| 5518 | ccwgroup_set_offline(card->gdev, false); | ||
| 5523 | dev_warn(&card->gdev->dev, | 5519 | dev_warn(&card->gdev->dev, |
| 5524 | "The qeth device driver failed to recover an error on the device\n"); | 5520 | "The qeth device driver failed to recover an error on the device\n"); |
| 5525 | } | 5521 | } |
| @@ -2307,7 +2307,6 @@ static void qeth_l2_remove_device(struct ccwgroup_device *gdev) · 2306 unmodified lines | |||
| 2307 | if (gdev->state == CCWGROUP_ONLINE) | 2307 | if (gdev->state == CCWGROUP_ONLINE) |
| 2308 | qeth_set_offline(card, card->discipline, false); | 2308 | qeth_set_offline(card, card->discipline, false); |
| 2309 | 2309 | ||
| 2310 | cancel_work_sync(&card->close_dev_work); | ||
| 2311 | if (card->dev->reg_state == NETREG_REGISTERED) { | 2310 | if (card->dev->reg_state == NETREG_REGISTERED) { |
| 2312 | priv = netdev_priv(card->dev); | 2311 | priv = netdev_priv(card->dev); |
| 2313 | if (priv->brport_features & BR_LEARNING_SYNC) { | 2312 | if (priv->brport_features & BR_LEARNING_SYNC) { |
| @@ -1969,7 +1969,6 @@ static void qeth_l3_remove_device(struct ccwgroup_device *cgdev) · 1968 unmodified lines | |||
| 1969 | if (cgdev->state == CCWGROUP_ONLINE) | 1969 | if (cgdev->state == CCWGROUP_ONLINE) |
| 1970 | qeth_set_offline(card, card->discipline, false); | 1970 | qeth_set_offline(card, card->discipline, false); |
| 1971 | 1971 | ||
| 1972 | cancel_work_sync(&card->close_dev_work); | ||
| 1973 | if (card->dev->reg_state == NETREG_REGISTERED) | 1972 | if (card->dev->reg_state == NETREG_REGISTERED) |
| 1974 | unregister_netdev(card->dev); | 1973 | unregister_netdev(card->dev); |
| 1975 | 1974 | ||
| @@ -1,5 +1,5 @@ | |||
| 1 | /* SPDX-License-Identifier: GPL-2.0 | 1 | /* SPDX-License-Identifier: GPL-2.0 |
| 2 | * Copyright 2019-2021 NXP Semiconductors | 2 | * Copyright 2019-2021 NXP |
| 3 | */ | 3 | */ |
| 4 | 4 | ||
| 5 | #ifndef _NET_DSA_TAG_OCELOT_H | 5 | #ifndef _NET_DSA_TAG_OCELOT_H |
| @@ -80,6 +80,9 @@ struct mdio_driver { · 79 unmodified lines | |||
| 80 | 80 | ||
| 81 | /* Clears up any memory if needed */ | 81 | /* Clears up any memory if needed */ |
| 82 | void (*remove)(struct mdio_device *mdiodev); | 82 | 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); | ||
| 83 | }; | 86 | }; |
| 84 | 87 | ||
| 85 | static inline struct mdio_driver * | 88 | static inline struct mdio_driver * |
| @@ -1,5 +1,5 @@ | |||
| 1 | /* SPDX-License-Identifier: BSD-3-Clause | 1 | /* SPDX-License-Identifier: BSD-3-Clause |
| 2 | * Copyright (c) 2016-2018, NXP Semiconductors | 2 | * Copyright 2016-2018 NXP |
| 3 | * Copyright (c) 2018-2019, Vladimir Oltean <olteanv@gmail.com> | 3 | * Copyright (c) 2018-2019, Vladimir Oltean <olteanv@gmail.com> |
| 4 | */ | 4 | */ |
| 5 | #ifndef _LINUX_PACKING_H | 5 | #ifndef _LINUX_PACKING_H |
| @@ -585,8 +585,16 @@ struct dsa_switch_ops { · 584 unmodified lines | |||
| 585 | int (*change_tag_protocol)(struct dsa_switch *ds, int port, | 585 | int (*change_tag_protocol)(struct dsa_switch *ds, int port, |
| 586 | enum dsa_tag_protocol proto); | 586 | enum dsa_tag_protocol proto); |
| 587 | 587 | ||
| 588 | /* Optional switch-wide initialization and destruction methods */ | ||
| 588 | int (*setup)(struct dsa_switch *ds); | 589 | int (*setup)(struct dsa_switch *ds); |
| 589 | void (*teardown)(struct dsa_switch *ds); | 590 | 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 | |||
| 590 | u32 (*get_phy_flags)(struct dsa_switch *ds, int port); | 598 | u32 (*get_phy_flags)(struct dsa_switch *ds, int port); |
| 591 | 599 | ||
| 592 | /* | 600 | /* |
| @@ -1046,6 +1054,7 @@ static inline int dsa_ndo_eth_ioctl(struct net_device *dev, struct ifreq *ifr, · 453 unmodified lines | |||
| 1046 | 1054 | ||
| 1047 | void dsa_unregister_switch(struct dsa_switch *ds); | 1055 | void dsa_unregister_switch(struct dsa_switch *ds); |
| 1048 | int dsa_register_switch(struct dsa_switch *ds); | 1056 | int dsa_register_switch(struct dsa_switch *ds); |
| 1057 | void dsa_switch_shutdown(struct dsa_switch *ds); | ||
| 1049 | struct dsa_switch *dsa_switch_find(int tree_index, int sw_index); | 1058 | struct dsa_switch *dsa_switch_find(int tree_index, int sw_index); |
| 1050 | #ifdef CONFIG_PM_SLEEP | 1059 | #ifdef CONFIG_PM_SLEEP |
| 1051 | int dsa_switch_suspend(struct dsa_switch *ds); | 1060 | int dsa_switch_suspend(struct dsa_switch *ds); |
| @@ -1640,6 +1640,7 @@ static inline void unlock_sock_fast(struct sock *sk, bool slow) · 1639 unmodified lines | |||
| 1640 | release_sock(sk); | 1640 | release_sock(sk); |
| 1641 | __release(&sk->sk_lock.slock); | 1641 | __release(&sk->sk_lock.slock); |
| 1642 | } else { | 1642 | } else { |
| 1643 | mutex_release(&sk->sk_lock.dep_map, _RET_IP_); | ||
| 1643 | spin_unlock_bh(&sk->sk_lock.slock); | 1644 | spin_unlock_bh(&sk->sk_lock.slock); |
| 1644 | } | 1645 | } |
| 1645 | } | 1646 | } |
| @@ -1,5 +1,5 @@ | |||
| 1 | // SPDX-License-Identifier: BSD-3-Clause OR GPL-2.0 | 1 | // SPDX-License-Identifier: BSD-3-Clause OR GPL-2.0 |
| 2 | /* Copyright (c) 2016-2018, NXP Semiconductors | 2 | /* Copyright 2016-2018 NXP |
| 3 | * Copyright (c) 2018-2019, Vladimir Oltean <olteanv@gmail.com> | 3 | * Copyright (c) 2018-2019, Vladimir Oltean <olteanv@gmail.com> |
| 4 | */ | 4 | */ |
| 5 | #include <linux/packing.h> | 5 | #include <linux/packing.h> |
| @@ -6923,12 +6923,16 @@ EXPORT_SYMBOL(napi_disable); · 6922 unmodified lines | |||
| 6923 | */ | 6923 | */ |
| 6924 | void napi_enable(struct napi_struct *n) | 6924 | void napi_enable(struct napi_struct *n) |
| 6925 | { | 6925 | { |
| 6926 | BUG_ON(!test_bit(NAPI_STATE_SCHED, &n->state)); | 6926 | unsigned long val, new; |
| 6927 | smp_mb__before_atomic(); | 6927 | |
| 6928 | clear_bit(NAPI_STATE_SCHED, &n->state); | 6928 | do { |
| 6929 | clear_bit(NAPI_STATE_NPSVC, &n->state); | 6929 | val = READ_ONCE(n->state); |
| 6930 | if (n->dev->threaded && n->thread) | 6930 | BUG_ON(!test_bit(NAPI_STATE_SCHED, &val)); |
| 6931 | set_bit(NAPI_STATE_THREADED, &n->state); | 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); | ||
| 6932 | } | 6936 | } |
| 6933 | EXPORT_SYMBOL(napi_enable); | 6937 | EXPORT_SYMBOL(napi_enable); |
| 6934 | 6938 | ||
| @@ -3179,17 +3179,15 @@ EXPORT_SYMBOL(sock_init_data); · 3178 unmodified lines | |||
| 3179 | 3179 | ||
| 3180 | void lock_sock_nested(struct sock *sk, int subclass) | 3180 | void lock_sock_nested(struct sock *sk, int subclass) |
| 3181 | { | 3181 | { |
| 3182 | /* The sk_lock has mutex_lock() semantics here. */ | ||
| 3183 | mutex_acquire(&sk->sk_lock.dep_map, subclass, 0, _RET_IP_); | ||
| 3184 | |||
| 3182 | might_sleep(); | 3185 | might_sleep(); |
| 3183 | spin_lock_bh(&sk->sk_lock.slock); | 3186 | spin_lock_bh(&sk->sk_lock.slock); |
| 3184 | if (sk->sk_lock.owned) | 3187 | if (sk->sk_lock.owned) |
| 3185 | __lock_sock(sk); | 3188 | __lock_sock(sk); |
| 3186 | sk->sk_lock.owned = 1; | 3189 | sk->sk_lock.owned = 1; |
| 3187 | spin_unlock(&sk->sk_lock.slock); | 3190 | spin_unlock_bh(&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(); | ||
| 3193 | } | 3191 | } |
| 3194 | EXPORT_SYMBOL(lock_sock_nested); | 3192 | EXPORT_SYMBOL(lock_sock_nested); |
| 3195 | 3193 | ||
| @@ -3227,24 +3225,35 @@ EXPORT_SYMBOL(release_sock); · 31 unmodified lines | |||
| 3227 | */ | 3225 | */ |
| 3228 | bool lock_sock_fast(struct sock *sk) __acquires(&sk->sk_lock.slock) | 3226 | bool lock_sock_fast(struct sock *sk) __acquires(&sk->sk_lock.slock) |
| 3229 | { | 3227 | { |
| 3228 | /* The sk_lock has mutex_lock() semantics here. */ | ||
| 3229 | mutex_acquire(&sk->sk_lock.dep_map, 0, 0, _RET_IP_); | ||
| 3230 | |||
| 3230 | might_sleep(); | 3231 | might_sleep(); |
| 3231 | spin_lock_bh(&sk->sk_lock.slock); | 3232 | spin_lock_bh(&sk->sk_lock.slock); |
| 3232 | 3233 | ||
| 3233 | if (!sk->sk_lock.owned) | 3234 | if (!sk->sk_lock.owned) { |
| 3234 | /* | 3235 | /* |
| 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(). | ||
| 3236 | */ | 3249 | */ |
| 3237 | return false; | 3250 | return false; |
| 3251 | } | ||
| 3238 | 3252 | ||
| 3239 | __lock_sock(sk); | 3253 | __lock_sock(sk); |
| 3240 | sk->sk_lock.owned = 1; | 3254 | 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_); | ||
| 3246 | __acquire(&sk->sk_lock.slock); | 3255 | __acquire(&sk->sk_lock.slock); |
| 3247 | local_bh_enable(); | 3256 | spin_unlock_bh(&sk->sk_lock.slock); |
| 3248 | return true; | 3257 | return true; |
| 3249 | } | 3258 | } |
| 3250 | EXPORT_SYMBOL(lock_sock_fast); | 3259 | EXPORT_SYMBOL(lock_sock_fast); |
| @@ -429,6 +429,7 @@ static int dsa_port_setup(struct dsa_port *dp) · 428 unmodified lines | |||
| 429 | { | 429 | { |
| 430 | struct devlink_port *dlp = &dp->devlink_port; | 430 | struct devlink_port *dlp = &dp->devlink_port; |
| 431 | bool dsa_port_link_registered = false; | 431 | bool dsa_port_link_registered = false; |
| 432 | struct dsa_switch *ds = dp->ds; | ||
| 432 | bool dsa_port_enabled = false; | 433 | bool dsa_port_enabled = false; |
| 433 | int err = 0; | 434 | int err = 0; |
| 434 | 435 | ||
| @@ -438,6 +439,12 @@ static int dsa_port_setup(struct dsa_port *dp) · 3 unmodified lines | |||
| 438 | INIT_LIST_HEAD(&dp->fdbs); | 439 | INIT_LIST_HEAD(&dp->fdbs); |
| 439 | INIT_LIST_HEAD(&dp->mdbs); | 440 | INIT_LIST_HEAD(&dp->mdbs); |
| 440 | 441 | ||
| 442 | if (ds->ops->port_setup) { | ||
| 443 | err = ds->ops->port_setup(ds, dp->index); | ||
| 444 | if (err) | ||
| 445 | return err; | ||
| 446 | } | ||
| 447 | |||
| 441 | switch (dp->type) { | 448 | switch (dp->type) { |
| 442 | case DSA_PORT_TYPE_UNUSED: | 449 | case DSA_PORT_TYPE_UNUSED: |
| 443 | dsa_port_disable(dp); | 450 | dsa_port_disable(dp); |
| @@ -480,8 +487,11 @@ static int dsa_port_setup(struct dsa_port *dp) · 36 unmodified lines | |||
| 480 | dsa_port_disable(dp); | 487 | dsa_port_disable(dp); |
| 481 | if (err && dsa_port_link_registered) | 488 | if (err && dsa_port_link_registered) |
| 482 | dsa_port_link_unregister_of(dp); | 489 | 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); | ||
| 484 | return err; | 493 | return err; |
| 494 | } | ||
| 485 | 495 | ||
| 486 | dp->setup = true; | 496 | dp->setup = true; |
| 487 | 497 | ||
| @@ -533,11 +543,15 @@ static int dsa_port_devlink_setup(struct dsa_port *dp) · 45 unmodified lines | |||
| 533 | static void dsa_port_teardown(struct dsa_port *dp) | 543 | static void dsa_port_teardown(struct dsa_port *dp) |
| 534 | { | 544 | { |
| 535 | struct devlink_port *dlp = &dp->devlink_port; | 545 | struct devlink_port *dlp = &dp->devlink_port; |
| 546 | struct dsa_switch *ds = dp->ds; | ||
| 536 | struct dsa_mac_addr *a, *tmp; | 547 | struct dsa_mac_addr *a, *tmp; |
| 537 | 548 | ||
| 538 | if (!dp->setup) | 549 | if (!dp->setup) |
| 539 | return; | 550 | return; |
| 540 | 551 | ||
| 552 | if (ds->ops->port_teardown) | ||
| 553 | ds->ops->port_teardown(ds, dp->index); | ||
| 554 | |||
| 541 | devlink_port_type_clear(dlp); | 555 | devlink_port_type_clear(dlp); |
| 542 | 556 | ||
| 543 | switch (dp->type) { | 557 | switch (dp->type) { |
| @@ -581,6 +595,36 @@ static void dsa_port_devlink_teardown(struct dsa_port *dp) · 37 unmodified lines | |||
| 581 | dp->devlink_port_setup = false; | 595 | dp->devlink_port_setup = false; |
| 582 | } | 596 | } |
| 583 | 597 | ||
| 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 | |||
| 584 | static int dsa_devlink_info_get(struct devlink *dl, | 628 | static int dsa_devlink_info_get(struct devlink *dl, |
| 585 | struct devlink_info_req *req, | 629 | struct devlink_info_req *req, |
| 586 | struct netlink_ext_ack *extack) | 630 | struct netlink_ext_ack *extack) |
| @@ -836,7 +880,7 @@ static int dsa_switch_setup(struct dsa_switch *ds) · 249 unmodified lines | |||
| 836 | devlink_params_publish(ds->devlink); | 880 | devlink_params_publish(ds->devlink); |
| 837 | 881 | ||
| 838 | if (!ds->slave_mii_bus && ds->ops->phy_read) { | 882 | 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(); |
| 840 | if (!ds->slave_mii_bus) { | 884 | if (!ds->slave_mii_bus) { |
| 841 | err = -ENOMEM; | 885 | err = -ENOMEM; |
| 842 | goto teardown; | 886 | goto teardown; |
| @@ -846,13 +890,16 @@ static int dsa_switch_setup(struct dsa_switch *ds) · 3 unmodified lines | |||
| 846 | 890 | ||
| 847 | err = mdiobus_register(ds->slave_mii_bus); | 891 | err = mdiobus_register(ds->slave_mii_bus); |
| 848 | if (err < 0) | 892 | if (err < 0) |
| 849 | goto teardown; | 893 | goto free_slave_mii_bus; |
| 850 | } | 894 | } |
| 851 | 895 | ||
| 852 | ds->setup = true; | 896 | ds->setup = true; |
| 853 | 897 | ||
| 854 | return 0; | 898 | return 0; |
| 855 | 899 | ||
| 900 | free_slave_mii_bus: | ||
| 901 | if (ds->slave_mii_bus && ds->ops->phy_read) | ||
| 902 | mdiobus_free(ds->slave_mii_bus); | ||
| 856 | teardown: | 903 | teardown: |
| 857 | if (ds->ops->teardown) | 904 | if (ds->ops->teardown) |
| 858 | ds->ops->teardown(ds); | 905 | ds->ops->teardown(ds); |
| @@ -877,8 +924,11 @@ static void dsa_switch_teardown(struct dsa_switch *ds) · 18 unmodified lines | |||
| 877 | if (!ds->setup) | 924 | if (!ds->setup) |
| 878 | return; | 925 | return; |
| 879 | 926 | ||
| 880 | if (ds->slave_mii_bus && ds->ops->phy_read) | 927 | if (ds->slave_mii_bus && ds->ops->phy_read) { |
| 881 | mdiobus_unregister(ds->slave_mii_bus); | 928 | mdiobus_unregister(ds->slave_mii_bus); |
| 929 | mdiobus_free(ds->slave_mii_bus); | ||
| 930 | ds->slave_mii_bus = NULL; | ||
| 931 | } | ||
| 882 | 932 | ||
| 883 | dsa_switch_unregister_notifier(ds); | 933 | dsa_switch_unregister_notifier(ds); |
| 884 | 934 | ||
| @@ -938,12 +988,9 @@ static int dsa_tree_setup_switches(struct dsa_switch_tree *dst) · 53 unmodified lines | |||
| 938 | list_for_each_entry(dp, &dst->ports, list) { | 988 | list_for_each_entry(dp, &dst->ports, list) { |
| 939 | err = dsa_port_setup(dp); | 989 | err = dsa_port_setup(dp); |
| 940 | if (err) { | 990 | if (err) { |
| 941 | dsa_port_devlink_teardown(dp); | 991 | err = dsa_port_reinit_as_unused(dp); |
| 942 | dp->type = DSA_PORT_TYPE_UNUSED; | ||
| 943 | err = dsa_port_devlink_setup(dp); | ||
| 944 | if (err) | 992 | if (err) |
| 945 | goto teardown; | 993 | goto teardown; |
| 946 | continue; | ||
| 947 | } | 994 | } |
| 948 | } | 995 | } |
| 949 | 996 | ||
| @@ -1048,6 +1095,7 @@ static int dsa_tree_setup(struct dsa_switch_tree *dst) · 98 unmodified lines | |||
| 1048 | teardown_master: | 1095 | teardown_master: |
| 1049 | dsa_tree_teardown_master(dst); | 1096 | dsa_tree_teardown_master(dst); |
| 1050 | teardown_switches: | 1097 | teardown_switches: |
| 1098 | dsa_tree_teardown_ports(dst); | ||
| 1051 | dsa_tree_teardown_switches(dst); | 1099 | dsa_tree_teardown_switches(dst); |
| 1052 | teardown_cpu_ports: | 1100 | teardown_cpu_ports: |
| 1053 | dsa_tree_teardown_cpu_ports(dst); | 1101 | dsa_tree_teardown_cpu_ports(dst); |
| @@ -1562,3 +1610,53 @@ void dsa_unregister_switch(struct dsa_switch *ds) · 508 unmodified lines | |||
| 1562 | mutex_unlock(&dsa2_mutex); | 1610 | mutex_unlock(&dsa2_mutex); |
| 1563 | } | 1611 | } |
| 1564 | EXPORT_SYMBOL_GPL(dsa_unregister_switch); | 1612 | 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); | ||
| @@ -1,5 +1,5 @@ | |||
| 1 | // SPDX-License-Identifier: GPL-2.0 | 1 | // SPDX-License-Identifier: GPL-2.0 |
| 2 | /* Copyright 2019 NXP Semiconductors | 2 | /* Copyright 2019 NXP |
| 3 | */ | 3 | */ |
| 4 | #include <linux/dsa/ocelot.h> | 4 | #include <linux/dsa/ocelot.h> |
| 5 | #include <soc/mscc/ocelot.h> | 5 | #include <soc/mscc/ocelot.h> |
| @@ -1,5 +1,5 @@ | |||
| 1 | // SPDX-License-Identifier: GPL-2.0 | 1 | // SPDX-License-Identifier: GPL-2.0 |
| 2 | /* Copyright 2020-2021 NXP Semiconductors | 2 | /* Copyright 2020-2021 NXP |
| 3 | * | 3 | * |
| 4 | * An implementation of the software-defined tag_8021q.c tagger format, which | 4 | * An implementation of the software-defined tag_8021q.c tagger format, which |
| 5 | * also preserves full functionality under a vlan_filtering bridge. It does | 5 | * also preserves full functionality under a vlan_filtering bridge. It does |
| @@ -1982,6 +1982,8 @@ static int replace_nexthop_grp(struct net *net, struct nexthop *old, · 1981 unmodified lines | |||
| 1982 | rcu_assign_pointer(old->nh_grp, newg); | 1982 | rcu_assign_pointer(old->nh_grp, newg); |
| 1983 | 1983 | ||
| 1984 | if (newg->resilient) { | 1984 | if (newg->resilient) { |
| 1985 | /* Make sure concurrent readers are not using 'oldg' anymore. */ | ||
| 1986 | synchronize_net(); | ||
| 1985 | rcu_assign_pointer(oldg->res_table, tmp_table); | 1987 | rcu_assign_pointer(oldg->res_table, tmp_table); |
| 1986 | rcu_assign_pointer(oldg->spare->res_table, tmp_table); | 1988 | rcu_assign_pointer(oldg->spare->res_table, tmp_table); |
| 1987 | } | 1989 | } |
| @@ -3565,6 +3567,7 @@ static struct notifier_block nh_netdev_notifier = { · 1577 unmodified lines | |||
| 3565 | }; | 3567 | }; |
| 3566 | 3568 | ||
| 3567 | static int nexthops_dump(struct net *net, struct notifier_block *nb, | 3569 | static int nexthops_dump(struct net *net, struct notifier_block *nb, |
| 3570 | enum nexthop_event_type event_type, | ||
| 3568 | struct netlink_ext_ack *extack) | 3571 | struct netlink_ext_ack *extack) |
| 3569 | { | 3572 | { |
| 3570 | struct rb_root *root = &net->nexthop.rb_root; | 3573 | 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 | |||
| 3575 | struct nexthop *nh; | 3578 | struct nexthop *nh; |
| 3576 | 3579 | ||
| 3577 | nh = rb_entry(node, struct nexthop, rb_node); | 3580 | nh = rb_entry(node, struct nexthop, rb_node); |
| 3578 | err = call_nexthop_notifier(nb, net, NEXTHOP_EVENT_REPLACE, nh, | 3581 | err = call_nexthop_notifier(nb, net, event_type, nh, extack); |
| 3579 | extack); | ||
| 3580 | if (err) | 3582 | if (err) |
| 3581 | break; | 3583 | break; |
| 3582 | } | 3584 | } |
| @@ -3590,7 +3592,7 @@ int register_nexthop_notifier(struct net *net, struct notifier_block *nb, · 7 unmodified lines | |||
| 3590 | int err; | 3592 | int err; |
| 3591 | 3593 | ||
| 3592 | rtnl_lock(); | 3594 | rtnl_lock(); |
| 3593 | err = nexthops_dump(net, nb, extack); | 3595 | err = nexthops_dump(net, nb, NEXTHOP_EVENT_REPLACE, extack); |
| 3594 | if (err) | 3596 | if (err) |
| 3595 | goto unlock; | 3597 | goto unlock; |
| 3596 | err = blocking_notifier_chain_register(&net->nexthop.notifier_chain, | 3598 | err = blocking_notifier_chain_register(&net->nexthop.notifier_chain, |
| @@ -3603,8 +3605,17 @@ EXPORT_SYMBOL(register_nexthop_notifier); · 6 unmodified lines | |||
| 3603 | 3605 | ||
| 3604 | int unregister_nexthop_notifier(struct net *net, struct notifier_block *nb) | 3606 | int unregister_nexthop_notifier(struct net *net, struct notifier_block *nb) |
| 3605 | { | 3607 | { |
| 3606 | return blocking_notifier_chain_unregister(&net->nexthop.notifier_chain, | 3608 | int err; |
| 3607 | nb); | 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; | ||
| 3608 | } | 3619 | } |
| 3609 | EXPORT_SYMBOL(unregister_nexthop_notifier); | 3620 | EXPORT_SYMBOL(unregister_nexthop_notifier); |
| 3610 | 3621 | ||
| @@ -1316,7 +1316,7 @@ static int mptcp_sendmsg_frag(struct sock *sk, struct sock *ssk, · 1315 unmodified lines | |||
| 1316 | goto alloc_skb; | 1316 | goto alloc_skb; |
| 1317 | } | 1317 | } |
| 1318 | 1318 | ||
| 1319 | must_collapse = (info->size_goal - skb->len > 0) && | 1319 | must_collapse = (info->size_goal > skb->len) && |
| 1320 | (skb_shinfo(skb)->nr_frags < sysctl_max_skb_frags); | 1320 | (skb_shinfo(skb)->nr_frags < sysctl_max_skb_frags); |
| 1321 | if (must_collapse) { | 1321 | if (must_collapse) { |
| 1322 | size_bias = skb->len; | 1322 | size_bias = skb->len; |
| @@ -1325,7 +1325,7 @@ static int mptcp_sendmsg_frag(struct sock *sk, struct sock *ssk, · 2 unmodified lines | |||
| 1325 | } | 1325 | } |
| 1326 | 1326 | ||
| 1327 | alloc_skb: | 1327 | alloc_skb: |
| 1328 | if (!must_collapse && !ssk->sk_tx_skb_cache && | 1328 | if (!must_collapse && |
| 1329 | !mptcp_alloc_tx_skb(sk, ssk, info->data_lock_held)) | 1329 | !mptcp_alloc_tx_skb(sk, ssk, info->data_lock_held)) |
| 1330 | return 0; | 1330 | return 0; |
| 1331 | 1331 | ||
| @@ -230,7 +230,8 @@ static int smc_clc_prfx_set(struct socket *clcsock, · 229 unmodified lines | |||
| 230 | goto out_rel; | 230 | goto out_rel; |
| 231 | } | 231 | } |
| 232 | /* get address to which the internal TCP socket is bound */ | 232 | /* 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; | ||
| 234 | /* analyze IP specific data of net_device belonging to TCP socket */ | 235 | /* analyze IP specific data of net_device belonging to TCP socket */ |
| 235 | addr6 = (struct sockaddr_in6 *)&addrs; | 236 | addr6 = (struct sockaddr_in6 *)&addrs; |
| 236 | rcu_read_lock(); | 237 | rcu_read_lock(); |
| @@ -1474,7 +1474,9 @@ static void smc_conn_abort_work(struct work_struct *work) · 1473 unmodified lines | |||
| 1474 | abort_work); | 1474 | abort_work); |
| 1475 | struct smc_sock *smc = container_of(conn, struct smc_sock, conn); | 1475 | struct smc_sock *smc = container_of(conn, struct smc_sock, conn); |
| 1476 | 1476 | ||
| 1477 | lock_sock(&smc->sk); | ||
| 1477 | smc_conn_kill(conn, true); | 1478 | smc_conn_kill(conn, true); |
| 1479 | release_sock(&smc->sk); | ||
| 1478 | sock_put(&smc->sk); /* sock_hold done by schedulers of abort_work */ | 1480 | sock_put(&smc->sk); /* sock_hold done by schedulers of abort_work */ |
| 1479 | } | 1481 | } |
| 1480 | 1482 | ||
| @@ -1,6 +1,6 @@ | |||
| 1 | #!/bin/bash | 1 | #!/bin/bash |
| 2 | # SPDX-License-Identifier: GPL-2.0 | 2 | # SPDX-License-Identifier: GPL-2.0 |
| 3 | # Copyright 2020 NXP Semiconductors | 3 | # Copyright 2020 NXP |
| 4 | 4 | ||
| 5 | WAIT_TIME=1 | 5 | WAIT_TIME=1 |
| 6 | NUM_NETIFS=4 | 6 | NUM_NETIFS=4 |
| @@ -1,5 +1,2 @@ | |||
| 1 | ##TEST_GEN_FILES := test_unix_oob | 1 | TEST_GEN_PROGS := test_unix_oob |
| 2 | TEST_PROGS := test_unix_oob | ||
| 3 | include ../../lib.mk | 2 | include ../../lib.mk |
| 4 | |||
| 5 | all: $(TEST_PROGS) | ||
| @@ -271,8 +271,9 @@ main(int argc, char **argv) · 270 unmodified lines | |||
| 271 | read_oob(pfd, &oob); | 271 | read_oob(pfd, &oob); |
| 272 | 272 | ||
| 273 | if (!signal_recvd || len != 127 || oob != '%' || atmark != 1) { | 273 | if (!signal_recvd || len != 127 || oob != '%' || atmark != 1) { |
| 274 | fprintf(stderr, "Test 3 failed, sigurg %d len %d OOB %c ", | 274 | fprintf(stderr, |
| 275 | "atmark %d\n", signal_recvd, len, oob, atmark); | 275 | "Test 3 failed, sigurg %d len %d OOB %c atmark %d\n", |
| 276 | signal_recvd, len, oob, atmark); | ||
| 276 | die(1); | 277 | die(1); |
| 277 | } | 278 | } |
| 278 | 279 | ||