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 data verification through module parameter in gadget zero
Date: Thu, 29 Sep 2016 14:18:54 +0530 [thread overview]
Message-ID: <1475138934-3647-1-git-send-email-mnarani@xilinx.com> (raw)
This patch adds support to configure data verification through
module parameter. This parameter can be used to disable data
verification 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 | 6 ++++--
drivers/usb/gadget/function/g_zero.h | 3 +++
drivers/usb/gadget/legacy/zero.c | 5 +++++
3 files changed, 12 insertions(+), 2 deletions(-)
diff --git a/drivers/usb/gadget/function/f_sourcesink.c b/drivers/usb/gadget/function/f_sourcesink.c
index 81274ba..2328d11 100644
--- a/drivers/usb/gadget/function/f_sourcesink.c
+++ b/drivers/usb/gadget/function/f_sourcesink.c
@@ -45,6 +45,7 @@ struct f_sourcesink {
int cur_alt;
unsigned pattern;
+ unsigned verify_rx_data;
unsigned isoc_interval;
unsigned isoc_maxpacket;
unsigned isoc_mult;
@@ -552,7 +553,7 @@ static void source_sink_complete(struct usb_ep *ep, struct usb_request *req)
switch (status) {
case 0: /* normal completion? */
- if (ep == ss->out_ep) {
+ if (ss->verify_rx_data && (ep == ss->out_ep)) {
check_read_data(ss, req);
if (ss->pattern != 2)
memset(req->buf, 0x55, req->length);
@@ -630,7 +631,7 @@ static int source_sink_start_ep(struct f_sourcesink *ss, bool is_in,
req->complete = source_sink_complete;
if (is_in)
reinit_write_data(ep, req);
- else if (ss->pattern != 2)
+ else if (ss->verify_rx_data && (ss->pattern != 2))
memset(req->buf, 0x55, req->length);
status = usb_ep_queue(ep, req, GFP_ATOMIC);
@@ -866,6 +867,7 @@ static struct usb_function *source_sink_alloc_func(
mutex_unlock(&ss_opts->lock);
ss->pattern = ss_opts->pattern;
+ ss->verify_rx_data = ss_opts->verify_rx_data;
ss->isoc_interval = ss_opts->isoc_interval;
ss->isoc_maxpacket = ss_opts->isoc_maxpacket;
ss->isoc_mult = ss_opts->isoc_mult;
diff --git a/drivers/usb/gadget/function/g_zero.h b/drivers/usb/gadget/function/g_zero.h
index b3234e7..8e5d20c 100644
--- a/drivers/usb/gadget/function/g_zero.h
+++ b/drivers/usb/gadget/function/g_zero.h
@@ -6,6 +6,7 @@
#ifndef __G_ZERO_H
#define __G_ZERO_H
+#define GZERO_VERIFY_RX_DATA 1
#define GZERO_BULK_BUFLEN 4096
#define GZERO_QLEN 32
#define GZERO_ISOC_INTERVAL 4
@@ -15,6 +16,7 @@
struct usb_zero_options {
unsigned pattern;
+ unsigned verify_rx_data;
unsigned isoc_interval;
unsigned isoc_maxpacket;
unsigned isoc_mult;
@@ -29,6 +31,7 @@ struct usb_zero_options {
struct f_ss_opts {
struct usb_function_instance func_inst;
unsigned pattern;
+ unsigned verify_rx_data;
unsigned isoc_interval;
unsigned isoc_maxpacket;
unsigned isoc_mult;
diff --git a/drivers/usb/gadget/legacy/zero.c b/drivers/usb/gadget/legacy/zero.c
index c88f5e0..0087ef8 100644
--- a/drivers/usb/gadget/legacy/zero.c
+++ b/drivers/usb/gadget/legacy/zero.c
@@ -64,6 +64,7 @@ static bool loopdefault = 0;
module_param(loopdefault, bool, S_IRUGO|S_IWUSR);
static struct usb_zero_options gzero_options = {
+ .verify_rx_data = GZERO_VERIFY_RX_DATA,
.isoc_interval = GZERO_ISOC_INTERVAL,
.isoc_maxpacket = GZERO_ISOC_MAXPACKET,
.bulk_buflen = GZERO_BULK_BUFLEN,
@@ -236,6 +237,9 @@ module_param_named(buflen, gzero_options.bulk_buflen, uint, 0);
module_param_named(pattern, gzero_options.pattern, uint, S_IRUGO|S_IWUSR);
MODULE_PARM_DESC(pattern, "0 = all zeroes, 1 = mod63, 2 = none");
+module_param_named(verify, gzero_options.verify_rx_data, uint, S_IRUGO|S_IWUSR);
+MODULE_PARM_DESC(verify, "Verification of received data : 0 = No, 1 = Yes");
+
module_param_named(isoc_interval, gzero_options.isoc_interval, uint,
S_IRUGO|S_IWUSR);
MODULE_PARM_DESC(isoc_interval, "1 - 16");
@@ -294,6 +298,7 @@ static int zero_bind(struct usb_composite_dev *cdev)
ss_opts = container_of(func_inst_ss, struct f_ss_opts, func_inst);
ss_opts->pattern = gzero_options.pattern;
+ ss_opts->verify_rx_data = gzero_options.verify_rx_data;
ss_opts->isoc_interval = gzero_options.isoc_interval;
ss_opts->isoc_maxpacket = gzero_options.isoc_maxpacket;
ss_opts->isoc_mult = gzero_options.isoc_mult;
--
2.1.1
next reply other threads:[~2016-09-29 10:24 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-09-29 8:48 Manish Narani [this message]
2016-09-29 9:16 ` Peter Chen
2016-09-29 11:25 ` Greg KH
2016-09-30 11:13 ` Manish Narani
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=1475138934-3647-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
all inboxes | Powered by JetHome®