From: Manish Narani <manish.narani@xilinx.com>
To: <balbi@kernel.org>, <gregkh@linuxfoundation.org>,
<k.opasiak@samsung.com>, <r.baldyga@samsung.com>,
<peter.chen@freescale.com>, <mnarani@xilinx.com>,
<John.Youn@synopsys.com>, <eu@felipetonello.com>,
<i.kotrasinsk@samsung.com>, <linux-usb@vger.kernel.org>,
<linux-kernel@vger.kernel.org>
Cc: <anuragku@xilinx.com>, <punnaia@xilinx.com>
Subject: [LINUX PATCH] usb: gadget: Configure bulk maxburst through module parameter in gadget zero.
Date: Thu, 29 Sep 2016 14:16:44 +0530 [thread overview]
Message-ID: <1475138804-3335-1-git-send-email-mnarani@xilinx.com> (raw)
This patch adds support to configure bulk maxburst through
module parameter. This parameter can be used to modify bulk
maxburst in case if one wants to measure peak Bulk/Isoc-IN/OUT
performance.
Signed-off-by: Manish Narani <mnarani@xilinx.com>
---
drivers/usb/gadget/function/f_sourcesink.c | 14 ++++++++++++++
drivers/usb/gadget/function/g_zero.h | 2 ++
drivers/usb/gadget/legacy/zero.c | 5 +++++
3 files changed, 21 insertions(+), 0 deletions(-)
diff --git a/drivers/usb/gadget/function/f_sourcesink.c b/drivers/usb/gadget/function/f_sourcesink.c
index df0189d..81274ba 100644
--- a/drivers/usb/gadget/function/f_sourcesink.c
+++ b/drivers/usb/gadget/function/f_sourcesink.c
@@ -49,6 +49,7 @@ struct f_sourcesink {
unsigned isoc_maxpacket;
unsigned isoc_mult;
unsigned isoc_maxburst;
+ unsigned bulk_maxburst;
unsigned buflen;
unsigned bulk_qlen;
unsigned iso_qlen;
@@ -334,6 +335,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) {
@@ -347,6 +352,14 @@ autoconf_fail:
if (!ss->out_ep)
goto autoconf_fail;
+ /*
+ * Fill in the SS bulk descriptors from the module parameters.
+ * We assume that the user knows what they are doing and won't
+ * give parameters that their UDC doesn't support.
+ */
+ 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;
@@ -857,6 +870,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 492924d..b3234e7 100644
--- a/drivers/usb/gadget/function/g_zero.h
+++ b/drivers/usb/gadget/function/g_zero.h
@@ -19,6 +19,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;
@@ -32,6 +33,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;
diff --git a/drivers/usb/gadget/legacy/zero.c b/drivers/usb/gadget/legacy/zero.c
index d02e2ce..c88f5e0 100644
--- a/drivers/usb/gadget/legacy/zero.c
+++ b/drivers/usb/gadget/legacy/zero.c
@@ -247,6 +247,10 @@ MODULE_PARM_DESC(isoc_maxpacket, "0 - 1023 (fs), 0 - 1024 (hs/ss)");
module_param_named(isoc_mult, gzero_options.isoc_mult, uint, S_IRUGO|S_IWUSR);
MODULE_PARM_DESC(isoc_mult, "0 - 2 (hs/ss only)");
+module_param_named(bulk_maxburst, gzero_options.bulk_maxburst, uint,
+ S_IRUGO|S_IWUSR);
+MODULE_PARM_DESC(bulk_maxburst, "0 - 15 (ss only)");
+
module_param_named(isoc_maxburst, gzero_options.isoc_maxburst, uint,
S_IRUGO|S_IWUSR);
MODULE_PARM_DESC(isoc_maxburst, "0 - 15 (ss only)");
@@ -294,6 +298,7 @@ static int zero_bind(struct usb_composite_dev *cdev)
ss_opts->isoc_maxpacket = gzero_options.isoc_maxpacket;
ss_opts->isoc_mult = gzero_options.isoc_mult;
ss_opts->isoc_maxburst = gzero_options.isoc_maxburst;
+ ss_opts->bulk_maxburst = gzero_options.bulk_maxburst;
ss_opts->bulk_buflen = gzero_options.bulk_buflen;
ss_opts->bulk_qlen = gzero_options.ss_bulk_qlen;
ss_opts->iso_qlen = gzero_options.ss_iso_qlen;
--
1.7.1
next reply other threads:[~2016-09-29 11:20 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <CGME20160929084701eucas1p2ca0b57d66f30f1aa5ec0825029990487@eucas1p2.samsung.com>
2016-09-29 8:46 ` Manish Narani [this message]
2016-09-29 8:54 ` Greg KH
2016-09-29 12:23 ` Felipe Balbi
2016-09-30 11:12 ` Manish Narani
2016-09-29 8:58 ` Krzysztof Opasiak
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1475138804-3335-1-git-send-email-mnarani@xilinx.com \
--to=manish.narani@xilinx.com \
--cc=John.Youn@synopsys.com \
--cc=anuragku@xilinx.com \
--cc=balbi@kernel.org \
--cc=eu@felipetonello.com \
--cc=gregkh@linuxfoundation.org \
--cc=i.kotrasinsk@samsung.com \
--cc=k.opasiak@samsung.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=mnarani@xilinx.com \
--cc=peter.chen@freescale.com \
--cc=punnaia@xilinx.com \
--cc=r.baldyga@samsung.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Powered by JetHome