by nh2 1 day ago

> The NIC could only buffer four packets

Where does the "4" come from? The article's diagram suggests that the NIC's buffer is "~35 KB", though I don't know where that number comes from either (I supposed measuring how long it takes until frames are dropped). "4" seems to be the number of 1 KB packets (the 3+1 from "packet size 1024 bMaxBurst 3"), so a transmission size (protocol-level "window size"), not a buffer size. I guess if you are referring to that as a different "buffer", that makes sense, but it doesn't seem to be the buffer the article is talking about.

But you are right with your main point regarding latency. My statement

> The monitor decides to send the adapter's packets on at only 2 Gbit/s

isn't really right: It's not that the monitor "decided" to only send 41 KiB instead of larger sizes; the 41 KiB is the maximum that the NIC can send because its `bMaxBurst = 3`, and the latency added by the monitor being a USB hub then limits the bandwidth to the mentioned ~2 Gbit/s.

I guess the key point not said anywhere is that `bMaxBurst = 3` and `wMaxPacketSize = 1024 B` are fixed protocol-level parameters that hubs like the monitor have no control over. So the 4 KiB windows are fixed from the NIC through the monitor to the Mac; the monitor cannot e.g. decide to buffer some of those to compensate for the latency it adds.

db48x 17 hours ago

> the monitor cannot e.g. decide to buffer some of those to compensate for the latency it adds.

Correct. The NIC buffers the Ethernet packets, the USB hub in the monitor can only forward what the NIC sends. If the NIC drops an Ethernet packet, no amount of buffering in the USB hub can help; it’s already been dropped.

> Where does the "4" come from?

It was set by whoever designed the RTL8156B chip. They looked at the delay product of the USB link and calculated that a buffer holding four packets would be enough to maintain 2.5Gbps. And they’re right, assuming the latency of the USB link stays low.

Notice that when it came time to make the RTL8157 chip that supports 5Gbps they doubled the buffer size to 8. That also works only if you assume that the latency of the USB link is low, or if you have Ethernet packets arriving at 2.5Gbps instead. They probably double it again in the chip that supports 10Gbps.

Realtek are just being cheap. It would only have cost pennies to double the buffer sizes in both products, and the result would be a more reliable product. This is an example of why engineers specify Intel NICs and only consumers end up with Realtek NICs.