From: Russell King <rmk+kernel@armlinux.org.uk>
To: Andrew Lunn <andrew@lunn.ch>,
Florian Fainelli <f.fainelli@gmail.com>,
Jonathan Corbet <corbet@lwn.net>
Cc: linux-doc@vger.kernel.org, netdev@vger.kernel.org
Subject: [PATCH 02/11] phylink: merge SGMII and 802.3z handling
Date: Fri, 01 Dec 2017 10:24:21 +0000 [thread overview]
Message-ID: <E1eKiUX-0004yP-DC@rmk-PC.armlinux.org.uk> (raw)
In-Reply-To: <20171201102306.GA18792@n2100.armlinux.org.uk>
The code handling SGMII and 802.3z is essentially the same, except that
we assume 802.3z has no PHY. Re-organise the code such that these cases
are merged, and exclude 802.3z mode from having a PHY attached. This
results in the same link handling behaviour as before.
Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
---
drivers/net/phy/phylink.c | 16 +++++++++-------
1 file changed, 9 insertions(+), 7 deletions(-)
diff --git a/drivers/net/phy/phylink.c b/drivers/net/phy/phylink.c
index a02d67689d6e..d7006fdc8f71 100644
--- a/drivers/net/phy/phylink.c
+++ b/drivers/net/phy/phylink.c
@@ -423,6 +423,7 @@ static void phylink_resolve(struct work_struct *w)
break;
case MLO_AN_SGMII:
+ case MLO_AN_8023Z:
phylink_get_mac_state(pl, &link_state);
if (pl->phydev) {
bool changed = false;
@@ -448,10 +449,6 @@ static void phylink_resolve(struct work_struct *w)
}
}
break;
-
- case MLO_AN_8023Z:
- phylink_get_mac_state(pl, &link_state);
- break;
}
}
@@ -656,6 +653,10 @@ int phylink_connect_phy(struct phylink *pl, struct phy_device *phy)
{
int ret;
+ if (WARN_ON(pl->link_an_mode == MLO_AN_FIXED ||
+ pl->link_an_mode == MLO_AN_8023Z))
+ return -EINVAL;
+
ret = phy_attach_direct(pl->netdev, phy, 0, pl->link_interface);
if (ret)
return ret;
@@ -674,8 +675,9 @@ int phylink_of_phy_connect(struct phylink *pl, struct device_node *dn)
struct phy_device *phy_dev;
int ret;
- /* Fixed links are handled without needing a PHY */
- if (pl->link_an_mode == MLO_AN_FIXED)
+ /* Fixed links and 802.3z are handled without needing a PHY */
+ if (pl->link_an_mode == MLO_AN_FIXED ||
+ pl->link_an_mode == MLO_AN_8023Z)
return 0;
phy_node = of_parse_phandle(dn, "phy-handle", 0);
@@ -850,13 +852,13 @@ int phylink_ethtool_ksettings_get(struct phylink *pl,
break;
case MLO_AN_SGMII:
+ case MLO_AN_8023Z:
/* If there is a phy attached, then use the reported
* settings from the phy with no modification.
*/
if (pl->phydev)
break;
- case MLO_AN_8023Z:
phylink_get_mac_state(pl, &link_state);
/* The MAC is reporting the link results from its own PCS
--
2.7.4
next prev parent reply other threads:[~2017-12-01 10:24 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-11-30 13:58 [PATCH 0/4] SFP/phylink fixes Russell King - ARM Linux
2017-12-01 10:23 ` [PATCH net-next 00/11] SFP/phylink updates Russell King - ARM Linux
2017-12-01 10:24 ` [PATCH 01/11] phy: add phy_interface_mode_is_8023z() helper Russell King
2017-12-01 17:20 ` Florian Fainelli
2017-12-01 10:24 ` Russell King [this message]
2017-12-01 17:21 ` [PATCH 02/11] phylink: merge SGMII and 802.3z handling Florian Fainelli
2017-12-01 10:24 ` [PATCH 03/11] phylink: get rid of separate Cisco SGMII and 802.3z modes Russell King
2017-12-01 17:22 ` Florian Fainelli
2017-12-01 10:24 ` [PATCH 04/11] phylink: add support for 2500baseX and 10GbaseKR Russell King
2017-12-01 17:22 ` Florian Fainelli
2017-12-01 10:24 ` [PATCH 05/11] phylink: remove phylink_init_eee() Russell King
2017-12-01 17:23 ` Florian Fainelli
2017-12-01 10:24 ` [PATCH 06/11] phylink: restart 802.3z negotiation when starting net device Russell King
2017-12-01 17:24 ` Florian Fainelli
2017-12-01 10:24 ` [PATCH 07/11] phylink: add documentation for kernel APIs Russell King
2017-12-01 17:28 ` Florian Fainelli
2017-12-01 10:24 ` [PATCH 08/11] sfp: " Russell King
2017-12-01 17:28 ` Florian Fainelli
2017-12-01 10:24 ` [PATCH 09/11] sfp: fix sparse warning Russell King
2017-12-01 18:17 ` Florian Fainelli
2017-12-01 10:25 ` [PATCH 10/11] sfp: convert to fwnode Russell King
2017-12-01 18:18 ` Florian Fainelli
2017-12-01 10:25 ` [PATCH 11/11] phylink: " Russell King
2017-12-01 18:19 ` Florian Fainelli
2017-12-01 10:29 ` [PATCH net-next 00/11] SFP/phylink updates Russell King - ARM Linux
2017-12-03 14:55 ` David Miller
2017-12-05 16:16 ` David Miller
2017-12-01 20:18 ` [PATCH 0/4] SFP/phylink fixes 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=E1eKiUX-0004yP-DC@rmk-PC.armlinux.org.uk \
--to=rmk+kernel@armlinux.org.uk \
--cc=andrew@lunn.ch \
--cc=corbet@lwn.net \
--cc=f.fainelli@gmail.com \
--cc=linux-doc@vger.kernel.org \
--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).