[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <d7089be7-dcbb-4934-9a78-48f9df52a2d4@lunn.ch>
Date: Wed, 8 May 2024 16:03:28 +0200
From: Andrew Lunn <andrew@...n.ch>
To: FUJITA Tomonori <fujita.tomonori@...il.com>
Cc: netdev@...r.kernel.org, kuba@...nel.org, jiri@...nulli.us,
horms@...nel.org
Subject: Re: [PATCH net-next v4 6/6] net: tn40xx: add PHYLIB support
On Wed, May 08, 2024 at 10:18:51PM +0900, FUJITA Tomonori wrote:
> Hi,
>
> On Wed, 8 May 2024 14:21:29 +0200
> Andrew Lunn <andrew@...n.ch> wrote:
>
> >> --- a/drivers/net/ethernet/tehuti/tn40.c
> >> +++ b/drivers/net/ethernet/tehuti/tn40.c
> >> @@ -7,6 +7,7 @@
> >> #include <linux/if_vlan.h>
> >> #include <linux/netdevice.h>
> >> #include <linux/pci.h>
> >> +#include <linux/phylink.h>
> >>
> >> #include "tn40.h"
> >>
> >> @@ -1185,21 +1186,25 @@ static void tn40_link_changed(struct tn40_priv *priv)
> >> u32 link = tn40_read_reg(priv,
> >> TN40_REG_MAC_LNK_STAT) & TN40_MAC_LINK_STAT;
> >> if (!link) {
> >> - if (netif_carrier_ok(priv->ndev) && priv->link)
> >> + if (netif_carrier_ok(priv->ndev) && priv->link) {
> >> netif_stop_queue(priv->ndev);
> >> + phylink_mac_change(priv->phylink, false);
> >> + }
> >
> > What exactly does link_changed mean?
> >
> > The normal use case for calling phylink_mac_change() is that you have
> > received an interrupt from something like the PCS, or the PHY. The MAC
> > driver itself cannot fully evaluate if the link is up because there
> > can be multiple parts in that decision. Is the SFP reporting LOS? Does
>
> The original driver receives an interrupt from an PHY (or something),
> then reads the register (TN40_REG_MAC_LNK_STAT) to evaluate the state
> of the link; doesn't use information from the PHY.
So i guess this is the PCS state. Call phylink_mac_change() with this
state. Don't do anything else here.
Andrew
Powered by blists - more mailing lists