[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <Y1Kiocu3WUubYyVe@lunn.ch>
Date: Fri, 21 Oct 2022 15:46:09 +0200
From: Andrew Lunn <andrew@...n.ch>
To: Raju Lakkaraju <Raju.Lakkaraju@...rochip.com>
Cc: netdev@...r.kernel.org, davem@...emloft.net, kuba@...nel.org,
linux-kernel@...r.kernel.org, bryan.whitehead@...rochip.com,
hkallweit1@...il.com, pabeni@...hat.com, edumazet@...gle.com,
linux@...linux.org.uk, UNGLinuxDriver@...rochip.com,
Ian.Saturley@...rochip.com
Subject: Re: [PATCH net-next 1/2] net: lan743x: Add support for
get_pauseparam and set_pauseparam
> +static int lan743x_set_pauseparam(struct net_device *dev,
> + struct ethtool_pauseparam *pause)
> +{
> + struct lan743x_adapter *adapter = netdev_priv(dev);
> + struct phy_device *phydev = dev->phydev;
> + struct lan743x_phy *phy = &adapter->phy;
> +
> + if (!phydev)
> + return -ENODEV;
> +
> + if (!phy_validate_pause(phydev, pause))
> + return -EINVAL;
> +
> + phy->fc_request_control = 0;
> + if (pause->rx_pause)
> + phy->fc_request_control |= FLOW_CTRL_RX;
> +
> + if (pause->tx_pause)
> + phy->fc_request_control |= FLOW_CTRL_TX;
> +
> + phy->fc_autoneg = pause->autoneg;
> +
> + phy_set_asym_pause(phydev, pause->rx_pause, pause->tx_pause);
> +
> + if (pause->autoneg == AUTONEG_DISABLE)
> + lan743x_mac_flow_ctrl_set_enables(adapter, pause->tx_pause,
> + pause->rx_pause);
pause is not too well defined. But i think phy_set_asym_pause() should
be in an else clause. If pause autoneg is off, you directly set it in
the MAC and ignore what is negotiated. If it is enabled, you
negotiate. As far as i understand, you don't modify your negotiation
when pause autoneg is off.
Andrew
Powered by blists - more mailing lists