Re: [PATCH 1/3] usb: xhci: Add support for eUSB2v2 1024-byte bulk packet size

From: Oliver Neukum

Date: Mon Jul 27 2026 - 08:59:59 EST




On 17.07.26 12:44, Pawel Laszczak via B4 Relay wrote:
From: Pawel Laszczak <pawell@xxxxxxxxxxx>

[..]
index 75e2bfd744a9..3b4f7aedd381 100644
--- a/drivers/usb/core/message.c
+++ b/drivers/usb/core/message.c
@@ -2007,6 +2007,65 @@ int usb_set_wireless_status(struct usb_interface *iface,
}
EXPORT_SYMBOL_GPL(usb_set_wireless_status);
+/*
+ * eusb_update_max_packet - set or restore max packet size
+ * @udev: target device
+ * @cp: if NULL restore MPS to 512 else set 1024
+ *
+ * This request is specific to eUSB2v2.
+ * An eUSB2v2 peripheral will revert the maximum packet size to 512
+ * for bulk endpoints after bus reset, disconnect and deconfiguration.
+ * This function allows updating the max packet size for BULK endpoints
+ * to 1024 after above events.
+ */
+static void eusb_update_max_packet(struct usb_device *udev, struct usb_host_config *cp)

This has interesting implications for error handling. The command
has to be redone before reset_resume() and post_reset().
Hence if this fails in these cases you'll change the packet size
behind a driver's back. The same happens if it initially failed
but succeeds before these two operations, only in the other direction.

IMHO if this operation fails before post_reset() or reset_resume(),
the driver will have to be unbound. Likewise if it had failed before
binding a driver, the failure has to be recorded and the command omitted
before post_reset() or reset_resume().

In any case, this function has to return errors.

Regards
Oliver