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)
Change History (23)
by , 2 years ago
Attachment: | Speedtest under Haiku.png added |
---|
comment:1 by , 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.
comment:2 by , 2 years ago
Hi, thanks for your quick reply. I'm on hrev56160, I've attached the required logs and outputs.
comment:3 by , 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 , 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 , 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 , 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 , 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 , 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 , 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 , 2 years ago
You can use the listimage
command to check the driver loaded is from non-packaged.
comment:11 by , 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
Then build and install the driver. This will result in more information being put in the syslog. Hopefully I can find something interesting there.
comment:12 by , 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?
comment:13 by , 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 , 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 , 2 years ago
Milestone: | Unscheduled → R1/beta4 |
---|---|
Resolution: | → fixed |
Status: | new → closed |
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.
Speedtest under Haiku