Exemplo n.º 1
0
static int ethtool_op_set_eee(struct net_device *dev, struct ethtool_value *eee)
{
	struct stmmac_priv *priv = netdev_priv(dev);

	if ((!eee->data) && (priv->eee_enabled)) {
		stmmac_disable_eee_mode(priv);
		priv->eee_enabled = eee->data;
	} else if ((eee->data) && (!priv->eee_enabled))
		/* We are asking for enabling the EEE but this
		 * has to be verified by invoking the eee_init function.
		 * For this reason we cannot set eee_enabled to
		 * eee->data, directly. */
		priv->eee_enabled = stmmac_eee_init(priv);

	return 0;
}
Exemplo n.º 2
0
static int stmmac_ethtool_op_set_eee(struct net_device *dev,
				     struct ethtool_eee *edata)
{
	struct stmmac_priv *priv = netdev_priv(dev);

	priv->eee_enabled = edata->eee_enabled;

	if (!priv->eee_enabled)
		stmmac_disable_eee_mode(priv);
	else {
		/* We are asking for enabling the EEE but it is safe
		 * to verify all by invoking the eee_init function.
		 * In case of failure it will return an error.
		 */
		priv->eee_enabled = stmmac_eee_init(priv);
		if (!priv->eee_enabled)
			return -EOPNOTSUPP;

		/* Do not change tx_lpi_timer in case of failure */
		priv->tx_lpi_timer = edata->tx_lpi_timer;
	}

	return phy_ethtool_set_eee(priv->phydev, edata);
}