mbox series

[net-next,00/13] net: pcs: xpcs: cleanups batch 2

Message ID Zv_BTd8UF7XbJF_e@shell.armlinux.org.uk (mailing list archive)
Headers show
Series net: pcs: xpcs: cleanups batch 2 | expand

Message

Russell King (Oracle) Oct. 4, 2024, 10:19 a.m. UTC
This is the second cleanup series for XPCS.

Patch 1 removes the enum indexing the dw_xpcs_compat array. The index is
never used except to place entries in the array and to size the array.

Patch 2 removes the interface arrays - each of which only contain one
interface.

Patch 3 makes xpcs_find_compat() take the xpcs structure rather than the
ID - the previous series removed the reason for xpcs_find_compat needing
to take the ID.

Patch 4 provides a helper to convert xpcs structure to a regular
phylink_pcs structure, which leads to patch 5.

Patch 5 moves the definition of struct dw_xpcs to the private xpcs
header - with patch 4 in place, nothing outside of the xpcs driver
accesses the contents of the dw_xpcs structure.

Patch 6 renames xpcs_get_id() to xpcs_read_id() since it's reading the
ID, rather than doing anything further with it. (Prior versions of this
series renamed it to xpcs_read_phys_id() since that more accurately
described that it was reading the physical ID registers.)

Patch 7 moves the searching of the ID list out of line as this is a
separate functional block.

Patch 8 converts xpcs to use the bitmap macros, which eliminates the
need for _SHIFT definitions.

Patch 9 adds and uses _modify() accessors as there are a large amount
of read-modify-write operations in this driver. This conversion found
a bug in xpcs-wx code that has been reported and already fixed.

Patch 10 converts xpcs to use read_poll_timeout() rather than open
coding that.

Patch 11 converts all printed messages to use the dev_*() functions so
the driver and devie name are always printed.

Patch 12 moves DW_VR_MII_DIG_CTRL1_2G5_EN to the correct place in the
header file, rather than amongst another register's definitions.

Patch 13 moves the Wangxun workaround to a common location rather than
duplicating it in two places. We also reformat this to fit within
80 columns.

 drivers/net/ethernet/stmicro/stmmac/dwmac-intel.c |   2 +-
 drivers/net/pcs/pcs-xpcs-nxp.c                    |  24 +-
 drivers/net/pcs/pcs-xpcs-wx.c                     |  56 ++-
 drivers/net/pcs/pcs-xpcs.c                        | 445 +++++++++-------------
 drivers/net/pcs/pcs-xpcs.h                        |  26 +-
 include/linux/pcs/pcs-xpcs.h                      |  19 +-
 6 files changed, 237 insertions(+), 335 deletions(-)

Comments

Russell King (Oracle) Oct. 4, 2024, 10:25 a.m. UTC | #1
On Fri, Oct 04, 2024 at 11:19:57AM +0100, Russell King (Oracle) wrote:
> This is the second cleanup series for XPCS.

As an additional note for Vladimir, the outstanding patches now are:

net: pcs: xpcs: convert to use linkmode_adv_to_c73()
net: pcs: xpcs: add xpcs_linkmode_supported()
net: mdio: add linkmode_adv_to_c73()

which based on your recent comment about c73 stuff, I'm not intending
to submit due to the 2500base-[K]X issue. The second patch may be of
some use however. I'll send that separately once this series has been
reviewed.
Vladimir Oltean Oct. 4, 2024, 11:19 a.m. UTC | #2
On Fri, Oct 04, 2024 at 11:19:57AM +0100, Russell King (Oracle) wrote:
>  drivers/net/pcs/pcs-xpcs-nxp.c                    |  24 +-

I want to test this on the SJA1110, but every XPCS cleanup series day is
a new unpacking day. I have to take the board out of a box and make sure
it still works. It might take a while.
Russell King (Oracle) Oct. 4, 2024, 5:07 p.m. UTC | #3
On Fri, Oct 04, 2024 at 02:19:40PM +0300, Vladimir Oltean wrote:
> On Fri, Oct 04, 2024 at 11:19:57AM +0100, Russell King (Oracle) wrote:
> >  drivers/net/pcs/pcs-xpcs-nxp.c                    |  24 +-
> 
> I want to test this on the SJA1110, but every XPCS cleanup series day is
> a new unpacking day. I have to take the board out of a box and make sure
> it still works. It might take a while.

