On Wed, 21 Jul 2021 08:40:34 +0200
Marcus Glocker <[email protected]> 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
diff:
# cvs diff dev/usb/if_ure.c
cvs diff: in directory .:
cvs diff: ignoring CVS/Root because it specifies a non-existent
repository /cvs
cvs diff: in directory dev/usb:
cvs diff: ignoring CVS/Root because it specifies a non-existent
repository /cvs
Index: dev/usb/if_ure.c
===================================================================
RCS file: /cvs/src/sys/dev/usb/if_ure.c,v
retrieving revision 1.24
diff -u -p -r1.24 if_ure.c
--- dev/usb/if_ure.c 15 Apr 2021 02:23:17 -0000 1.24
+++ dev/usb/if_ure.c 21 Jul 2021 16:06:57 -0000
@@ -435,6 +435,10 @@ 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
@@ -576,6 +580,14 @@ ure_link_state(struct ure_softc *sc)
int
ure_get_link_status(struct ure_softc *sc)
{
+
+ uint8_t status1;
+ uint16_t status2;
+
+ status1 = ure_read_1(sc, URE_PLA_PHYSTATUS, URE_MCU_TYPE_PLA);
+ status2 = ure_read_2(sc, URE_PLA_PHYSTATUS, URE_MCU_TYPE_PLA);
+ printf("link status1=0x%x, status2=0x%x\n", status1, status2);
+
if (ure_read_2(sc, URE_PLA_PHYSTATUS, URE_MCU_TYPE_PLA) &
URE_PHYSTATUS_LINK) {
sc->ure_flags |= URE_FLAG_LINK;