* [PATCH net-next v2 0/2] net: dsa: adjust_link removal @ 2024-04-29 16:54 Florian Fainelli 2024-04-29 16:54 ` [PATCH net-next v2 1/2] net: dsa: Remove fixed_link_update member Florian Fainelli 2024-04-29 16:54 ` [PATCH net-next v2 2/2] net: dsa: Remove adjust_link paths Florian Fainelli 0 siblings, 2 replies; 7+ messages in thread From: Florian Fainelli @ 2024-04-29 16:54 UTC (permalink / raw) To: netdev Cc: Florian Fainelli, Andrew Lunn, Florian Fainelli, Vladimir Oltean, David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni, Russell King, open list Now that the last in-tree driver (b53) has been converted to PHYLINK, we can get rid of all of code that catered to working with drivers implementing only PHYLIB's adjust_link callback. Changes in v2: - remove a now unused phy_device pointer in dsa_port_phylink_mac_link_down Florian Fainelli (2): net: dsa: Remove fixed_link_update member net: dsa: Remove adjust_link paths include/net/dsa.h | 11 ---- net/dsa/dsa.c | 3 +- net/dsa/port.c | 136 ++++------------------------------------------ 3 files changed, 12 insertions(+), 138 deletions(-) -- 2.34.1 ^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH net-next v2 1/2] net: dsa: Remove fixed_link_update member 2024-04-29 16:54 [PATCH net-next v2 0/2] net: dsa: adjust_link removal Florian Fainelli @ 2024-04-29 16:54 ` Florian Fainelli 2024-04-29 16:54 ` [PATCH net-next v2 2/2] net: dsa: Remove adjust_link paths Florian Fainelli 1 sibling, 0 replies; 7+ messages in thread From: Florian Fainelli @ 2024-04-29 16:54 UTC (permalink / raw) To: netdev Cc: Florian Fainelli, Andrew Lunn, Florian Fainelli, Vladimir Oltean, David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni, Russell King, open list We have not had a switch driver use a fixed_link_update callback since 58d56fcc3964f9be0a9ca42fd126bcd9dc7afc90 ("net: dsa: bcm_sf2: Get rid of PHYLIB functions") remove this callback. Signed-off-by: Florian Fainelli <florian.fainelli@broadcom.com> --- include/net/dsa.h | 4 ---- 1 file changed, 4 deletions(-) diff --git a/include/net/dsa.h b/include/net/dsa.h index a6ef7e4c503f..678f1fd8b189 100644 --- a/include/net/dsa.h +++ b/include/net/dsa.h @@ -25,7 +25,6 @@ struct dsa_8021q_context; struct tc_action; struct phy_device; -struct fixed_phy_status; struct phylink_link_state; #define DSA_TAG_PROTO_NONE_VALUE 0 @@ -873,9 +872,6 @@ struct dsa_switch_ops { */ void (*adjust_link)(struct dsa_switch *ds, int port, struct phy_device *phydev); - void (*fixed_link_update)(struct dsa_switch *ds, int port, - struct fixed_phy_status *st); - /* * PHYLINK integration */ -- 2.34.1 ^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH net-next v2 2/2] net: dsa: Remove adjust_link paths 2024-04-29 16:54 [PATCH net-next v2 0/2] net: dsa: adjust_link removal Florian Fainelli 2024-04-29 16:54 ` [PATCH net-next v2 1/2] net: dsa: Remove fixed_link_update member Florian Fainelli @ 2024-04-29 16:54 ` Florian Fainelli 2024-04-29 20:00 ` Simon Horman ` (2 more replies) 1 sibling, 3 replies; 7+ messages in thread From: Florian Fainelli @ 2024-04-29 16:54 UTC (permalink / raw) To: netdev Cc: Florian Fainelli, Andrew Lunn, Florian Fainelli, Vladimir Oltean, David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni, Russell King, open list Now that we no longer any drivers using PHYLIB's adjust_link callback, remove all paths that made use of adjust_link as well as the associated functions. Signed-off-by: Florian Fainelli <florian.fainelli@broadcom.com> --- include/net/dsa.h | 7 --- net/dsa/dsa.c | 3 +- net/dsa/port.c | 136 ++++------------------------------------------ 3 files changed, 12 insertions(+), 134 deletions(-) diff --git a/include/net/dsa.h b/include/net/dsa.h index 678f1fd8b189..eef702dbea78 100644 --- a/include/net/dsa.h +++ b/include/net/dsa.h @@ -24,8 +24,6 @@ struct dsa_8021q_context; struct tc_action; -struct phy_device; -struct phylink_link_state; #define DSA_TAG_PROTO_NONE_VALUE 0 #define DSA_TAG_PROTO_BRCM_VALUE 1 @@ -867,11 +865,6 @@ struct dsa_switch_ops { int (*phy_write)(struct dsa_switch *ds, int port, int regnum, u16 val); - /* - * Link state adjustment (called from libphy) - */ - void (*adjust_link)(struct dsa_switch *ds, int port, - struct phy_device *phydev); /* * PHYLINK integration */ diff --git a/net/dsa/dsa.c b/net/dsa/dsa.c index 2f347cd37316..12521a7d4048 100644 --- a/net/dsa/dsa.c +++ b/net/dsa/dsa.c @@ -1511,8 +1511,7 @@ static int dsa_switch_probe(struct dsa_switch *ds) ds->ops->phylink_mac_config || ds->ops->phylink_mac_finish || ds->ops->phylink_mac_link_down || - ds->ops->phylink_mac_link_up || - ds->ops->adjust_link) + ds->ops->phylink_mac_link_up) return -EINVAL; } diff --git a/net/dsa/port.c b/net/dsa/port.c index c6febc3d96d9..68955014f83d 100644 --- a/net/dsa/port.c +++ b/net/dsa/port.c @@ -1535,25 +1535,6 @@ void dsa_port_set_tag_protocol(struct dsa_port *cpu_dp, cpu_dp->tag_ops = tag_ops; } -static struct phy_device *dsa_port_get_phy_device(struct dsa_port *dp) -{ - struct device_node *phy_dn; - struct phy_device *phydev; - - phy_dn = of_parse_phandle(dp->dn, "phy-handle", 0); - if (!phy_dn) - return NULL; - - phydev = of_phy_find_device(phy_dn); - if (!phydev) { - of_node_put(phy_dn); - return ERR_PTR(-EPROBE_DEFER); - } - - of_node_put(phy_dn); - return phydev; -} - static struct phylink_pcs * dsa_port_phylink_mac_select_pcs(struct phylink_config *config, phy_interface_t interface) @@ -1616,17 +1597,13 @@ static void dsa_port_phylink_mac_link_down(struct phylink_config *config, phy_interface_t interface) { struct dsa_port *dp = dsa_phylink_to_port(config); - struct phy_device *phydev = NULL; struct dsa_switch *ds = dp->ds; if (dsa_port_is_user(dp)) phydev = dp->user->phydev; - if (!ds->ops->phylink_mac_link_down) { - if (ds->ops->adjust_link && phydev) - ds->ops->adjust_link(ds, dp->index, phydev); + if (!ds->ops->phylink_mac_link_down) return; - } ds->ops->phylink_mac_link_down(ds, dp->index, mode, interface); } @@ -1641,11 +1618,8 @@ static void dsa_port_phylink_mac_link_up(struct phylink_config *config, struct dsa_port *dp = dsa_phylink_to_port(config); struct dsa_switch *ds = dp->ds; - if (!ds->ops->phylink_mac_link_up) { - if (ds->ops->adjust_link && phydev) - ds->ops->adjust_link(ds, dp->index, phydev); + if (!ds->ops->phylink_mac_link_up) return; - } ds->ops->phylink_mac_link_up(ds, dp->index, mode, interface, phydev, speed, duplex, tx_pause, rx_pause); @@ -1708,78 +1682,6 @@ void dsa_port_phylink_destroy(struct dsa_port *dp) dp->pl = NULL; } -static int dsa_shared_port_setup_phy_of(struct dsa_port *dp, bool enable) -{ - struct dsa_switch *ds = dp->ds; - struct phy_device *phydev; - int port = dp->index; - int err = 0; - - phydev = dsa_port_get_phy_device(dp); - if (!phydev) - return 0; - - if (IS_ERR(phydev)) - return PTR_ERR(phydev); - - if (enable) { - err = genphy_resume(phydev); - if (err < 0) - goto err_put_dev; - - err = genphy_read_status(phydev); - if (err < 0) - goto err_put_dev; - } else { - err = genphy_suspend(phydev); - if (err < 0) - goto err_put_dev; - } - - if (ds->ops->adjust_link) - ds->ops->adjust_link(ds, port, phydev); - - dev_dbg(ds->dev, "enabled port's phy: %s", phydev_name(phydev)); - -err_put_dev: - put_device(&phydev->mdio.dev); - return err; -} - -static int dsa_shared_port_fixed_link_register_of(struct dsa_port *dp) -{ - struct device_node *dn = dp->dn; - struct dsa_switch *ds = dp->ds; - struct phy_device *phydev; - int port = dp->index; - phy_interface_t mode; - int err; - - err = of_phy_register_fixed_link(dn); - if (err) { - dev_err(ds->dev, - "failed to register the fixed PHY of port %d\n", - port); - return err; - } - - phydev = of_phy_find_device(dn); - - err = of_get_phy_mode(dn, &mode); - if (err) - mode = PHY_INTERFACE_MODE_NA; - phydev->interface = mode; - - genphy_read_status(phydev); - - if (ds->ops->adjust_link) - ds->ops->adjust_link(ds, port, phydev); - - put_device(&phydev->mdio.dev); - - return 0; -} - static int dsa_shared_port_phylink_register(struct dsa_port *dp) { struct dsa_switch *ds = dp->ds; @@ -1983,44 +1885,28 @@ int dsa_shared_port_link_register_of(struct dsa_port *dp) dsa_switches_apply_workarounds)) return -EINVAL; - if (!ds->ops->adjust_link) { - if (missing_link_description) { - dev_warn(ds->dev, - "Skipping phylink registration for %s port %d\n", - dsa_port_is_cpu(dp) ? "CPU" : "DSA", dp->index); - } else { - dsa_shared_port_link_down(dp); + if (missing_link_description) { + dev_warn(ds->dev, + "Skipping phylink registration for %s port %d\n", + dsa_port_is_cpu(dp) ? "CPU" : "DSA", dp->index); + } else { + dsa_shared_port_link_down(dp); - return dsa_shared_port_phylink_register(dp); - } - return 0; + return dsa_shared_port_phylink_register(dp); } - dev_warn(ds->dev, - "Using legacy PHYLIB callbacks. Please migrate to PHYLINK!\n"); - - if (of_phy_is_fixed_link(dp->dn)) - return dsa_shared_port_fixed_link_register_of(dp); - else - return dsa_shared_port_setup_phy_of(dp, true); + return 0; } void dsa_shared_port_link_unregister_of(struct dsa_port *dp) { - struct dsa_switch *ds = dp->ds; - - if (!ds->ops->adjust_link && dp->pl) { + if (dp->pl) { rtnl_lock(); phylink_disconnect_phy(dp->pl); rtnl_unlock(); dsa_port_phylink_destroy(dp); return; } - - if (of_phy_is_fixed_link(dp->dn)) - of_phy_deregister_fixed_link(dp->dn); - else - dsa_shared_port_setup_phy_of(dp, false); } int dsa_port_hsr_join(struct dsa_port *dp, struct net_device *hsr, -- 2.34.1 ^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH net-next v2 2/2] net: dsa: Remove adjust_link paths 2024-04-29 16:54 ` [PATCH net-next v2 2/2] net: dsa: Remove adjust_link paths Florian Fainelli @ 2024-04-29 20:00 ` Simon Horman 2024-04-29 21:47 ` Florian Fainelli 2024-04-30 2:33 ` kernel test robot 2024-04-30 4:20 ` kernel test robot 2 siblings, 1 reply; 7+ messages in thread From: Simon Horman @ 2024-04-29 20:00 UTC (permalink / raw) To: Florian Fainelli Cc: netdev, Andrew Lunn, Florian Fainelli, Vladimir Oltean, David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni, Russell King, open list On Mon, Apr 29, 2024 at 09:54:05AM -0700, Florian Fainelli wrote: > Now that we no longer any drivers using PHYLIB's adjust_link callback, > remove all paths that made use of adjust_link as well as the associated > functions. > > Signed-off-by: Florian Fainelli <florian.fainelli@broadcom.com> ... > @@ -1616,17 +1597,13 @@ static void dsa_port_phylink_mac_link_down(struct phylink_config *config, > phy_interface_t interface) > { > struct dsa_port *dp = dsa_phylink_to_port(config); > - struct phy_device *phydev = NULL; Hi Florian, I'm wondering if some changes got lost somewhere. phydev is removed here... > struct dsa_switch *ds = dp->ds; > > if (dsa_port_is_user(dp)) > phydev = dp->user->phydev; ... assigned here, but not used. Perhaps the three lines above should be removed? > > - if (!ds->ops->phylink_mac_link_down) { > - if (ds->ops->adjust_link && phydev) > - ds->ops->adjust_link(ds, dp->index, phydev); > + if (!ds->ops->phylink_mac_link_down) > return; > - } > > ds->ops->phylink_mac_link_down(ds, dp->index, mode, interface); > } ... -- pw-client: changes-requested ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH net-next v2 2/2] net: dsa: Remove adjust_link paths 2024-04-29 20:00 ` Simon Horman @ 2024-04-29 21:47 ` Florian Fainelli 0 siblings, 0 replies; 7+ messages in thread From: Florian Fainelli @ 2024-04-29 21:47 UTC (permalink / raw) To: Simon Horman Cc: netdev, Andrew Lunn, Florian Fainelli, Vladimir Oltean, David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni, Russell King, open list [-- Attachment #1: Type: text/plain, Size: 970 bytes --] On 4/29/24 13:00, Simon Horman wrote: > On Mon, Apr 29, 2024 at 09:54:05AM -0700, Florian Fainelli wrote: >> Now that we no longer any drivers using PHYLIB's adjust_link callback, >> remove all paths that made use of adjust_link as well as the associated >> functions. >> >> Signed-off-by: Florian Fainelli <florian.fainelli@broadcom.com> > > ... > >> @@ -1616,17 +1597,13 @@ static void dsa_port_phylink_mac_link_down(struct phylink_config *config, >> phy_interface_t interface) >> { >> struct dsa_port *dp = dsa_phylink_to_port(config); >> - struct phy_device *phydev = NULL; > > Hi Florian, > > I'm wondering if some changes got lost somewhere. > > phydev is removed here... > >> struct dsa_switch *ds = dp->ds; >> >> if (dsa_port_is_user(dp)) >> phydev = dp->user->phydev; > > ... assigned here, but not used. > > Perhaps the three lines above should be removed? Yes, sorry about that, rebase gone wrong on my side. -- Florian [-- Attachment #2: S/MIME Cryptographic Signature --] [-- Type: application/pkcs7-signature, Size: 4221 bytes --] ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH net-next v2 2/2] net: dsa: Remove adjust_link paths 2024-04-29 16:54 ` [PATCH net-next v2 2/2] net: dsa: Remove adjust_link paths Florian Fainelli 2024-04-29 20:00 ` Simon Horman @ 2024-04-30 2:33 ` kernel test robot 2024-04-30 4:20 ` kernel test robot 2 siblings, 0 replies; 7+ messages in thread From: kernel test robot @ 2024-04-30 2:33 UTC (permalink / raw) To: Florian Fainelli, netdev Cc: oe-kbuild-all, Florian Fainelli, Andrew Lunn, Vladimir Oltean, Eric Dumazet, Jakub Kicinski, Paolo Abeni, Russell King, linux-kernel Hi Florian, kernel test robot noticed the following build errors: [auto build test ERROR on net-next/main] url: https://github.com/intel-lab-lkp/linux/commits/Florian-Fainelli/net-dsa-Remove-fixed_link_update-member/20240430-005631 base: net-next/main patch link: https://lore.kernel.org/r/20240429165405.2298962-3-florian.fainelli%40broadcom.com patch subject: [PATCH net-next v2 2/2] net: dsa: Remove adjust_link paths config: m68k-allmodconfig (https://download.01.org/0day-ci/archive/20240430/202404301046.whP44a3U-lkp@intel.com/config) compiler: m68k-linux-gcc (GCC) 13.2.0 reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240430/202404301046.whP44a3U-lkp@intel.com/reproduce) If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags | Reported-by: kernel test robot <lkp@intel.com> | Closes: https://lore.kernel.org/oe-kbuild-all/202404301046.whP44a3U-lkp@intel.com/ All errors (new ones prefixed by >>): net/dsa/port.c: In function 'dsa_port_phylink_mac_link_down': >> net/dsa/port.c:1603:17: error: 'phydev' undeclared (first use in this function) 1603 | phydev = dp->user->phydev; | ^~~~~~ net/dsa/port.c:1603:17: note: each undeclared identifier is reported only once for each function it appears in vim +/phydev +1603 net/dsa/port.c dd805cf3e80e03 Russell King (Oracle 2023-05-25 1594) 8ae674964e67eb Florian Fainelli 2019-12-16 1595 static void dsa_port_phylink_mac_link_down(struct phylink_config *config, 77373d49de22e8 Ioana Ciornei 2019-05-28 1596 unsigned int mode, 77373d49de22e8 Ioana Ciornei 2019-05-28 1597 phy_interface_t interface) 77373d49de22e8 Ioana Ciornei 2019-05-28 1598 { dd0c9855b41310 Russell King (Oracle 2024-04-10 1599) struct dsa_port *dp = dsa_phylink_to_port(config); 77373d49de22e8 Ioana Ciornei 2019-05-28 1600 struct dsa_switch *ds = dp->ds; 77373d49de22e8 Ioana Ciornei 2019-05-28 1601 57d77986e74287 Vladimir Oltean 2021-10-20 1602 if (dsa_port_is_user(dp)) 6ca80638b90cec Florian Fainelli 2023-10-23 @1603 phydev = dp->user->phydev; 0e27921816ad99 Ioana Ciornei 2019-05-28 1604 e9829e26ff2c61 Florian Fainelli 2024-04-29 1605 if (!ds->ops->phylink_mac_link_down) 77373d49de22e8 Ioana Ciornei 2019-05-28 1606 return; 77373d49de22e8 Ioana Ciornei 2019-05-28 1607 77373d49de22e8 Ioana Ciornei 2019-05-28 1608 ds->ops->phylink_mac_link_down(ds, dp->index, mode, interface); 77373d49de22e8 Ioana Ciornei 2019-05-28 1609 } 77373d49de22e8 Ioana Ciornei 2019-05-28 1610 -- 0-DAY CI Kernel Test Service https://github.com/intel/lkp-tests/wiki ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH net-next v2 2/2] net: dsa: Remove adjust_link paths 2024-04-29 16:54 ` [PATCH net-next v2 2/2] net: dsa: Remove adjust_link paths Florian Fainelli 2024-04-29 20:00 ` Simon Horman 2024-04-30 2:33 ` kernel test robot @ 2024-04-30 4:20 ` kernel test robot 2 siblings, 0 replies; 7+ messages in thread From: kernel test robot @ 2024-04-30 4:20 UTC (permalink / raw) To: Florian Fainelli, netdev Cc: llvm, oe-kbuild-all, Florian Fainelli, Andrew Lunn, Vladimir Oltean, Eric Dumazet, Jakub Kicinski, Paolo Abeni, Russell King, linux-kernel Hi Florian, kernel test robot noticed the following build errors: [auto build test ERROR on net-next/main] url: https://github.com/intel-lab-lkp/linux/commits/Florian-Fainelli/net-dsa-Remove-fixed_link_update-member/20240430-005631 base: net-next/main patch link: https://lore.kernel.org/r/20240429165405.2298962-3-florian.fainelli%40broadcom.com patch subject: [PATCH net-next v2 2/2] net: dsa: Remove adjust_link paths config: arm-defconfig (https://download.01.org/0day-ci/archive/20240430/202404301234.CUZfd15j-lkp@intel.com/config) compiler: clang version 14.0.6 (https://github.com/llvm/llvm-project.git f28c006a5895fc0e329fe15fead81e37457cb1d1) reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240430/202404301234.CUZfd15j-lkp@intel.com/reproduce) If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags | Reported-by: kernel test robot <lkp@intel.com> | Closes: https://lore.kernel.org/oe-kbuild-all/202404301234.CUZfd15j-lkp@intel.com/ All errors (new ones prefixed by >>): >> net/dsa/port.c:1603:3: error: use of undeclared identifier 'phydev' phydev = dp->user->phydev; ^ 1 error generated. vim +/phydev +1603 net/dsa/port.c dd805cf3e80e03 Russell King (Oracle 2023-05-25 1594) 8ae674964e67eb Florian Fainelli 2019-12-16 1595 static void dsa_port_phylink_mac_link_down(struct phylink_config *config, 77373d49de22e8 Ioana Ciornei 2019-05-28 1596 unsigned int mode, 77373d49de22e8 Ioana Ciornei 2019-05-28 1597 phy_interface_t interface) 77373d49de22e8 Ioana Ciornei 2019-05-28 1598 { dd0c9855b41310 Russell King (Oracle 2024-04-10 1599) struct dsa_port *dp = dsa_phylink_to_port(config); 77373d49de22e8 Ioana Ciornei 2019-05-28 1600 struct dsa_switch *ds = dp->ds; 77373d49de22e8 Ioana Ciornei 2019-05-28 1601 57d77986e74287 Vladimir Oltean 2021-10-20 1602 if (dsa_port_is_user(dp)) 6ca80638b90cec Florian Fainelli 2023-10-23 @1603 phydev = dp->user->phydev; 0e27921816ad99 Ioana Ciornei 2019-05-28 1604 e9829e26ff2c61 Florian Fainelli 2024-04-29 1605 if (!ds->ops->phylink_mac_link_down) 77373d49de22e8 Ioana Ciornei 2019-05-28 1606 return; 77373d49de22e8 Ioana Ciornei 2019-05-28 1607 77373d49de22e8 Ioana Ciornei 2019-05-28 1608 ds->ops->phylink_mac_link_down(ds, dp->index, mode, interface); 77373d49de22e8 Ioana Ciornei 2019-05-28 1609 } 77373d49de22e8 Ioana Ciornei 2019-05-28 1610 -- 0-DAY CI Kernel Test Service https://github.com/intel/lkp-tests/wiki ^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2024-04-30 4:21 UTC | newest] Thread overview: 7+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2024-04-29 16:54 [PATCH net-next v2 0/2] net: dsa: adjust_link removal Florian Fainelli 2024-04-29 16:54 ` [PATCH net-next v2 1/2] net: dsa: Remove fixed_link_update member Florian Fainelli 2024-04-29 16:54 ` [PATCH net-next v2 2/2] net: dsa: Remove adjust_link paths Florian Fainelli 2024-04-29 20:00 ` Simon Horman 2024-04-29 21:47 ` Florian Fainelli 2024-04-30 2:33 ` kernel test robot 2024-04-30 4:20 ` kernel test robot
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).