Sorry about that - if netdev didn't have the "15 patches max" then I
would've posted it as one series which would've saved you the
additional work.
Serge Semin Oct. 4, 2024, 11:40 p.m. UTC | #4
Hi

On Fri, Oct 04, 2024 at 11:19:57AM GMT, Russell King (Oracle) wrote:
> This is the second cleanup series for XPCS.
> 
> Patch 1 removes the enum indexing the dw_xpcs_compat array. The index is
> never used except to place entries in the array and to size the array.
> 
> Patch 2 removes the interface arrays - each of which only contain one
> interface.
> 
> Patch 3 makes xpcs_find_compat() take the xpcs structure rather than the
> ID - the previous series removed the reason for xpcs_find_compat needing
> to take the ID.
> 
> Patch 4 provides a helper to convert xpcs structure to a regular
> phylink_pcs structure, which leads to patch 5.
> 
> Patch 5 moves the definition of struct dw_xpcs to the private xpcs
> header - with patch 4 in place, nothing outside of the xpcs driver
> accesses the contents of the dw_xpcs structure.
> 
> Patch 6 renames xpcs_get_id() to xpcs_read_id() since it's reading the
> ID, rather than doing anything further with it. (Prior versions of this
> series renamed it to xpcs_read_phys_id() since that more accurately
> described that it was reading the physical ID registers.)
> 
> Patch 7 moves the searching of the ID list out of line as this is a
> separate functional block.
> 
> Patch 8 converts xpcs to use the bitmap macros, which eliminates the
> need for _SHIFT definitions.
> 
> Patch 9 adds and uses _modify() accessors as there are a large amount
> of read-modify-write operations in this driver. This conversion found
> a bug in xpcs-wx code that has been reported and already fixed.
> 
> Patch 10 converts xpcs to use read_poll_timeout() rather than open
> coding that.
> 
> Patch 11 converts all printed messages to use the dev_*() functions so
> the driver and devie name are always printed.
> 
> Patch 12 moves DW_VR_MII_DIG_CTRL1_2G5_EN to the correct place in the
> header file, rather than amongst another register's definitions.
> 
> Patch 13 moves the Wangxun workaround to a common location rather than
> duplicating it in two places. We also reformat this to fit within
> 80 columns.

If you don't mind I'll test the series out on Monday or Tuesday on the
next week after my local-tree changes concerning the DW XPCS driver
are rebased onto it.

-Serge(y)

> 
>  drivers/net/ethernet/stmicro/stmmac/dwmac-intel.c |   2 +-
>  drivers/net/pcs/pcs-xpcs-nxp.c                    |  24 +-
>  drivers/net/pcs/pcs-xpcs-wx.c                     |  56 ++-
>  drivers/net/pcs/pcs-xpcs.c                        | 445 +++++++++-------------
>  drivers/net/pcs/pcs-xpcs.h                        |  26 +-
>  include/linux/pcs/pcs-xpcs.h                      |  19 +-
>  6 files changed, 237 insertions(+), 335 deletions(-)
> 
> -- 
> RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
> FTTP is here! 80Mbps down 10Mbps up. Decent connectivity at last!
>
Russell King (Oracle) Oct. 9, 2024, 9:27 a.m. UTC | #5
On Wed, Oct 09, 2024 at 03:02:46AM +0300, Serge Semin wrote:
> On Sat, Oct 05, 2024 at 02:40:42AM GMT, Serge Semin wrote:
> > Hi
> > 
> > On Fri, Oct 04, 2024 at 11:19:57AM GMT, Russell King (Oracle) wrote:
> > > This is the second cleanup series for XPCS.
> > > 
> > > ...
> > 
> > If you don't mind I'll test the series out on Monday or Tuesday on the
> > next week after my local-tree changes concerning the DW XPCS driver
> > are rebased onto it.
> 
> As promised just finished rebasing the series onto the kernel 6.12-rc2
> and testing it out on the next HW setup:
> 
> DW XGMAC <-(XGMII)-> DW XPCS <-(10Gbase-R)-> Marvell 88x2222
> <-(10gbase-r)->
> SFP+ DAC SFP+
> <-(10gbase-r)->
> Marvell 88x2222 <-(10gbase-r)-> DW XPCS <-(XGMII)-> DW XGMAC
> 
> No problem has been spotted.
> 
> Tested-by: Serge Semin <fancer.lancer@gmail.com>

