EN7581 or AN7583 SoCs support connecting multiple external SerDes (e.g.
Ethernet or USB SerDes) to GDM3 or GDM4 ports via a hw arbiter that
manages the traffic in a TDM manner. As a result multiple net_devices can
connect to the same GDM{3,4} port and there is a theoretical "1:n"
relation between GDM ports and net_devices.
┌─────────────────────────────────┐
│ │ ┌──────┐
│ P1 GDM1 ├────►MT7530│
│ │ └──────┘
│ │ ETH0 (DSA conduit)
│ │
│ PSE/FE │
│ │
│ │
│ │ ┌─────┐
│ P0 CDM1 ├────►QDMA0│
│ P4 P9 GDM4 │ └─────┘
└──┬─────────────────────────┬────┘
│ │
┌──▼──┐ ┌────▼────┐
│ PPE │ │ ARB │
└─────┘ └─┬─────┬─┘
│ │
┌──▼──┐┌─▼───┐
│ ETH ││ USB │
└─────┘└─────┘
ETH1 ETH2
This series introduces support for multiple net_devices connected to the
same Frame Engine (FE) GDM port (GDM3 or GDM4) via an external hw
arbiter. Please note GDM1 or GDM2 does not support the connection with
the external arbiter.
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Link: https://github.com/openwrt/openwrt/pull/23481
Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
74 lines
2.6 KiB
Diff
74 lines
2.6 KiB
Diff
From 00272dbf6a52241a21145631f22dc5f03891078b Mon Sep 17 00:00:00 2001
|
|
Message-ID: <00272dbf6a52241a21145631f22dc5f03891078b.1779348625.git.lorenzo@kernel.org>
|
|
In-Reply-To: <e15783f7c987e199ecf80b3d858ed5a86d33c508.1779348625.git.lorenzo@kernel.org>
|
|
References: <e15783f7c987e199ecf80b3d858ed5a86d33c508.1779348625.git.lorenzo@kernel.org>
|
|
From: Lorenzo Bianconi <lorenzo@kernel.org>
|
|
Date: Fri, 10 Apr 2026 14:47:08 +0200
|
|
Subject: [PATCH 05/13] net: airoha: Move {cpu,fwd}_tx_packets in
|
|
airoha_gdm_dev struct
|
|
|
|
Since now multiple net_devices connected to different QDMA blocks can
|
|
share the same GDM port, cpu_tx_packets and fwd_tx_packets fields can
|
|
be overwritten with the value from a different QDMA block. In order to
|
|
fix the issue move cpu_tx_packets and fwd_tx_packets fields from
|
|
airoha_gdm_port struct to airoha_gdm_dev one.
|
|
|
|
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
|
|
---
|
|
drivers/net/ethernet/airoha/airoha_eth.c | 16 +++++++---------
|
|
drivers/net/ethernet/airoha/airoha_eth.h | 7 +++----
|
|
2 files changed, 10 insertions(+), 13 deletions(-)
|
|
|
|
--- a/drivers/net/ethernet/airoha/airoha_eth.c
|
|
+++ b/drivers/net/ethernet/airoha/airoha_eth.c
|
|
@@ -2535,19 +2535,17 @@ static int airoha_qdma_get_tx_ets_stats(
|
|
struct tc_ets_qopt_offload *opt)
|
|
{
|
|
struct airoha_gdm_dev *dev = netdev_priv(netdev);
|
|
- struct airoha_gdm_port *port = dev->port;
|
|
+ struct airoha_qdma *qdma = dev->qdma;
|
|
|
|
- u64 cpu_tx_packets = airoha_qdma_rr(dev->qdma,
|
|
- REG_CNTR_VAL(channel << 1));
|
|
- u64 fwd_tx_packets = airoha_qdma_rr(dev->qdma,
|
|
+ u64 cpu_tx_packets = airoha_qdma_rr(qdma, REG_CNTR_VAL(channel << 1));
|
|
+ u64 fwd_tx_packets = airoha_qdma_rr(qdma,
|
|
REG_CNTR_VAL((channel << 1) + 1));
|
|
- u64 tx_packets = (cpu_tx_packets - port->cpu_tx_packets) +
|
|
- (fwd_tx_packets - port->fwd_tx_packets);
|
|
+ u64 tx_packets = (cpu_tx_packets - dev->cpu_tx_packets) +
|
|
+ (fwd_tx_packets - dev->fwd_tx_packets);
|
|
|
|
_bstats_update(opt->stats.bstats, 0, tx_packets);
|
|
-
|
|
- port->cpu_tx_packets = cpu_tx_packets;
|
|
- port->fwd_tx_packets = fwd_tx_packets;
|
|
+ dev->cpu_tx_packets = cpu_tx_packets;
|
|
+ dev->fwd_tx_packets = fwd_tx_packets;
|
|
|
|
return 0;
|
|
}
|
|
--- a/drivers/net/ethernet/airoha/airoha_eth.h
|
|
+++ b/drivers/net/ethernet/airoha/airoha_eth.h
|
|
@@ -560,6 +560,9 @@ struct airoha_gdm_dev {
|
|
#endif
|
|
|
|
DECLARE_BITMAP(qos_sq_bmap, AIROHA_NUM_QOS_CHANNELS);
|
|
+ /* qos stats counters */
|
|
+ u64 cpu_tx_packets;
|
|
+ u64 fwd_tx_packets;
|
|
};
|
|
|
|
struct airoha_gdm_port {
|
|
@@ -569,10 +572,6 @@ struct airoha_gdm_port {
|
|
|
|
struct airoha_hw_stats stats;
|
|
|
|
- /* qos stats counters */
|
|
- u64 cpu_tx_packets;
|
|
- u64 fwd_tx_packets;
|
|
-
|
|
struct metadata_dst *dsa_meta[AIROHA_MAX_DSA_PORTS];
|
|
};
|
|
|