Hi Sumit, On 2026-09-28T06:40:33, Sumit Singh Dhami <[email protected]> wrote: > usb: gadget: fastboot: allow configuring the endpoint buffer size > > The hard-coded 4096-byte EP_BUFFER_SIZE limits the maximum length of a > fastboot command received over USB. Long "oem run" commands, such as > a multi-partition "gpt write", can exceed that and get rejected with > "buffer overflow". > > Make the buffer size configurable via CONFIG_FASTBOOT_EP_BUFFER_SIZE, > defaulting to 4096. The value must stay a multiple of the endpoint's > maxpacket size. > > Signed-off-by: Sumit Singh Dhami <[email protected]> > > drivers/fastboot/Kconfig | 14 ++++++++++++++ > drivers/usb/gadget/f_fastboot.c | 2 +- > 2 files changed, 15 insertions(+), 1 deletion(-)
> diff --git a/drivers/fastboot/Kconfig b/drivers/fastboot/Kconfig > @@ -49,6 +49,20 @@ config TCP_FUNCTION_FASTBOOT > +config FASTBOOT_EP_BUFFER_SIZE > + hex "Fastboot bulk endpoint buffer size" > + default 0x1000 This only affects f_fastboot.c, i.e. the USB gadget, but it appears for UDP/TCP-only builds too since it sits under 'if FASTBOOT'. Please can you add 'depends on USB_FUNCTION_FASTBOOT' (or move it next to that option)? > diff --git a/drivers/fastboot/Kconfig b/drivers/fastboot/Kconfig > @@ -49,6 +49,20 @@ config TCP_FUNCTION_FASTBOOT > + Must be an integral multiple of the endpoint maxpacket size (64, > + 512 or 1024 bytes), otherwise transfers break on controllers such > + as DWC3. Since this is now user-settable, it would be better to enforce the constraint at build time rather than in the help text, e.g. a BUILD_BUG_ON() or preprocessor check in f_fastboot.c that the value is a multiple of 1024 (which covers all three cases). What do you think? > diff --git a/drivers/fastboot/Kconfig b/drivers/fastboot/Kconfig > @@ -49,6 +49,20 @@ config TCP_FUNCTION_FASTBOOT > + A larger value is needed to accept long commands, for example > + "oem run" with a large command string. My understanding is that the fastboot protocol caps commands at 4096 bytes and the standard host tool refuses to send anything longer, so raising this only helps with hosts that don't enforce that (such as Snagboot?). Please say so here and in the commit message, so people don't expect the stock fastboot binary to benefit. Regards, Simon
