/* ethtool function - get WOL (Wake on LAN) settings, Only Magic Packet * Detection is supported through ethtool
*/ void bcmgenet_get_wol(struct net_device *dev, struct ethtool_wolinfo *wol)
{ struct bcmgenet_priv *priv = netdev_priv(dev); struct device *kdev = &priv->pdev->dev;
u32 phy_wolopts = 0;
if (dev->phydev) {
phy_ethtool_get_wol(dev->phydev, wol);
phy_wolopts = wol->wolopts;
}
/* MAC is not wake-up capable, return what the PHY does */ if (!device_can_wakeup(kdev)) return;
/* Overlay MAC capabilities with that of the PHY queried before */
wol->supported |= WAKE_MAGIC | WAKE_MAGICSECURE | WAKE_FILTER;
wol->wolopts |= priv->wolopts;
/* Return the PHY configured magic password */ if (phy_wolopts & WAKE_MAGICSECURE) return;
/* Otherwise the MAC one */
memset(wol->sopass, 0, sizeof(wol->sopass)); if (wol->wolopts & WAKE_MAGICSECURE)
memcpy(wol->sopass, priv->sopass, sizeof(priv->sopass));
}
/* ethtool function - set WOL (Wake on LAN) settings. * Only for magic packet detection mode.
*/ int bcmgenet_set_wol(struct net_device *dev, struct ethtool_wolinfo *wol)
{ struct bcmgenet_priv *priv = netdev_priv(dev); struct device *kdev = &priv->pdev->dev; int ret;
/* Try Wake-on-LAN from the PHY first */ if (dev->phydev) {
ret = phy_ethtool_set_wol(dev->phydev, wol); if (ret != -EOPNOTSUPP && wol->wolopts) return ret;
}
if (!device_can_wakeup(kdev)) return -ENOTSUPP;
if (wol->wolopts & ~(WAKE_MAGIC | WAKE_MAGICSECURE | WAKE_FILTER)) return -EINVAL;
if (wol->wolopts & WAKE_MAGICSECURE)
memcpy(priv->sopass, wol->sopass, sizeof(priv->sopass));
/* Flag the device and relevant IRQ as wakeup capable */ if (wol->wolopts) {
device_set_wakeup_enable(kdev, 1); /* Avoid unbalanced enable_irq_wake calls */ if (priv->wol_irq_disabled) {
enable_irq_wake(priv->wol_irq);
enable_irq_wake(priv->irq0);
}
priv->wol_irq_disabled = false;
} else {
device_set_wakeup_enable(kdev, 0); /* Avoid unbalanced disable_irq_wake calls */ if (!priv->wol_irq_disabled) {
disable_irq_wake(priv->wol_irq);
disable_irq_wake(priv->irq0);
}
priv->wol_irq_disabled = true;
}
/* Resume link status tracking */
mutex_lock(&dev->phydev->lock); if (dev->phydev->link)
dev->phydev->state = PHY_RUNNING; else
dev->phydev->state = PHY_NOLINK;
mutex_unlock(&dev->phydev->lock);
return 0;
}
Messung V0.5
¤ Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.0.24Bemerkung:
Wie Sie bei der Firma Beratungs- und Dienstleistungen beauftragen können
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.