Benutzer:Leo: Unterschied zwischen den Versionen
Erscheinungsbild
Inhalt gelöscht Inhalt hinzugefügt
Leo (Diskussion | Beiträge) eth0 bug text hinzugefügt |
Leo (Diskussion | Beiträge) eth0-bug ausgelagert |
||
| Zeile 1: | Zeile 1: | ||
=Merker für mich= |
==Merker für mich== |
||
mesh knoten |
mesh knoten |
||
mesh-service-bridge |
mesh-service-bridge |
||
inet-gw , mesh-hub |
inet-gw , mesh-hub |
||
=eth0-bug-loco-xw= |
==eth0-bug-loco-xw== |
||
backup of https://pad.hack-hro.de/p/eth0-bug-loco-xw |
backup of https://pad.hack-hro.de/p/eth0-bug-loco-xw |
||
==inhalt== |
==Links (ausgelagert)inhalt== |
||
* [[Benutzer:Leo/eth0-bug-analyse]] |
|||
linux-ar71xx_generic/linux-3.10.49/drivers/net/ethernet/atheros/ag71xx/ag71xx_main.c |
|||
<pre> |
|||
AR9342 - Ist der SoC der Loco XWs |
|||
AR8030 - PHY chip - - http://qca.qualcomm.com/wp-content/uploads/2013/11/AR8030.pdf |
|||
AG71XX - ethernet driver |
|||
AR7240 SoC - Woi kommt das her? |
|||
Wo wird UP/DOWN von Ethernet behandelt? |
|||
ag71xx_main.c |
|||
- ag71xx_fast_reset() |
|||
- ag71xx_link_adjust() |
|||
hier wird auch fast_reset aufgerufen |
|||
ag71xx_phy.c - Was machen Funktionen? |
|||
- ag71xx_phy_link_adjust() |
|||
ruft auch ag71xx_link_adjust() auf |
|||
- ag71xx_phy_connect() |
|||
Implementierung: |
|||
in ag71xx_phy.c (detecktiere von UP zu DOWN) |
|||
+ if (status_change) { |
|||
+ pr_info("Debug: phy state change. ag->link=%d \n", ag->link); |
|||
+ pr_info("Debug: phy state change. phydev->link=%d \n ", phydev->link); |
|||
if () |
|||
ag71xx_link_adjust(ag); |
|||
} |
|||
------- |
|||
und in ag71xx_main.c |
|||
+#include <linux/of_gpio.h> |
|||
+#include <linux/gpio.h> |
|||
+#define GPIO_SET 0x1804000C |
|||
+#define GPIO_CLEAR 0x18040010 |
|||
void ag71xx_link_adjust() |
|||
... |
|||
if (!ag->link) { |
|||
ag71xx_hw_stop(ag); |
|||
netif_carrier_off(ag->dev); |
|||
-+if (netif_msg_link(ag)) { |
|||
pr_info("%s: link down\n", ag->dev->name); |
|||
+pr_info("AR803x PHY hangs? Reset it now! Interface maybe down but should not be in defect state ...\n"); |
|||
+gpiod_set_value(GPIO_CLEAR, (1<<0)); |
|||
+msleep(2); |
|||
+gpiod_set_value(GPIO_SET, (1<<0)); |
|||
+msleep(2); |
|||
} |
|||
return; |
|||
} |
|||
Was muss implementiert werden? (allgemein) |
|||
https://dev.openwrt.org/ticket/19085#comment:14 |
|||
Checken wie folgendes realisiert werden kann (Interface reset) |
|||
#define GPIO_SET 0x1804000C |
|||
#define GPIO_CLEAR 0x18040010 |
|||
athr_reg_wr(GPIO_CLEAR,(1<<0)); |
|||
mdelay(2); |
|||
athr_reg_wr(GPIO_SET,(1<<0)); |
|||
mdelay(2); |
|||
---------- |
|||
von http://permalink.gmane.org/gmane.linux.network/318765 |
|||
+#include <linux/of_gpio.h> |
|||
+#include <linux/gpio/consumer.h> |
|||
+static void at803x_adjust_state(struct phy_device *phydev) |
|||
+{ |
|||
+ struct at803x_priv *priv = phydev->priv; |
|||
+ if (phydev->drv->phy_id == ATH8030_PHY_ID) { |
|||
+ if (phydev->state == PHY_NOLINK) { |
|||
+ if (priv->gpiod_reset && !priv->phy_reset) { |
|||
+ struct at803x_context context; |
|||
+ |
|||
+ at803x_context_save(phydev, &context); |
|||
+ |
|||
+ gpiod_set_value(priv->gpiod_reset, 0); |
|||
+ msleep(1); |
|||
+ gpiod_set_value(priv->gpiod_reset, 1); |
|||
+ msleep(1); |
|||
+ |
|||
+ at803x_context_restore(phydev, &context); |
|||
+ |
|||
+ dev_dbg(&phydev->dev, "%s(): phy was reset\n", |
|||
+ __func__); |
|||
+ priv->phy_reset = true; |
|||
+ } |
|||
+ } else { |
|||
+ priv->phy_reset = false; |
|||
+ } |
|||
+ } |
|||
=============== |
|||
enum phy_state { |
|||
PHY_DOWN=0, |
|||
PHY_STARTING, |
|||
PHY_READY, |
|||
PHY_PENDING, |
|||
PHY_UP, |
|||
PHY_AN, |
|||
PHY_RUNNING, |
|||
PHY_NOLINK, |
|||
PHY_FORCING, |
|||
PHY_CHANGELINK, |
|||
PHY_HALTED, |
|||
PHY_RESUMING |
|||
}; |
|||
=========================== |
|||
Log nach Anwendung des obigen Patches, zeigt leider zwei Dinge: |
|||
1. Schwenk von UP zu DOWN wurde nicht erkannt. |
|||
2. Einfach so GPIO zu schreiben, bringt Kernelfehler (naja, war fast zu erwarten. Aber es war einen Versuch wert) |
|||
Log nach dem normalen Booten: |
|||
root@AP-2-30:~# dmesg | grep -i phy |
|||
[ 0.000000] Determined physical RAM map: |
|||
[ 0.600000] libphy: ag71xx_mdio: probed |
|||
[ 1.150000] ag71xx ag71xx.0: connected to PHY at ag71xx-mdio.0:01 [uid=004dd023, driver=Generic PHY] |
|||
[ 6.170000] Debug: phy state change. ag->link=1 (Opennet 4) |
|||
[ 6.170000] Debug: phy state change. phydev->link=1 (Opennet 4) |
|||
[ 21.730000] AR803x PHY hangs? Reset it now! Interface maybe down but should not be in defect state ...(Opennet Hack4) |
|||
[ 21.730000] [<800b4bfc>] ag71xx_phy_stop+0x78/0x9c |
|||
[ 21.990000] [<800b4bfc>] ag71xx_phy_stop+0x78/0x9c |
|||
[ 25.570000] ieee80211 phy0: Selected rate control algorithm 'minstrel_ht' |
|||
[ 25.650000] ieee80211 phy0: Atheros AR9340 Rev:0 mem=0xb8100000, irq=47 |
|||
[ 43.430000] Debug: phy state change. ag->link=1 (Opennet 4) |
|||
[ 43.430000] Debug: phy state change. phydev->link=1 (Opennet 4) |
|||
[69453.360000] Debug: phy state change. ag->link=1 (Opennet 4) |
|||
[69453.360000] Debug: phy state change. phydev->link=1 (Opennet 4) |
|||
[69453.360000] |
|||
[69453.360000] eth0: link up (10Mbps/Half duplex) |
|||
[69455.370000] Debug: phy state change. ag->link=0 (Opennet 4) |
|||
[69455.370000] Debug: phy state change. phydev->link=0 (Opennet 4) |
|||
[69455.370000] |
|||
[69455.370000] eth0: link down |
|||
[69455.370000] AR803x PHY hangs? Reset it now! Interface maybe down but should not be in defect state ...(Opennet Hack4) |
|||
[69455.370000] ------------[ cut here ]------------ |
|||
[69455.370000] WARNING: at drivers/gpio/gpiolib.c:126 gpio_to_desc+0x2c/0x54() |
|||
[69455.370000] invalid GPIO 402915344 |
|||
[69455.370000] Modules linked in: ath9k ath9k_common pppoe ppp_async iptable_nat ath9k_hw ath pptp pppox ppp_mppe ppp_generic nf_nat_ipv4 nf_conntrack_ipv4 mac80211 ipt_MASQUERADE cfg80211 xt_time xt_tcpudp xt_state xt_nat xt_multiport xt_mark xt_mac xt_limit xt_id xt_conntrack xt_comment xt_TCPMSS xt_REDIRECT xt_LOG xt_CT slhc nf_nat_irc nf_nat_ftp nf_nat nf_defrag_ipv4 nf_conntrack_irc nf_conntrack_ftp iptable_raw iptable_mangle iptable_filter ipt_REJECT ip_tables crc_ccitt compat ip6t_REJECT ip6table_raw ip6table_mangle ip6table_filter ip6_tables x_tables nf_conntrack_ipv6 nf_conntrack nf_defrag_ipv6 ip_gre gre ip_tunnel tun ipv6 sha1_generic ecb arc4 crypto_blkcipher crypto_hash |
|||
[69455.370000] CPU: 0 PID: 232 Comm: kworker/0:2 Tainted: G W 3.10.49 #4 |
|||
[69455.370000] Workqueue: events phy_state_machine |
|||
[69455.370000] Stack : 839da380 802d4c44 80148110 0000007e 802e4278 83926c00 83926d74 8030f8b0 |
|||
[69455.370000] 00000008 8027b720 000000e8 801e38ac 83904a08 83926c00 802e2250 83aa7ce4 |
|||
[69455.370000] 83aa7ce4 8027b720 00000003 801e33d0 802e4278 00000000 00000005 802144b0 |
|||
[69455.370000] 00000000 00000000 00000000 00000000 00000000 00000000 6576656e 74730000 |
|||
[69455.370000] 00000000 00000000 00000000 00000000 83816a00 81082300 801da094 83aa7c90 |
|||
[69455.370000] ... |
|||
[69455.370000] Call Trace: |
|||
[69455.370000] [<8022441c>] show_stack+0x48/0x70 |
|||
[69455.370000] [<8028aca4>] warn_slowpath_common+0x78/0xa8 |
|||
[69455.370000] [<8028ad00>] warn_slowpath_fmt+0x2c/0x38 |
|||
[69455.370000] [<80148110>] gpio_to_desc+0x2c/0x54 |
|||
[69455.370000] [<8008fef8>] __gpio_set_value+0x1c/0xe0 |
|||
[69455.370000] [<800b3b84>] ag71xx_link_adjust+0x84/0x39c |
|||
[69455.370000] [<800b4b10>] ag71xx_phy_link_adjust+0xa0/0xc8 |
|||
[69455.370000] [<801da334>] phy_state_machine+0x2a0/0x484 |
|||
[69455.370000] [<801ebe5c>] process_one_work+0x228/0x364 |
|||
[69455.370000] [<8028c054>] worker_thread+0x234/0x388 |
|||
[69455.370000] [<8018c7a4>] kthread+0xb0/0xb8 |
|||
[69455.370000] [<80060878>] ret_from_kernel_thread+0x14/0x1c |
|||
[69455.370000] |
|||
[69455.370000] ---[ end trace 9841a412d51fe0b2 ]--- |
|||
[69455.590000] ------------[ cut here ]------------ |
|||
[69455.590000] WARNING: at drivers/gpio/gpiolib.c:126 gpio_to_desc+0x2c/0x54() |
|||
[69455.600000] invalid GPIO 402915340 |
|||
[69455.600000] Modules linked in: ath9k ath9k_common pppoe ppp_async iptable_nat ath9k_hw ath pptp pppox ppp_mppe ppp_generic nf_nat_ipv4 nf_conntrack_ipv4 mac80211 ipt_MASQUERADE cfg80211 xt_time xt_tcpudp xt_state xt_nat xt_multiport xt_mark xt_mac xt_limit xt_id xt_conntrack xt_comment xt_TCPMSS xt_REDIRECT xt_LOG xt_CT slhc nf_nat_irc nf_nat_ftp nf_nat nf_defrag_ipv4 nf_conntrack_irc nf_conntrack_ftp iptable_raw iptable_mangle iptable_filter ipt_REJECT ip_tables crc_ccitt compat ip6t_REJECT ip6table_raw ip6table_mangle ip6table_filter ip6_tables x_tables nf_conntrack_ipv6 nf_conntrack nf_defrag_ipv6 ip_gre gre ip_tunnel tun ipv6 sha1_generic ecb arc4 crypto_blkcipher crypto_hash |
|||
[69455.660000] CPU: 0 PID: 232 Comm: kworker/0:2 Tainted: G W 3.10.49 #4 |
|||
[69455.670000] Workqueue: events phy_state_machine/home/leo/trunk/5-package-repo-change/on_firmware/openwrt/build_dir/targ~ibc-0.9.33.2/linux-ar71xx_generic/linux-3.18.11/arch/mips/ath79/common.c |
|||
[69455.680000] Stack : 839da380 802d4c44 80148110 0000007e 802e4278 83926c00 83926d74 8030f8b0 |
|||
[69455.680000] 00000008 8027b720 000000e8 801e38ac 83904a08 83926c00 802e2250 83aa7ce4 |
|||
[69455.680000] 83aa7ce4 8027b720 00000003 801e33d0 802e4278 00000000 00000005 802144b0 |
|||
[69455.680000] 00000000 00000000 00000000 00000000 00000000 00000000 6576656e 74730000 |
|||
[69455.680000] 00000000 00000000 00000000 00000000 83816a00 81082300 801da094 83aa7c90 |
|||
[69455.680000] ... |
|||
[69455.710000] Call Trace: |
|||
[69455.720000] [<8022441c>] show_stack+0x48/0x70 |
|||
[69455.720000] [<8028aca4>] warn_slowpath_common+0x78/0xa8 |
|||
[69455.730000] [<8028ad00>] warn_slowpath_fmt+0x2c/0x38 |
|||
[69455.730000] [<80148110>] gpio_to_desc+0x2c/0x54 |
|||
[69455.730000] [<8008fef8>] __gpio_set_value+0x1c/0xe0 |
|||
[69455.740000] [<800b3b98>] ag71xx_link_adjust+0x98/0x39c |
|||
[69455.750000] [<800b4b10>] ag71xx_phy_link_adjust+0xa0/0xc8 |
|||
[69455.750000] [<801da334>] phy_state_machine+0x2a0/0x484 |
|||
[69455.760000] [<801ebe5c>] process_one_work+0x228/0x364 |
|||
[69455.760000] [<8028c054>] worker_thread+0x234/0x388 |
|||
[69455.770000] [<8018c7a4>] kthread+0xb0/0xb8 |
|||
[69455.770000] [<80060878>] ret_from_kernel_thread+0x14/0x1c |
|||
[69455.780000] |
|||
[69455.780000] ---[ end trace 9841a412d51fe0b3 ]--- |
|||
[69455.790000] br-lan: port 1(eth0) entered disabled state |
|||
[71876.510000] br-lan: port 1(eth0) entered disabled state |
|||
[71885.020000] IPv6: ADDRCONF(NETDEV_UP): eth0: link is not ready |
|||
============================= |
|||
Versuch: Reset bei jedem up/down machen oder zumindest bei jeden Reset des Interfaces. |
|||
Fragen: In welche Situationen wird interface Reset gemacht. Das durch Debug Meldungen in Funktionen ermitteln. |
|||
Frage: In welche Funktion den Reset machen? |
|||
- evtl. in /home/leo/trunk/5-package-repo-change/on_firmware/openwrt/build_dir/targ~ibc-0.9.33.2/linux-ar71xx_generic/linux-3.18.11/arch/mips/ath79/common.c |
|||
void ath79_device_reset_clear(u32 mask) |
|||
diese Funktion wird in der ag71xx...main.c - ag71xx_hw_init() aufgerufen. |
|||
In der ag71xx_hw_init() gibt es auch ein Reset-Bit (reset_mask). |
|||
gpio = devm_gpiod_get_index(dev, name, index); |
|||
res = gpiod_direction_output(gpio, !value); |
|||
devm_gpiod_put(dev, gpio); |
|||
gpiod_set_value_cansleep(gpio, value); |
|||
einige Beschreibungen zu GPIO : linux-ar71xx_generic/linux-3.18.11/Documentation/gpio/consumer.txt |
|||
=============================== |
|||
ag71xx_phy.c |
|||
- ag71xx_phy_link_adjust() |
|||
-- vor phydev->link |
|||
int id1 = phy_read( phydev, 2 ) |
|||
int id2 = phy_read( phydev, 3 ) |
|||
printk ("hack id=%04x %04x", id1, id2); /* sollte "004d d023" sein, bis der bug auftritt */ |
|||
====================== |
|||
ag71xx_phy.c |
|||
- ag71xx_phy_link_adjust() |
|||
spin_lock_irqsave(&ag->lock, flags); |
|||
int id1 = phy_read( phydev, 2 ); |
|||
int id2 = phy_read( phydev, 3 ); |
|||
printk("Opennet Hack09: id=%04x %04x",id1, id2); /* sollte "004d d023" sein, bis der bug auftritt */ |
|||
if (phydev->link) { |
|||
- ag71xx_main.c |
|||
<------><------>pr_info("%s: link up (%sMbps/%s duplex) OpennetHack09\n", |
|||
======================== |
|||
leo@minato:~/trunk/eth0-bug-trunk/on_firmware/openwrt/build_dir/target-mips_34kc_uClibc-0.9.33.2/linux-ar71xx_generic/linux-3.18.14/drivers/net/ethernet/atheros/ag71xx$ cp ag71xx_phy.c.patched ~ |
|||
</pre> |
|||
Version vom 5. Juni 2016, 18:59 Uhr
Merker für mich
mesh knoten mesh-service-bridge inet-gw , mesh-hub
eth0-bug-loco-xw
backup of https://pad.hack-hro.de/p/eth0-bug-loco-xw