diff options
author | Tristram Ha <Tristram.Ha@microchip.com> | 2019-02-22 16:36:49 -0800 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2019-02-24 17:49:59 -0800 |
commit | c30d894b6a6a2d1c7ea47d06e6ad4fb5cf0b4999 (patch) | |
tree | aade3f420cf3c5843e8493280286839dc96bb8d7 /drivers/net/dsa/microchip/ksz_common.c | |
parent | 7c6ff470aa867f53b8522a3a5c84c36ac7a20090 (diff) | |
download | kernel_replicant_linux-c30d894b6a6a2d1c7ea47d06e6ad4fb5cf0b4999.tar.gz kernel_replicant_linux-c30d894b6a6a2d1c7ea47d06e6ad4fb5cf0b4999.tar.bz2 kernel_replicant_linux-c30d894b6a6a2d1c7ea47d06e6ad4fb5cf0b4999.zip |
net: dsa: microchip: get port link status
Get port link status to know whether to read MIB counters when the link
is going down.
Signed-off-by: Tristram Ha <Tristram.Ha@microchip.com>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/dsa/microchip/ksz_common.c')
-rw-r--r-- | drivers/net/dsa/microchip/ksz_common.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/drivers/net/dsa/microchip/ksz_common.c b/drivers/net/dsa/microchip/ksz_common.c index eecfbf30cdc2..0589fc7ad09e 100644 --- a/drivers/net/dsa/microchip/ksz_common.c +++ b/drivers/net/dsa/microchip/ksz_common.c @@ -140,6 +140,20 @@ int ksz_phy_write16(struct dsa_switch *ds, int addr, int reg, u16 val) } EXPORT_SYMBOL_GPL(ksz_phy_write16); +void ksz_adjust_link(struct dsa_switch *ds, int port, + struct phy_device *phydev) +{ + struct ksz_device *dev = ds->priv; + struct ksz_port *p = &dev->ports[port]; + + /* Read all MIB counters when the link is going down. */ + if (!phydev->link) { + p->read = true; + schedule_work(&dev->mib_read); + } +} +EXPORT_SYMBOL_GPL(ksz_adjust_link); + int ksz_sset_count(struct dsa_switch *ds, int port, int sset) { struct ksz_device *dev = ds->priv; |