Thanks. However, it looks like patchwork hasn't picked up your
tested-by. Maybe it needs to be sent in reply to the cover message
and not in a sub-thread?

https://patchwork.kernel.org/project/netdevbpf/list/?series=895512

Maybe netdev folk can add it?
patchwork-bot+netdevbpf@kernel.org Oct. 9, 2024, 11:20 a.m. UTC | #6
Hello:

This series was applied to netdev/net-next.git (main)
by David S. Miller <davem@davemloft.net>:

On Fri, 4 Oct 2024 11:19:57 +0100 you wrote:
> This is the second cleanup series for XPCS.
> 
> Patch 1 removes the enum indexing the dw_xpcs_compat array. The index is
> never used except to place entries in the array and to size the array.
> 
> Patch 2 removes the interface arrays - each of which only contain one
> interface.
> 
> [...]

Here is the summary with links:
  - [net-next,01/13] net: pcs: xpcs: remove dw_xpcs_compat enum
    https://git.kernel.org/netdev/net-next/c/e30993a9ab00
  - [net-next,02/13] net: pcs: xpcs: don't use array for interface
    https://git.kernel.org/netdev/net-next/c/0397212f9306
  - [net-next,03/13] net: pcs: xpcs: pass xpcs instead of xpcs->id to xpcs_find_compat()
    https://git.kernel.org/netdev/net-next/c/4490f5669b06
  - [net-next,04/13] net: pcs: xpcs: provide a helper to get the phylink pcs given xpcs
    https://git.kernel.org/netdev/net-next/c/f042365a26b0
  - [net-next,05/13] net: pcs: xpcs: move definition of struct dw_xpcs to private header
    https://git.kernel.org/netdev/net-next/c/accd5f5cd2e1
  - [net-next,06/13] net: pcs: xpcs: rename xpcs_get_id()
    https://git.kernel.org/netdev/net-next/c/135d118bfd01
  - [net-next,07/13] net: pcs: xpcs: move searching ID list out of line
    https://git.kernel.org/netdev/net-next/c/7921d3e602fc
  - [net-next,08/13] net: pcs: xpcs: use FIELD_PREP() and FIELD_GET()
    https://git.kernel.org/netdev/net-next/c/f68189181061
  - [net-next,09/13] net: pcs: xpcs: add _modify() accessors
    https://git.kernel.org/netdev/net-next/c/ce8d6081fcf4
  - [net-next,10/13] net: pcs: xpcs: convert to use read_poll_timeout()
    https://git.kernel.org/netdev/net-next/c/d69908faf132
  - [net-next,11/13] net: pcs: xpcs: use dev_*() to print messages
    https://git.kernel.org/netdev/net-next/c/acb5fb5a42cf
  - [net-next,12/13] net: pcs: xpcs: correctly place DW_VR_MII_DIG_CTRL1_2G5_EN
    https://git.kernel.org/netdev/net-next/c/5ba561930390
  - [net-next,13/13] net: pcs: xpcs: move Wangxun VR_XS_PCS_DIG_CTRL1 configuration
    https://git.kernel.org/netdev/net-next/c/bb0b8aeca636

