net: phy: split the mscc driver
Subsystems (3)
v3 cover net: phy: split the mscc driver
Hello,
This is a proposal to split the MSCC PHY driver, as its code base grew a lot lately (it's already 3800+ lines). It also supports features requiring a lot of code (MACsec), which would gain in being split from the driver core, for readability and maintenance. This is also done as other features should be coming later, which will also need lots of code addition.
This series shouldn't change the way the driver works.
I checked, and there were no patch pending on this driver. This change was done on top of all the modifications done on this driver in net-next.
Thanks,
Antoine
Since v2:
- Defined inline functions as static inline.
- Fixed a locking issue reported by Kbuild.
Since v1:
- Moved more definitions into the mscc_macsec.h header.
Antoine Tenart (3):
net: phy: move the mscc driver to its own directory
net: phy: mscc: split the driver into separate files
net: phy: mscc: fix header defines and descriptions
drivers/net/phy/Makefile | 2 +-
drivers/net/phy/mscc/Makefile | 10 +
drivers/net/phy/mscc/mscc.h | 392 +++++
drivers/net/phy/{ => mscc}/mscc_fc_buffer.h | 8 +-
drivers/net/phy/{ => mscc}/mscc_mac.h | 8 +-
drivers/net/phy/mscc/mscc_macsec.c | 1051 +++++++++++++
drivers/net/phy/{ => mscc}/mscc_macsec.h | 66 +-
drivers/net/phy/{mscc.c => mscc/mscc_main.c} | 1469 +-----------------
8 files changed, 1532 insertions(+), 1474 deletions(-)
create mode 100644 drivers/net/phy/mscc/Makefile
create mode 100644 drivers/net/phy/mscc/mscc.h
rename drivers/net/phy/{ => mscc}/mscc_fc_buffer.h (95%)
rename drivers/net/phy/{ => mscc}/mscc_mac.h (98%)
create mode 100644 drivers/net/phy/mscc/mscc_macsec.c
rename drivers/net/phy/{ => mscc}/mscc_macsec.h (90%)
rename drivers/net/phy/{mscc.c => mscc/mscc_main.c} (60%)Signature · 1 line
2.24.1
PATCH v3 1/3 net: phy: move the mscc driver to its own directory
The MSCC PHY driver is growing, with lots of space consuming features (firmware support, full initialization, MACsec...). It's becoming hard to read and navigate in its source code. This patch moves the MSCC driver to its own directory, without modifying anything, as a preparation for splitting up its features into dedicated files.
---
drivers/net/phy/Makefile | 2 +-
drivers/net/phy/mscc/Makefile | 5 +++++
drivers/net/phy/{ => mscc}/mscc.c | 0
drivers/net/phy/{ => mscc}/mscc_fc_buffer.h | 0
drivers/net/phy/{ => mscc}/mscc_mac.h | 0
drivers/net/phy/{ => mscc}/mscc_macsec.h | 0
6 files changed, 6 insertions(+), 1 deletion(-)
create mode 100644 drivers/net/phy/mscc/Makefile
rename drivers/net/phy/{ => mscc}/mscc.c (100%)
rename drivers/net/phy/{ => mscc}/mscc_fc_buffer.h (100%)
rename drivers/net/phy/{ => mscc}/mscc_mac.h (100%)
rename drivers/net/phy/{ => mscc}/mscc_macsec.h (100%)drivers/net/phy/Makefile +1 -1
@@ -89,7 +89,7 @@ obj-$(CONFIG_MICREL_KS8995MA) += spi_ks8995.o obj-$(CONFIG_MICREL_PHY) += micrel.o obj-$(CONFIG_MICROCHIP_PHY) += microchip.o obj-$(CONFIG_MICROCHIP_T1_PHY) += microchip_t1.o -obj-$(CONFIG_MICROSEMI_PHY) += mscc.o +obj-$(CONFIG_MICROSEMI_PHY) += mscc/ obj-$(CONFIG_NATIONAL_PHY) += national.o obj-$(CONFIG_NXP_TJA11XX_PHY) += nxp-tja11xx.o obj-$(CONFIG_QSEMI_PHY) += qsemi.o
drivers/net/phy/mscc/Makefile new file +5 -0
@@ -0,0 +1,5 @@ +# SPDX-License-Identifier: GPL-2.0 +# +# Makefile for MSCC networking PHY driver + +obj-$(CONFIG_MICROSEMI_PHY) += mscc.o
drivers/net/phy/mscc/mscc.c renamed from drivers/net/phy/mscc.c +0 -0
drivers/net/phy/mscc/mscc_fc_buffer.h renamed from drivers/net/phy/mscc_fc_buffer.h +0 -0
drivers/net/phy/mscc/mscc_mac.h renamed from drivers/net/phy/mscc_mac.h +0 -0
drivers/net/phy/mscc/mscc_macsec.h renamed from drivers/net/phy/mscc_macsec.h +0 -0
Signature · 1 line
2.24.1
PATCH v3 2/3 net: phy: mscc: split the driver into separate files
In reply to Antoine TenartThis patch splits the MSCC driver into separate files, per functionality, to improve readability and maintenance as the codebase grew a lot. The MACsec code is moved to a dedicated mscc_macsec.c file, the mscc.c file is renamed to mscc_main.c to keep the driver binary to be named mscc and common definition are put into a new mscc.h header.
Most of the code was just moved around, except for a few exceptions:
- Header inclusions were reworked to only keep what's needed.
- Three helpers were created in the MACsec code, to avoid #ifdef's in the main C file: vsc8584_macsec_init, vsc8584_handle_macsec_interrupt and vsc8584_config_macsec_intr.
The patch should not introduce any functional modification.
---
drivers/net/phy/mscc/Makefile | 7 +-
drivers/net/phy/mscc/mscc.h | 392 +++++
drivers/net/phy/mscc/mscc_macsec.c | 1051 +++++++++++++
drivers/net/phy/mscc/mscc_macsec.h | 58 +
drivers/net/phy/mscc/{mscc.c => mscc_main.c} | 1469 +-----------------
5 files changed, 1515 insertions(+), 1462 deletions(-)
create mode 100644 drivers/net/phy/mscc/mscc.h
create mode 100644 drivers/net/phy/mscc/mscc_macsec.c
rename drivers/net/phy/mscc/{mscc.c => mscc_main.c} (60%)drivers/net/phy/mscc/Makefile +6 -1
@@ -2,4 +2,9 @@ # # Makefile for MSCC networking PHY driver -obj-$(CONFIG_MICROSEMI_PHY) += mscc.o +obj-$(CONFIG_MICROSEMI_PHY) := mscc.o +mscc-objs := mscc_main.o + +ifdef CONFIG_MACSEC +mscc-objs += mscc_macsec.o +endif
drivers/net/phy/mscc/mscc.h new file +392 -0
392 lines not on this page · raw message
drivers/net/phy/mscc/mscc_macsec.c new file +1051 -0
1,051 lines not on this page · raw message
drivers/net/phy/mscc/mscc_macsec.h +58 -0
70 lines not on this page · raw message
drivers/net/phy/mscc/mscc_main.c renamed from drivers/net/phy/mscc/mscc.c +8 -1461
1,477 lines not on this page · raw message
The rest of this diff is not shown. View the raw message.
Signature · 1 line
2.24.1
Part of the diff is not shown here. View the raw message.
PATCH v3 3/3 net: phy: mscc: fix header defines and descriptions
In reply to Antoine TenartCosmetic commit fixing the MSCC PHY header defines and descriptions, which were referring the to MSCC Ocelot MAC driver (see drivers/net/ethernet/mscc/).
--- drivers/net/phy/mscc/mscc_fc_buffer.h | 8 ++++---- drivers/net/phy/mscc/mscc_mac.h | 8 ++++---- drivers/net/phy/mscc/mscc_macsec.h | 8 ++++---- 3 files changed, 12 insertions(+), 12 deletions(-)
drivers/net/phy/mscc/mscc_fc_buffer.h +4 -4
@@ -1,12 +1,12 @@/* SPDX-License-Identifier: (GPL-2.0 OR MIT) */ /* -* Microsemi Ocelot Switch driver +* Driver for Microsemi VSC85xx PHYs * * Copyright (C) 2019 Microsemi Corporation */ -#ifndef _MSCC_OCELOT_FC_BUFFER_H_ -#define _MSCC_OCELOT_FC_BUFFER_H_ +#ifndef _MSCC_PHY_FC_BUFFER_H_ +#define _MSCC_PHY_FC_BUFFER_H_#define MSCC_FCBUF_ENA_CFG 0x00#define MSCC_FCBUF_MODE_CFG 0x01
@@ -61,4 +61,4 @@#define MSCC_FCBUF_FC_READ_THRESH_CFG_RX_THRESH (x) ((x) << 16)#define MSCC_FCBUF_FC_READ_THRESH_CFG_RX_THRESH_M GENMASK(31, 16) -#endif +#endif /* _MSCC_PHY_FC_BUFFER_H_ */
drivers/net/phy/mscc/mscc_mac.h +4 -4
@@ -1,12 +1,12 @@/* SPDX-License-Identifier: (GPL-2.0 OR MIT) */ /* -* Microsemi Ocelot Switch driver +* Driver for Microsemi VSC85xx PHYs * * Copyright (c) 2017 Microsemi Corporation */ -#ifndef _MSCC_OCELOT_LINE_MAC_H_ -#define _MSCC_OCELOT_LINE_MAC_H_ +#ifndef _MSCC_PHY_LINE_MAC_H_ +#define _MSCC_PHY_LINE_MAC_H_#define MSCC_MAC_CFG_ENA_CFG 0x00#define MSCC_MAC_CFG_MODE_CFG 0x01
@@ -156,4 +156,4 @@#define MSCC_PROC_0_IP_1588_TOP_CFG_STAT_MODE_CTL_PROTOCOL_MODE (x) (x)#define MSCC_PROC_0_IP_1588_TOP_CFG_STAT_MODE_CTL_PROTOCOL_MODE_M GENMASK(2, 0) -#endif /* _MSCC_OCELOT_LINE_MAC_H_ */ +#endif /* _MSCC_PHY_LINE_MAC_H_ */
drivers/net/phy/mscc/mscc_macsec.h +4 -4
@@ -1,12 +1,12 @@/* SPDX-License-Identifier: (GPL-2.0 OR MIT) */ /* -* Microsemi Ocelot Switch driver +* Driver for Microsemi VSC85xx PHYs * * Copyright (c) 2018 Microsemi Corporation */ -#ifndef _MSCC_OCELOT_MACSEC_H_ -#define _MSCC_OCELOT_MACSEC_H_ +#ifndef _MSCC_PHY_MACSEC_H_ +#define _MSCC_PHY_MACSEC_H_#include <net/macsec.h>
@@ -321,4 +321,4 @@ struct macsec_flow {#define MSCC_MS_INTR_CTRL_STATUS_INTR_ENABLE_M GENMASK(31, 16)#define MACSEC_INTR_CTRL_STATUS_ROLLOVER BIT(5) -#endif +#endif /* _MSCC_PHY_MACSEC_H_ */
Signature · 1 line
2.24.1
David Miller
maintainerFrom: Antoine Tenart <[email protected]>
Date: Fri, 13 Mar 2020 10:47:59 +0100
Quoted 11 lines
This is a proposal to split the MSCC PHY driver, as its code base grew a lot lately (it's already 3800+ lines). It also supports features requiring a lot of code (MACsec), which would gain in being split from the driver core, for readability and maintenance. This is also done as other features should be coming later, which will also need lots of code addition.
This series shouldn't change the way the driver works.
I checked, and there were no patch pending on this driver. This change was done on top of all the modifications done on this driver in net-next.
...
Series applied, thanks Antoine.