Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 00d171a3 authored by Hemant Kumar's avatar Hemant Kumar
Browse files

usb: gadget: f_mtp: Increase default TX buffer size



Increasing buffer size from 16k to 1MB improves throughput
from 36MBps to 77MBps with 8 usb request buffers. Hence add
default TX buffer macro of 1MB size and try to allocate the
same.

Change-Id: Ifebf5cbe46e24ae019829db388550d47fd4a5ff4
Signed-off-by: default avatarHemant Kumar <hemantk@codeaurora.org>
parent b78dea62
Loading
Loading
Loading
Loading
+6 −8
Original line number Diff line number Diff line
@@ -43,6 +43,7 @@
#include "configfs.h"

#define MTP_RX_BUFFER_INIT_SIZE    1048576
#define MTP_TX_BUFFER_INIT_SIZE    1048576
#define MTP_BULK_BUFFER_SIZE       16384
#define INTR_BUFFER_SIZE           28
#define MAX_INST_NAME_LEN          40
@@ -82,7 +83,7 @@
unsigned int mtp_rx_req_len = MTP_RX_BUFFER_INIT_SIZE;
module_param(mtp_rx_req_len, uint, 0644);

unsigned int mtp_tx_req_len = MTP_BULK_BUFFER_SIZE;
unsigned int mtp_tx_req_len = MTP_TX_BUFFER_INIT_SIZE;
module_param(mtp_tx_req_len, uint, 0644);

unsigned int mtp_tx_reqs = MTP_TX_REQ_MAX;
@@ -527,9 +528,6 @@ static int mtp_create_bulk_endpoints(struct mtp_dev *dev,
	dev->ep_intr = ep;

retry_tx_alloc:
	if (mtp_tx_req_len > MTP_BULK_BUFFER_SIZE)
		mtp_tx_reqs = 4;

	/* now allocate requests for our endpoints */
	for (i = 0; i < mtp_tx_reqs; i++) {
		req = mtp_request_new(dev->ep_in, mtp_tx_req_len);
@@ -747,8 +745,8 @@ static ssize_t mtp_write(struct file *fp, const char __user *buf,
			break;
		}

		if (count > MTP_BULK_BUFFER_SIZE)
			xfer = MTP_BULK_BUFFER_SIZE;
		if (count > mtp_tx_req_len)
			xfer = mtp_tx_req_len;
		else
			xfer = count;
		if (xfer && copy_from_user(req->buf, buf, xfer)) {
@@ -844,8 +842,8 @@ static void send_file_work(struct work_struct *data)
			break;
		}

		if (count > MTP_BULK_BUFFER_SIZE)
			xfer = MTP_BULK_BUFFER_SIZE;
		if (count > mtp_tx_req_len)
			xfer = mtp_tx_req_len;
		else
			xfer = count;