diff mbox

[v2,5/5] usb: gadget: mass_storage: allow for deeper queue lengths

Message ID 20150915201717.GV19948@saruman.tx.rr.com
State Superseded
Headers show

Commit Message

Felipe Balbi Sept. 15, 2015, 8:17 p.m. UTC
hi,

On Tue, Sep 15, 2015 at 03:24:19PM -0400, Alan Stern wrote:
> > @@ -2662,7 +2662,7 @@ EXPORT_SYMBOL_GPL(fsg_common_put);
> >  /* check if fsg_num_buffers is within a valid range */
> >  static inline int fsg_num_buffers_validate(unsigned int fsg_num_buffers)
> >  {
> > -	if (fsg_num_buffers >= 2 && fsg_num_buffers <= 4)
> > +	if (fsg_num_buffers >= 2 && fsg_num_buffers <= 32)
> >  		return 0;
> >  	pr_err("fsg_num_buffers %u is out of range (%d to %d)\n",
> >  	       fsg_num_buffers, 2, 4);
> 
> You should fix up this pr_err() statement accordingly.  Maybe #define a 
> preprocessor symbol for the upper limit.

8<-----------------------------------------------------------------------

From b1ede0faf6e4961842f80e5e2fc1bf5373fef235 Mon Sep 17 00:00:00 2001
From: Felipe Balbi <balbi@ti.com>
Date: Tue, 15 Sep 2015 09:39:45 -0500
Subject: [PATCHv3] usb: gadget: mass_storage: allow for deeper queue lengths

Instead of allowing a range of 2 to 4 requests,
let's allow the user choose up to 32 requests
as that will give us a better chance of keeping
controller busy.

We still maintain default of 2 so users shouldn't
be affected.

Signed-off-by: Felipe Balbi <balbi@ti.com>
---

changes since v2:
	- fix pr_err()
	- add max_num_buffers macro

 drivers/usb/gadget/Kconfig                   | 2 +-
 drivers/usb/gadget/function/f_mass_storage.c | 6 ++++--
 2 files changed, 5 insertions(+), 3 deletions(-)
diff mbox

Patch

diff --git a/drivers/usb/gadget/Kconfig b/drivers/usb/gadget/Kconfig
index bcf83c0a6e62..33834aa09ed4 100644
--- a/drivers/usb/gadget/Kconfig
+++ b/drivers/usb/gadget/Kconfig
@@ -113,7 +113,7 @@  config USB_GADGET_VBUS_DRAW
 
 config USB_GADGET_STORAGE_NUM_BUFFERS
 	int "Number of storage pipeline buffers"
-	range 2 4
+	range 2 32
 	default 2
 	help
 	   Usually 2 buffers are enough to establish a good buffering
diff --git a/drivers/usb/gadget/function/f_mass_storage.c b/drivers/usb/gadget/function/f_mass_storage.c
index a6eb537d7768..ef3a1164b58c 100644
--- a/drivers/usb/gadget/function/f_mass_storage.c
+++ b/drivers/usb/gadget/function/f_mass_storage.c
@@ -2662,10 +2662,12 @@  EXPORT_SYMBOL_GPL(fsg_common_put);
 /* check if fsg_num_buffers is within a valid range */
 static inline int fsg_num_buffers_validate(unsigned int fsg_num_buffers)
 {
-	if (fsg_num_buffers >= 2 && fsg_num_buffers <= 4)
+#define FSG_MAX_NUM_BUFFERS	32
+
+	if (fsg_num_buffers >= 2 && fsg_num_buffers <= FGS_MAX_NUM_BUFFERS)
 		return 0;
 	pr_err("fsg_num_buffers %u is out of range (%d to %d)\n",
-	       fsg_num_buffers, 2, 4);
+	       fsg_num_buffers, 2, FSG_MAX_NUM_BUFFERS);
 	return -EINVAL;
 }