Skip to contentSkip to conversation

net: enetc: use .mac_select_pcs() interface

PATCH In review Russell King (Oracle) 3 participants 5 messages Dec 16, 2021 – Jan 11, 2022

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 net: enetc: use .mac_select_pcs() interface

Convert the PCS selection to use mac_select_pcs, which allows the PCS to perform any validation it needs.

---
 drivers/net/ethernet/freescale/enetc/enetc_pf.c | 14 +++++++++-----
 1 file changed, 9 insertions(+), 5 deletions(-)
drivers/net/ethernet/freescale/enetc/enetc_pf.c +9 -5
index fe6a544f37f0..1f5bc8fe0a3c 100644
@@ -930,18 +930,21 @@ static void enetc_mdiobus_destroy(struct enetc_pf *pf)
 	enetc_imdio_remove(pf);
 }
 
+static struct phylink_pcs *
+enetc_pl_mac_select_pcs(struct phylink_config *config, phy_interface_t iface)
+{
+	struct enetc_pf *pf = phylink_to_enetc_pf(config);
+
+	return pf->pcs ? &pf->pcs->pcs : NULL;
+}
+
 static void enetc_pl_mac_config(struct phylink_config *config,
 				unsigned int mode,
 				const struct phylink_link_state *state)
 {
 	struct enetc_pf *pf = phylink_to_enetc_pf(config);
-	struct enetc_ndev_priv *priv;
 
 	enetc_mac_config(&pf->si->hw, state->interface);
-
-	priv = netdev_priv(pf->si->ndev);
-	if (pf->pcs)
-		phylink_set_pcs(priv->phylink, &pf->pcs->pcs);
 }
 
 static void enetc_force_rgmii_mac(struct enetc_hw *hw, int speed, int duplex)
