diff mbox series

[CFT,net-next] net: enetc: use .mac_select_pcs() interface

Message ID E1mxq4r-00GWrp-Ay@rmk-PC.armlinux.org.uk (mailing list archive)
State RFC
Delegated to: Netdev Maintainers
Headers show
Series [CFT,net-next] net: enetc: use .mac_select_pcs() interface | expand

Checks

Context Check Description
netdev/tree_selection success Clearly marked for net-next
netdev/fixes_present success Fixes tag not required for -next series
netdev/subject_prefix success Link
netdev/cover_letter success Single patches do not need cover letters
netdev/patch_count success Link
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 0 this patch: 0
netdev/cc_maintainers warning 1 maintainers not CCed: linux@armlinux.org.uk
netdev/build_clang success Errors and warnings before: 0 this patch: 0
netdev/module_param success Was 0 now: 0
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/verify_fixes success No Fixes tag
netdev/build_allmodconfig_warn success Errors and warnings before: 0 this patch: 0
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 33 lines checked
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0

Commit Message

Russell King (Oracle) Dec. 16, 2021, 12:41 p.m. UTC
Convert the PCS selection to use mac_select_pcs, which allows the PCS
to perform any validation it needs.

Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
---
 drivers/net/ethernet/freescale/enetc/enetc_pf.c | 14 +++++++++-----
 1 file changed, 9 insertions(+), 5 deletions(-)

Comments

Russell King (Oracle) Jan. 7, 2022, 1:41 p.m. UTC | #1
On Thu, Dec 16, 2021 at 12:41:41PM +0000, Russell King (Oracle) wrote:
> Convert the PCS selection to use mac_select_pcs, which allows the PCS
> to perform any validation it needs.
> 
> Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>

Hi,

Can anyone test this please? Claudiu?

Russell.

> ---
>  drivers/net/ethernet/freescale/enetc/enetc_pf.c | 14 +++++++++-----
>  1 file changed, 9 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/net/ethernet/freescale/enetc/enetc_pf.c b/drivers/net/ethernet/freescale/enetc/enetc_pf.c
> index fe6a544f37f0..1f5bc8fe0a3c 100644
> --- a/drivers/net/ethernet/freescale/enetc/enetc_pf.c
> +++ b/drivers/net/ethernet/freescale/enetc/enetc_pf.c
> @@ -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,
> -- 
> 2.30.2
> 
>
Claudiu Manoil Jan. 10, 2022, 5:37 p.m. UTC | #2
> -----Original Message-----
> From: Russell King <linux@armlinux.org.uk>
> Sent: Friday, January 7, 2022 3:41 PM
> To: David S. Miller <davem@davemloft.net>; Jakub Kicinski
> <kuba@kernel.org>
> Cc: Claudiu Manoil <claudiu.manoil@nxp.com>; netdev@vger.kernel.org
> Subject: Re: [PATCH CFT net-next] net: enetc: use .mac_select_pcs()
> interface
> 
> On Thu, Dec 16, 2021 at 12:41:41PM +0000, Russell King (Oracle) wrote:
> > Convert the PCS selection to use mac_select_pcs, which allows the PCS
> > to perform any validation it needs.
> >
> > Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
> 
> 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
Claudiu Manoil Jan. 11, 2022, 8:27 a.m. UTC | #3
> -----Original Message-----
> From: Claudiu Manoil
> Sent: Monday, January 10, 2022 7:38 PM
> To: Russell King <linux@armlinux.org.uk>; David S. Miller
> <davem@davemloft.net>; Jakub Kicinski <kuba@kernel.org>
> Cc: netdev@vger.kernel.org
> Subject: RE: [PATCH CFT net-next] net: enetc: use .mac_select_pcs()
> interface
> 
> > -----Original Message-----
> > From: Russell King <linux@armlinux.org.uk>
> > Sent: Friday, January 7, 2022 3:41 PM
> > To: David S. Miller <davem@davemloft.net>; Jakub Kicinski
> > <kuba@kernel.org>
> > Cc: Claudiu Manoil <claudiu.manoil@nxp.com>; netdev@vger.kernel.org
> > Subject: Re: [PATCH CFT net-next] net: enetc: use .mac_select_pcs()
> > interface
> >
> > On Thu, Dec 16, 2021 at 12:41:41PM +0000, Russell King (Oracle) wrote:
> > > Convert the PCS selection to use mac_select_pcs, which allows the PCS
> > > to perform any validation it needs.
> > >
> > > Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
> >
> > 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.
> 

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'.
Russell King (Oracle) Jan. 11, 2022, 9:56 a.m. UTC | #4
On Mon, Jan 10, 2022 at 05:37:55PM +0000, Claudiu Manoil wrote:
> 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.

Thanks.

> 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.
diff mbox series

Patch

diff --git a/drivers/net/ethernet/freescale/enetc/enetc_pf.c b/drivers/net/ethernet/freescale/enetc/enetc_pf.c
index fe6a544f37f0..1f5bc8fe0a3c 100644
--- a/drivers/net/ethernet/freescale/enetc/enetc_pf.c
+++ b/drivers/net/ethernet/freescale/enetc/enetc_pf.c
@@ -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,