From: Maxime Chevallier <maxime.chevallier@bootlin.com>
To: Birger Koblitz <mail@birger-koblitz.de>,
Andrew Lunn <andrew+netdev@lunn.ch>,
"David S. Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@google.com>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>
Cc: linux-usb@vger.kernel.org, netdev@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH 5/9] ax88179_178a: Add support for ethtool pause parameter configuration
Date: Wed, 1 Jul 2026 12:04:05 +0200 [thread overview]
Message-ID: <587499ee-d87e-4056-8d2a-8fda2ef3f0f1@bootlin.com> (raw)
In-Reply-To: <20260701-ax88179a-v1-5-13685df67515@birger-koblitz.de>
Hi
On 7/1/26 07:42, Birger Koblitz wrote:
> The AX179A-based chips support pause parameter configuration.
> Make it available through ethtool ops.
>
> Signed-off-by: Birger Koblitz <mail@birger-koblitz.de>
> ---
> drivers/net/usb/ax88179_178a.c | 67 ++++++++++++++++++++++++++++++++++++++++++
> 1 file changed, 67 insertions(+)
>
> diff --git a/drivers/net/usb/ax88179_178a.c b/drivers/net/usb/ax88179_178a.c
> index 16528d873e804fde5dcc27659048882eee1c3eaa..586c049c6f7422a853aeae5e9372ead3a6d106c5 100644
> --- a/drivers/net/usb/ax88179_178a.c
> +++ b/drivers/net/usb/ax88179_178a.c
> @@ -956,6 +956,71 @@ static int ax88179_set_link_ksettings(struct net_device *net,
> return mii_ethtool_set_link_ksettings(&dev->mii, cmd);
> }
>
> +static void ax88179a_get_pauseparam(struct net_device *net, struct ethtool_pauseparam *pause)
> +{
> + struct usbnet *dev = netdev_priv(net);
> + struct ax88179_data *data;
> + u16 bmcr, lcladv, rmtadv;
> + u8 cap;
> +
> + data = dev->driver_priv;
> +
> + if (data->chip_version < AX_VERSION_AX88179A)
> + return;
> +
> + bmcr = ax88179_mdio_read(net, dev->mii.phy_id, MII_BMCR);
> + lcladv = ax88179_mdio_read(net, dev->mii.phy_id, MII_ADVERTISE);
> + rmtadv = ax88179_mdio_read(net, dev->mii.phy_id, MII_LPA);
> +
> + if (!(bmcr & BMCR_ANENABLE)) {
> + pause->autoneg = 0;
> + pause->rx_pause = 0;
> + pause->tx_pause = 0;
> + return;
> + }
> +
> + pause->autoneg = 1;
pause autoneg is not the same as link-wide autoneg. If link autoneg is disabled,
you have to keep track on how pause autoneg was configured by user, so that this
can be re-applied when link aneg gets re-enabled.
The best way to have this correct is to use phylink, but for that you'd need to
have a proper PHY driver instead of using the mii_ API here.
> +
> + cap = mii_resolve_flowctrl_fdx(lcladv, rmtadv);
> +
> + if (cap & FLOW_CTRL_RX)
> + pause->rx_pause = 1;
> +
> + if (cap & FLOW_CTRL_TX)
> + pause->tx_pause = 1;
> +}
> +
> +static int ax88179a_set_pauseparam(struct net_device *net, struct ethtool_pauseparam *pause)
> +{
> + struct usbnet *dev = netdev_priv(net);
> + struct ax88179_data *data;
> + u16 old, new1, bmcr;
> + u8 cap = 0;
> +
> + data = dev->driver_priv;
> +
> + if (data->chip_version < AX_VERSION_AX88179A)
> + return -EOPNOTSUPP;
> +
> + bmcr = ax88179_mdio_read(net, dev->mii.phy_id, MII_BMCR);
> + if (pause->autoneg && !(bmcr & BMCR_ANENABLE))
> + return -EINVAL;
As I said, pause autoneg can be on while linke autoneg is off. of course, the
device doesn't advertise pause, but the driver needs to keep track of what's
the pause aneg flag.
Maxime
next prev parent reply other threads:[~2026-07-01 10:04 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-01 5:42 [PATCH 0/9] ax88179_178a: Add support for AX88179A-based chips Birger Koblitz
2026-07-01 5:42 ` [PATCH 1/9] ax88179_178a: Fix endianness of pause watermark register Birger Koblitz
2026-07-01 14:57 ` Andrew Lunn
2026-07-01 5:42 ` [PATCH 2/9] ax88179_178a: Add HW support for AX179A-based chips Birger Koblitz
2026-07-01 15:05 ` Andrew Lunn
2026-07-01 5:42 ` [PATCH 3/9] ax88179_178a: Add support for AX88179A MMD access Birger Koblitz
2026-07-01 9:53 ` Maxime Chevallier
2026-07-01 5:42 ` [PATCH 4/9] ax88179_178a: Obtain speed and duplex from Interrupt URB Birger Koblitz
2026-07-01 5:42 ` [PATCH 5/9] ax88179_178a: Add support for ethtool pause parameter configuration Birger Koblitz
2026-07-01 10:04 ` Maxime Chevallier [this message]
2026-07-01 15:08 ` Andrew Lunn
2026-07-01 16:22 ` Birger Koblitz
2026-07-01 17:05 ` Andrew Lunn
2026-07-01 17:45 ` Birger Koblitz
2026-07-01 18:41 ` Andrew Lunn
2026-07-01 5:42 ` [PATCH 6/9] ax88179_178a: Add VLAN offload support for AX88179A Birger Koblitz
2026-07-01 5:42 ` [PATCH 7/9] ax88179_178a: Add ethtool get_drvinfo Birger Koblitz
2026-07-01 5:42 ` [PATCH 8/9] ax88179_178a: Add support for AX88179A/772D/279 EEPROM access Birger Koblitz
2026-07-01 5:42 ` [PATCH 9/9] ax88179_178a: Add AX179A/AX279 multicast configuration Birger Koblitz
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=587499ee-d87e-4056-8d2a-8fda2ef3f0f1@bootlin.com \
--to=maxime.chevallier@bootlin.com \
--cc=andrew+netdev@lunn.ch \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=mail@birger-koblitz.de \
--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