usb: gadget: Configure data verification through module parameter in gadget zero
PATCH 1/1 usb: gadget: Configure data verification through module parameter in gadget zero
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
--- 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(-)
drivers/usb/gadget/function/f_sourcesink.c +4 -2
@@ -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;
drivers/usb/gadget/function/g_zero.h +3 -0
@@ -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;
drivers/usb/gadget/legacy/zero.c +5 -0
@@ -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;
Signature · 1 line
2.1.1
Quoted 6 lines
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
Would configfs parameter 'pattern' can't satisfy you?
Peter
Quoted 109 lines
Signed-off-by Manish Narani <[email protected]>---
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(-)drivers/usb/gadget/function/f_sourcesink.c +2
-1@@ -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);drivers/usb/gadget/function/f_sourcesink.c +1
-1-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;drivers/usb/gadget/function/f_sourcesink.c +1
-0+ 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;drivers/usb/gadget/function/g_zero.h +3
-0@@ -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;drivers/usb/gadget/legacy/zero.c +1
-0@@ -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");drivers/usb/gadget/legacy/zero.c +4
-0+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 intzero_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;drivers/usb/gadget/legacy/zero.c +1
-0+ 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
Greg KH
maintainerQuoted 6 lines · Manish Narani
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 <[email protected]>
Minor question, why would this be anything other than a LINUX PATCH? :)
Just "PATCH" is usually fine here.
And again, please no new module parameters if at all possible.
thanks,
greg k-h
Hi Greg,
Thanks for the suggestion. I will fix it and send you in next version. :)
Regards,
Manish
-----Original Message-----
From: Greg KH [mailto:[email protected]]
Sent: Thursday, September 29, 2016 4:56 PM
To: Manish Narani <[email protected]>
Cc: [email protected]; [email protected]; [email protected]; [email protected]; Manish Narani <[email protected]>; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; Anurag Kumar Vulisha <[email protected]>; Punnaiah Choudary Kalluri <[email protected]>
Subject: Re: [LINUX PATCH] usb: gadget: Configure data verification through module parameter in gadget zero
Quoted 5 lines · Manish Narani
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 <[email protected]>
Minor question, why would this be anything other than a LINUX PATCH? :)
Just "PATCH" is usually fine here.
And again, please no new module parameters if at all possible.
thanks,
greg k-h
This email and any attachments are intended for the sole use of the named recipient(s) and contain(s) confidential information that may be proprietary, privileged or copyrighted under applicable law. If you are not the intended recipient, do not read, copy, or forward this email message or any attachments. Delete this email message and any attachments immediately.