From: "Russell King (Oracle)" <linux@armlinux.org.uk>
To: Andrew Lunn <andrew@lunn.ch>
Cc: Jiawen Wu <jiawenwu@trustnetic.com>,
netdev@vger.kernel.org, davem@davemloft.net, edumazet@google.com,
kuba@kernel.org, pabeni@redhat.com, horms@kernel.org,
mengyuanlou@net-swift.com
Subject: Re: [PATCH net-next 1/5] net: wangxun: add flow control support
Date: Wed, 22 Nov 2023 16:30:41 +0000 [thread overview]
Message-ID: <ZV4ssdbQyxtYgURN@shell.armlinux.org.uk> (raw)
In-Reply-To: <6218df6e-db11-4640-a296-946088d32916@lunn.ch>
On Wed, Nov 22, 2023 at 05:15:05PM +0100, Andrew Lunn wrote:
> > +static void ngbe_get_pauseparam(struct net_device *netdev,
> > + struct ethtool_pauseparam *pause)
> > +{
> > + struct wx *wx = netdev_priv(netdev);
> > +
> > + pause->autoneg = !wx->fc.disable_fc_autoneg;
>
> Maybe call it enable_fs_autoneg, since that is what the kAPI uses?
fs?
> > + wx->fc.disable_fc_autoneg = !pause->autoneg;
> > + wx->fc.tx_pause = pause->tx_pause;
> > + wx->fc.rx_pause = pause->rx_pause;
> > +
> > + phy_set_asym_pause(wx->phydev, pause->rx_pause, pause->tx_pause);
>
> You should only be doing this if pause->autoneg is true. If it is
> false, you ignore the results from autoneg, and just configure the
> hardware as indicated by pause->{tr}x_pause.
However, if autoneg is supported, but pause autoneg is disabled, there
is still the need to update the PHY's advertisement so the remote end
knows what's going on, as documented in the user API:
" * If the link is autonegotiated, drivers should use
* mii_advertise_flowctrl() or similar code to set the advertised
* pause frame capabilities based on the @rx_pause and @tx_pause flags,
* even if @autoneg is zero. ... "
You are correct that when !pause->autoneg, tx_pause/rx_pause are to be
used in place of the negotiated versions.
Also... when getting the pause parameters, tx_pause/rx_pause _should_
reflect what was set for these parameters via the set function, *not*
the current state affected by negotiation.
--
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 80Mbps down 10Mbps up. Decent connectivity at last!
next prev parent reply other threads:[~2023-11-22 16:30 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-11-22 10:22 [PATCH net-next 0/5] Implement more ethtool_ops for Wangxun Jiawen Wu
2023-11-22 10:22 ` [PATCH net-next 1/5] net: wangxun: add flow control support Jiawen Wu
2023-11-22 16:15 ` Andrew Lunn
2023-11-22 16:30 ` Russell King (Oracle) [this message]
2023-11-22 17:24 ` Andrew Lunn
2023-11-22 17:26 ` Russell King (Oracle)
2023-11-23 9:20 ` Jiawen Wu
2023-11-22 10:22 ` [PATCH net-next 2/5] net: wangxun: add ethtool_ops for ring parameters Jiawen Wu
2023-11-22 16:24 ` Andrew Lunn
2023-11-23 9:25 ` Jiawen Wu
2023-11-23 15:14 ` Andrew Lunn
2023-11-30 3:32 ` Jiawen Wu
2023-11-22 10:22 ` [PATCH net-next 3/5] net: wangxun: add coalesce options support Jiawen Wu
2023-11-22 10:22 ` [PATCH net-next 4/5] net: wangxun: add ethtool_ops for channel number Jiawen Wu
2023-11-22 16:35 ` Andrew Lunn
2023-11-22 10:22 ` [PATCH net-next 5/5] net: wangxun: add ethtool_ops for msglevel Jiawen Wu
2023-11-22 16:36 ` Andrew Lunn
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=ZV4ssdbQyxtYgURN@shell.armlinux.org.uk \
--to=linux@armlinux.org.uk \
--cc=andrew@lunn.ch \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=horms@kernel.org \
--cc=jiawenwu@trustnetic.com \
--cc=kuba@kernel.org \
--cc=mengyuanlou@net-swift.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
/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).