netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Heiner Kallweit <hkallweit1@gmail.com>
To: Andrew Lunn <andrew@lunn.ch>
Cc: Florian Fainelli <f.fainelli@gmail.com>,
	David Miller <davem@davemloft.net>,
	"netdev@vger.kernel.org" <netdev@vger.kernel.org>
Subject: Re: [PATCH net-next 2/2] net: phy: improve phy_set_sym_pause and phy_set_asym_pause
Date: Wed, 1 May 2019 21:32:14 +0200	[thread overview]
Message-ID: <f2fb8c83-c824-9c61-0660-22c164cde5c7@gmail.com> (raw)
In-Reply-To: <40b84e7e-24ed-bf14-f55d-c943ac9f4f4c@gmail.com>

On 30.04.2019 07:06, Heiner Kallweit wrote:
> On 29.04.2019 23:52, Andrew Lunn wrote:
>>> @@ -2078,6 +2089,11 @@ EXPORT_SYMBOL(phy_set_sym_pause);
>>>  void phy_set_asym_pause(struct phy_device *phydev, bool rx, bool tx)
>>>  {
>>>  	__ETHTOOL_DECLARE_LINK_MODE_MASK(oldadv);
>>> +	bool asym_pause_supported;
>>> +
>>> +	asym_pause_supported =
>>> +		linkmode_test_bit(ETHTOOL_LINK_MODE_Asym_Pause_BIT,
>>> +				  phydev->supported);
>>>  
>>>  	linkmode_copy(oldadv, phydev->advertising);
>>>  
>>> @@ -2086,14 +2102,14 @@ void phy_set_asym_pause(struct phy_device *phydev, bool rx, bool tx)
>>>  	linkmode_clear_bit(ETHTOOL_LINK_MODE_Asym_Pause_BIT,
>>>  			   phydev->advertising);
>>>  
>>> -	if (rx) {
>>> +	if (rx && asym_pause_supported) {
>>>  		linkmode_set_bit(ETHTOOL_LINK_MODE_Pause_BIT,
>>>  				 phydev->advertising);
>>>  		linkmode_set_bit(ETHTOOL_LINK_MODE_Asym_Pause_BIT,
>>>  				 phydev->advertising);
>>>  	}
>>>  
>>> -	if (tx)
>>> +	if (tx && asym_pause_supported)
>>>  		linkmode_change_bit(ETHTOOL_LINK_MODE_Asym_Pause_BIT,
>>>  				    phydev->advertising);
>>
>> Hi Heiner
>>
> Hi Andrew,
> 
>> If the PHY only supports Pause, not Asym Pause, i wounder if we should
>> fall back to Pause here?
>>
> I wasn't sure about whether a silent fallback is the expected behavior.
> Also open is whether we can rely on a set_pause callback having called
> phy_validate_pause() before. Another option could be to change the
> return type to int and return an error like -EOPNOTSUPP if the requested
> mode isn't supported.
> 
Most drivers call phy_validate_pause() first, this seems to be the
expected pattern. Therefore I will remove patch 2. However there seems to
be an error in phy_validate_pause(), the fix I will submit separately.

>>      Andrew
>>
> Heiner
> 


  reply	other threads:[~2019-05-01 19:32 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-04-29 20:12 [PATCH net-next 0/2] net: phy: improve pause handling Heiner Kallweit
2019-04-29 20:13 ` [PATCH net-next 1/2] " Heiner Kallweit
2019-04-29 20:14 ` [PATCH net-next 2/2] net: phy: improve phy_set_sym_pause and phy_set_asym_pause Heiner Kallweit
2019-04-29 21:52   ` Andrew Lunn
2019-04-30  5:06     ` Heiner Kallweit
2019-05-01 19:32       ` Heiner Kallweit [this message]
2019-05-01 19:34 ` [PATCH v2 net-next] net: phy: improve pause handling Heiner Kallweit
2019-05-01 20:35   ` Andrew Lunn
2019-05-04  4:48   ` David Miller

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=f2fb8c83-c824-9c61-0660-22c164cde5c7@gmail.com \
    --to=hkallweit1@gmail.com \
    --cc=andrew@lunn.ch \
    --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).