From: Selvarasu Ganesan selvarasu.g@samsung.com
The current implementation sets the wMaxPacketSize of bulk in/out endpoints to 1024 bytes at the end of the f_midi_bind function. However, in cases where there is a failure in the first midi bind attempt, consider rebinding. This scenario may encounter an f_midi_bind issue due to the previous bind setting the bulk endpoint's wMaxPacketSize to 1024 bytes, which exceeds the ep->maxpacket_limit where configured TX/RX FIFO's maxpacket size of 512 bytes for IN/OUT endpoints in support HS speed only. This commit addresses this issue by resetting the wMaxPacketSize before endpoint claim
Fixes: 46decc82ffd5 ("usb: gadget: unconditionally allocate hs/ss descriptor in bind operation") Cc: stable@vger.kernel.org Signed-off-by: Selvarasu Ganesan selvarasu.g@samsung.com --- drivers/usb/gadget/function/f_midi.c | 9 +++++++++ 1 file changed, 9 insertions(+)
diff --git a/drivers/usb/gadget/function/f_midi.c b/drivers/usb/gadget/function/f_midi.c index 837fcdfa3840..5caa0e4eb07e 100644 --- a/drivers/usb/gadget/function/f_midi.c +++ b/drivers/usb/gadget/function/f_midi.c @@ -907,6 +907,15 @@ static int f_midi_bind(struct usb_configuration *c, struct usb_function *f)
status = -ENODEV;
+ /* + * Reset wMaxPacketSize with maximum packet size of FS bulk transfer before + * endpoint claim. This ensures that the wMaxPacketSize does not exceed the + * limit during bind retries where configured TX/RX FIFO's maxpacket size + * of 512 bytes for IN/OUT endpoints in support HS speed only. + */ + bulk_in_desc.wMaxPacketSize = cpu_to_le16(64); + bulk_out_desc.wMaxPacketSize = cpu_to_le16(64); + /* allocate instance-specific endpoints */ midi->in_ep = usb_ep_autoconfig(cdev->gadget, &bulk_in_desc); if (!midi->in_ep)
Hello Maintainers,
Please ignore this commit as this duplicate copy of https://lore.kernel.org/linux-usb/20241208152322.1653-1-selvarasu.g@samsung....
Thanks,
Selva
On 12/8/2024 8:43 PM, Faraz Ata wrote:
From: Selvarasu Ganesan selvarasu.g@samsung.com
The current implementation sets the wMaxPacketSize of bulk in/out endpoints to 1024 bytes at the end of the f_midi_bind function. However, in cases where there is a failure in the first midi bind attempt, consider rebinding. This scenario may encounter an f_midi_bind issue due to the previous bind setting the bulk endpoint's wMaxPacketSize to 1024 bytes, which exceeds the ep->maxpacket_limit where configured TX/RX FIFO's maxpacket size of 512 bytes for IN/OUT endpoints in support HS speed only. This commit addresses this issue by resetting the wMaxPacketSize before endpoint claim
Fixes: 46decc82ffd5 ("usb: gadget: unconditionally allocate hs/ss descriptor in bind operation") Cc: stable@vger.kernel.org Signed-off-by: Selvarasu Ganesan selvarasu.g@samsung.com
drivers/usb/gadget/function/f_midi.c | 9 +++++++++ 1 file changed, 9 insertions(+)
diff --git a/drivers/usb/gadget/function/f_midi.c b/drivers/usb/gadget/function/f_midi.c index 837fcdfa3840..5caa0e4eb07e 100644 --- a/drivers/usb/gadget/function/f_midi.c +++ b/drivers/usb/gadget/function/f_midi.c @@ -907,6 +907,15 @@ static int f_midi_bind(struct usb_configuration *c, struct usb_function *f) status = -ENODEV;
- /*
* Reset wMaxPacketSize with maximum packet size of FS bulk transfer before
* endpoint claim. This ensures that the wMaxPacketSize does not exceed the
* limit during bind retries where configured TX/RX FIFO's maxpacket size
* of 512 bytes for IN/OUT endpoints in support HS speed only.
*/
- bulk_in_desc.wMaxPacketSize = cpu_to_le16(64);
- bulk_out_desc.wMaxPacketSize = cpu_to_le16(64);
- /* allocate instance-specific endpoints */ midi->in_ep = usb_ep_autoconfig(cdev->gadget, &bulk_in_desc); if (!midi->in_ep)
On Sun, Dec 08, 2024 at 08:58:32PM +0530, Selvarasu Ganesan wrote:
Hello Maintainers,
Please ignore this commit as this duplicate copy of https://lore.kernel.org/linux-usb/20241208152322.1653-1-selvarasu.g@samsung....
So which is correct?
confused,
greg k-h
On 12/8/2024 9:18 PM, Greg KH wrote:
On Sun, Dec 08, 2024 at 08:58:32PM +0530, Selvarasu Ganesan wrote:
Hello Maintainers,
Please ignore this commit as this duplicate copy of https://lore.kernel.org/linux-usb/20241208152322.1653-1-selvarasu.g@samsung....
So which is correct?
confused,
Sorry for the confusion. The below is the correct one.
https://lore.kernel.org/linux-usb/20241208152322.1653-1-selvarasu.g@samsung....
Thanks, Selva
greg k-h
linux-stable-mirror@lists.linaro.org