netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Ben Hutchings <ben@decadent.org.uk>
To: Woojung.Huh@microchip.com, davem@davemloft.net
Cc: netdev@vger.kernel.org
Subject: Re: [PATCH V2 net-next 2/3] lan78xx: add ethtool set & get pause functions
Date: Thu, 18 Feb 2016 23:45:11 +0000	[thread overview]
Message-ID: <1455839111.2794.51.camel@decadent.org.uk> (raw)
In-Reply-To: <9235D6609DB808459E95D78E17F2E43D404B37B5@CHN-SV-EXMX02.mchp-main.com>

[-- Attachment #1: Type: text/plain, Size: 1185 bytes --]

On Thu, 2016-02-18 at 22:40 +0000, Woojung.Huh@microchip.com wrote:
> Add ethtool operations of set_pauseram and get_pauseparm.
[...]
> +static void lan78xx_get_pause(struct net_device *net,
> +			      struct ethtool_pauseparam *pause)
> +{
> +	struct lan78xx_net *dev = netdev_priv(net);
> +	struct phy_device *phydev = net->phydev;
> +	struct ethtool_cmd ecmd = { .cmd = ETHTOOL_GSET };
> +
> +	phy_ethtool_gset(phydev, &ecmd);
> +
> +	pause->autoneg = dev->fc_autoneg;
> +
> +	if (dev->fc_autoneg) {
> +		if (dev->fc_autoneg_control & FLOW_CTRL_TX)
> +			pause->tx_pause = 1;
> +
> +		if (dev->fc_autoneg_control & FLOW_CTRL_RX)
> +			pause->rx_pause = 1;

This is incorrect; you should always return the manual settings
(fc_request_control flags) here.  If autonegotiation is enabled then
your get_settings function will return the actual pause flags.

Ben.


> +	} else {
> +		if (dev->fc_request_control & FLOW_CTRL_TX)
> +			pause->tx_pause = 1;
> +
> +		if (dev->fc_request_control & FLOW_CTRL_RX)
> +			pause->rx_pause = 1;
> +	}
> +}
[...]

-- 
Ben Hutchings
Once a job is fouled up, anything done to improve it makes it worse.

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 811 bytes --]

  reply	other threads:[~2016-02-18 23:45 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-02-18 22:40 [PATCH V2 net-next 2/3] lan78xx: add ethtool set & get pause functions Woojung.Huh
2016-02-18 23:45 ` Ben Hutchings [this message]
2016-02-19  0:03   ` Woojung.Huh
2016-02-19  0:06     ` Ben Hutchings
2016-02-19  0:16       ` Woojung.Huh
2016-02-19  1:20         ` Ben Hutchings
2016-02-22 18:26           ` Woojung.Huh
2016-02-22 18:28   ` Woojung.Huh
2016-02-22 19:10     ` David Miller
2016-02-22 20:05       ` Ben Hutchings
2016-02-22 20:28         ` Woojung.Huh
2016-02-23  0:03           ` Ben Hutchings

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=1455839111.2794.51.camel@decadent.org.uk \
    --to=ben@decadent.org.uk \
    --cc=Woojung.Huh@microchip.com \
    --cc=davem@davemloft.net \
    --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).