On Wed, 21 Jul 2021 19:23:18 -0300 Adrian Ali <adrian...@fortix.com.ar> wrote:
> > On Wed, 21 Jul 2021 13:46:54 -0300 > > Adrian Ali <adrian...@fortix.com.ar> wrote: > > > > > On Wed, 21 Jul 2021 08:40:34 +0200 > > > Marcus Glocker <mar...@nazgul.ch> wrote: > > > > > > > Does this diff fix the issue? > > > > > > > > > > > > Index: if_ure.c > > > > =============================================================== > > > > RCS file: /cvs/src/sys/dev/usb/if_ure.c,v > > > > retrieving revision 1.24 > > > > diff -u -p -u -p -r1.24 if_ure.c > > > > --- if_ure.c 15 Apr 2021 02:23:17 -0000 1.24 > > > > +++ if_ure.c 21 Jul 2021 14:15:10 -0000 > > > > @@ -435,6 +435,9 @@ ure_miibus_statchg(struct device *dev) > > > > /* Lost link, do nothing. */ > > > > if ((sc->ure_flags & URE_FLAG_LINK) == 0) > > > > return; > > > > + > > > > + /* Enable transmit and receive. */ > > > > + URE_SETBIT_1(sc, URE_PLA_CR, URE_MCU_TYPE_PLA, > > > > URE_CR_RE | URE_CR_TE); > > > > } > > > > > > > > int > > > > > > No, test steps: > > > > > > Start computer: > > > > > > # dmesg | grep ure0 > > > ure0 at uhub0 port 2 configuration 1 interface 0 "TP-LINK USB > > > 10/100 LAN" rev 2.10/20.00 addr 3 > > > ure0: RTL8152 (0x4c10), address 7c:c2:c6:1a:37:01 > > > rlphy0 at ure0 phy 0: RTL8201E 10/100 PHY, rev. 2 > > > > > > # ifconfig ure0 > > > ure0: flags=8802<BROADCAST,SIMPLEX,MULTICAST> mtu 1500 > > > lladdr 7c:c2:c6:1a:37:01 > > > index 5 priority 0 llprio 3 > > > media: Ethernet autoselect (100baseTX full-duplex) > > > status: active > > > > > > Add IP configuration in device: > > > > > > # ifconfig ure0 debug > > > # ifconfig ure0 192.168.47.1/24 > > > > > > # ifconfig ure0 > > > ure0: flags=8847<UP,BROADCAST,DEBUG,RUNNING,SIMPLEX,MULTICAST> mtu > > > 1500 lladdr 7c:c2:c6:1a:37:01 > > > index 5 priority 0 llprio 3 > > > media: Ethernet autoselect (100baseTX full-duplex) > > > status: active > > > inet 192.168.47.1 netmask 0xffffff00 broadcast > > 192.168.47.255 > > > > > > Test ping, it works: > > > > > > # ping -c3 192.168.47.2 > > > PING 192.168.47.2 (192.168.47.2): 56 data bytes > > > 64 bytes from 192.168.47.2: icmp_seq=0 ttl=255 time=0.749 ms > > > 64 bytes from 192.168.47.2: icmp_seq=1 ttl=255 time=0.779 ms > > > 64 bytes from 192.168.47.2: icmp_seq=2 ttl=255 time=0.836 ms > > > > > > --- 192.168.47.2 ping statistics --- > > > 3 packets transmitted, 3 packets received, 0.0% packet loss > > > round-trip min/avg/max/std-dev = 0.749/0.788/0.836/0.036 ms > > > > > > unplug cable: > > > > > > # ifconfig ure0 > > > ure0: flags=8847<UP,BROADCAST,DEBUG,RUNNING,SIMPLEX,MULTICAST> mtu > > > 1500 lladdr 7c:c2:c6:1a:37:01 > > > index 5 priority 0 llprio 3 > > > media: Ethernet autoselect (none) > > > status: no carrier > > > inet 192.168.47.1 netmask 0xffffff00 broadcast > 192.168.47.255 > > > > > > plug in cable: > > > > > > # ifconfig ure0 > > > ure0: flags=8847<UP,BROADCAST,DEBUG,RUNNING,SIMPLEX,MULTICAST> mtu > > > 1500 lladdr 7c:c2:c6:1a:37:01 > > > index 5 priority 0 llprio 3 > > > media: Ethernet autoselect (100baseTX full-duplex) > > > status: active > > > inet 192.168.47.1 netmask 0xffffff00 broadcast > 192.168.47.255 > > > > > > Test ping, does not work: > > > > > > # ping -c3 192.168.47.2 > > > PING 192.168.47.2 (192.168.47.2): 56 data bytes > > > > > > --- 192.168.47.2 ping statistics --- > > > 3 packets transmitted, 0 packets received, 100.0% packet loss > > > > > > log: > > > > > > Jul 21 13:10:02 neurus /bsd: ure0: usb error on tx: IN_PROGRESS > > > Jul 21 13:10:02 neurus /bsd: usb_insert_transfer: > > > xfer=0xfffffd821eeb6c08 not free > > > > Um, interesting. I could get my hands on a RTL8153 in the meantime, > > and there the diff fixes the issue. With the RTL8153 I can see that > > after the cable gets unplugged, RX/TX is getting disabled on the > > chip. I have assumed that would also apply to the other RTL815x > > chip sets. > > > > If you want to run this diff (it does basically the same but with > > more debug output), and send back the dmesg, then we could at least > > see the RTL8152 behaviour related to the RX/TX register. > > Hi, dmesg with this diff : > > 1. Start computer: > > # dmesg | grep ure0 > ure0 at uhub0 port 2 configuration 1 interface 0 "TP-LINK USB 10/100 > LAN" rev 2.10/20.00 addr 3 > ure0: RTL8152 (0x4c10), address 7c:c2:c6:1a:37:01 > rlphy0 at ure0 phy 0: RTL8201E 10/100 PHY, rev. 2 > > # ifconfig ure0 > ure0: flags=8802<BROADCAST,SIMPLEX,MULTICAST> mtu 1500 > lladdr 7c:c2:c6:1a:37:01 > index 5 priority 0 llprio 3 > media: Ethernet autoselect (100baseTX full-duplex) > status: active > > 2. Add IP configuration in device: > > # ifconfig ure0 debug > # ifconfig ure0 192.168.47.1/24 > > dmesg: > > Jul 21 19:00:54 neurus /bsd: ure_check_trx_enabled: val=0xc: RX-ON > TX-ON Jul 21 19:00:56 neurus last message repeated 2 times > > # ifconfig ure0 > ure0: flags=8847<UP,BROADCAST,DEBUG,RUNNING,SIMPLEX,MULTICAST> mtu > 1500 lladdr 7c:c2:c6:1a:37:01 > index 5 priority 0 llprio 3 > media: Ethernet autoselect (100baseTX full-duplex) > status: active > inet 192.168.47.1 netmask 0xffffff00 broadcast 192.168.47.255 > > 3. Test ping, it works: > > # ping -c3 192.168.47.2 > PING 192.168.47.2 (192.168.47.2): 56 data bytes > 64 bytes from 192.168.47.2: icmp_seq=0 ttl=255 time=1.594 ms > 64 bytes from 192.168.47.2: icmp_seq=1 ttl=255 time=0.783 ms > 64 bytes from 192.168.47.2: icmp_seq=2 ttl=255 time=0.795 ms > > --- 192.168.47.2 ping statistics --- > 3 packets transmitted, 3 packets received, 0.0% packet loss > round-trip min/avg/max/std-dev = 0.783/1.057/1.594/0.380 ms > > 4. Unplug cable: > > # ifconfig ure0 > ure0: flags=8847<UP,BROADCAST,DEBUG,RUNNING,SIMPLEX,MULTICAST> mtu > 1500 lladdr 7c:c2:c6:1a:37:01 > index 5 priority 0 llprio 3 > media: Ethernet autoselect (none) > status: no carrier > inet 192.168.47.1 netmask 0xffffff00 broadcast 192.168.47.255 > > 5. Plug in cable: > > dmesg: > > Jul 21 19:04:01 neurus /bsd: ure_check_trx_enabled: val=0x0: > Jul 21 19:04:01 neurus /bsd: ure_check_trx_enabled: val=0xc: RX-ON > TX-ON > > # ifconfig ure0 > ure0: flags=8847<UP,BROADCAST,DEBUG,RUNNING,SIMPLEX,MULTICAST> mtu > 1500 lladdr 7c:c2:c6:1a:37:01 > index 5 priority 0 llprio 3 > media: Ethernet autoselect (100baseTX full-duplex) > status: active > inet 192.168.47.1 netmask 0xffffff00 broadcast 192.168.47.255 > > 6. Test ping, does not work: > > # ping -c3 192.168.47.2 > PING 192.168.47.2 (192.168.47.2): 56 data bytes > > --- 192.168.47.2 ping statistics --- > 3 packets transmitted, 0 packets received, 100.0% packet loss > > dmesg: > > Jul 21 19:04:51 neurus /bsd: ure0: usb error on tx: IN_PROGRESS > Jul 21 19:04:52 neurus /bsd: usb_insert_transfer: > xfer=0xfffffd821eeb6c08 not free Thanks for checking. So you see the same behavior, and the diff also re-establishes the RX/TX state on the device after the cable re-plug, but other than on the RTL8153, the RTL8152 still can't send out data afterwards. I'm afraid without having such a device here I won't be able to help much further. It will be too much try and error ...