[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20220624080208.3143093-1-o.rempel@pengutronix.de>
Date: Fri, 24 Jun 2022 10:02:07 +0200
From: Oleksij Rempel <o.rempel@...gutronix.de>
To: "David S. Miller" <davem@...emloft.net>,
Eric Dumazet <edumazet@...gle.com>,
Jakub Kicinski <kuba@...nel.org>,
Paolo Abeni <pabeni@...hat.com>
Cc: Oleksij Rempel <o.rempel@...gutronix.de>, kernel@...gutronix.de,
linux-kernel@...r.kernel.org, netdev@...r.kernel.org,
Lukas Wunner <lukas@...ner.de>
Subject: [PATCH net-next v1 1/1] net: asix: add optional flow control support
Add optional flow control support with respect to the link partners
abilities.
Signed-off-by: Oleksij Rempel <o.rempel@...gutronix.de>
---
drivers/net/usb/asix_common.c | 10 ++++++++++
drivers/net/usb/asix_devices.c | 2 ++
2 files changed, 12 insertions(+)
diff --git a/drivers/net/usb/asix_common.c b/drivers/net/usb/asix_common.c
index b4a1b7abcfc9..c9df7cd8daae 100644
--- a/drivers/net/usb/asix_common.c
+++ b/drivers/net/usb/asix_common.c
@@ -420,6 +420,8 @@ void asix_adjust_link(struct net_device *netdev)
u16 mode = 0;
if (phydev->link) {
+ bool tx_pause, rx_pause;
+
mode = AX88772_MEDIUM_DEFAULT;
if (phydev->duplex == DUPLEX_HALF)
@@ -427,6 +429,14 @@ void asix_adjust_link(struct net_device *netdev)
if (phydev->speed != SPEED_100)
mode &= ~AX_MEDIUM_PS;
+
+ phy_get_pause(phydev, &tx_pause, &rx_pause);
+
+ if (rx_pause)
+ mode |= AX_MEDIUM_RFC;
+
+ if (tx_pause)
+ mode |= AX_MEDIUM_TFC;
}
asix_write_medium_mode(dev, mode, 0);
diff --git a/drivers/net/usb/asix_devices.c b/drivers/net/usb/asix_devices.c
index 5b5eb630c4b7..1bb12bbc34bf 100644
--- a/drivers/net/usb/asix_devices.c
+++ b/drivers/net/usb/asix_devices.c
@@ -677,6 +677,8 @@ static int ax88772_init_phy(struct usbnet *dev)
phy_suspend(priv->phydev);
priv->phydev->mac_managed_pm = 1;
+ phy_support_asym_pause(priv->phydev);
+
phy_attached_info(priv->phydev);
if (priv->embd_phy)
--
2.30.2
Powered by blists - more mailing lists