[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <0b772f90-9f0b-fa3c-7b8e-08c253b256d6@codeaurora.org>
Date: Fri, 13 Jan 2017 00:20:37 -0600
From: Timur Tabi <timur@...eaurora.org>
To: David Miller <davem@...emloft.net>,
Florian Fainelli <f.fainelli@...il.com>,
netdev@...r.kernel.org, Alok Chauhan <alokc@...eaurora.org>
Subject: Re: [PATCH] [v2] net: qcom/emac: add ethtool support
Timur Tabi wrote:
> +static void emac_get_pauseparam(struct net_device *netdev,
> + struct ethtool_pauseparam *pause)
> +{
> + struct phy_device *phydev = netdev->phydev;
> +
> + 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;
> + }
> +}
I finally figured out why this code was bothering me.
This function works, as long as I do NOT implement set_pauseparam.
That's because the driver always matches the pause frame support in the
MAC with whatever the PHY is doing. Since the MAC and PHY are always in
sync, I can use the PHY settings for get_pauseparam.
However, technically this is not correct. get_pauseparam is supposed to
return the setting of the MAC, not the PHY. If I also implement
set_pauseparam, which can force the MAC to ignore the PHY and
enable/disable pause frames arbitrarily, then the above function is wrong.
Do I finally understand this correctly?
--
Sent by an employee of the Qualcomm Innovation Center, Inc.
The Qualcomm Innovation Center, Inc. is a member of the
Code Aurora Forum, hosted by The Linux Foundation.
Powered by blists - more mailing lists