Opened 2 years ago

Closed 2 years ago

#17775 closed bug (fixed)

USB tethering (RNDIS) performance issues/bugs

Reported by: fatigatti Owned by: pulkomandy
Priority: normal Milestone: R1/beta4
Component: Drivers/Network/usb_rndis Version: R1/Development
Keywords: Cc:
Blocked By: Blocking:
Platform: All

Description

I can't seem to get a consistent internet connection using the USB RNDIS driver, with an Android 11 phone (Samsung Galaxy A03 core, on the cheap end).

Updating the system using HaikuDepot or pkgman it's impossible (it works just fine using Ethernet). Also, I can't traceroute anywhere. Web browsing kind of works, but a speed test quickly shows there's something wrong (see attachments).

I've noticed, using ifconfig, that I keep getting errors on the receiving side of things. This makes sense as the upload speed seems to be OK, it's the download speed giving trouble.

The same phone, on the same laptop under Windows works just fine.

I'm guessing there might be a bug on the usb_rndis driver (or higher in the stack?). My wifi cards are not supported (Broadcom 4313 and USB Ralink RT3070) so I can't compare.

Also, plugging and unplugging the phone seems to mess with Haiku's ability to recognise it (sometimes a reboot is required)

Attachments (8)

Speedtest under Haiku.png (39.8 KB ) - added by fatigatti 2 years ago.
Speedtest under Haiku
Speedtest under Windows.png (38.9 KB ) - added by fatigatti 2 years ago.
Speedtest under Windows
ifconfig errors.png (15.2 KB ) - added by fatigatti 2 years ago.
ifconfig errors (interface just started)
syslog.txt (225.4 KB ) - added by fatigatti 2 years ago.
Syslog
listusb.txt (18.5 KB ) - added by fatigatti 2 years ago.
listusb -v
syslog.old (512.1 KB ) - added by fatigatti 2 years ago.
syslog (verbose)
syslog (195.5 KB ) - added by fatigatti 2 years ago.
syslog (verbose)
speed.png (167.4 KB ) - added by fatigatti 2 years ago.
Clean boot, pkgman full-sync right after

Download all attachments as: .zip

Change History (23)

by fatigatti, 2 years ago

Attachment: Speedtest under Haiku.png added

Speedtest under Haiku

by fatigatti, 2 years ago

Attachment: Speedtest under Windows.png added

Speedtest under Windows

by fatigatti, 2 years ago

Attachment: ifconfig errors.png added

ifconfig errors (interface just started)

comment:1 by waddlesplash, 2 years ago

Please attach:

1) a syslog. 2) what hrev you are on (though the syslog should note this.) 3) the output of listusb -v with the phone connected.

1) and 2) are standard procedure for reporting bugs in drivers/kernel and should basically always be included in such tickets.

by fatigatti, 2 years ago

Attachment: syslog.txt added

Syslog

by fatigatti, 2 years ago

Attachment: listusb.txt added

listusb -v

comment:2 by fatigatti, 2 years ago

Hi, thanks for your quick reply. I'm on hrev56160, I've attached the required logs and outputs.

comment:3 by waddlesplash, 2 years ago

KERN: usb_rndis: Received unexpected packet type 00000000 on data link
KERN: usb_rndis: Received unexpected packet type 75736e69 on data link
KERN: usb_rndis: Received unexpected packet type 29053400 on data link
KERN: usb_rndis: Received unexpected packet type 212ac804 on data link
KERN: usb_rndis: Received unexpected packet type 454ab5b2 on data link
KERN: usb_rndis: Received unexpected packet type 17c5e2b5 on data link
KERN: usb_rndis: Received unexpected packet type 7345135a on data link
KERN: usb_rndis: Received unexpected packet type c7d4480f on data link

Probably the packets are being decapped incorrectly, somehow.

comment:4 by fatigatti, 2 years ago

Also, plugging and unplugging the phone seems to mess with Haiku's ability to recognise it (sometimes a reboot is required)

More into this. If I unplug the phone and I plug it again using the same port, it does not work. The message KERN: usb_rndis: rndis device 0 added gets printed to the syslog, but that's it. It is not recognised in the Network preferences applet at all.

If I use a different port, it works and gets recognised perfectly. The previous line gets printed to the syslog as well, but inmediately after that one I get the MAC address, frame size, link speed, etc and DHCP negotiation starts.

