net: axienet: modernise pcs implementation
cover net: axienet: modernise pcs implementation
Hi,
These two patches modernise the Xilinx axienet PCS implementation to use the phylink split PCS support.
The first patch adds split PCS support and makes use of the newly introduced mac_select_pcs() function, which is the preferred way to conditionally attach a PCS.
The second patch cleans up the use of mdiobus_write() since we now have bus accessors for mdio devices.
There should be no functional change to the driver.
Please test, thanks.
drivers/net/ethernet/xilinx/xilinx_axienet.h | 1 + drivers/net/ethernet/xilinx/xilinx_axienet_main.c | 111 +++++++++++----------- 2 files changed, 56 insertions(+), 56 deletions(-)
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!
PATCH 1/2 net: axienet: convert to phylink_pcs
Convert axienet to use the phylink_pcs layer, resulting in it no longer being a legacy driver.
One oddity in this driver is that lp->switch_x_sgmii controls whether we support switching between SGMII and 1000baseX. However, when clear, this also blocks updating the 1000baseX advertisement, which it probably should not be doing. Nevertheless, this behaviour is preserved but a comment is added.
--- drivers/net/ethernet/xilinx/xilinx_axienet.h | 1 + .../net/ethernet/xilinx/xilinx_axienet_main.c | 112 +++++++++--------- 2 files changed, 57 insertions(+), 56 deletions(-)
drivers/net/ethernet/xilinx/xilinx_axienet.h +1 -0
@@ -434,6 +434,7 @@ struct axienet_local {struct phylink_config phylink_config;struct mdio_device *pcs_phy; +struct phylink_pcs pcs;bool switch_x_sgmii;
drivers/net/ethernet/xilinx/xilinx_axienet_main.c +56 -56
155 lines not on this page · raw message
Signature · 1 line
2.30.2
PATCH 2/2 net: axienet: replace mdiobus_write() with mdiodev_write()
In reply to Russell King (Oracle)Commit 197a68ef1837 ("net: mdio: Add helper functions for accessing MDIO devices") added support for mdiodev accessor operations that neatly wrap the mdiobus accessor operations. Since we are dealing with a mdio device here, update the driver to use mdiodev_write().
--- drivers/net/ethernet/xilinx/xilinx_axienet_main.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/net/ethernet/xilinx/xilinx_axienet_main.c +1 -2
@@ -1543,8 +1543,7 @@ static int axienet_pcs_config(struct phylink_pcs *pcs, unsigned int mode,if (!lp->switch_x_sgmii)return 0 ; - ret =mdiobus_write (pcs_phy->bus, pcs_phy->addr, -XLNX_MII_STD_SELECT_REG , + ret =mdiodev_write (pcs_phy,XLNX_MII_STD_SELECT_REG , interface ==PHY_INTERFACE_MODE_SGMII ?XLNX_MII_STD_SELECT_SGMII :0 );if (ret <0 ) {
Signature · 1 line
2.30.2
Jakub Kicinski
maintainerRe: [PATCH CFT net-next 2/2] net: axienet: replace mdiobus_write() with mdiodev_write()
Quoted 2 lines · On Thu, 16 Dec 2021 12:48:50 +0000 Russell King (Oracle) wrote:
Commit
197a68ef1837("net: mdio: Add helper functions for accessing MDIO devices") added support for mdiodev accessor operations that
Nit: wrong commit id, 0ebecb2644c8 ("net: mdio: Add helper functions for accessing MDIO devices")?
Jakub Kicinski
maintainerRe: [PATCH CFT net-next 1/2] net: axienet: convert to phylink_pcs
In reply to Russell King (Oracle)Quoted 10 lines · On Thu, 16 Dec 2021 12:48:45 +0000 Russell King (Oracle) wrote:
Convert axienet to use the
phylink_pcslayer, resulting in it no longer being a legacy driver.One oddity in this driver is that
lp->switch_x_sgmiicontrols whether we support switching between SGMII and 1000baseX. However, when clear, this also blocks updating the 1000baseX advertisement, which it probably should not be doing. Nevertheless, this behaviour is preserved but a comment is added.Signed-off-by Russell King (Oracle) <[email protected]>
drivers/net/ethernet/xilinx/xilinx_axienet.h:479: warning: Function parameter or member 'pcs' not described in 'axienet_local'
Re: [PATCH CFT net-next 1/2] net: axienet: convert to phylink_pcs
Quoted 10 lines · Jakub Kicinski
Quoted 9 lines · On Thu, 16 Dec 2021 12:48:45 +0000 Russell King (Oracle) wrote:
Convert axienet to use the
phylink_pcslayer, resulting in it no longer being a legacy driver.One oddity in this driver is that
lp->switch_x_sgmiicontrols whether we support switching between SGMII and 1000baseX. However, when clear, this also blocks updating the 1000baseX advertisement, which it probably should not be doing. Nevertheless, this behaviour is preserved but a comment is added.
Quoted 3 lines
Quoted 1 line
Signed-off-by Russell King (Oracle) <[email protected]>
drivers/net/ethernet/xilinx/xilinx_axienet.h:479: warning: Function parameter or member 'pcs' not described in 'axienet_local'
Fixed that and the sha1 issue you raised in patch 2. Since both are "documentation" issues, I won't send out replacement patches until I've heard they've been tested on hardware though.
Thanks!
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!
RE: [PATCH CFT net-next 1/2] net: axienet: convert to phylink_pcs
+ Harini
Quoted 21 lines
-----Original Message-----
From: Russell King <[email protected]>
Sent: Thursday, December 16, 2021 10:32 PM
To: Jakub Kicinski <[email protected]>
Cc: Michal Simek <[email protected]>; Radhey Shyam Pandey <[email protected]>; Sean Anderson <[email protected]>; David S. Miller <[email protected]>; [email protected]; linux-arm- [email protected]
Subject: Re: [PATCH CFT net-next 1/2] net: axienet: convert tophylink_pcsQuoted 10 lines · Jakub Kicinski
Quoted 9 lines · On Thu, 16 Dec 2021 12:48:45 +0000 Russell King (Oracle) wrote:
Convert axienet to use the
phylink_pcslayer, resulting in it no longer being a legacy driver.One oddity in this driver is that
lp->switch_x_sgmiicontrols whether we support switching between SGMII and 1000baseX. However, when clear, this also blocks updating the 1000baseX advertisement, which it probably should not be doing. Nevertheless, this behaviour is preserved but a comment is added.
Quoted 8 lines
Quoted 3 lines
Quoted 1 line
Signed-off-by Russell King (Oracle) <[email protected]>
drivers/net/ethernet/xilinx/xilinx_axienet.h:479: warning: Functionparameter or member 'pcs' not described in '
axienet_local'Fixed that and the sha1 issue you raised in patch 2. Since both are "documentation" issues, I won't send out replacement patches until I've heard they've been tested on hardware though.
Thanks, series looks fine. I have added Harini to this thread and she will confirm it on hardware.
Quoted 6 lines
Thanks!
--
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 40Mbps down 10Mbps up. Decent connectivity at last!
Re: [PATCH CFT net-next 1/2] net: axienet: convert to phylink_pcs
In reply to Russell King (Oracle)Hi Russell,
Quoted 12 lines · Russell King (Oracle)
Quoted 10 lines · Jakub Kicinski
Quoted 9 lines · On Thu, 16 Dec 2021 12:48:45 +0000 Russell King (Oracle) wrote:
Convert axienet to use the
phylink_pcslayer, resulting in it no longer being a legacy driver.One oddity in this driver is that
lp->switch_x_sgmiicontrols whether we support switching between SGMII and 1000baseX. However, when clear, this also blocks updating the 1000baseX advertisement, which it probably should not be doing. Nevertheless, this behaviour is preserved but a comment is added.
Quoted 7 lines
Quoted 3 lines
Quoted 1 line
Signed-off-by Russell King (Oracle) <[email protected]>
drivers/net/ethernet/xilinx/xilinx_axienet.h:479: warning: Function parameter or member 'pcs' not described in 'axienet_local'Fixed that and the sha1 issue you raised in patch 2. Since both are "documentation" issues, I won't send out replacement patches until I've heard they've been tested on hardware though.
Thanks for the patches.
Series looks good and we're testing at our end; will get back to you early next week.
Regards,
Harini
Re: [PATCH CFT net-next 1/2] net: axienet: convert to phylink_pcs
Quoted 21 lines · Harini Katakam
Hi Russell,
Quoted 16 lines · Russell King (Oracle)
Quoted 13 lines · Jakub Kicinski
Quoted 10 lines · On Thu, 16 Dec 2021 12:48:45 +0000 Russell King (Oracle) wrote:
Convert axienet to use the
phylink_pcslayer, resulting in it no longer being a legacy driver.One oddity in this driver is that
lp->switch_x_sgmiicontrols whether we support switching between SGMII and 1000baseX. However, when clear, this also blocks updating the 1000baseX advertisement, which it probably should not be doing. Nevertheless, this behaviour is preserved but a comment is added.Signed-off-by Russell King (Oracle) <[email protected]>
drivers/net/ethernet/xilinx/xilinx_axienet.h:479: warning: Function parameter or member 'pcs' not described in 'axienet_local'
Quoted 7 lines
Quoted 3 lines
Fixed that and the sha1 issue you raised in patch 2. Since both are "documentation" issues, I won't send out replacement patches until I've heard they've been tested on hardware though.
Thanks for the patches.
Series looks good and we're testing at our end; will get back to you early next week.
Thanks Russell. I've tested AXI Ethernet and it works fine.
Regards,
Harini
Re: [PATCH CFT net-next 1/2] net: axienet: convert to phylink_pcs
Quoted 26 lines · Harini Katakam
Quoted 25 lines · Harini Katakam
Hi Russell,
Quoted 19 lines · Russell King (Oracle)
Quoted 10 lines · Jakub Kicinski
Quoted 9 lines · On Thu, 16 Dec 2021 12:48:45 +0000 Russell King (Oracle) wrote:
Convert axienet to use the
phylink_pcslayer, resulting in it no longer being a legacy driver.One oddity in this driver is that
lp->switch_x_sgmiicontrols whether we support switching between SGMII and 1000baseX. However, when clear, this also blocks updating the 1000baseX advertisement, which it probably should not be doing. Nevertheless, this behaviour is preserved but a comment is added.Quoted 3 lines
Quoted 1 line
Signed-off-by Russell King (Oracle) <[email protected]>
drivers/net/ethernet/xilinx/xilinx_axienet.h:479: warning: Function parameter or member 'pcs' not described in 'axienet_local'Fixed that and the sha1 issue you raised in patch 2. Since both are "documentation" issues, I won't send out replacement patches until I've heard they've been tested on hardware though.
Quoted 5 lines
Quoted 3 lines
Thanks for the patches.
Series looks good and we're testing at our end; will get back to you early next week.Thanks Russell. I've tested AXI Ethernet and it works fine.
Happy new year!
Thanks - can I use that as a tested-by please, and would you be happy for me to send the patches for merging this week?
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!
Harini Katakam
Tested-byRE: [PATCH CFT net-next 1/2] net: axienet: convert to phylink_pcs
Quoted 45 lines
-----Original Message-----
From: Russell King <[email protected]>
Sent: Tuesday, January 4, 2022 2:31 PM
To: Harini Katakam <[email protected]>
Cc: Jakub Kicinski <[email protected]>; Michal Simek <[email protected]>; Radhey Shyam Pandey <[email protected]>; Sean Anderson <[email protected]>; David S. Miller <[email protected]>; netdev <[email protected]>; [email protected]
Subject: Re: [PATCH CFT net-next 1/2] net: axienet: convert tophylink_pcsQuoted 18 lines · Harini Katakam
Quoted 17 lines · Harini Katakam
Hi Russell,
Quoted 12 lines · Russell King (Oracle)
Quoted 10 lines · Jakub Kicinski
Quoted 9 lines · On Thu, 16 Dec 2021 12:48:45 +0000 Russell King (Oracle) wrote:
Convert axienet to use the
phylink_pcslayer, resulting in it no longer being a legacy driver.One oddity in this driver is that
lp->switch_x_sgmiicontrols whether we support switching between SGMII and 1000baseX. However, when clear, this also blocks updating the 1000baseX advertisement, which it probably should not be doing. Nevertheless, this behaviour is preserved but a comment is added.Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 2 lines
Signed-off-by: Russell King (Oracle)
<[email protected]>
drivers/net/ethernet/xilinx/xilinx_axienet.h:479: warning: Functionparameter or member 'pcs' not described in '
axienet_local'Quoted 9 lines
Quoted 8 lines
Quoted 4 lines
Fixed that and the sha1 issue you raised in patch 2. Since both are "documentation" issues, I won't send out replacement patches until I've heard they've been tested on hardware though.
Thanks for the patches.
Series looks good and we're testing at our end; will get back to you early next week.
Quoted 6 lines
Quoted 1 line
Thanks Russell. I've tested AXI Ethernet and it works fine.
Happy new year!
Thanks - can I use that as a tested-by please, and would you be happy for me to send the patches for merging this week?
Sure, yes and yes.
Happy new year to you too!
Regards,
Harini
Re: [PATCH CFT net-next 1/2] net: axienet: convert to phylink_pcs
Quoted 47 lines · Harini Katakam
Quoted 47 lines
-----Original Message-----
From: Russell King <[email protected]>
Sent: Tuesday, January 4, 2022 2:31 PM
To: Harini Katakam <[email protected]>
Cc: Jakub Kicinski <[email protected]>; Michal Simek <[email protected]>; Radhey Shyam Pandey <[email protected]>; Sean Anderson <[email protected]>; David S. Miller <[email protected]>; netdev <[email protected]>; [email protected]
Subject: Re: [PATCH CFT net-next 1/2] net: axienet: convert tophylink_pcsQuoted 18 lines · Harini Katakam
Quoted 17 lines · Harini Katakam
Hi Russell,
Quoted 12 lines · Russell King (Oracle)
Quoted 10 lines · Jakub Kicinski
Quoted 9 lines · On Thu, 16 Dec 2021 12:48:45 +0000 Russell King (Oracle) wrote:
Convert axienet to use the
phylink_pcslayer, resulting in it no longer being a legacy driver.One oddity in this driver is that
lp->switch_x_sgmiicontrols whether we support switching between SGMII and 1000baseX. However, when clear, this also blocks updating the 1000baseX advertisement, which it probably should not be doing. Nevertheless, this behaviour is preserved but a comment is added.Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 2 lines
Signed-off-by: Russell King (Oracle)
<[email protected]>
drivers/net/ethernet/xilinx/xilinx_axienet.h:479: warning: Functionparameter or member 'pcs' not described in '
axienet_local'Quoted 10 lines
Quoted 8 lines
Quoted 4 lines
Fixed that and the sha1 issue you raised in patch 2. Since both are "documentation" issues, I won't send out replacement patches until I've heard they've been tested on hardware though.
Thanks for the patches.
Series looks good and we're testing at our end; will get back to you early next week.Thanks Russell. I've tested AXI Ethernet and it works fine.
Happy new year!
Quoted 7 lines
Quoted 2 lines
Thanks - can I use that as a tested-by please, and would you be happy for me to send the patches for merging this week?
Sure, yes and yes.
Tested-by Harini Katakam <[email protected]>Happy new year to you too!
Thanks. While adding the attributation, I was reminded of this comment in the commit message:
One oddity in this driver is that lp->switch_x_sgmii controls whether we support switching between SGMII and 1000baseX. However, when clear, this also blocks updating the 1000baseX advertisement, which it probably should not be doing. Nevertheless, this behaviour is preserved but a comment is added.
went back to look at that, and realised that this was not the case at all, so patch 1 introduces a behaviour that wasn't originally there. I'll post an update, but essentially the change to patch 1 is:
drivers/net/ethernet/xilinx/xilinx_axienet_main.c +11 -12
@@ -1533,18 +1533,17 @@ static int axienet_pcs_config(struct phylink_pcs *pcs, unsigned int mode,struct axienet_local *lp =netdev_priv (ndev);int ret; -/* We don't support changing the advertisement in 1000base-X? --rmk */ -if (!lp->switch_x_sgmii) -return 0 ; - - ret =mdiobus_write (pcs_phy->bus, pcs_phy->addr, -XLNX_MII_STD_SELECT_REG , - interface ==PHY_INTERFACE_MODE_SGMII ? -XLNX_MII_STD_SELECT_SGMII :0 ); -if (ret <0 ) { -netdev_warn (ndev,"Failed to switch PHY interface: %d\n" , - ret); -return ret; +if (lp->switch_x_sgmii) { + ret =mdiobus_write (pcs_phy->bus, pcs_phy->addr, +XLNX_MII_STD_SELECT_REG , + interface ==PHY_INTERFACE_MODE_SGMII ? +XLNX_MII_STD_SELECT_SGMII :0 ); +if (ret <0 ) { +netdev_warn (ndev, +"Failed to switch PHY interface: %d\n" , + ret); +return ret; + } } ret =phylink_mii_c22_pcs_config (pcs_phy, mode, interface, advertising);
and a corresponding change to patch 2 for the change in code formatting.
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!
v2 cover net: axienet: modernise pcs implementation
In reply to Russell King (Oracle)Hi,
These two patches modernise the Xilinx axienet PCS implementation to use the phylink split PCS support.
The first patch adds split PCS support and makes use of the newly introduced mac_select_pcs() function, which is the preferred way to conditionally attach a PCS.
The second patch cleans up the use of mdiobus_write() since we now have bus accessors for mdio devices.
There should be no functional change to the driver.
Please test, thanks.
v2: remove question over switch_x_sgmii
drivers/net/ethernet/xilinx/xilinx_axienet.h | 2 + drivers/net/ethernet/xilinx/xilinx_axienet_main.c | 108 +++++++++++----------- 2 files changed, 55 insertions(+), 55 deletions(-)
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!
PATCH v2 1/2 net: axienet: convert to phylink_pcs
Convert axienet to use the phylink_pcs layer, resulting in it no longer being a legacy driver.
--- drivers/net/ethernet/xilinx/xilinx_axienet.h | 2 + .../net/ethernet/xilinx/xilinx_axienet_main.c | 107 +++++++++--------- 2 files changed, 55 insertions(+), 54 deletions(-)
drivers/net/ethernet/xilinx/xilinx_axienet.h +2 -0
@@ -386,6 +386,7 @@ struct axidma_bd {* @phylink: Pointer to phylink instance * @phylink_config: phylink configuration settings * @pcs_phy: Reference to PCS/PMA PHY if used +* @pcs: phylink pcs structure for PCS PHY * @switch_x_sgmii: Whether switchable 1000BaseX/SGMII mode is enabled in the core * @axi_clk: AXI4-Lite bus clock * @misc_clks: Misc ethernet clocks (AXI4-Stream, Ref, MGT clocks)
@@ -434,6 +435,7 @@ struct axienet_local {struct phylink_config phylink_config;struct mdio_device *pcs_phy; +struct phylink_pcs pcs;bool switch_x_sgmii;
drivers/net/ethernet/xilinx/xilinx_axienet_main.c +53 -54
152 lines not on this page · raw message
Signature · 1 line
2.30.2
PATCH v2 2/2 net: axienet: replace mdiobus_write() with mdiodev_write()
In reply to Russell King (Oracle)Commit 0ebecb2644c8 ("net: mdio: Add helper functions for accessing MDIO devices") added support for mdiodev accessor operations that neatly wrap the mdiobus accessor operations. Since we are dealing with a mdio device here, update the driver to use mdiodev_write().
--- drivers/net/ethernet/xilinx/xilinx_axienet_main.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/net/ethernet/xilinx/xilinx_axienet_main.c +1 -2
@@ -1540,8 +1540,7 @@ static int axienet_pcs_config(struct phylink_pcs *pcs, unsigned int mode,int ret;if (lp->switch_x_sgmii) { - ret =mdiobus_write (pcs_phy->bus, pcs_phy->addr, -XLNX_MII_STD_SELECT_REG , + ret =mdiodev_write (pcs_phy,XLNX_MII_STD_SELECT_REG , interface ==PHY_INTERFACE_MODE_SGMII ?XLNX_MII_STD_SELECT_SGMII :0 );if (ret <0 ) {
Signature · 1 line
2.30.2