airoha: backport minor fixes for ethernet driver
Backport some upstream patch for Airoha ethernet driver in preparation for Flow Offload support. Tested-by: Aleksander Jan Bajkowski <olek2@wp.pl> # tested on Quantum W1700k Tested-by: Andrew LaMarche <andrewjlamarche@gmail.com> Link: https://github.com/openwrt/openwrt/pull/18166 Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
This commit is contained in:
parent
34ba7e8a8a
commit
afea8bda0d
3 changed files with 158 additions and 0 deletions
|
@ -0,0 +1,46 @@
|
||||||
|
From d31a49d37cb132b31cc6683eef2122f8609d6229 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Christian Marangi <ansuelsmth@gmail.com>
|
||||||
|
Date: Mon, 20 Jan 2025 16:41:40 +0100
|
||||||
|
Subject: [PATCH] net: airoha: Fix wrong GDM4 register definition
|
||||||
|
|
||||||
|
Fix wrong GDM4 register definition, in Airoha SDK GDM4 is defined at
|
||||||
|
offset 0x2400 but this doesn't make sense as it does conflict with the
|
||||||
|
CDM4 that is in the same location.
|
||||||
|
|
||||||
|
Following the pattern where each GDM base is at the FWD_CFG, currently
|
||||||
|
GDM4 base offset is set to 0x2500. This is correct but REG_GDM4_FWD_CFG
|
||||||
|
and REG_GDM4_SRC_PORT_SET are still using the SDK reference with the
|
||||||
|
0x2400 offset. Fix these 2 define by subtracting 0x100 to each register
|
||||||
|
to reflect the real address location.
|
||||||
|
|
||||||
|
Fixes: 23020f049327 ("net: airoha: Introduce ethernet support for EN7581 SoC")
|
||||||
|
Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
|
||||||
|
Acked-by: Lorenzo Bianconi <lorenzo@kernel.org>
|
||||||
|
Reviewed-by: Jacob Keller <jacob.e.keller@intel.com>
|
||||||
|
Link: https://patch.msgid.link/20250120154148.13424-1-ansuelsmth@gmail.com
|
||||||
|
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
|
||||||
|
---
|
||||||
|
drivers/net/ethernet/mediatek/airoha_eth.c | 4 ++--
|
||||||
|
1 file changed, 2 insertions(+), 2 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/drivers/net/ethernet/mediatek/airoha_eth.c b/drivers/net/ethernet/mediatek/airoha_eth.c
|
||||||
|
index 415d784de741..09f448f29124 100644
|
||||||
|
--- a/drivers/net/ethernet/mediatek/airoha_eth.c
|
||||||
|
+++ b/drivers/net/ethernet/mediatek/airoha_eth.c
|
||||||
|
@@ -266,11 +266,11 @@
|
||||||
|
#define REG_GDM3_FWD_CFG GDM3_BASE
|
||||||
|
#define GDM3_PAD_EN_MASK BIT(28)
|
||||||
|
|
||||||
|
-#define REG_GDM4_FWD_CFG (GDM4_BASE + 0x100)
|
||||||
|
+#define REG_GDM4_FWD_CFG GDM4_BASE
|
||||||
|
#define GDM4_PAD_EN_MASK BIT(28)
|
||||||
|
#define GDM4_SPORT_OFFSET0_MASK GENMASK(11, 8)
|
||||||
|
|
||||||
|
-#define REG_GDM4_SRC_PORT_SET (GDM4_BASE + 0x33c)
|
||||||
|
+#define REG_GDM4_SRC_PORT_SET (GDM4_BASE + 0x23c)
|
||||||
|
#define GDM4_SPORT_OFF2_MASK GENMASK(19, 16)
|
||||||
|
#define GDM4_SPORT_OFF1_MASK GENMASK(15, 12)
|
||||||
|
#define GDM4_SPORT_OFF0_MASK GENMASK(11, 8)
|
||||||
|
--
|
||||||
|
2.48.1
|
||||||
|
|
|
@ -0,0 +1,65 @@
|
||||||
|
From c6287e1a858e336cc202b484c6138a0fe252c6b3 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Lorenzo Bianconi <lorenzo@kernel.org>
|
||||||
|
Date: Thu, 13 Feb 2025 16:34:20 +0100
|
||||||
|
Subject: [PATCH] net: airoha: Fix TSO support for header cloned skbs
|
||||||
|
|
||||||
|
For GSO packets, skb_cow_head() will reallocate the skb for TSO header
|
||||||
|
cloned skbs in airoha_dev_xmit(). For this reason, sinfo pointer can be
|
||||||
|
no more valid. Fix the issue relying on skb_shinfo() macro directly in
|
||||||
|
airoha_dev_xmit().
|
||||||
|
|
||||||
|
The problem exists since
|
||||||
|
commit 23020f049327 ("net: airoha: Introduce ethernet support for EN7581 SoC")
|
||||||
|
but it is not a user visible, since we can't currently enable TSO
|
||||||
|
for DSA user ports since we are missing to initialize net_device
|
||||||
|
vlan_features field.
|
||||||
|
|
||||||
|
Reviewed-by: Mateusz Polchlopek <mateusz.polchlopek@intel.com>
|
||||||
|
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
|
||||||
|
Link: https://patch.msgid.link/20250213-airoha-en7581-flowtable-offload-v4-1-b69ca16d74db@kernel.org
|
||||||
|
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
|
||||||
|
---
|
||||||
|
drivers/net/ethernet/mediatek/airoha_eth.c | 10 +++++-----
|
||||||
|
1 file changed, 5 insertions(+), 5 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/drivers/net/ethernet/mediatek/airoha_eth.c b/drivers/net/ethernet/mediatek/airoha_eth.c
|
||||||
|
index 09f448f29124..aa5f220ddbcf 100644
|
||||||
|
--- a/drivers/net/ethernet/mediatek/airoha_eth.c
|
||||||
|
+++ b/drivers/net/ethernet/mediatek/airoha_eth.c
|
||||||
|
@@ -2556,11 +2556,10 @@ static u16 airoha_dev_select_queue(struct net_device *dev, struct sk_buff *skb,
|
||||||
|
static netdev_tx_t airoha_dev_xmit(struct sk_buff *skb,
|
||||||
|
struct net_device *dev)
|
||||||
|
{
|
||||||
|
- struct skb_shared_info *sinfo = skb_shinfo(skb);
|
||||||
|
struct airoha_gdm_port *port = netdev_priv(dev);
|
||||||
|
+ u32 nr_frags = 1 + skb_shinfo(skb)->nr_frags;
|
||||||
|
u32 msg0, msg1, len = skb_headlen(skb);
|
||||||
|
struct airoha_qdma *qdma = port->qdma;
|
||||||
|
- u32 nr_frags = 1 + sinfo->nr_frags;
|
||||||
|
struct netdev_queue *txq;
|
||||||
|
struct airoha_queue *q;
|
||||||
|
void *data = skb->data;
|
||||||
|
@@ -2583,8 +2582,9 @@ static netdev_tx_t airoha_dev_xmit(struct sk_buff *skb,
|
||||||
|
if (skb_cow_head(skb, 0))
|
||||||
|
goto error;
|
||||||
|
|
||||||
|
- if (sinfo->gso_type & (SKB_GSO_TCPV4 | SKB_GSO_TCPV6)) {
|
||||||
|
- __be16 csum = cpu_to_be16(sinfo->gso_size);
|
||||||
|
+ if (skb_shinfo(skb)->gso_type & (SKB_GSO_TCPV4 |
|
||||||
|
+ SKB_GSO_TCPV6)) {
|
||||||
|
+ __be16 csum = cpu_to_be16(skb_shinfo(skb)->gso_size);
|
||||||
|
|
||||||
|
tcp_hdr(skb)->check = (__force __sum16)csum;
|
||||||
|
msg0 |= FIELD_PREP(QDMA_ETH_TXMSG_TSO_MASK, 1);
|
||||||
|
@@ -2613,7 +2613,7 @@ static netdev_tx_t airoha_dev_xmit(struct sk_buff *skb,
|
||||||
|
for (i = 0; i < nr_frags; i++) {
|
||||||
|
struct airoha_qdma_desc *desc = &q->desc[index];
|
||||||
|
struct airoha_queue_entry *e = &q->entry[index];
|
||||||
|
- skb_frag_t *frag = &sinfo->frags[i];
|
||||||
|
+ skb_frag_t *frag = &skb_shinfo(skb)->frags[i];
|
||||||
|
dma_addr_t addr;
|
||||||
|
u32 val;
|
||||||
|
|
||||||
|
--
|
||||||
|
2.48.1
|
||||||
|
|
|
@ -0,0 +1,47 @@
|
||||||
|
From c9f947769b77c8e8f318bfc8a0777e5d20c44d8d Mon Sep 17 00:00:00 2001
|
||||||
|
From: Lorenzo Bianconi <lorenzo@kernel.org>
|
||||||
|
Date: Thu, 17 Oct 2024 16:01:41 +0200
|
||||||
|
Subject: [PATCH] net: airoha: Reset BQL stopping the netdevice
|
||||||
|
|
||||||
|
Run airoha_qdma_cleanup_tx_queue() in ndo_stop callback in order to
|
||||||
|
unmap pending skbs. Moreover, reset BQL txq state stopping the netdevice,
|
||||||
|
|
||||||
|
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
|
||||||
|
Reviewed-by: Hariprasad Kelam <hkelam@marvell.com>
|
||||||
|
Message-ID: <20241017-airoha-en7581-reset-bql-v1-1-08c0c9888de5@kernel.org>
|
||||||
|
Signed-off-by: Andrew Lunn <andrew@lunn.ch>
|
||||||
|
---
|
||||||
|
drivers/net/ethernet/mediatek/airoha_eth.c | 10 +++++++++-
|
||||||
|
1 file changed, 9 insertions(+), 1 deletion(-)
|
||||||
|
|
||||||
|
diff --git a/drivers/net/ethernet/mediatek/airoha_eth.c b/drivers/net/ethernet/mediatek/airoha_eth.c
|
||||||
|
index 21d6eed8aece..f463a505f5ba 100644
|
||||||
|
--- a/drivers/net/ethernet/mediatek/airoha_eth.c
|
||||||
|
+++ b/drivers/net/ethernet/mediatek/airoha_eth.c
|
||||||
|
@@ -2342,7 +2342,7 @@ static int airoha_dev_stop(struct net_device *dev)
|
||||||
|
{
|
||||||
|
struct airoha_gdm_port *port = netdev_priv(dev);
|
||||||
|
struct airoha_qdma *qdma = port->qdma;
|
||||||
|
- int err;
|
||||||
|
+ int i, err;
|
||||||
|
|
||||||
|
netif_tx_disable(dev);
|
||||||
|
err = airoha_set_gdm_ports(qdma->eth, false);
|
||||||
|
@@ -2353,6 +2353,14 @@ static int airoha_dev_stop(struct net_device *dev)
|
||||||
|
GLOBAL_CFG_TX_DMA_EN_MASK |
|
||||||
|
GLOBAL_CFG_RX_DMA_EN_MASK);
|
||||||
|
|
||||||
|
+ for (i = 0; i < ARRAY_SIZE(qdma->q_tx); i++) {
|
||||||
|
+ if (!qdma->q_tx[i].ndesc)
|
||||||
|
+ continue;
|
||||||
|
+
|
||||||
|
+ airoha_qdma_cleanup_tx_queue(&qdma->q_tx[i]);
|
||||||
|
+ netdev_tx_reset_subqueue(dev, i);
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
--
|
||||||
|
2.48.1
|
||||||
|
|
Loading…
Reference in a new issue