Re: [PATCH net-next v4 06/11] net: stmmac: resetup XPCS according to the new interface mode

From: Russell King (Oracle)
Date: Tue Jan 30 2024 - 05:22:42 EST


On Mon, Jan 29, 2024 at 09:02:48PM +0800, Choong Yong Liang wrote:
> XPCS creation will map the configuration for the provided interface mode.
> Then XPCS will operate according to the interface mode.
>
> When the interface mode changes, XPCS is required to map the configuration
> to the new interface mode and destroy the old interface mode where it
> is not in use.
>
> Signed-off-by: Choong Yong Liang <yong.liang.choong@xxxxxxxxxxxxxxx>
> ---
> drivers/net/ethernet/stmicro/stmmac/stmmac.h | 2 +-
> drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 13 +++++++++++--
> drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c | 7 +++----
> 3 files changed, 15 insertions(+), 7 deletions(-)
>
> diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac.h b/drivers/net/ethernet/stmicro/stmmac/stmmac.h
> index f155e4841c62..886efd26991e 100644
> --- a/drivers/net/ethernet/stmicro/stmmac/stmmac.h
> +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac.h
> @@ -357,7 +357,7 @@ enum stmmac_state {
> int stmmac_mdio_unregister(struct net_device *ndev);
> int stmmac_mdio_register(struct net_device *ndev);
> int stmmac_mdio_reset(struct mii_bus *mii);
> -int stmmac_xpcs_setup(struct mii_bus *mii);
> +int stmmac_xpcs_setup(struct mii_bus *mii, phy_interface_t interface);
> void stmmac_set_ethtool_ops(struct net_device *netdev);
>
> int stmmac_init_tstamp_counter(struct stmmac_priv *priv, u32 systime_flags);
> diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
> index 00af5a4195fd..50429c985441 100644
> --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
> +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
> @@ -941,8 +941,17 @@ static struct phylink_pcs *stmmac_mac_select_pcs(struct phylink_config *config,
> {
> struct stmmac_priv *priv = netdev_priv(to_net_dev(config->dev));
>
> - if (priv->hw->xpcs)
> + if (priv->hw->xpcs) {
> + if (interface != PHY_INTERFACE_MODE_NA &&
> + interface != priv->plat->phy_interface) {
> + /* When there are major changes, we reconfigure
> + * the setup for xpcs according to the interface.
> + */
> + xpcs_destroy(priv->hw->xpcs);
> + stmmac_xpcs_setup(priv->mii, interface);

NAK. Absolutely not. You haven't read the phylink documentation, nor
understood how phylink works.

Since you haven't read the phylink documentation, I'm not going to
waste any more time reviewing this series since you haven't done your
side of the bargin here.

--
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 80Mbps down 10Mbps up. Decent connectivity at last!