Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
usb: gadget: f_ncm: fix ncm_bitrate for SuperSpeed and above.
Currently, SuperSpeed NCM gadgets report a speed of 851 Mbps in USB_CDC_NOTIFY_SPEED_CHANGE. But the calculation appears to assume 16 packets per microframe, and USB 3 and above no longer use microframes. Maximum speed is actually much higher. On a direct connection, theoretical throughput is about 3.86 Gbps for gen1x1 and 9.35 Gbps for gen2x1, and I have seen gadget->host speeds >2 Gbps for gen1x1 and >4 Gbps for gen2x1. Unfortunately the ConnectionSpeedChange defined in the CDC spec only uses 32-bit values, so we can't report accurate numbers for 10Gbps and above. So always report a speed of 4 Gbps, which is close enough to the technical maximum of a 5 Gbps link. This results in: [96033.958723] cdc_ncm 8-2:1.0 enx4643f5db6f40: renamed from usb0 [96033.997136] cdc_ncm 8-2:1.0 enx4643f5db6f40: 4000 mbit/s downlink 4000 mbit/s uplink Fixes: 1650113 ("usb: gadget: f_ncm: add SuperSpeed descriptors for CDC NCM") Signed-off-by: Lorenzo Colitti <lorenzo@google.com>
- Loading branch information