From: Russell King <rmk+kernel@armlinux.org.uk>
To: Andrew Lunn <andrew@lunn.ch>,
Florian Fainelli <f.fainelli@gmail.com>,
Heiner Kallweit <hkallweit1@gmail.com>,
tinywrkb <tinywrkb@gmail.com>
Cc: "David S. Miller" <davem@davemloft.net>, netdev@vger.kernel.org
Subject: [PATCH 3/4] net: phy: extract pause mode
Date: Sun, 22 Sep 2019 12:00:20 +0100 [thread overview]
Message-ID: <E1iBzbI-000072-R4@rmk-PC.armlinux.org.uk> (raw)
In-Reply-To: <20190922105932.GP25745@shell.armlinux.org.uk>
Extract the update of phylib's software pause mode state from
genphy_read_status(), so that we can re-use this functionality with
PHYs that have alternative ways to read the negotiation results.
Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
---
drivers/net/phy/phy-core.c | 20 +++++++++++++-------
include/linux/phy.h | 1 +
2 files changed, 14 insertions(+), 7 deletions(-)
diff --git a/drivers/net/phy/phy-core.c b/drivers/net/phy/phy-core.c
index 16667fbac8bf..91b856b31fd6 100644
--- a/drivers/net/phy/phy-core.c
+++ b/drivers/net/phy/phy-core.c
@@ -278,6 +278,18 @@ void of_set_phy_eee_broken(struct phy_device *phydev)
phydev->eee_broken_modes = broken;
}
+void phy_resolve_aneg_pause(struct phy_device *phydev)
+{
+ if (phydev->duplex == DUPLEX_FULL) {
+ phydev->pause = linkmode_test_bit(ETHTOOL_LINK_MODE_Pause_BIT,
+ phydev->lp_advertising);
+ phydev->asym_pause = linkmode_test_bit(
+ ETHTOOL_LINK_MODE_Asym_Pause_BIT,
+ phydev->lp_advertising);
+ }
+}
+EXPORT_SYMBOL_GPL(phy_resolve_aneg_pause);
+
/**
* phy_resolve_aneg_linkmode - resolve the advertisements into phy settings
* @phydev: The phy_device struct
@@ -300,13 +312,7 @@ void phy_resolve_aneg_linkmode(struct phy_device *phydev)
break;
}
- if (phydev->duplex == DUPLEX_FULL) {
- phydev->pause = linkmode_test_bit(ETHTOOL_LINK_MODE_Pause_BIT,
- phydev->lp_advertising);
- phydev->asym_pause = linkmode_test_bit(
- ETHTOOL_LINK_MODE_Asym_Pause_BIT,
- phydev->lp_advertising);
- }
+ phy_resolve_aneg_pause(phydev);
}
EXPORT_SYMBOL_GPL(phy_resolve_aneg_linkmode);
diff --git a/include/linux/phy.h b/include/linux/phy.h
index bef7f30af22d..224e81740963 100644
--- a/include/linux/phy.h
+++ b/include/linux/phy.h
@@ -686,6 +686,7 @@ static inline bool phy_is_started(struct phy_device *phydev)
return phydev->state >= PHY_UP;
}
+void phy_resolve_aneg_pause(struct phy_device *phydev);
void phy_resolve_aneg_linkmode(struct phy_device *phydev);
/**
--
2.7.4
next prev parent reply other threads:[~2019-09-22 11:00 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-09-22 10:59 [PATCH 0/4] Attempt to fix regression with AR8035 speed downgrade Russell King - ARM Linux admin
2019-09-22 11:00 ` [PATCH 1/4] net: phy: fix write to mii-ctrl1000 register Russell King
2019-09-22 16:33 ` Andrew Lunn
2019-09-22 11:00 ` [PATCH 2/4] net: phy: extract link partner advertisement reading Russell King
2019-09-22 16:35 ` Andrew Lunn
2019-09-22 11:00 ` Russell King [this message]
2019-09-22 16:38 ` [PATCH 3/4] net: phy: extract pause mode Andrew Lunn
2019-09-22 11:00 ` [PATCH 4/4] net: phy: at803x: use operating parameters from PHY-specific status Russell King
2019-09-22 16:45 ` Andrew Lunn
2019-09-22 12:56 ` [PATCH 0/4] Attempt to fix regression with AR8035 speed downgrade Russell King - ARM Linux admin
2019-09-22 15:03 ` tinywrkb
2019-09-22 16:53 ` Andrew Lunn
2019-09-22 17:52 ` Russell King - ARM Linux admin
2019-09-22 18:02 ` Florian Fainelli
2019-09-22 21:20 ` Russell King - ARM Linux admin
2019-09-25 11: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=E1iBzbI-000072-R4@rmk-PC.armlinux.org.uk \
--to=rmk+kernel@armlinux.org.uk \
--cc=andrew@lunn.ch \
--cc=davem@davemloft.net \
--cc=f.fainelli@gmail.com \
--cc=hkallweit1@gmail.com \
--cc=netdev@vger.kernel.org \
--cc=tinywrkb@gmail.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).