gl-infra-builder-FUjr/patches-22.03.4/3013-fix-ath79-ar8337-remove-wan-port-network-cable-clear-ip.patch
2023-04-26 16:06:20 +08:00

52 lines
1.9 KiB
Diff

From f97272d7f7aa9aac944ef225d3652791e9ab9512 Mon Sep 17 00:00:00 2001
From: Weiping Yang <weiping.yang@gl-inet.com>
Date: Tue, 21 Mar 2023 05:26:55 -0400
Subject: [PATCH] fix-ar8337-remove-wan-port-network-cable-clear-ip
---
...move-wan-port-network-cable-clear-ip.patch | 32 +++++++++++++++++++
1 file changed, 32 insertions(+)
create mode 100644 target/linux/ath79/patches-5.10/943-fix-ar8337-remove-wan-port-network-cable-clear-ip.patch
diff --git a/target/linux/ath79/patches-5.10/943-fix-ar8337-remove-wan-port-network-cable-clear-ip.patch b/target/linux/ath79/patches-5.10/943-fix-ar8337-remove-wan-port-network-cable-clear-ip.patch
new file mode 100644
index 0000000000..f77b0eab11
--- /dev/null
+++ b/target/linux/ath79/patches-5.10/943-fix-ar8337-remove-wan-port-network-cable-clear-ip.patch
@@ -0,0 +1,32 @@
+Index: linux-5.10.146/drivers/net/phy/ar8216.c
+===================================================================
+--- linux-5.10.146.orig/drivers/net/phy/ar8216.c
++++ linux-5.10.146/drivers/net/phy/ar8216.c
+@@ -2545,6 +2545,8 @@ ar8xxx_phy_read_status(struct phy_device
+ {
+ struct ar8xxx_priv *priv = phydev->priv;
+ struct switch_port_link link;
++ bool port1_status;
++ port1_status = priv->link_up[1];
+
+ /* check for switch port link changes */
+ ar8xxx_check_link_states(priv);
+@@ -2572,8 +2574,16 @@ ar8xxx_phy_read_status(struct phy_device
+ }
+ phydev->duplex = link.duplex ? DUPLEX_FULL : DUPLEX_HALF;
+
+- phydev->state = PHY_RUNNING;
+- netif_carrier_on(phydev->attached_dev);
++ //Execute only when the wan port is down
++ if(port1_status && port1_status != priv->link_up[1]){
++ phydev->link = 0;
++ phydev->state = PHY_NOLINK;
++ netif_carrier_off(phydev->attached_dev);
++ } else {
++ phydev->state = PHY_RUNNING;
++ netif_carrier_on(phydev->attached_dev);
++ }
++
+ if (phydev->adjust_link)
+ phydev->adjust_link(phydev->attached_dev);
+
--
2.17.1