mirror of
https://github.com/openwrt/openwrt.git
synced 2026-06-17 12:40:16 +04:00
airoha: backport GDM2 loopback fixup for Ethernet driver
Backport GDM2 loopback fixup for Ethernet driver. This should be the last patch before introduction of Multi-Serdes support series. Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
This commit is contained in:
+45
@@ -0,0 +1,45 @@
|
|||||||
|
From 985d4a55e64e43bd86eeb896b81ceba453301989 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Lorenzo Bianconi <lorenzo@kernel.org>
|
||||||
|
Date: Wed, 20 May 2026 15:12:02 +0200
|
||||||
|
Subject: [PATCH] net: airoha: Disable GDM2 forwarding before configuring GDM2
|
||||||
|
loopback
|
||||||
|
|
||||||
|
Hw design requires to disable GDM2 forwarding before configuring GDM2
|
||||||
|
loopback in airoha_set_gdm2_loopback routine.
|
||||||
|
|
||||||
|
Fixes: 9cd451d414f6e ("net: airoha: Add loopback support for GDM2")
|
||||||
|
Tested-by: Madhur Agrawal <madhur.agrawal@airoha.com>
|
||||||
|
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
|
||||||
|
Link: https://patch.msgid.link/20260520-airoha-disable-gdm2-fwd-v1-1-1eeea5dffc2f@kernel.org
|
||||||
|
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
|
||||||
|
---
|
||||||
|
drivers/net/ethernet/airoha/airoha_eth.c | 10 ++++++----
|
||||||
|
1 file changed, 6 insertions(+), 4 deletions(-)
|
||||||
|
|
||||||
|
--- a/drivers/net/ethernet/airoha/airoha_eth.c
|
||||||
|
+++ b/drivers/net/ethernet/airoha/airoha_eth.c
|
||||||
|
@@ -1790,11 +1790,8 @@ static int airoha_set_gdm2_loopback(stru
|
||||||
|
u32 val, pse_port, chan;
|
||||||
|
int i, src_port;
|
||||||
|
|
||||||
|
- /* Forward the traffic to the proper GDM port */
|
||||||
|
- pse_port = port->id == AIROHA_GDM3_IDX ? FE_PSE_PORT_GDM3
|
||||||
|
- : FE_PSE_PORT_GDM4;
|
||||||
|
airoha_set_gdm_port_fwd_cfg(eth, REG_GDM_FWD_CFG(AIROHA_GDM2_IDX),
|
||||||
|
- pse_port);
|
||||||
|
+ FE_PSE_PORT_DROP);
|
||||||
|
airoha_fe_clear(eth, REG_GDM_FWD_CFG(AIROHA_GDM2_IDX),
|
||||||
|
GDM_STRIP_CRC_MASK);
|
||||||
|
|
||||||
|
@@ -1812,6 +1809,11 @@ static int airoha_set_gdm2_loopback(stru
|
||||||
|
GDM_SHORT_LEN_MASK | GDM_LONG_LEN_MASK,
|
||||||
|
FIELD_PREP(GDM_SHORT_LEN_MASK, 60) |
|
||||||
|
FIELD_PREP(GDM_LONG_LEN_MASK, AIROHA_MAX_MTU));
|
||||||
|
+ /* Forward the traffic to the proper GDM port */
|
||||||
|
+ pse_port = port->id == AIROHA_GDM3_IDX ? FE_PSE_PORT_GDM3
|
||||||
|
+ : FE_PSE_PORT_GDM4;
|
||||||
|
+ airoha_set_gdm_port_fwd_cfg(eth, REG_GDM_FWD_CFG(AIROHA_GDM2_IDX),
|
||||||
|
+ pse_port);
|
||||||
|
|
||||||
|
/* Disable VIP and IFC for GDM2 */
|
||||||
|
airoha_fe_clear(eth, REG_FE_VIP_PORT_EN, BIT(AIROHA_GDM2_IDX));
|
||||||
@@ -15,7 +15,7 @@ Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
|
|||||||
|
|
||||||
--- a/drivers/net/ethernet/airoha/airoha_eth.c
|
--- a/drivers/net/ethernet/airoha/airoha_eth.c
|
||||||
+++ b/drivers/net/ethernet/airoha/airoha_eth.c
|
+++ b/drivers/net/ethernet/airoha/airoha_eth.c
|
||||||
@@ -3194,7 +3194,6 @@ static void airoha_remove(struct platfor
|
@@ -3196,7 +3196,6 @@ static void airoha_remove(struct platfor
|
||||||
}
|
}
|
||||||
|
|
||||||
static const char * const en7581_xsi_rsts_names[] = {
|
static const char * const en7581_xsi_rsts_names[] = {
|
||||||
@@ -23,7 +23,7 @@ Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
|
|||||||
"hsi0-mac",
|
"hsi0-mac",
|
||||||
"hsi1-mac",
|
"hsi1-mac",
|
||||||
"hsi-mac",
|
"hsi-mac",
|
||||||
@@ -3248,7 +3247,6 @@ static u32 airoha_en7581_get_vip_port(st
|
@@ -3250,7 +3249,6 @@ static u32 airoha_en7581_get_vip_port(st
|
||||||
}
|
}
|
||||||
|
|
||||||
static const char * const an7583_xsi_rsts_names[] = {
|
static const char * const an7583_xsi_rsts_names[] = {
|
||||||
|
|||||||
+5
-5
@@ -79,7 +79,7 @@ Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2914,6 +2936,11 @@ static const struct ethtool_ops airoha_e
|
@@ -2916,6 +2938,11 @@ static const struct ethtool_ops airoha_e
|
||||||
.get_link = ethtool_op_get_link,
|
.get_link = ethtool_op_get_link,
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -91,7 +91,7 @@ Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
|
|||||||
static int airoha_metadata_dst_alloc(struct airoha_gdm_port *port)
|
static int airoha_metadata_dst_alloc(struct airoha_gdm_port *port)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
@@ -2958,6 +2985,119 @@ bool airoha_is_valid_gdm_port(struct air
|
@@ -2960,6 +2987,119 @@ bool airoha_is_valid_gdm_port(struct air
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -211,7 +211,7 @@ Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
|
|||||||
static int airoha_alloc_gdm_port(struct airoha_eth *eth,
|
static int airoha_alloc_gdm_port(struct airoha_eth *eth,
|
||||||
struct device_node *np)
|
struct device_node *np)
|
||||||
{
|
{
|
||||||
@@ -3031,6 +3171,12 @@ static int airoha_alloc_gdm_port(struct
|
@@ -3033,6 +3173,12 @@ static int airoha_alloc_gdm_port(struct
|
||||||
port->nbq = id == AIROHA_GDM3_IDX && airoha_is_7581(eth) ? 4 : 0;
|
port->nbq = id == AIROHA_GDM3_IDX && airoha_is_7581(eth) ? 4 : 0;
|
||||||
eth->ports[p] = port;
|
eth->ports[p] = port;
|
||||||
|
|
||||||
@@ -224,7 +224,7 @@ Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
|
|||||||
return airoha_metadata_dst_alloc(port);
|
return airoha_metadata_dst_alloc(port);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -3158,8 +3304,11 @@ error_napi_stop:
|
@@ -3160,8 +3306,11 @@ error_napi_stop:
|
||||||
if (!port)
|
if (!port)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
@@ -237,7 +237,7 @@ Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
|
|||||||
airoha_metadata_dst_free(port);
|
airoha_metadata_dst_free(port);
|
||||||
}
|
}
|
||||||
airoha_hw_cleanup(eth);
|
airoha_hw_cleanup(eth);
|
||||||
@@ -3184,6 +3333,8 @@ static void airoha_remove(struct platfor
|
@@ -3186,6 +3335,8 @@ static void airoha_remove(struct platfor
|
||||||
if (!port)
|
if (!port)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
|||||||
+5
-5
@@ -57,7 +57,7 @@ Signed-off-by: Mikhail Kshevetskiy <mikhail.kshevetskiy@iopsys.eu>
|
|||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@@ -2988,6 +2994,7 @@ bool airoha_is_valid_gdm_port(struct air
|
@@ -2990,6 +2996,7 @@ bool airoha_is_valid_gdm_port(struct air
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -65,7 +65,7 @@ Signed-off-by: Mikhail Kshevetskiy <mikhail.kshevetskiy@iopsys.eu>
|
|||||||
static void airoha_mac_link_up(struct phylink_config *config, struct phy_device *phy,
|
static void airoha_mac_link_up(struct phylink_config *config, struct phy_device *phy,
|
||||||
unsigned int mode, phy_interface_t interface,
|
unsigned int mode, phy_interface_t interface,
|
||||||
int speed, int duplex, bool tx_pause, bool rx_pause)
|
int speed, int duplex, bool tx_pause, bool rx_pause)
|
||||||
@@ -3100,6 +3107,7 @@ static int airoha_setup_phylink(struct n
|
@@ -3102,6 +3109,7 @@ static int airoha_setup_phylink(struct n
|
||||||
|
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
@@ -73,7 +73,7 @@ Signed-off-by: Mikhail Kshevetskiy <mikhail.kshevetskiy@iopsys.eu>
|
|||||||
|
|
||||||
static int airoha_alloc_gdm_port(struct airoha_eth *eth,
|
static int airoha_alloc_gdm_port(struct airoha_eth *eth,
|
||||||
struct device_node *np)
|
struct device_node *np)
|
||||||
@@ -3174,11 +3182,13 @@ static int airoha_alloc_gdm_port(struct
|
@@ -3176,11 +3184,13 @@ static int airoha_alloc_gdm_port(struct
|
||||||
port->nbq = id == AIROHA_GDM3_IDX && airoha_is_7581(eth) ? 4 : 0;
|
port->nbq = id == AIROHA_GDM3_IDX && airoha_is_7581(eth) ? 4 : 0;
|
||||||
eth->ports[p] = port;
|
eth->ports[p] = port;
|
||||||
|
|
||||||
@@ -87,7 +87,7 @@ Signed-off-by: Mikhail Kshevetskiy <mikhail.kshevetskiy@iopsys.eu>
|
|||||||
|
|
||||||
return airoha_metadata_dst_alloc(port);
|
return airoha_metadata_dst_alloc(port);
|
||||||
}
|
}
|
||||||
@@ -3308,8 +3318,10 @@ error_napi_stop:
|
@@ -3310,8 +3320,10 @@ error_napi_stop:
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (port->dev->reg_state == NETREG_REGISTERED) {
|
if (port->dev->reg_state == NETREG_REGISTERED) {
|
||||||
@@ -98,7 +98,7 @@ Signed-off-by: Mikhail Kshevetskiy <mikhail.kshevetskiy@iopsys.eu>
|
|||||||
unregister_netdev(port->dev);
|
unregister_netdev(port->dev);
|
||||||
}
|
}
|
||||||
airoha_metadata_dst_free(port);
|
airoha_metadata_dst_free(port);
|
||||||
@@ -3336,8 +3348,10 @@ static void airoha_remove(struct platfor
|
@@ -3338,8 +3350,10 @@ static void airoha_remove(struct platfor
|
||||||
if (!port)
|
if (!port)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
|||||||
@@ -212,7 +212,7 @@ Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
|
|||||||
q->ndesc = ndesc;
|
q->ndesc = ndesc;
|
||||||
netif_napi_add(eth->napi_dev, &q->napi, airoha_qdma_rx_napi_poll);
|
netif_napi_add(eth->napi_dev, &q->napi, airoha_qdma_rx_napi_poll);
|
||||||
|
|
||||||
@@ -2032,6 +2151,64 @@ int airoha_get_fe_port(struct airoha_gdm
|
@@ -2034,6 +2153,64 @@ int airoha_get_fe_port(struct airoha_gdm
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -277,7 +277,7 @@ Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
|
|||||||
static netdev_tx_t airoha_dev_xmit(struct sk_buff *skb,
|
static netdev_tx_t airoha_dev_xmit(struct sk_buff *skb,
|
||||||
struct net_device *dev)
|
struct net_device *dev)
|
||||||
{
|
{
|
||||||
@@ -2931,6 +3108,7 @@ static const struct net_device_ops airoh
|
@@ -2933,6 +3110,7 @@ static const struct net_device_ops airoh
|
||||||
.ndo_stop = airoha_dev_stop,
|
.ndo_stop = airoha_dev_stop,
|
||||||
.ndo_change_mtu = airoha_dev_change_mtu,
|
.ndo_change_mtu = airoha_dev_change_mtu,
|
||||||
.ndo_select_queue = airoha_dev_select_queue,
|
.ndo_select_queue = airoha_dev_select_queue,
|
||||||
@@ -285,7 +285,7 @@ Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
|
|||||||
.ndo_start_xmit = airoha_dev_xmit,
|
.ndo_start_xmit = airoha_dev_xmit,
|
||||||
.ndo_get_stats64 = airoha_dev_get_stats64,
|
.ndo_get_stats64 = airoha_dev_get_stats64,
|
||||||
.ndo_set_mac_address = airoha_dev_set_macaddr,
|
.ndo_set_mac_address = airoha_dev_set_macaddr,
|
||||||
@@ -3148,12 +3326,9 @@ static int airoha_alloc_gdm_port(struct
|
@@ -3150,12 +3328,9 @@ static int airoha_alloc_gdm_port(struct
|
||||||
dev->ethtool_ops = &airoha_ethtool_ops;
|
dev->ethtool_ops = &airoha_ethtool_ops;
|
||||||
dev->max_mtu = AIROHA_MAX_MTU;
|
dev->max_mtu = AIROHA_MAX_MTU;
|
||||||
dev->watchdog_timeo = 5 * HZ;
|
dev->watchdog_timeo = 5 * HZ;
|
||||||
|
|||||||
Reference in New Issue
Block a user