[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250828112944.2042343-3-srikanth.chary-chennoju@amd.com>
Date: Thu, 28 Aug 2025 16:59:43 +0530
From: Srikanth Chary Chennoju <srikanth.chary-chennoju@....com>
To: <gregkh@...uxfoundation.org>, <Thinh.Nguyen@...opsys.com>,
<m.grzeschik@...gutronix.de>, <Chris.Wulff@...mp.com>, <tiwai@...e.de>
CC: <linux-usb@...r.kernel.org>, <linux-kernel@...r.kernel.org>,
<punnaiah.choudary.kalluri@....com>, Srikanth Chary Chennoju
<srikanth.chary-chennoju@....com>
Subject: [PATCH v2 2/3] usb: gadget: f_sourcesink support for maxburst for bulk
This patch supports bulk_maxburst. Without this change we are not able
to achieve performance for super speed plus device.Without this fix,
we confirmed through lecroy that it is sendingpackets with NumP always
equal to 1.
Signed-off-by: Srikanth Chary Chennoju <srikanth.chary-chennoju@....com>
---
drivers/usb/gadget/function/f_sourcesink.c | 9 +++++++++
drivers/usb/gadget/function/g_zero.h | 2 ++
2 files changed, 11 insertions(+)
diff --git a/drivers/usb/gadget/function/f_sourcesink.c b/drivers/usb/gadget/function/f_sourcesink.c
index ec5fd25020fd..a3a69166c343 100644
--- a/drivers/usb/gadget/function/f_sourcesink.c
+++ b/drivers/usb/gadget/function/f_sourcesink.c
@@ -45,6 +45,7 @@ struct f_sourcesink {
unsigned isoc_maxpacket;
unsigned isoc_mult;
unsigned isoc_maxburst;
+ unsigned bulk_maxburst;
unsigned buflen;
unsigned bulk_qlen;
unsigned iso_qlen;
@@ -328,6 +329,10 @@ sourcesink_bind(struct usb_configuration *c, struct usb_function *f)
source_sink_intf_alt0.bInterfaceNumber = id;
source_sink_intf_alt1.bInterfaceNumber = id;
+ /* sanity check the bulk module parameters */
+ if (ss->bulk_maxburst > 15)
+ ss->bulk_maxburst = 15;
+
/* allocate bulk endpoints */
ss->in_ep = usb_ep_autoconfig(cdev->gadget, &fs_source_desc);
if (!ss->in_ep) {
@@ -341,6 +346,9 @@ sourcesink_bind(struct usb_configuration *c, struct usb_function *f)
if (!ss->out_ep)
goto autoconf_fail;
+ ss_source_comp_desc.bMaxBurst = ss->bulk_maxburst;
+ ss_sink_comp_desc.bMaxBurst = ss->bulk_maxburst;
+
/* sanity check the isoc module parameters */
if (ss->isoc_interval < 1)
ss->isoc_interval = 1;
@@ -852,6 +860,7 @@ static struct usb_function *source_sink_alloc_func(
ss->isoc_maxpacket = ss_opts->isoc_maxpacket;
ss->isoc_mult = ss_opts->isoc_mult;
ss->isoc_maxburst = ss_opts->isoc_maxburst;
+ ss->bulk_maxburst = ss_opts->bulk_maxburst;
ss->buflen = ss_opts->bulk_buflen;
ss->bulk_qlen = ss_opts->bulk_qlen;
ss->iso_qlen = ss_opts->iso_qlen;
diff --git a/drivers/usb/gadget/function/g_zero.h b/drivers/usb/gadget/function/g_zero.h
index 98b8462ad538..3f327e37f398 100644
--- a/drivers/usb/gadget/function/g_zero.h
+++ b/drivers/usb/gadget/function/g_zero.h
@@ -20,6 +20,7 @@ struct usb_zero_options {
unsigned isoc_maxpacket;
unsigned isoc_mult;
unsigned isoc_maxburst;
+ unsigned bulk_maxburst;
unsigned bulk_buflen;
unsigned qlen;
unsigned ss_bulk_qlen;
@@ -33,6 +34,7 @@ struct f_ss_opts {
unsigned isoc_maxpacket;
unsigned isoc_mult;
unsigned isoc_maxburst;
+ unsigned bulk_maxburst;
unsigned bulk_buflen;
unsigned bulk_qlen;
unsigned iso_qlen;
--
2.25.1
Powered by blists - more mailing lists