netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Russell King (Oracle)" <linux@armlinux.org.uk>
To: FUJITA Tomonori <fujita.tomonori@gmail.com>
Cc: netdev@vger.kernel.org, andrew@lunn.ch, horms@kernel.org,
	kuba@kernel.org, jiri@resnulli.us, pabeni@redhat.com,
	hfdevel@gmx.net, naveenm@marvell.com, jdamato@fastly.com
Subject: Re: [PATCH net-next v8 6/6] net: tn40xx: add phylink support
Date: Mon, 3 Jun 2024 14:13:36 +0100	[thread overview]
Message-ID: <Zl3BgH3sSd1YyomC@shell.armlinux.org.uk> (raw)
In-Reply-To: <20240603.205455.1265693633847576919.fujita.tomonori@gmail.com>

On Mon, Jun 03, 2024 at 08:54:55PM +0900, FUJITA Tomonori wrote:
> On Mon, 3 Jun 2024 10:22:17 +0100
> "Russell King (Oracle)" <linux@armlinux.org.uk> wrote:
> 
> > On Mon, Jun 03, 2024 at 03:49:55PM +0900, FUJITA Tomonori wrote:
> >> @@ -1374,6 +1375,10 @@ static void tn40_stop(struct tn40_priv *priv)
> >>  static int tn40_close(struct net_device *ndev)
> >>  {
> >>  	struct tn40_priv *priv = netdev_priv(ndev);
> >> +
> >> +	phylink_stop(priv->phylink);
> >> +	phylink_disconnect_phy(priv->phylink);
> > 
> > There is no need to pair both of these together - you can disconnect
> > from the PHY later if it's more convenient.
> 
> I see. Seems that there is no reason to call phylink_disconnect_phy()
> later so I leave this alone.
> 
> >> +
> >>  	napi_disable(&priv->napi);
> >>  	netif_napi_del(&priv->napi);
> >>  	tn40_stop(priv);
> >> @@ -1392,6 +1397,14 @@ static int tn40_open(struct net_device *dev)
> >>  		return ret;
> >>  	}
> >>  	napi_enable(&priv->napi);
> >> +	ret = phylink_connect_phy(priv->phylink, priv->phydev);
> >> +	if (ret) {
> >> +		napi_disable(&priv->napi);
> >> +		tn40_stop(priv);
> >> +		netdev_err(dev, "failed to connect to phy %d\n", ret);
> >> +		return ret;
> >> +	}
> > 
> > Again, no need to pair phylink_connect_phy() close to phylink_start()
> > if there's somewhere more convenient to place it. Operation with the
> > PHY doesn't begin until phylink_start() is called.
> > 
> > My review comment last time was purely about where phylink_start()
> > and phylink_stop() were being called. It's the placement of these
> > two functions that are key.
> 
> Understood. Calling phylink_connect_phy() first in this function looks
> simpler. I modified the code in the following way:
> 
> @@ -1385,13 +1390,20 @@ static int tn40_open(struct net_device *dev)
>  	struct tn40_priv *priv = netdev_priv(dev);
>  	int ret;
>  
> +	ret = phylink_connect_phy(priv->phylink, priv->phydev);
> +	if (ret) {
> +		netdev_err(dev, "failed to connect to phy %d\n", ret);
> +		return ret;
> +	}
>  	tn40_sw_reset(priv);
>  	ret = tn40_start(priv);
>  	if (ret) {
> +		phylink_disconnect_phy(priv->phylink);
>  		netdev_err(dev, "failed to start %d\n", ret);
>  		return ret;
>  	}
>  	napi_enable(&priv->napi);
> +	phylink_start(priv->phylink);
>  	netif_start_queue(priv->ndev);
>  	return 0;
>  }

LGTM, thanks!

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

      reply	other threads:[~2024-06-03 13:13 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-06-03  6:49 [PATCH net-next v8 0/6] add ethernet driver for Tehuti Networks TN40xx chips FUJITA Tomonori
2024-06-03  6:49 ` [PATCH net-next v8 1/6] net: tn40xx: add pci " FUJITA Tomonori
2024-06-03  6:49 ` [PATCH net-next v8 2/6] net: tn40xx: add register defines FUJITA Tomonori
2024-06-03  6:49 ` [PATCH net-next v8 3/6] net: tn40xx: add basic Tx handling FUJITA Tomonori
2024-06-03  6:49 ` [PATCH net-next v8 4/6] net: tn40xx: add basic Rx handling FUJITA Tomonori
2024-06-03  6:49 ` [PATCH net-next v8 5/6] net: tn40xx: add mdio bus support FUJITA Tomonori
2024-06-03  6:49 ` [PATCH net-next v8 6/6] net: tn40xx: add phylink support FUJITA Tomonori
2024-06-03  9:22   ` Russell King (Oracle)
2024-06-03 11:54     ` FUJITA Tomonori
2024-06-03 13:13       ` Russell King (Oracle) [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Zl3BgH3sSd1YyomC@shell.armlinux.org.uk \
    --to=linux@armlinux.org.uk \
    --cc=andrew@lunn.ch \
    --cc=fujita.tomonori@gmail.com \
    --cc=hfdevel@gmx.net \
    --cc=horms@kernel.org \
    --cc=jdamato@fastly.com \
    --cc=jiri@resnulli.us \
    --cc=kuba@kernel.org \
    --cc=naveenm@marvell.com \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).