nuttx/arch
Ricard Rosson cc77be145a arch/rp2040: clamp bulk OUT read length to the endpoint max packet size
rp2040_epread() armed the DPSRAM buffer-control register with the full
usbdev request length.  That length is only correct for requests no
larger than the buffer-control LEN field, which is 10 bits wide (max
1023 bytes).  Class drivers that post larger read requests -- e.g.
cdcncm allocates a 16 KiB NTB read buffer -- overflow LEN: 16384 & 0x3ff
is 0, and the high bits corrupt the neighbouring control flags.  The
controller then sees a zero-length available buffer and completes the
transfer immediately with zero bytes, over and over, so no OUT data is
ever received (cdcncm floods "Wrong NTH SIGN, skblen 0").

The receive path already accumulates a request across multiple packets:
rp2040_rxcomplete() copies each packet, advances xfrd and re-arms via
rp2040_rdrequest() until the request is satisfied or a short packet
arrives.  So the buffer only ever needs to be armed for a single
maximum-size packet.  Clamp nbytes accordingly.  This matches the
transmit path, which already chunks to ep.maxpacket in rp2040_wrrequest.

Bulk classes with small reads (cdcacm, usbmsc) were unaffected because
their request lengths already fit in LEN, which is why the defect only
showed up on cdcncm.

Validated on raspberrypi-pico (RP2040): a CONFIG_NET_CDCNCM device that
previously received nothing now passes traffic in both directions with
0% packet loss.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AHJRvWeBMTHwzpwjaUg4HW
Signed-off-by: Ricard Rosson <ricard@groundbits.com>
2026-07-15 22:27:03 +08:00
..
arm arch/rp2040: clamp bulk OUT read length to the endpoint max packet size 2026-07-15 22:27:03 +08:00
arm64 arch/common: fix host_flags_to_mode() O_RDONLY sentinel collision 2026-07-15 08:41:38 +02:00
avr arch/avr/src/avrdx/avrdx_delay: add custom up_udelay function 2026-06-12 09:55:11 -04:00
ceva arch/ceva: Replace board_app_initialize 2026-05-02 18:36:46 +08:00
dummy
hc style: fix checkpatch issues after debug.h move 2026-04-07 07:50:06 -03:00
mips arch/mips: Add basic support for MIPS Creator CI20 board 2026-07-15 08:02:55 -03:00
misoc include/debug.h: Move to include/nuttx/debug.h 2026-04-07 07:50:06 -03:00
or1k include/debug.h: Move to include/nuttx/debug.h 2026-04-07 07:50:06 -03:00
renesas drivers/efuse/efuse: Drivers Registered With World Write Permissions(Part 1) 2026-07-13 12:08:01 +02:00
risc-v arch/common: fix host_flags_to_mode() O_RDONLY sentinel collision 2026-07-15 08:41:38 +02:00
sim !include/fcntl.h: align open flags with Linux values 2026-06-30 13:43:44 +08:00
sparc drivers: Fix comment typos — 'Pubic' → 'Public' across drivers and headers. 2026-07-02 13:29:48 +08:00
tricore arch/tricore: Add hardware debug breakpoint and watchpoint support. 2026-05-22 15:38:36 +08:00
x86 drivers/efuse/efuse: Drivers Registered With World Write Permissions(Part 1) 2026-07-13 12:08:01 +02:00
x86_64 !include/fcntl.h: align open flags with Linux values 2026-06-30 13:43:44 +08:00
xtensa drivers/: Multiple Drivers Are Registered With World Writable - Part 2 2026-07-15 15:27:28 +08:00
z16 include/debug.h: Move to include/nuttx/debug.h 2026-04-07 07:50:06 -03:00
z80 style: fix checkpatch issues after debug.h move 2026-04-07 07:50:06 -03:00
CMakeLists.txt
Kconfig sched/clock/clock_delay: added config flag to remove weak up_udelay 2026-06-12 09:55:11 -04:00