@@ -1058,6 +1061,7 @@ static void enetc_pl_mac_link_down(struct phylink_config *config,
 
 static const struct phylink_mac_ops enetc_mac_phylink_ops = {
 	.validate = phylink_generic_validate,
+	.mac_select_pcs = enetc_pl_mac_select_pcs,
 	.mac_config = enetc_pl_mac_config,
 	.mac_link_up = enetc_pl_mac_link_up,
 	.mac_link_down = enetc_pl_mac_link_down,
Signature · 1 line
2.30.2
#1 lore raw
Quoted 4 lines · Russell King (Oracle)

Convert the PCS selection to use mac_select_pcs, which allows the PCS to perform any validation it needs.

Hi,

Can anyone test this please? Claudiu?

Russell.

Quoted 47 lines
---
 drivers/net/ethernet/freescale/enetc/enetc_pf.c | 14 +++++++++-----
 1 file changed, 9 insertions(+), 5 deletions(-)
drivers/net/ethernet/freescale/enetc/enetc_pf.c +9 -5
index fe6a544f37f0..1f5bc8fe0a3c 100644
@@ -930,18 +930,21 @@ static void enetc_mdiobus_destroy(struct enetc_pf *pf)
 	enetc_imdio_remove(pf);
 }
 
+static struct phylink_pcs *
+enetc_pl_mac_select_pcs(struct phylink_config *config, phy_interface_t iface)
+{
+	struct enetc_pf *pf = phylink_to_enetc_pf(config);
+
+	return pf->pcs ? &pf->pcs->pcs : NULL;
+}
+
 static void enetc_pl_mac_config(struct phylink_config *config,
 				unsigned int mode,
 				const struct phylink_link_state *state)
 {
 	struct enetc_pf *pf = phylink_to_enetc_pf(config);
-	struct enetc_ndev_priv *priv;
 
 	enetc_mac_config(&pf->si->hw, state->interface);
-
-	priv = netdev_priv(pf->si->ndev);
-	if (pf->pcs)
-		phylink_set_pcs(priv->phylink, &pf->pcs->pcs);
 }
 
 static void enetc_force_rgmii_mac(struct enetc_hw *hw, int speed, int duplex)
@@ -1058,6 +1061,7 @@ static void enetc_pl_mac_link_down(struct phylink_config *config,
 
 static const struct phylink_mac_ops enetc_mac_phylink_ops = {
 	.validate = phylink_generic_validate,
+	.mac_select_pcs = enetc_pl_mac_select_pcs,
 	.mac_config = enetc_pl_mac_config,
 	.mac_link_up = enetc_pl_mac_link_up,
 	.mac_link_down = enetc_pl_mac_link_down,
Signature · 1 line
2.30.2
Signature · 2 lines
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 40Mbps down 10Mbps up. Decent connectivity at last!
maintainer
#2 lore raw
Quoted 13 lines

-----Original Message-----
From: Russell King <[email protected]>
Sent: Friday, January 7, 2022 3:41 PM
To: David S. Miller <[email protected]>; Jakub Kicinski <[email protected]>
Cc: Claudiu Manoil <[email protected]>; [email protected]
Subject: Re: [PATCH CFT net-next] net: enetc: use .mac_select_pcs() interface

Quoted 3 lines · Russell King (Oracle)

Convert the PCS selection to use mac_select_pcs, which allows the PCS to perform any validation it needs.

Quoted 8 lines
Quoted 1 line

Hi,

Can anyone test this please? Claudiu?

Russell.

Hi Russell,

drivers/net/ethernet/freescale/enetc/enetc_pf.c: In function 'enetc_pl_mac_select_pcs':
drivers/net/ethernet/freescale/enetc/enetc_pf.c:942:27: error: 'struct phylink_pcs' has no member named 'pcs'
942 | return pf->pcs ? &pf->pcs->pcs : NULL;

I suppose you meant:
- return pf->pcs ? &pf->pcs->pcs : NULL;
+ return pf->pcs;

With this correction I could bring up the SGMII link on my ls1028rdb. The patch needs also rebase.

Thanks.
Claudiu

maintainer
#3 lore raw
Quoted 43 lines

-----Original Message-----
From: Claudiu Manoil
Sent: Monday, January 10, 2022 7:38 PM
To: Russell King <[email protected]>; David S. Miller <[email protected]>; Jakub Kicinski <[email protected]>
Cc: [email protected]
Subject: RE: [PATCH CFT net-next] net: enetc: use .mac_select_pcs() interface

Quoted 13 lines

-----Original Message-----
From: Russell King <[email protected]>
Sent: Friday, January 7, 2022 3:41 PM
To: David S. Miller <[email protected]>; Jakub Kicinski <[email protected]>
Cc: Claudiu Manoil <[email protected]>; [email protected]
Subject: Re: [PATCH CFT net-next] net: enetc: use .mac_select_pcs() interface

Quoted 3 lines · Russell King (Oracle)

Convert the PCS selection to use mac_select_pcs, which allows the PCS to perform any validation it needs.

Quoted 8 lines
Quoted 1 line

Hi,

Can anyone test this please? Claudiu?

Russell.

Hi Russell,

drivers/net/ethernet/freescale/enetc/enetc_pf.c: In function 'enetc_pl_mac_select_pcs':
drivers/net/ethernet/freescale/enetc/enetc_pf.c:942:27: error: 'struct phylink_pcs' has no member named 'pcs'
942 | return pf->pcs ? &pf->pcs->pcs : NULL;

I suppose you meant:

(quoted diff) +1 -1
-       return pf->pcs ? &pf->pcs->pcs : NULL;
+       return pf->pcs;
Quoted 3 lines

With this correction I could bring up the SGMII link on my ls1028rdb. The patch needs also rebase.

Actually it's just a matter of rebasing the patch on latest net-next, since commit e7026f15564f "net: phy: lynx: refactor Lynx PCS module to use generic phylink_pcs" replaced 'struct lynx_pcs' with 'struct phylink_pcs'.

#4 lore raw
In reply to Claudiu Manoil
Quoted 11 lines · Claudiu Manoil

Hi Russell,

drivers/net/ethernet/freescale/enetc/enetc_pf.c: In function 'enetc_pl_mac_select_pcs':
drivers/net/ethernet/freescale/enetc/enetc_pf.c:942:27: error: 'struct phylink_pcs' has no member named 'pcs'
942 | return pf->pcs ? &pf->pcs->pcs : NULL;

I suppose you meant:

(quoted diff) +1 -1
-       return pf->pcs ? &pf->pcs->pcs : NULL;
+       return pf->pcs;

With this correction I could bring up the SGMII link on my ls1028rdb.

Thanks.

Quoted 1 line

The patch needs also rebase.

Yes, due to other patches have been merged into net-next since the patch was sent for testing. However, now is not the time to be sending it for net-next as the merge window is open, so there's little point rebasing it until after the merge window has closed.

Signature · 2 lines
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 40Mbps down 10Mbps up. Decent connectivity at last!