Update the TAS patch to the one sent upstream, it adds SparX-5 registers. Signed-off-by: Robert Marko <robert.marko@sartura.hr>
227 lines
7.3 KiB
Diff
227 lines
7.3 KiB
Diff
From 2ad75da9a7b7fa1fed92624685c0e9c25fcad719 Mon Sep 17 00:00:00 2001
|
|
From: Robert Marko <robert.marko@sartura.hr>
|
|
Date: Wed, 1 Jul 2026 15:37:32 +0200
|
|
Subject: [RFC net-next] net: sparx5: configure TAS port link speed
|
|
|
|
On the TSN and RED variants of LAN969x and SparX-5i TAS (Time-Aware Shaper)
|
|
is present in the silicon.
|
|
|
|
Currently, the driver does not use configure it at all, which means that
|
|
the TAS_PROFILE_CONFIG.LINK_SPEED[1] value is left at the default of 3
|
|
which means that its configured for 1 Gbps.
|
|
|
|
So, running iperf between two 10G switch ports will result in only 940-ish
|
|
Mbps while we should be getting around 9.3 Gbps.
|
|
|
|
Correctly populating the TAS_PROFILE_CONFIG.LINK_SPEED[1] with the current
|
|
port speed fixes this issue and we achieve around 9.4 Gbps between two 10G
|
|
switch ports.
|
|
|
|
So, port the TAS port link speed setting from the vendor BSP 6.18 kernel[2]
|
|
|
|
[1] https://microchip-ung.github.io/lan969x-industrial_reginfo/reginfo_LAN969x-Industrial.html?select=hsch,tas_profile_cfg,tas_profile_config,link_speed
|
|
[2] https://github.com/microchip-ung/linux/tree/bsp-6.18-2026
|
|
|
|
Signed-off-by: Robert Marko <robert.marko@sartura.hr>
|
|
---
|
|
.../microchip/sparx5/lan969x/lan969x_regs.c | 3 ++
|
|
.../microchip/sparx5/sparx5_main_regs.h | 12 +++++
|
|
.../ethernet/microchip/sparx5/sparx5_port.c | 4 ++
|
|
.../ethernet/microchip/sparx5/sparx5_qos.c | 49 +++++++++++++++++++
|
|
.../ethernet/microchip/sparx5/sparx5_qos.h | 1 +
|
|
.../ethernet/microchip/sparx5/sparx5_regs.c | 3 ++
|
|
.../ethernet/microchip/sparx5/sparx5_regs.h | 3 ++
|
|
7 files changed, 75 insertions(+)
|
|
|
|
--- a/drivers/net/ethernet/microchip/sparx5/lan969x/lan969x_regs.c
|
|
+++ b/drivers/net/ethernet/microchip/sparx5/lan969x/lan969x_regs.c
|
|
@@ -95,6 +95,7 @@ const unsigned int lan969x_gaddr[GADDR_L
|
|
[GA_HSCH_SYSTEM] = 37384,
|
|
[GA_HSCH_MMGT] = 36260,
|
|
[GA_HSCH_TAS_CONFIG] = 37696,
|
|
+ [GA_HSCH_TAS_PROFILE_CFG] = 37712,
|
|
[GA_PTP_PTP_CFG] = 512,
|
|
[GA_PTP_PTP_TOD_DOMAINS] = 528,
|
|
[GA_PTP_PHASE_DETECTOR_CTRL] = 628,
|
|
@@ -129,6 +130,7 @@ const unsigned int lan969x_gcnt[GCNT_LAS
|
|
[GC_GCB_SIO_CTRL] = 1,
|
|
[GC_HSCH_HSCH_CFG] = 1120,
|
|
[GC_HSCH_HSCH_DWRR] = 32,
|
|
+ [GC_HSCH_TAS_PROFILE_CFG] = 30,
|
|
[GC_PTP_PTP_PINS] = 8,
|
|
[GC_PTP_PHASE_DETECTOR_CTRL] = 8,
|
|
[GC_REW_PORT] = 35,
|
|
@@ -144,6 +146,7 @@ const unsigned int lan969x_gsize[GSIZE_L
|
|
[GW_FDMA_FDMA] = 448,
|
|
[GW_GCB_CHIP_REGS] = 180,
|
|
[GW_HSCH_TAS_CONFIG] = 16,
|
|
+ [GW_HSCH_TAS_PROFILE_CFG] = 68,
|
|
[GW_PTP_PHASE_DETECTOR_CTRL] = 12,
|
|
[GW_QSYS_PAUSE_CFG] = 988,
|
|
};
|
|
--- a/drivers/net/ethernet/microchip/sparx5/sparx5_main_regs.h
|
|
+++ b/drivers/net/ethernet/microchip/sparx5/sparx5_main_regs.h
|
|
@@ -5369,6 +5369,18 @@ extern const struct sparx5_regs *regs;
|
|
#define HSCH_TAS_STATEMACHINE_CFG_REVISIT_DLY_GET(x)\
|
|
FIELD_GET(HSCH_TAS_STATEMACHINE_CFG_REVISIT_DLY, x)
|
|
|
|
+/* HSCH:TAS_PROFILE_CFG:TAS_PROFILE_CONFIG */
|
|
+#define HSCH_TAS_PROFILE_CONFIG(g) \
|
|
+ __REG(TARGET_HSCH, 0, 1, regs->gaddr[GA_HSCH_TAS_PROFILE_CFG], g, \
|
|
+ regs->gcnt[GC_HSCH_TAS_PROFILE_CFG], \
|
|
+ regs->gsize[GW_HSCH_TAS_PROFILE_CFG], 32, 0, 1, 4)
|
|
+
|
|
+#define HSCH_TAS_PROFILE_CONFIG_LINK_SPEED GENMASK(10, 8)
|
|
+#define HSCH_TAS_PROFILE_CONFIG_LINK_SPEED_SET(x)\
|
|
+ FIELD_PREP(HSCH_TAS_PROFILE_CONFIG_LINK_SPEED, x)
|
|
+#define HSCH_TAS_PROFILE_CONFIG_LINK_SPEED_GET(x)\
|
|
+ FIELD_GET(HSCH_TAS_PROFILE_CONFIG_LINK_SPEED, x)
|
|
+
|
|
/* LAN969X ONLY */
|
|
/* HSIOWRAP:XMII_CFG:XMII_CFG */
|
|
#define HSIO_WRAP_XMII_CFG(g) \
|
|
--- a/drivers/net/ethernet/microchip/sparx5/sparx5_port.c
|
|
+++ b/drivers/net/ethernet/microchip/sparx5/sparx5_port.c
|
|
@@ -11,6 +11,7 @@
|
|
#include "sparx5_main_regs.h"
|
|
#include "sparx5_main.h"
|
|
#include "sparx5_port.h"
|
|
+#include "sparx5_qos.h"
|
|
|
|
#define SPX5_ETYPE_TAG_C 0x8100
|
|
#define SPX5_ETYPE_TAG_S 0x88a8
|
|
@@ -1050,6 +1051,9 @@ int sparx5_port_config(struct sparx5 *sp
|
|
sparx5,
|
|
QFWD_SWITCH_PORT_MODE(port->portno));
|
|
|
|
+ /* Notify TAS about the speed. */
|
|
+ sparx5_tas_speed(port, conf->speed);
|
|
+
|
|
/* Save the new values */
|
|
port->conf = *conf;
|
|
|
|
--- a/drivers/net/ethernet/microchip/sparx5/sparx5_qos.c
|
|
+++ b/drivers/net/ethernet/microchip/sparx5/sparx5_qos.c
|
|
@@ -9,6 +9,17 @@
|
|
#include "sparx5_main.h"
|
|
#include "sparx5_qos.h"
|
|
|
|
+enum sparx5_tas_link_speed {
|
|
+ TAS_SPEED_NO_GB,
|
|
+ TAS_SPEED_10,
|
|
+ TAS_SPEED_100,
|
|
+ TAS_SPEED_1000,
|
|
+ TAS_SPEED_2500,
|
|
+ TAS_SPEED_5000,
|
|
+ TAS_SPEED_10000,
|
|
+ TAS_SPEED_25000,
|
|
+};
|
|
+
|
|
/* Calculate new base_time based on cycle_time.
|
|
*
|
|
* The hardware requires a base_time that is always in the future.
|
|
@@ -581,3 +592,41 @@ int sparx5_tc_ets_del(struct sparx5_port
|
|
|
|
return sparx5_dwrr_conf_set(port, &dwrr);
|
|
}
|
|
+
|
|
+void sparx5_tas_speed(struct sparx5_port *port, int speed)
|
|
+{
|
|
+ struct sparx5 *sparx5 = port->sparx5;
|
|
+ u8 spd;
|
|
+
|
|
+ switch (speed) {
|
|
+ case SPEED_10:
|
|
+ spd = TAS_SPEED_10;
|
|
+ break;
|
|
+ case SPEED_100:
|
|
+ spd = TAS_SPEED_100;
|
|
+ break;
|
|
+ case SPEED_1000:
|
|
+ spd = TAS_SPEED_1000;
|
|
+ break;
|
|
+ case SPEED_2500:
|
|
+ spd = TAS_SPEED_2500;
|
|
+ break;
|
|
+ case SPEED_5000:
|
|
+ spd = TAS_SPEED_5000;
|
|
+ break;
|
|
+ case SPEED_10000:
|
|
+ spd = TAS_SPEED_10000;
|
|
+ break;
|
|
+ case SPEED_25000:
|
|
+ spd = TAS_SPEED_25000;
|
|
+ break;
|
|
+ default:
|
|
+ netdev_err(port->ndev, "TAS: Unsupported speed: %d\n", speed);
|
|
+ return;
|
|
+ }
|
|
+
|
|
+ spx5_rmw(HSCH_TAS_PROFILE_CONFIG_LINK_SPEED_SET(spd),
|
|
+ HSCH_TAS_PROFILE_CONFIG_LINK_SPEED,
|
|
+ sparx5,
|
|
+ HSCH_TAS_PROFILE_CONFIG(port->portno));
|
|
+}
|
|
--- a/drivers/net/ethernet/microchip/sparx5/sparx5_qos.h
|
|
+++ b/drivers/net/ethernet/microchip/sparx5/sparx5_qos.h
|
|
@@ -60,6 +60,7 @@ struct sparx5_dwrr {
|
|
};
|
|
|
|
int sparx5_qos_init(struct sparx5 *sparx5);
|
|
+void sparx5_tas_speed(struct sparx5_port *port, int speed);
|
|
|
|
/* Multi-Queue Priority */
|
|
int sparx5_tc_mqprio_add(struct net_device *ndev, u8 num_tc);
|
|
--- a/drivers/net/ethernet/microchip/sparx5/sparx5_regs.c
|
|
+++ b/drivers/net/ethernet/microchip/sparx5/sparx5_regs.c
|
|
@@ -95,6 +95,7 @@ const unsigned int sparx5_gaddr[GADDR_LA
|
|
[GA_HSCH_SYSTEM] = 184000,
|
|
[GA_HSCH_MMGT] = 162368,
|
|
[GA_HSCH_TAS_CONFIG] = 162384,
|
|
+ [GA_HSCH_TAS_PROFILE_CFG] = 188416,
|
|
[GA_PTP_PTP_CFG] = 320,
|
|
[GA_PTP_PTP_TOD_DOMAINS] = 336,
|
|
[GA_PTP_PHASE_DETECTOR_CTRL] = 420,
|
|
@@ -129,6 +130,7 @@ const unsigned int sparx5_gcnt[GCNT_LAST
|
|
[GC_GCB_SIO_CTRL] = 3,
|
|
[GC_HSCH_HSCH_CFG] = 5040,
|
|
[GC_HSCH_HSCH_DWRR] = 72,
|
|
+ [GC_HSCH_TAS_PROFILE_CFG] = 100,
|
|
[GC_PTP_PTP_PINS] = 5,
|
|
[GC_PTP_PHASE_DETECTOR_CTRL] = 5,
|
|
[GC_REW_PORT] = 70,
|
|
@@ -144,6 +146,7 @@ const unsigned int sparx5_gsize[GSIZE_LA
|
|
[GW_FDMA_FDMA] = 428,
|
|
[GW_GCB_CHIP_REGS] = 424,
|
|
[GW_HSCH_TAS_CONFIG] = 12,
|
|
+ [GW_HSCH_TAS_PROFILE_CFG] = 64,
|
|
[GW_PTP_PHASE_DETECTOR_CTRL] = 8,
|
|
[GW_QSYS_PAUSE_CFG] = 1128,
|
|
};
|
|
--- a/drivers/net/ethernet/microchip/sparx5/sparx5_regs.h
|
|
+++ b/drivers/net/ethernet/microchip/sparx5/sparx5_regs.h
|
|
@@ -104,6 +104,7 @@ enum sparx5_gaddr_enum {
|
|
GA_HSCH_SYSTEM,
|
|
GA_HSCH_MMGT,
|
|
GA_HSCH_TAS_CONFIG,
|
|
+ GA_HSCH_TAS_PROFILE_CFG,
|
|
GA_PTP_PTP_CFG,
|
|
GA_PTP_PTP_TOD_DOMAINS,
|
|
GA_PTP_PHASE_DETECTOR_CTRL,
|
|
@@ -139,6 +140,7 @@ enum sparx5_gcnt_enum {
|
|
GC_GCB_SIO_CTRL,
|
|
GC_HSCH_HSCH_CFG,
|
|
GC_HSCH_HSCH_DWRR,
|
|
+ GC_HSCH_TAS_PROFILE_CFG,
|
|
GC_PTP_PTP_PINS,
|
|
GC_PTP_PHASE_DETECTOR_CTRL,
|
|
GC_REW_PORT,
|
|
@@ -155,6 +157,7 @@ enum sparx5_gsize_enum {
|
|
GW_FDMA_FDMA,
|
|
GW_GCB_CHIP_REGS,
|
|
GW_HSCH_TAS_CONFIG,
|
|
+ GW_HSCH_TAS_PROFILE_CFG,
|
|
GW_PTP_PHASE_DETECTOR_CTRL,
|
|
GW_QSYS_PAUSE_CFG,
|
|
GSIZE_LAST,
|