Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix RTL8139 driver issues #483

Merged
merged 13 commits into from May 5, 2023
Merged

Fix RTL8139 driver issues #483

merged 13 commits into from May 5, 2023

Conversation

vinc
Copy link
Owner

@vinc vinc commented May 4, 2023

The RTL8139 driver was working well in QEMU but not so much on real hardware.

  • Add fence before polling for status change
  • Use spin_loop while polling for status change
  • Use 1024 bytes for max DMA burst size instead of 2048
  • Fix transmit ring overflow
  • Change transmit buffer length from 4096 to 2048 bytes
  • Fix issue when transmitting packets < 64 bytes
  • Fix typo in receive buffer size (8129 instead of 8192)
  • Fix httpd buffer size issue

Fix #325

@vinc
Copy link
Owner Author

vinc commented May 5, 2023

The network is not yet bug free on real hardware.

When I run the HTTP service and download files from another computer some larger files get truncated around the middle of the download, but not always exactly at the same length.

 3682 alice.txt.5
 3682 alice.txt.4
 3682 alice.txt.2
 3682 alice.txt.1
 3682 alice.txt
 5128 alice.txt.3
 6692 clear
 6820 print
 6948 reboot
 6948 halt
10320 moros.png.4
10320 moros.png.2
11766 moros.png.3
11766 moros.png.1
11766 moros.png
20836 sleep.3
20836 sleep.1
20836 sleep
22282 sleep.2
23728 sleep.5
23728 sleep.4
23836 hello

Edit: the response buffer was cut into chunks of 1500 bytes but this resulted in two TCP packets with a payload of 1446 and 54 bytes, so only about half of the total number of packets were actually transmitted.

@vinc
Copy link
Owner Author

vinc commented May 5, 2023

The HTTP service is now more efficient compared to #391

> siege -c 8 -r 64 -b --no-parser http://127.0.0.1:8080
** SIEGE 4.1.6
** Preparing 8 concurrent users for battle.
The server is now under siege...
HTTP/1.1 200     0.00 secs:     617 bytes ==> GET  /
HTTP/1.1 200     0.00 secs:     617 bytes ==> GET  /
HTTP/1.1 200     0.00 secs:     617 bytes ==> GET  /
HTTP/1.1 200     0.00 secs:     617 bytes ==> GET  /
HTTP/1.1 200     0.01 secs:     617 bytes ==> GET  /
...
HTTP/1.1 200     0.01 secs:     617 bytes ==> GET  /
HTTP/1.1 200     0.00 secs:     617 bytes ==> GET  /
HTTP/1.1 200     0.00 secs:     617 bytes ==> GET  /
HTTP/1.1 200     0.00 secs:     617 bytes ==> GET  /
HTTP/1.1 200     0.00 secs:     617 bytes ==> GET  /

Transactions:		         512 hits
Availability:		      100.00 %
Elapsed time:		        2.38 secs
Data transferred:	        0.30 MB
Response time:		        0.02 secs
Transaction rate:	      215.13 trans/sec
Throughput:		        0.13 MB/sec
Concurrency:		        5.13
Successful transactions:         512
Failed transactions:	           0
Longest transaction:	        1.22
Shortest transaction:	        0.00

@vinc vinc marked this pull request as ready for review May 5, 2023 20:56
@vinc vinc merged commit 7665c11 into trunk May 5, 2023
1 check passed
@vinc vinc deleted the fix/rtl8139 branch May 5, 2023 21:14
@vinc vinc mentioned this pull request Jun 20, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Fix RTL8139 network driver on physical hardware
1 participant