mirror of
https://git.openwrt.org/openwrt/openwrt.git
synced 2026-05-02 00:21:01 +02:00
airoha: backport QDMA rx queue descriptor setup optimization
Backport patch merged upstream that optimize the QDMA rx queue descriptor setup by configuring the CPU IDX only when needed. (cherry picked from commit 70ad03e0ac2d7c6d8597e13d74bbc057bb6fc17c) Link: https://github.com/openwrt/openwrt/pull/23046 Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
This commit is contained in:
parent
919361fdb8
commit
d2722eadf2
@ -0,0 +1,35 @@
|
||||
From a94ddc191f19579a7e0a5da2c012f1048ce10262 Mon Sep 17 00:00:00 2001
|
||||
From: Lorenzo Bianconi <lorenzo@kernel.org>
|
||||
Date: Mon, 30 Mar 2026 00:03:49 +0200
|
||||
Subject: [PATCH] net: airoha: Fix typo in airoha_set_gdm2_loopback routine
|
||||
name
|
||||
|
||||
Rename airhoha_set_gdm2_loopback() in airoha_set_gdm2_loopback()
|
||||
|
||||
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
|
||||
Link: https://patch.msgid.link/20260330-airoha_set_gdm2_loopback-fix-typo-v1-1-a1320ff6b6cc@kernel.org
|
||||
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
|
||||
---
|
||||
drivers/net/ethernet/airoha/airoha_eth.c | 4 ++--
|
||||
1 file changed, 2 insertions(+), 2 deletions(-)
|
||||
|
||||
--- a/drivers/net/ethernet/airoha/airoha_eth.c
|
||||
+++ b/drivers/net/ethernet/airoha/airoha_eth.c
|
||||
@@ -1722,7 +1722,7 @@ static int airoha_dev_set_macaddr(struct
|
||||
return 0;
|
||||
}
|
||||
|
||||
-static int airhoha_set_gdm2_loopback(struct airoha_gdm_port *port)
|
||||
+static int airoha_set_gdm2_loopback(struct airoha_gdm_port *port)
|
||||
{
|
||||
struct airoha_eth *eth = port->qdma->eth;
|
||||
u32 val, pse_port, chan;
|
||||
@@ -1796,7 +1796,7 @@ static int airoha_dev_init(struct net_de
|
||||
if (!eth->ports[1]) {
|
||||
int err;
|
||||
|
||||
- err = airhoha_set_gdm2_loopback(port);
|
||||
+ err = airoha_set_gdm2_loopback(port);
|
||||
if (err)
|
||||
return err;
|
||||
}
|
||||
@ -0,0 +1,34 @@
|
||||
From 269389ba539834ec80e4d55583fca2cd70e4dc9c Mon Sep 17 00:00:00 2001
|
||||
From: Lorenzo Bianconi <lorenzo@kernel.org>
|
||||
Date: Tue, 31 Mar 2026 12:33:24 +0200
|
||||
Subject: [PATCH] net: airoha: Set REG_RX_CPU_IDX() once in
|
||||
airoha_qdma_fill_rx_queue()
|
||||
|
||||
It is not necessary to update REG_RX_CPU_IDX register for each iteration
|
||||
of the descriptor loop in airoha_qdma_fill_rx_queue routine.
|
||||
Move REG_RX_CPU_IDX configuration out of the descriptor loop and rely on
|
||||
the last queue head value updated in the descriptor loop.
|
||||
|
||||
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
|
||||
Link: https://patch.msgid.link/20260331-airoha-cpu-idx-out-off-loop-v1-1-75c66b428f50@kernel.org
|
||||
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
|
||||
---
|
||||
drivers/net/ethernet/airoha/airoha_eth.c | 3 ++-
|
||||
1 file changed, 2 insertions(+), 1 deletion(-)
|
||||
|
||||
--- a/drivers/net/ethernet/airoha/airoha_eth.c
|
||||
+++ b/drivers/net/ethernet/airoha/airoha_eth.c
|
||||
@@ -561,11 +561,12 @@ static int airoha_qdma_fill_rx_queue(str
|
||||
WRITE_ONCE(desc->msg1, 0);
|
||||
WRITE_ONCE(desc->msg2, 0);
|
||||
WRITE_ONCE(desc->msg3, 0);
|
||||
+ }
|
||||
|
||||
+ if (nframes)
|
||||
airoha_qdma_rmw(qdma, REG_RX_CPU_IDX(qid),
|
||||
RX_RING_CPU_IDX_MASK,
|
||||
FIELD_PREP(RX_RING_CPU_IDX_MASK, q->head));
|
||||
- }
|
||||
|
||||
return nframes;
|
||||
}
|
||||
@ -13,7 +13,7 @@ Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
|
||||
|
||||
--- a/drivers/net/ethernet/airoha/airoha_eth.c
|
||||
+++ b/drivers/net/ethernet/airoha/airoha_eth.c
|
||||
@@ -1422,6 +1422,10 @@ static int airoha_hw_init(struct platfor
|
||||
@@ -1423,6 +1423,10 @@ static int airoha_hw_init(struct platfor
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
|
||||
@ -16,7 +16,7 @@ Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
|
||||
|
||||
--- a/drivers/net/ethernet/airoha/airoha_eth.c
|
||||
+++ b/drivers/net/ethernet/airoha/airoha_eth.c
|
||||
@@ -577,8 +577,11 @@ static int airoha_qdma_get_gdm_port(stru
|
||||
@@ -578,8 +578,11 @@ static int airoha_qdma_get_gdm_port(stru
|
||||
|
||||
sport = FIELD_GET(QDMA_ETH_RXMSG_SPORT_MASK, msg1);
|
||||
switch (sport) {
|
||||
|
||||
@ -28,7 +28,7 @@ Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
|
||||
|
||||
airoha_fe_crsn_qsel_init(eth);
|
||||
|
||||
@@ -1654,7 +1656,8 @@ static int airoha_dev_open(struct net_de
|
||||
@@ -1655,7 +1657,8 @@ static int airoha_dev_open(struct net_de
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
|
||||
@ -15,7 +15,7 @@ Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
|
||||
|
||||
--- a/drivers/net/ethernet/airoha/airoha_eth.c
|
||||
+++ b/drivers/net/ethernet/airoha/airoha_eth.c
|
||||
@@ -3125,7 +3125,6 @@ static void airoha_remove(struct platfor
|
||||
@@ -3126,7 +3126,6 @@ static void airoha_remove(struct platfor
|
||||
}
|
||||
|
||||
static const char * const en7581_xsi_rsts_names[] = {
|
||||
@ -23,7 +23,7 @@ Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
|
||||
"hsi0-mac",
|
||||
"hsi1-mac",
|
||||
"hsi-mac",
|
||||
@@ -3179,7 +3178,6 @@ static u32 airoha_en7581_get_vip_port(st
|
||||
@@ -3180,7 +3179,6 @@ static u32 airoha_en7581_get_vip_port(st
|
||||
}
|
||||
|
||||
static const char * const an7583_xsi_rsts_names[] = {
|
||||
|
||||
@ -35,7 +35,7 @@ Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
|
||||
static void airoha_set_macaddr(struct airoha_gdm_port *port, const u8 *addr)
|
||||
{
|
||||
struct airoha_eth *eth = port->qdma->eth;
|
||||
@@ -1651,6 +1657,17 @@ static int airoha_dev_open(struct net_de
|
||||
@@ -1652,6 +1658,17 @@ static int airoha_dev_open(struct net_de
|
||||
struct airoha_qdma *qdma = port->qdma;
|
||||
u32 pse_port = FE_PSE_PORT_PPE1;
|
||||
|
||||
@ -53,7 +53,7 @@ Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
|
||||
netif_tx_start_all_queues(dev);
|
||||
err = airoha_set_vip_for_gdm_port(port, true);
|
||||
if (err)
|
||||
@@ -1715,6 +1732,11 @@ static int airoha_dev_stop(struct net_de
|
||||
@@ -1716,6 +1733,11 @@ static int airoha_dev_stop(struct net_de
|
||||
}
|
||||
}
|
||||
|
||||
@ -65,7 +65,7 @@ Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -2845,6 +2867,20 @@ static const struct ethtool_ops airoha_e
|
||||
@@ -2846,6 +2868,20 @@ static const struct ethtool_ops airoha_e
|
||||
.get_link = ethtool_op_get_link,
|
||||
};
|
||||
|
||||
@ -86,7 +86,7 @@ Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
|
||||
static int airoha_metadata_dst_alloc(struct airoha_gdm_port *port)
|
||||
{
|
||||
int i;
|
||||
@@ -2889,6 +2925,99 @@ bool airoha_is_valid_gdm_port(struct air
|
||||
@@ -2890,6 +2926,99 @@ bool airoha_is_valid_gdm_port(struct air
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -186,7 +186,7 @@ Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
|
||||
static int airoha_alloc_gdm_port(struct airoha_eth *eth,
|
||||
struct device_node *np)
|
||||
{
|
||||
@@ -2962,6 +3091,12 @@ static int airoha_alloc_gdm_port(struct
|
||||
@@ -2963,6 +3092,12 @@ static int airoha_alloc_gdm_port(struct
|
||||
port->nbq = id == AIROHA_GDM3_IDX && airoha_is_7581(eth) ? 4 : 0;
|
||||
eth->ports[p] = port;
|
||||
|
||||
@ -199,7 +199,7 @@ Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
|
||||
return airoha_metadata_dst_alloc(port);
|
||||
}
|
||||
|
||||
@@ -3091,6 +3226,10 @@ error_napi_stop:
|
||||
@@ -3092,6 +3227,10 @@ error_napi_stop:
|
||||
|
||||
if (port->dev->reg_state == NETREG_REGISTERED)
|
||||
unregister_netdev(port->dev);
|
||||
@ -210,7 +210,7 @@ Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
|
||||
airoha_metadata_dst_free(port);
|
||||
}
|
||||
airoha_hw_cleanup(eth);
|
||||
@@ -3117,6 +3256,10 @@ static void airoha_remove(struct platfor
|
||||
@@ -3118,6 +3257,10 @@ static void airoha_remove(struct platfor
|
||||
|
||||
unregister_netdev(port->dev);
|
||||
airoha_metadata_dst_free(port);
|
||||
|
||||
@ -14,7 +14,7 @@ Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
|
||||
|
||||
--- a/drivers/net/ethernet/airoha/airoha_eth.c
|
||||
+++ b/drivers/net/ethernet/airoha/airoha_eth.c
|
||||
@@ -588,6 +588,9 @@ static int airoha_qdma_get_gdm_port(stru
|
||||
@@ -589,6 +589,9 @@ static int airoha_qdma_get_gdm_port(stru
|
||||
case 0x18:
|
||||
port = 3; /* GDM4 */
|
||||
break;
|
||||
|
||||
@ -28,7 +28,7 @@ Signed-off-by: Mikhail Kshevetskiy <mikhail.kshevetskiy@iopsys.eu>
|
||||
|
||||
static void airoha_set_macaddr(struct airoha_gdm_port *port, const u8 *addr)
|
||||
{
|
||||
@@ -1660,6 +1662,7 @@ static int airoha_dev_open(struct net_de
|
||||
@@ -1661,6 +1663,7 @@ static int airoha_dev_open(struct net_de
|
||||
struct airoha_qdma *qdma = port->qdma;
|
||||
u32 pse_port = FE_PSE_PORT_PPE1;
|
||||
|
||||
@ -36,7 +36,7 @@ Signed-off-by: Mikhail Kshevetskiy <mikhail.kshevetskiy@iopsys.eu>
|
||||
if (airhoa_is_phy_external(port)) {
|
||||
err = phylink_of_phy_connect(port->phylink, dev->dev.of_node, 0);
|
||||
if (err) {
|
||||
@@ -1670,6 +1673,7 @@ static int airoha_dev_open(struct net_de
|
||||
@@ -1671,6 +1674,7 @@ static int airoha_dev_open(struct net_de
|
||||
|
||||
phylink_start(port->phylink);
|
||||
}
|
||||
@ -44,7 +44,7 @@ Signed-off-by: Mikhail Kshevetskiy <mikhail.kshevetskiy@iopsys.eu>
|
||||
|
||||
netif_tx_start_all_queues(dev);
|
||||
err = airoha_set_vip_for_gdm_port(port, true);
|
||||
@@ -1735,10 +1739,12 @@ static int airoha_dev_stop(struct net_de
|
||||
@@ -1736,10 +1740,12 @@ static int airoha_dev_stop(struct net_de
|
||||
}
|
||||
}
|
||||
|
||||
@ -57,7 +57,7 @@ Signed-off-by: Mikhail Kshevetskiy <mikhail.kshevetskiy@iopsys.eu>
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -2870,6 +2876,7 @@ static const struct ethtool_ops airoha_e
|
||||
@@ -2871,6 +2877,7 @@ static const struct ethtool_ops airoha_e
|
||||
.get_link = ethtool_op_get_link,
|
||||
};
|
||||
|
||||
@ -65,7 +65,7 @@ Signed-off-by: Mikhail Kshevetskiy <mikhail.kshevetskiy@iopsys.eu>
|
||||
static struct phylink_pcs *airoha_phylink_mac_select_pcs(struct phylink_config *config,
|
||||
phy_interface_t interface)
|
||||
{
|
||||
@@ -2883,6 +2890,7 @@ static void airoha_mac_config(struct phy
|
||||
@@ -2884,6 +2891,7 @@ static void airoha_mac_config(struct phy
|
||||
const struct phylink_link_state *state)
|
||||
{
|
||||
}
|
||||
@ -73,7 +73,7 @@ Signed-off-by: Mikhail Kshevetskiy <mikhail.kshevetskiy@iopsys.eu>
|
||||
|
||||
static int airoha_metadata_dst_alloc(struct airoha_gdm_port *port)
|
||||
{
|
||||
@@ -2928,6 +2936,7 @@ bool airoha_is_valid_gdm_port(struct air
|
||||
@@ -2929,6 +2937,7 @@ bool airoha_is_valid_gdm_port(struct air
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -81,7 +81,7 @@ Signed-off-by: Mikhail Kshevetskiy <mikhail.kshevetskiy@iopsys.eu>
|
||||
static void airoha_mac_link_up(struct phylink_config *config, struct phy_device *phy,
|
||||
unsigned int mode, phy_interface_t interface,
|
||||
int speed, int duplex, bool tx_pause, bool rx_pause)
|
||||
@@ -3020,6 +3029,7 @@ static int airoha_setup_phylink(struct n
|
||||
@@ -3021,6 +3030,7 @@ static int airoha_setup_phylink(struct n
|
||||
|
||||
return 0;
|
||||
}
|
||||
@ -89,7 +89,7 @@ Signed-off-by: Mikhail Kshevetskiy <mikhail.kshevetskiy@iopsys.eu>
|
||||
|
||||
static int airoha_alloc_gdm_port(struct airoha_eth *eth,
|
||||
struct device_node *np)
|
||||
@@ -3094,11 +3104,13 @@ static int airoha_alloc_gdm_port(struct
|
||||
@@ -3095,11 +3105,13 @@ static int airoha_alloc_gdm_port(struct
|
||||
port->nbq = id == AIROHA_GDM3_IDX && airoha_is_7581(eth) ? 4 : 0;
|
||||
eth->ports[p] = port;
|
||||
|
||||
@ -103,7 +103,7 @@ Signed-off-by: Mikhail Kshevetskiy <mikhail.kshevetskiy@iopsys.eu>
|
||||
|
||||
return airoha_metadata_dst_alloc(port);
|
||||
}
|
||||
@@ -3229,10 +3241,12 @@ error_napi_stop:
|
||||
@@ -3230,10 +3242,12 @@ error_napi_stop:
|
||||
|
||||
if (port->dev->reg_state == NETREG_REGISTERED)
|
||||
unregister_netdev(port->dev);
|
||||
@ -116,7 +116,7 @@ Signed-off-by: Mikhail Kshevetskiy <mikhail.kshevetskiy@iopsys.eu>
|
||||
airoha_metadata_dst_free(port);
|
||||
}
|
||||
airoha_hw_cleanup(eth);
|
||||
@@ -3259,10 +3273,12 @@ static void airoha_remove(struct platfor
|
||||
@@ -3260,10 +3274,12 @@ static void airoha_remove(struct platfor
|
||||
|
||||
unregister_netdev(port->dev);
|
||||
airoha_metadata_dst_free(port);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user