net: sparx5: misc fixes for sparx5 and lan969x
Subsystems (4)
Daniel Machon
maintainercover net: sparx5: misc fixes for sparx5 and lan969x
This series fixes various issues in the Sparx5 and lan969x drivers. Most of the fixes are for new issues introduced by the recent series adding lan969x switch support in the Sparx5 driver.
Most notable is patch 1/5 that moves the lan969x dir into the sparx5 dir, in order to address a cyclic dependency issue reported by depmod, when installing modules. Details are in the commit descriptions.
To: Andrew Lunn <[email protected]>
To: David S. Miller <[email protected]>
To: Eric Dumazet <[email protected]>
To: Jakub Kicinski <[email protected]>
To: Paolo Abeni <[email protected]>
To: Lars Povlsen <[email protected]>
To: Steen Hegelund <[email protected]>
To: [email protected]
To: Richard Cochran <[email protected]>
To: Bjarni Jonasson <[email protected]>
To: [email protected]
To: [email protected]
To: [email protected]
To: [email protected]
To: [email protected]
Cc: Calvin Owens <[email protected]>
Cc: Muhammad Usama Anjum <[email protected]>
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
---
Daniel Machon (5):
net: lan969x: fix cyclic dependency reported by depmod
net: lan969x: fix the use of spin_lock in PTP handler
net: sparx5: fix FDMA performance issue
net: sparx5: fix default value of monitor ports
net: sparx5: fix the maximum frame length register
MAINTAINERS | 2 +-
drivers/net/ethernet/microchip/Kconfig | 1 -
drivers/net/ethernet/microchip/Makefile | 1 -
drivers/net/ethernet/microchip/lan969x/Kconfig | 5 -----
drivers/net/ethernet/microchip/lan969x/Makefile | 13 -------------
drivers/net/ethernet/microchip/sparx5/Kconfig | 6 ++++++
drivers/net/ethernet/microchip/sparx5/Makefile | 6 ++++++
.../net/ethernet/microchip/{ => sparx5}/lan969x/lan969x.c | 9 ++-------
.../net/ethernet/microchip/{ => sparx5}/lan969x/lan969x.h | 0
.../microchip/{ => sparx5}/lan969x/lan969x_calendar.c | 0
.../microchip/{ => sparx5}/lan969x/lan969x_regs.c | 0
.../microchip/{ => sparx5}/lan969x/lan969x_vcap_ag_api.c | 0
.../microchip/{ => sparx5}/lan969x/lan969x_vcap_impl.c | 0
drivers/net/ethernet/microchip/sparx5/sparx5_calendar.c | 2 --
drivers/net/ethernet/microchip/sparx5/sparx5_main.c | 15 +++++++--------
drivers/net/ethernet/microchip/sparx5/sparx5_mirror.c | 3 +--
drivers/net/ethernet/microchip/sparx5/sparx5_port.c | 2 +-
drivers/net/ethernet/microchip/sparx5/sparx5_ptp.c | 1 -
18 files changed, 24 insertions(+), 42 deletions(-)---
base-commit: da4fa00abe5674d3d165cfd8032c740e8aab4d3b
change-id: 20241203-sparx5-lan969x-misc-fixes-869bff8b55a1
Best regards,
Signature · 1 line
Daniel Machon <[email protected]>
Daniel Machon
maintainerPATCH 1/5 net: lan969x: fix cyclic dependency reported by depmod
Depmod reports a cyclic dependency between modules sparx5-switch.ko and lan969x-switch.ko:
depmod: ERROR: Cycle detected: lan969x_switch -> sparx5_switch -> lan969x_switch
depmod: ERROR: Found 2 modules in dependency cycles!
make[2]: *** [scripts/Makefile.modinst:132: depmod] Error 1
make: *** [Makefile:224: __sub-make] Error 2
This makes sense, as they both require symbols from each other.
Fix this by compiling lan969x support into the sparx5-switch.ko module. In order to do this, in a sensible way, we move the lan969x/ dir into the sparx5/ dir and do some code cleanup of code that is no longer required.
After this patch, depmod will no longer complain, as lan969x support is compiled into the sparx5-swicth.ko module, and can no longer be compiled as a standalone module.
---
MAINTAINERS | 2 +-
drivers/net/ethernet/microchip/Kconfig | 1 -
drivers/net/ethernet/microchip/Makefile | 1 -
drivers/net/ethernet/microchip/lan969x/Kconfig | 5 -----
drivers/net/ethernet/microchip/lan969x/Makefile | 13 -------------
drivers/net/ethernet/microchip/sparx5/Kconfig | 6 ++++++
drivers/net/ethernet/microchip/sparx5/Makefile | 6 ++++++
.../net/ethernet/microchip/{ => sparx5}/lan969x/lan969x.c | 5 -----
.../net/ethernet/microchip/{ => sparx5}/lan969x/lan969x.h | 0
.../microchip/{ => sparx5}/lan969x/lan969x_calendar.c | 0
.../ethernet/microchip/{ => sparx5}/lan969x/lan969x_regs.c | 0
.../microchip/{ => sparx5}/lan969x/lan969x_vcap_ag_api.c | 0
.../microchip/{ => sparx5}/lan969x/lan969x_vcap_impl.c | 0
drivers/net/ethernet/microchip/sparx5/sparx5_calendar.c | 2 --
drivers/net/ethernet/microchip/sparx5/sparx5_main.c | 4 ++--
drivers/net/ethernet/microchip/sparx5/sparx5_ptp.c | 1 -
16 files changed, 15 insertions(+), 31 deletions(-)MAINTAINERS +1 -1
@@ -15270,7 +15270,7 @@ M: Daniel Machon <[email protected]> M: [email protected] L: [email protected] S: Maintained -F: drivers/net/ethernet/microchip/lan969x/* +F: drivers/net/ethernet/microchip/sparx5/lan969x/* MICROCHIP LCDFB DRIVER M: Nicolas Ferre <[email protected]>
drivers/net/ethernet/microchip/Kconfig +0 -1
@@ -59,7 +59,6 @@ config LAN743X source "drivers/net/ethernet/microchip/lan865x/Kconfig" source "drivers/net/ethernet/microchip/lan966x/Kconfig" -source "drivers/net/ethernet/microchip/lan969x/Kconfig" source "drivers/net/ethernet/microchip/sparx5/Kconfig" source "drivers/net/ethernet/microchip/vcap/Kconfig" source "drivers/net/ethernet/microchip/fdma/Kconfig"
drivers/net/ethernet/microchip/Makefile +0 -1
@@ -11,7 +11,6 @@ lan743x-objs := lan743x_main.o lan743x_ethtool.o lan743x_ptp.o obj-$(CONFIG_LAN865X) += lan865x/ obj-$(CONFIG_LAN966X_SWITCH) += lan966x/ -obj-$(CONFIG_LAN969X_SWITCH) += lan969x/ obj-$(CONFIG_SPARX5_SWITCH) += sparx5/ obj-$(CONFIG_VCAP) += vcap/ obj-$(CONFIG_FDMA) += fdma/
drivers/net/ethernet/microchip/lan969x/Kconfig deleted +0 -5
@@ -1,5 +0,0 @@ -config LAN969X_SWITCH - bool "Lan969x switch driver" - depends on SPARX5_SWITCH - help - This driver supports the lan969x family of network switch devices.
drivers/net/ethernet/microchip/lan969x/Makefile deleted +0 -13
@@ -1,13 +0,0 @@ -# SPDX-License-Identifier: GPL-2.0-only -# -# Makefile for the Microchip lan969x network device drivers. -# - -obj-$(CONFIG_SPARX5_SWITCH) += lan969x-switch.o - -lan969x-switch-y := lan969x_regs.o lan969x.o lan969x_calendar.o \ - lan969x_vcap_ag_api.o lan969x_vcap_impl.o - -# Provide include files -ccflags-y += -I$(srctree)/drivers/net/ethernet/microchip/fdma -ccflags-y += -I$(srctree)/drivers/net/ethernet/microchip/vcap
drivers/net/ethernet/microchip/sparx5/Kconfig +6 -0
@@ -24,3 +24,9 @@ config SPARX5_DCB DSCP and PCP. If unsure, set to Y. + +config LAN969X_SWITCH + bool "Lan969x switch driver" + depends on SPARX5_SWITCH + help + This driver supports the lan969x family of network switch devices.
drivers/net/ethernet/microchip/sparx5/Makefile +6 -0
@@ -16,6 +16,12 @@ sparx5-switch-y := sparx5_main.o sparx5_packet.o \ sparx5-switch-$(CONFIG_SPARX5_DCB) += sparx5_dcb.o sparx5-switch-$(CONFIG_DEBUG_FS) += sparx5_vcap_debugfs.o +sparx5-switch-$(CONFIG_LAN969X_SWITCH) += lan969x/lan969x_regs.o \ + lan969x/lan969x.o \ + lan969x/lan969x_calendar.o \ + lan969x/lan969x_vcap_ag_api.o \ + lan969x/lan969x_vcap_impl.o + # Provide include files ccflags-y += -I$(srctree)/drivers/net/ethernet/microchip/vcap ccflags-y += -I$(srctree)/drivers/net/ethernet/microchip/fdma
drivers/net/ethernet/microchip/sparx5/lan969x/lan969x.c renamed from drivers/net/ethernet/microchip/lan969x/lan969x.c +0 -5
@@ -346,8 +346,3 @@ const struct sparx5_match_data lan969x_desc = { .consts = &lan969x_consts, .ops = &lan969x_ops, }; -EXPORT_SYMBOL_GPL (lan969x_desc); - -MODULE_DESCRIPTION ("Microchip lan969x switch driver" ); -MODULE_AUTHOR ("Daniel Machon <[email protected]>" ); -MODULE_LICENSE ("Dual MIT/GPL" );
drivers/net/ethernet/microchip/sparx5/lan969x/lan969x.h renamed from drivers/net/ethernet/microchip/lan969x/lan969x.h +0 -0
drivers/net/ethernet/microchip/sparx5/lan969x/lan969x_calendar.c renamed from drivers/net/ethernet/microchip/lan969x/lan969x_calendar.c +0 -0
drivers/net/ethernet/microchip/sparx5/lan969x/lan969x_regs.c renamed from drivers/net/ethernet/microchip/lan969x/lan969x_regs.c +0 -0
drivers/net/ethernet/microchip/sparx5/lan969x/lan969x_vcap_ag_api.c renamed from drivers/net/ethernet/microchip/lan969x/lan969x_vcap_ag_api.c +0 -0
drivers/net/ethernet/microchip/sparx5/lan969x/lan969x_vcap_impl.c renamed from drivers/net/ethernet/microchip/lan969x/lan969x_vcap_impl.c +0 -0
drivers/net/ethernet/microchip/sparx5/sparx5_calendar.c +0 -2
@@ -98,7 +98,6 @@ u32 sparx5_cal_speed_to_value(enum sparx5_cal_bw speed)default :return 0 ; } } -EXPORT_SYMBOL_GPL (sparx5_cal_speed_to_value);static u32 sparx5_bandwidth_to_calendar (u32 bw) {
@@ -150,7 +149,6 @@ enum sparx5_cal_bw sparx5_get_port_cal_speed(struct sparx5 *sparx5, u32 portno)return SPX5_CAL_SPEED_NONE ;return sparx5_bandwidth_to_calendar (port->conf.bandwidth); } -EXPORT_SYMBOL_GPL (sparx5_get_port_cal_speed);/* Auto configure the QSYS calendar based on port configuration */ int sparx5_config_auto_calendar (struct sparx5 *sparx5)
drivers/net/ethernet/microchip/sparx5/sparx5_main.c +2 -2
@@ -24,7 +24,7 @@#include <linux/types.h> #include <linux/reset.h> -#include "../lan969x/lan969x.h" /* for lan969x match data */ +#include "lan969x/lan969x.h" /* for lan969x match data */ #include "sparx5_main_regs.h" #include "sparx5_main.h"
@@ -1093,7 +1093,7 @@ static const struct sparx5_match_data sparx5_desc = {static const struct of_device_id mchp_sparx5_match[] = { { .compatible ="microchip,sparx5-switch" , .data = &sparx5_desc }, -#if IS_ENABLED(CONFIG_LAN969X_SWITCH) +#ifdef CONFIG_LAN969X_SWITCH { .compatible ="microchip,lan9691-switch" , .data = &lan969x_desc }, #endif { }
drivers/net/ethernet/microchip/sparx5/sparx5_ptp.c +0 -1
@@ -303,7 +303,6 @@ void sparx5_get_hwtimestamp(struct sparx5 *sparx5,spin_unlock_irqrestore (&sparx5->ptp_clock_lock, flags); } -EXPORT_SYMBOL_GPL (sparx5_get_hwtimestamp);irqreturn_t sparx5_ptp_irq_handler (int irq,void *args) {
Signature · 1 line
2.34.1
Daniel Machon
maintainerPATCH 2/5 net: lan969x: fix the use of spin_lock in PTP handler
In reply to Daniel MachonWe are mixing the use of spin_lock() and spin_lock_irqsave() functions in the PTP handler of lan969x. Fix this by correctly using the _irqsave variants.
--- drivers/net/ethernet/microchip/sparx5/lan969x/lan969x.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/ethernet/microchip/sparx5/lan969x/lan969x.c +2 -2
@@ -273,9 +273,9 @@ static irqreturn_t lan969x_ptp_irq_handler(int irq, void *args)if (WARN_ON (!skb_match))continue ; -spin_lock (&sparx5->ptp_ts_id_lock); +spin_lock_irqsave (&sparx5->ptp_ts_id_lock, flags); sparx5->ptp_skbs--; -spin_unlock (&sparx5->ptp_ts_id_lock); +spin_unlock_irqrestore (&sparx5->ptp_ts_id_lock, flags);/* Get the h/w timestamp */ sparx5_get_hwtimestamp (sparx5, &ts, delay);
Signature · 1 line
2.34.1
Daniel Machon
maintainerPATCH 3/5 net: sparx5: fix FDMA performance issue
In reply to Daniel MachonThe FDMA handler is responsible for scheduling a NAPI poll, which will eventually fetch RX packets from the FDMA queue. Currently, the FDMA handler is run in a threaded context. For some reason, this kills performance. Admittedly, I did not do a thorough investigation to see exactly what causes the issue, however, I noticed that in the other driver utilizing the same FDMA engine, we run the FDMA handler in hard IRQ context.
Fix this performance issue, by running the FDMA handler in hard IRQ context, not deferring any work to a thread.
Prior to this change, the RX UDP performance was:
Interval Transfer Bitrate Jitter 0.00-10.20 sec 44.6 MBytes 36.7 Mbits/sec 0.027 ms
After this change, the rx UDP performance is:
Interval Transfer Bitrate Jitter 0.00-9.12 sec 1.01 GBytes 953 Mbits/sec 0.020 ms
--- drivers/net/ethernet/microchip/sparx5/sparx5_main.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-)
drivers/net/ethernet/microchip/sparx5/sparx5_main.c +5 -6
@@ -780,12 +780,11 @@ static int sparx5_start(struct sparx5 *sparx5) err = -ENXIO ;if (sparx5->fdma_irq >=0 &&is_sparx5 (sparx5)) {if (GCB_CHIP_ID_REV_ID_GET (sparx5->chip_id) >0 ) - err =devm_request_threaded_irq (sparx5->dev, - sparx5->fdma_irq, -NULL , - sparx5_fdma_handler, -IRQF_ONESHOT , -"sparx5-fdma" , sparx5); + err =devm_request_irq (sparx5->dev, + sparx5->fdma_irq, + sparx5_fdma_handler, +0 , +"sparx5-fdma" , sparx5);if (!err) err =sparx5_fdma_start (sparx5);if (err)
Signature · 1 line
2.34.1
Daniel Machon
maintainerPATCH 4/5 net: sparx5: fix default value of monitor ports
In reply to Daniel MachonWhen doing port mirroring, the physical port to send the frame to, is written to the FRMC_PORT_VAL field of the QFWD_FRAME_COPY_CFG register. This field is 7 bits wide on sparx5 and 6 bits wide on lan969x, and has a default value of 65 and 30, respectively (the number of front ports).
On mirror deletion, we set the default value of the monitor port to 65 for this field, in case no more ports exists for the mirror. Needless to say, this will not fit the 6 bits on lan969x.
Fix this by correctly using the n_ports constant instead.
--- drivers/net/ethernet/microchip/sparx5/sparx5_mirror.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/net/ethernet/microchip/sparx5/sparx5_mirror.c +1 -2
@@ -12,7 +12,6 @@#define SPX5_MIRROR_DISABLED 0#define SPX5_MIRROR_EGRESS 1#define SPX5_MIRROR_INGRESS 2 -#define SPX5_MIRROR_MONITOR_PORT_DEFAULT 65#define SPX5_QFWD_MP_OFFSET 9/* Mirror port offset in the QFWD register */ /* Convert from bool ingress/egress to mirror direction */
@@ -200,7 +199,7 @@ void sparx5_mirror_del(struct sparx5_mall_entry *entry)sparx5_mirror_monitor_set (sparx5, mirror_idx, -SPX5_MIRROR_MONITOR_PORT_DEFAULT ); + sparx5->data->consts->n_ports); } void sparx5_mirror_stats(struct sparx5_mall_entry *entry,
Signature · 1 line
2.34.1
Daniel Machon
maintainerPATCH 5/5 net: sparx5: fix the maximum frame length register
In reply to Daniel MachonOn port initialization, we configure the maximum frame length accepted by the receive module associated with the port. This value is currently written to the MAX_LEN field of the DEV10G_MAC_ENA_CFG register, when in fact, it should be written to the DEV10G_MAC_MAXLEN_CFG register. Fix this.
--- drivers/net/ethernet/microchip/sparx5/sparx5_port.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/microchip/sparx5/sparx5_port.c +1 -1
@@ -1151,7 +1151,7 @@ int sparx5_port_init(struct sparx5 *sparx5,spx5_inst_rmw (DEV10G_MAC_MAXLEN_CFG_MAX_LEN_SET (ETH_MAXLEN ),DEV10G_MAC_MAXLEN_CFG_MAX_LEN , devinst, -DEV10G_MAC_ENA_CFG (0 )); +DEV10G_MAC_MAXLEN_CFG (0 ));/* Handle Signal Detect in 10G PCS */ spx5_inst_wr(PCS10G_BR_PCS_SD_CFG_SD_POL_SET(sd_pol) |
Signature · 1 line
2.34.1
This series was applied to netdev/net.git (main) by David S. Miller <[email protected]>:
Hello:
This series was applied to netdev/net.git (main)
by David S. Miller <[email protected]>:
Quoted 9 lines · On Thu, 5 Dec 2024 14:54:23 +0100 you wrote:
This series fixes various issues in the Sparx5 and lan969x drivers. Most of the fixes are for new issues introduced by the recent series adding lan969x switch support in the Sparx5 driver.
Most notable is patch 1/5 that moves the lan969x dir into the sparx5 dir, in order to address a cyclic dependency issue reported by depmod, when installing modules. Details are in the commit descriptions.
[...]
Here is the summary with links:
- [net,1/5] net: lan969x: fix cyclic dependency reported by depmod
https://git.kernel.org/netdev/net/c/1cd7523f4baa - [net,2/5] net: lan969x: fix the use of spin_lock in PTP handler https://git.kernel.org/netdev/net/c/aa5fc889844f - [net,3/5] net: sparx5: fix FDMA performance issue https://git.kernel.org/netdev/net/c/f004f2e535e2 - [net,4/5] net: sparx5: fix default value of monitor ports https://git.kernel.org/netdev/net/c/e4d505fda6c8 - [net,5/5] net: sparx5: fix the maximum frame length register https://git.kernel.org/netdev/net/c/ddd7ba006078
You are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html