net: qcom/emac: add ethool support for setting pause parameters
To support setting the pause parameters, the driver can no longer just mirror the PHY. The set_pauseparam feature allows the driver to force the setting in the MAC, regardless of how the PHY is configured. This means that we now need to maintain an internal state for pause frame support, and so get_pauseparam also needs to be updated. If the interface is already running when the setting is changed, then the interface is reset. Note that if the MAC is configured to enable RX pause frame support (i.e. it transmits pause frames to throttle the other end), but the PHY is configured to block those frames, then the feature will not work. Also some buffer size initialization code into emac_init_adapter(), so that it lives with similar code, including the initializtion of pause frame support. Signed-off-by: Timur Tabi <timur@codeaurora.org> Signed-off-by: David S. Miller <davem@davemloft.net>
此提交包含在:
@@ -148,16 +148,26 @@ static void emac_get_ringparam(struct net_device *netdev,
|
||||
static void emac_get_pauseparam(struct net_device *netdev,
|
||||
struct ethtool_pauseparam *pause)
|
||||
{
|
||||
struct phy_device *phydev = netdev->phydev;
|
||||
struct emac_adapter *adpt = netdev_priv(netdev);
|
||||
|
||||
if (phydev) {
|
||||
if (phydev->autoneg)
|
||||
pause->autoneg = 1;
|
||||
if (phydev->pause)
|
||||
pause->rx_pause = 1;
|
||||
if (phydev->pause != phydev->asym_pause)
|
||||
pause->tx_pause = 1;
|
||||
}
|
||||
pause->autoneg = adpt->automatic ? AUTONEG_ENABLE : AUTONEG_DISABLE;
|
||||
pause->rx_pause = adpt->rx_flow_control ? 1 : 0;
|
||||
pause->tx_pause = adpt->tx_flow_control ? 1 : 0;;
|
||||
}
|
||||
|
||||
static int emac_set_pauseparam(struct net_device *netdev,
|
||||
struct ethtool_pauseparam *pause)
|
||||
{
|
||||
struct emac_adapter *adpt = netdev_priv(netdev);
|
||||
|
||||
adpt->automatic = pause->autoneg == AUTONEG_ENABLE;
|
||||
adpt->rx_flow_control = pause->rx_pause != 0;
|
||||
adpt->tx_flow_control = pause->tx_pause != 0;
|
||||
|
||||
if (netif_running(netdev))
|
||||
return emac_reinit_locked(adpt);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static const struct ethtool_ops emac_ethtool_ops = {
|
||||
@@ -172,7 +182,9 @@ static const struct ethtool_ops emac_ethtool_ops = {
|
||||
.get_ethtool_stats = emac_get_ethtool_stats,
|
||||
|
||||
.get_ringparam = emac_get_ringparam,
|
||||
|
||||
.get_pauseparam = emac_get_pauseparam,
|
||||
.set_pauseparam = emac_set_pauseparam,
|
||||
|
||||
.nway_reset = emac_nway_reset,
|
||||
|
||||
|
新增問題並參考
封鎖使用者