KERN: usb_rndis: rndis device 0 added
KERN: usb_rndis: mac address: ae:cb:b4:18:94:4f
KERN: usb_rndis: max frame size: 1500
KERN: usb_rndis: media connect state: 0
KERN: usb_rndis: link speed: 4259840 * 100bps
DAEMON 'DHCP': /dev/net/usb_rndis/0: Send DHCP_DISCOVER to 255.255.255.255:67
DAEMON 'DHCP': /dev/net/usb_rndis/0: Received DHCP_OFFER from 192.168.14.227
...

comment:5 by fatigatti, 2 years ago

More findings. If I reboot with the phone connected and working (the phone never leaves the tethering mode, and so when Haiku is booting it presents itself as a network interface), on restart it gets recognised on the Network applet, but the DHCP negotiation never happens and so I don't have connection. The following line gets printed to the syslog:

KERN: usb_rndis: unsupported ioctl 8925

Might be related to #17763?

comment:6 by waddlesplash, 2 years ago

8295 is SIOCGIFMEDIA. That's called to display various statistics in the GUI and ifconfig. It's a harmless error.

comment:7 by pulkomandy, 2 years ago

Hello,

Can you try https://review.haiku-os.org/c/haiku/+/5376 ?

Are you set up to compile the driver yourself and test some changes? (if not I will see if I can provide pre-built drivers)

comment:8 by fatigatti, 2 years ago

Hi... I'm not really set up at the moment but I'm definitely willing to learn. I guess I need to download the Haiku tree, which takes some time considering that I depend mainly on USB_RNDIS for connection. If you could provide a pre-built driver (and an explanation on how to use it, should I just replace the driver file?) for this time it would be great (and I'll start looking how to build it for the next time). Thanks.

comment:9 by fatigatti, 2 years ago

Ok so I think I got it right. Downloaded the full tree, downloaded the "new" RNDISDevice.cpp and replaced the one in the tree, configured, jam -q usb_rndis, got the driver as expected. Placed the driver under non-packaged using the right hierarchy, made the symlink, rebooted, blacklisted the system driver. Same results. I'm 99% sure I'm loading the driver from non-packaged cause at first I didn't know about the symlink and so after blacklisting no driver was getting loaded at all.

So to summarize, if I didn't screw up at some place then I'm getting exactly the same results.

comment:10 by waddlesplash, 2 years ago

You can use the listimage command to check the driver loaded is from non-packaged.

comment:11 by pulkomandy, 2 years ago

If you are able to build for yourself, you can do one additional change: in Driver.h, add a #define TRACE_RNDIS 1 before the #if TRACE_RNDIS

https://cgit.haiku-os.org/haiku/tree/src/add-ons/kernel/drivers/network/ether/usb_rndis/Driver.h#n33

Then build and install the driver. This will result in more information being put in the syslog. Hopefully I can find something interesting there.

by fatigatti, 2 years ago

Attachment: syslog.old added

syslog (verbose)

by fatigatti, 2 years ago

Attachment: syslog added

syslog (verbose)

by fatigatti, 2 years ago

Attachment: speed.png added

Clean boot, pkgman full-sync right after

comment:12 by fatigatti, 2 years ago

So I did and wow, that's verbose. Anyway, as you can see in the screenshot attached, the number of errors piled are not correlated to the transfer speed. This is right after booting. It's like it's getting one error per connection established, if that makes sense. New errors weren't getting added but the speed was painfully slow. Then I opened a newspaper website and I got like 50 errors in a couple of seconds (like every modern webpage, there's a ton of files to download), but the browsing speed, while not what it should be, is totally acceptable (1.5Mbps or so).

Syslogs attached.

EDIT: forget about the "one error per connection" nonsense. StreamRadio is not triggering even one error while playing. At the same time, as soon as I open a webpage errors pile up, and it seems worse when the page is complex. Concurrency?

Last edited 2 years ago by fatigatti (previous) (diff)

comment:13 by pulkomandy, 2 years ago

Not exactly concurrency, but it has to do with receiving multiple packets at nearly the same time so they are bundled together in a single USB packet.

https://review.haiku-os.org/c/haiku/+/5377 should fix the remaining problem, it would be great if you can confirm that it works now.

comment:14 by fatigatti, 2 years ago

A big THANK YOU! It's fixed for me using that last revision. Performance is excellent, no errors displayed on ifconfig and plugging-unplugging using the same port works as expected or so it seems at the moment (might have to test this a little bit more). I'd say resolved.

comment:15 by pulkomandy, 2 years ago

Milestone: UnscheduledR1/beta4
Resolution: fixed
Status: newclosed

Thanks for your time testing and helping investigate this, it helps a lot :)

The changes are merged in hrev56183 and will be available in the next nightlies. You can remove your non-packaged driver once you have upgraded.

Note: See TracTickets for help on using tickets.