On Tue, 20 Jul 2021 11:03:53 -0300 (-03)
[email protected] wrote:

> >Synopsis:    the ure driver (RTL8152) under certain conditions
> >does not respond. Category:  kernel
> >Environment:  
>       System      : OpenBSD 6.9
>       Details     : OpenBSD 6.9-current (GENERIC.MP) #133: Sun Jul
> 18 10:59:17 MDT 2021
> [email protected]:/usr/src/sys/arch/amd64/compile/GENERIC.MP
> 
>       Architecture: OpenBSD.amd64
>       Machine     : amd64
> >Description:  
>       The ure driver with the RTL8152 adapter does not respond if
> the device is UP before having ethernet link. The dmesg command
> displays the following lines when the error occurs:
> 
>       ure0: usb error on tx: IN_PROGRESS
>       usb_insert_transfer: xfer=0xfffffd821eeaec08 not free
> 
>       once the error occurred only by restarting the computer the
> USB/Ethernet adapter works again.
> 
> >How-To-Repeat:  
>       Steps to reproduce the problem:
> 
>       1. Boot with the adapter plugged in (you could also plug in
> after the operating system has booted). The dmesg command show:
> 
>       ure0 at uhub0 port 1 configuration 1 interface 0 "TP-LINK USB
> 10/100 LAN" rev 2.10/20.00 addr 2 ure0: RTL8152 (0x4c10), address
> 7c:c2:c6:1a:37:01 rlphy0 at ure0 phy 0: RTL8201E 10/100 PHY, rev. 2
>  
>       The ifconfig command show:
> 
>       ure0: flags=8802<BROADCAST,SIMPLEX,MULTICAST> mtu 1500
>         lladdr 7c:c2:c6:1a:37:01
>         index 6 priority 0 llprio 3
>         media: Ethernet autoselect (none)
>         status: no carrier
> 
>       2. Setting IP configuration in adapter:
> 
>       # ifconfig ure0 debug
>       # ifconfig ure0 192.168.47.1/24
>       
>       The debug flag does not produce more information in the logs.
> The ifconfig command show:
> 
>       ure0:
> flags=8847<UP,BROADCAST,DEBUG,RUNNING,SIMPLEX,MULTICAST> mtu 1500
> lladdr 7c:c2:c6:1a:37:01 index 6 priority 0 llprio 3
>         media: Ethernet autoselect (none)
>         status: no carrier
>         inet 192.168.47.1 netmask 0xffffff00 broadcast 192.168.47.255
> 
>       3. Connect patchcord to ethernet port to get link:
> 
>       ure0:
> flags=8847<UP,BROADCAST,DEBUG,RUNNING,SIMPLEX,MULTICAST> mtu 1500
> lladdr 7c:c2:c6:1a:37:01 index 6 priority 0 llprio 3
>         media: Ethernet autoselect (100baseTX full-duplex)
>         status: active
>         inet 192.168.47.1 netmask 0xffffff00 broadcast 192.168.47.255
> 
>       4. Initiating any type of data transfer, with any protocol
> produces the error. Ping a host on the subnet.
> 
>       # ping -c3 192.168.47.2
>       PING 192.168.47.2 (192.168.47.2): 56 data bytes
>       ping: sendmsg: Network is down
>       ping: wrote 192.168.47.2 64 chars, ret=-1
>       ping: sendmsg: Network is down
>       ping: wrote 192.168.47.2 64 chars, ret=-1
>       ping: sendmsg: Network is down
>       ping: wrote 192.168.47.2 64 chars, ret=-1
>       
>       --- 192.168.47.2 ping statistics ---
>       3 packets transmitted, 0 packets received, 100.0% packet loss
> 
>       The dmesg commando show:
> 
>       ure0: usb error on tx: IN_PROGRESS
>       usb_insert_transfer: xfer=0xfffffd821eeaeaf0 not free

I don't have such a device here.  But one reason could be that ure(4)
isn't reading the link status correctly.  Following a debug diff.  If
you could run it with the cable disconnected and then connected and
send back the output please.


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    20 Jul 2021 19:38:41 -0000
@@ -576,6 +576,13 @@ 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;

Reply via email to