Re: [PATCH] spi: ljca: Do not wait for an ack after every write chunk

From: Mark Brown

Date: Thu Nov 26 2026 - 13:10:57 EST


> The LJCA adapter in the Dell XPS 9315 (8086:0b63) is a USB Full Speed
> device with 64-byte bulk endpoints, so ljca_spi_transfer() splits each
> SPI transfer into chunks of 58 bytes, and ljca_transfer() waits for the
> adapter’s ack after each of them. On the Full Speed bus, every such
> round trip takes about 0.3 ms.
>
> This is most visible when mei_vsc boots the Intel Visual Sensing
> Controller (IVSC): it downloads about 1.7 MB of firmware with write-only
> SPI transfers, which takes about 12 seconds. Tracing `modprobe mei_vsc`
> with the function_graph tracer:
>
> SPI device statistics: 1730864 bytes in 3407 transfers
> ljca_send(): 30085 calls, median 279 us, 11.1 s in total
> usb_bulk_msg() (OUT): median 133 us, 4.6 s in total
> waiting for the ack: median 146 us, 6.5 s in total
>
> Only request an ack for the last chunk of a write, and send the others
> with ljca_transfer_noack(). Bulk messages arrive in order, so the
> transfer still completes only after the adapter has handled all chunks.
> A write chunk then takes 112 us (median) instead of 279 us. Reads and
> full-duplex transfers are unchanged, as each of their chunks returns
> data.
>
> On the Dell XPS 9315, with Debian’s 7.3.5 kernel and only spi-ljca.ko
> rebuilt with this change, `modprobe mei_vsc` (mei_vsc blacklisted, so
> that the IVSC is in its reset state), two boots each:
>
> without this change: 12.28 s, 12.08 s
> with this change: 7.56 s, 7.34 s
>
> Both cases transfer the same 1730864 bytes in 3407 transfers, the IVSC
> boots, the IPU6 finds the sensor, and libcamera captures frames.
>
> Sending several of the 64-byte messages in one bulk transfer was slower
> (8.4 to 8.6 s for 8 messages), as the adapter seems to NAK the next
> packet while it still forwards the previous chunk over SPI.
> ---

You've not provided a Signed-off-by for this so I can't do anything with
it, please see Documentation/process/submitting-patches.rst for details
on what this is and why it's important.

--
Mark Brown <broonie@xxxxxxxxxx>