@@ -96,6 +96,21 @@ config USB_GADGET_VBUS_DRAW
This value will be used except for system-specific gadget
drivers that have more specific information.
+config USB_GADGET_STORAGE_NUM_BUFFERS
+ int "Number of storage pipeline buffers"
+ range 2 64
+ default 2
+ help
+ Usually 2 buffers are enough to establish a good
+ buffering pipeline. But when dealing with expensive
+ request preparation (i.e. dma_map) there may be benefits of
+ increasing the number of buffers. There is an extra cost for
+ every first request, the others are prepared in parallel with
+ an ongoing transfer. Every time all buffers are consumed there is
+ an additional cost for the first request. Increasing the number
+ of buffers decreases the risk of running out of buffers.
+ If unsure, say 2.
+
config USB_GADGET_SELECTED
boolean
@@ -262,8 +262,11 @@ static struct fsg_lun *fsg_lun_from_dev(struct device *dev)
#define EP0_BUFSIZE 256
#define DELAYED_STATUS (EP0_BUFSIZE + 999) /* An impossibly large value */
-/* Number of buffers we will use. 2 is enough for double-buffering */
-#define FSG_NUM_BUFFERS 2
+/*
+ * Number of buffers we will use.
+ * 2 is usually enough for good buffering pipeline
+ */
+#define FSG_NUM_BUFFERS CONFIG_USB_GADGET_STORAGE_NUM_BUFFERS
/* Default size of buffer length. */
#define FSG_BUFLEN ((u32)16384)