Hacker News new | past | comments | ask | show | jobs | submit
No, you’ve misunderstood. Any time the NIC signals that one or more packets have arrived the CPU must reply back to the NIC to give it a DMA buffer to copy the packet(s) into. By the time that reply arrived at the NIC it was already too late. The NIC could only buffer four packets and the fifth or even sixth packet had already arrived and been dropped. The NIC then sent the four packets it had to the DMA buffer and started over.

The monitor was not really at fault. All USB hubs must read USB packets on all of their ports and copy them over to the upstream port. Those packets must all go into a buffer first so they the hub can send them individually even when they arrive simultaneously. That introduced just enough delay to allow the NIC’s internal buffer to fill up. Any hub would have caused the same problem. The solution was to buy a NIC designed for a higher speed because it has a bigger internal buffer. That new NIC will probably have the same problem with USB hubs, but at 5Gbps instead of 2.5Gbps.

> 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.

Not all hubs and computers are equal here. Having experienced this with RTL8153, the combination of the Studio Display and ARM MacBooks is especially bad. Using an Intel MacBook with the display, or a different USB hub instead of the display, gets the full NIC bandwidth.
loading story #50592796