netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Timur Tabi <timur@codeaurora.org>
To: David Miller <davem@davemloft.net>,
	Florian Fainelli <f.fainelli@gmail.com>,
	netdev@vger.kernel.org, Alok Chauhan <alokc@codeaurora.org>
Subject: Re: [PATCH] [v2] net: qcom/emac: add ethtool support
Date: Fri, 13 Jan 2017 00:20:37 -0600	[thread overview]
Message-ID: <0b772f90-9f0b-fa3c-7b8e-08c253b256d6@codeaurora.org> (raw)
In-Reply-To: <1483738981-31019-1-git-send-email-timur@codeaurora.org>

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.

      parent reply	other threads:[~2017-01-13  6:20 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-01-06 21:43 [PATCH] [v2] net: qcom/emac: add ethtool support Timur Tabi
2017-01-09 17:08 ` David Miller
2017-01-13  6:20 ` Timur Tabi [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=0b772f90-9f0b-fa3c-7b8e-08c253b256d6@codeaurora.org \
    --to=timur@codeaurora.org \
    --cc=alokc@codeaurora.org \
    --cc=davem@davemloft.net \
    --cc=f.fainelli@gmail.com \
    --cc=netdev@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).