You are awesome, thank you!
Vladimir Oltean Oct. 9, 2024, 11:47 a.m. UTC | #7
On Fri, Oct 04, 2024 at 11:19:57AM +0100, Russell King (Oracle) wrote:
> This is the second cleanup series for XPCS.
> 
> Patch 1 removes the enum indexing the dw_xpcs_compat array. The index is
> never used except to place entries in the array and to size the array.
> 
> Patch 2 removes the interface arrays - each of which only contain one
> interface.
> 
> Patch 3 makes xpcs_find_compat() take the xpcs structure rather than the
> ID - the previous series removed the reason for xpcs_find_compat needing
> to take the ID.
> 
> Patch 4 provides a helper to convert xpcs structure to a regular
> phylink_pcs structure, which leads to patch 5.
> 
> Patch 5 moves the definition of struct dw_xpcs to the private xpcs
> header - with patch 4 in place, nothing outside of the xpcs driver
> accesses the contents of the dw_xpcs structure.
> 
> Patch 6 renames xpcs_get_id() to xpcs_read_id() since it's reading the
> ID, rather than doing anything further with it. (Prior versions of this
> series renamed it to xpcs_read_phys_id() since that more accurately
> described that it was reading the physical ID registers.)
> 
> Patch 7 moves the searching of the ID list out of line as this is a
> separate functional block.
> 
> Patch 8 converts xpcs to use the bitmap macros, which eliminates the
> need for _SHIFT definitions.
> 
> Patch 9 adds and uses _modify() accessors as there are a large amount
> of read-modify-write operations in this driver. This conversion found
> a bug in xpcs-wx code that has been reported and already fixed.
> 
> Patch 10 converts xpcs to use read_poll_timeout() rather than open
> coding that.
> 
> Patch 11 converts all printed messages to use the dev_*() functions so
> the driver and devie name are always printed.
> 
> Patch 12 moves DW_VR_MII_DIG_CTRL1_2G5_EN to the correct place in the
> header file, rather than amongst another register's definitions.
> 
> Patch 13 moves the Wangxun workaround to a common location rather than
> duplicating it in two places. We also reformat this to fit within
> 80 columns.
> 
>  drivers/net/ethernet/stmicro/stmmac/dwmac-intel.c |   2 +-
>  drivers/net/pcs/pcs-xpcs-nxp.c                    |  24 +-
>  drivers/net/pcs/pcs-xpcs-wx.c                     |  56 ++-
>  drivers/net/pcs/pcs-xpcs.c                        | 445 +++++++++-------------
>  drivers/net/pcs/pcs-xpcs.h                        |  26 +-
>  include/linux/pcs/pcs-xpcs.h                      |  19 +-
>  6 files changed, 237 insertions(+), 335 deletions(-)
> 
> -- 
> RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
> FTTP is here! 80Mbps down 10Mbps up. Decent connectivity at last!

Late, I know, but:

Reviewed-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Serge Semin Oct. 10, 2024, 8:31 p.m. UTC | #8
On Wed, Oct 09, 2024 at 10:27:30AM GMT, Russell King (Oracle) wrote:
> On Wed, Oct 09, 2024 at 03:02:46AM +0300, Serge Semin wrote:
> > On Sat, Oct 05, 2024 at 02:40:42AM GMT, Serge Semin wrote:
> > > Hi
> > > 
> > > On Fri, Oct 04, 2024 at 11:19:57AM GMT, Russell King (Oracle) wrote:
> > > > This is the second cleanup series for XPCS.
> > > > 
> > > > ...
> > > 
> > > If you don't mind I'll test the series out on Monday or Tuesday on the
> > > next week after my local-tree changes concerning the DW XPCS driver
> > > are rebased onto it.
> > 
> > As promised just finished rebasing the series onto the kernel 6.12-rc2
> > and testing it out on the next HW setup:
> > 
> > DW XGMAC <-(XGMII)-> DW XPCS <-(10Gbase-R)-> Marvell 88x2222
> > <-(10gbase-r)->
> > SFP+ DAC SFP+
> > <-(10gbase-r)->
> > Marvell 88x2222 <-(10gbase-r)-> DW XPCS <-(XGMII)-> DW XGMAC
> > 
> > No problem has been spotted.
> > 
> > Tested-by: Serge Semin <fancer.lancer@gmail.com>
> 

> Thanks. However, it looks like patchwork hasn't picked up your
> tested-by. Maybe it needs to be sent in reply to the cover message
> and not in a sub-thread?
> 
> https://patchwork.kernel.org/project/netdevbpf/list/?series=895512
> 
> Maybe netdev folk can add it?

Yeah, the tb-tag hasn't been added to the commits either:
https://git.kernel.org/pub/scm/linux/kernel/git/netdev/net-next.git/commit/?id=bb0b8aeca636373a9136a7a5b7594031c7587c5e
Likely you are right and the patchwork just doesn't detect the
sub-replies tags. In the meantime the b4-tool does pick them up. I've
just tested it.

-Serge(y)

> 
> -- 
> RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
> FTTP is here! 80Mbps down 10Mbps up. Decent connectivity at last!