From patchwork Wed Jun 17 05:42:57 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Macpaul Lin X-Patchwork-Id: 11609055 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id D791592A for ; Wed, 17 Jun 2020 05:43:22 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id C0DBB207E8 for ; Wed, 17 Jun 2020 05:43:22 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=mediatek.com header.i=@mediatek.com header.b="bIYfQxQM" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725929AbgFQFnT (ORCPT ); Wed, 17 Jun 2020 01:43:19 -0400 Received: from mailgw02.mediatek.com ([210.61.82.184]:1574 "EHLO mailgw02.mediatek.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1725851AbgFQFnS (ORCPT ); Wed, 17 Jun 2020 01:43:18 -0400 X-UUID: 4d3606af9abb4eb3b71ff1d3b9ba594b-20200617 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=mediatek.com; s=dk; h=Content-Transfer-Encoding:Content-Type:MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:CC:To:From; bh=rdDoFRdKNzLFxd2DJUrNxctB8vmIe5DS4Jzw+A+aOnM=; b=bIYfQxQM3ixEWbj5ddGKb24ocTww1yEbDTKx/93ZPyi8XNFz2M6uH+9eRIrW6rDf0VbYOgfD5Y1BnL2k0VWGBSeg0QcT7JLHLhZxjWt1NpASrJ/eEmDrLjMo8FRJbFjPFx3Qab69Dl11ksLchHh5nmX6ZEFRj1y53VoKuxR63zM=; X-UUID: 4d3606af9abb4eb3b71ff1d3b9ba594b-20200617 Received: from mtkcas07.mediatek.inc [(172.21.101.84)] by mailgw02.mediatek.com (envelope-from ) (Cellopoint E-mail Firewall v4.1.10 Build 0809 with TLS) with ESMTP id 854175745; Wed, 17 Jun 2020 13:43:14 +0800 Received: from mtkcas08.mediatek.inc (172.21.101.126) by mtkmbs08n1.mediatek.inc (172.21.101.55) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Wed, 17 Jun 2020 13:43:12 +0800 Received: from mtkswgap22.mediatek.inc (172.21.77.33) by mtkcas08.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.0.1497.2 via Frontend Transport; Wed, 17 Jun 2020 13:43:12 +0800 From: Macpaul Lin To: Alan Stern , Chunfeng Yun , Greg Kroah-Hartman , Felipe Balbi , Matthias Brugger , =?utf-8?b?TWljaGHFgiBNaXJvc8WCYXc=?= , Sergey Organov , Fabrice Gasnier , , , , CC: Mediatek WSD Upstream , Macpaul Lin , Macpaul Lin Subject: [PATCH v3] usb: gadget: u_serial: improve performance for large data Date: Wed, 17 Jun 2020 13:42:57 +0800 Message-ID: <1592372577-7986-1-git-send-email-macpaul.lin@mediatek.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1592362007-7120-1-git-send-email-macpaul.lin@mediatek.com> References: <1592362007-7120-1-git-send-email-macpaul.lin@mediatek.com> MIME-Version: 1.0 X-MTK: N Sender: linux-usb-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org Nowadays some embedded systems use VCOM to transfer large log and data. Take LTE MODEM as an example, during the long debugging stage, large log and data were transfer through VCOM when doing field try or in operator's lab. Here we suggest slightly increase the transfer buffer in u_serial.c for performance improving. Signed-off-by: Macpaul Lin --- Changes for v2: - Drop previous patch for adding flag which indicates hardware capability in gadget.h and in DMA engine according to Alan's suggestion. Thanks. - Replace requested buffer size "REQ_BUF_SIZE" instead of checking hardware capability. - Refine commit messages. Changes for v3: - Code: no change. Commit: Add missing change log in v2. drivers/usb/gadget/function/u_serial.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/usb/gadget/function/u_serial.c b/drivers/usb/gadget/function/u_serial.c index 3cfc6e2..d7912a9 100644 --- a/drivers/usb/gadget/function/u_serial.c +++ b/drivers/usb/gadget/function/u_serial.c @@ -80,6 +80,7 @@ #define QUEUE_SIZE 16 #define WRITE_BUF_SIZE 8192 /* TX only */ #define GS_CONSOLE_BUF_SIZE 8192 +#define REQ_BUF_SIZE 4096 /* console info */ struct gs_console { @@ -247,7 +248,7 @@ static int gs_start_tx(struct gs_port *port) break; req = list_entry(pool->next, struct usb_request, list); - len = gs_send_packet(port, req->buf, in->maxpacket); + len = gs_send_packet(port, req->buf, REQ_BUF_SIZE); if (len == 0) { wake_up_interruptible(&port->drain_wait); break; @@ -514,7 +515,7 @@ static int gs_alloc_requests(struct usb_ep *ep, struct list_head *head, * be as speedy as we might otherwise be. */ for (i = 0; i < n; i++) { - req = gs_alloc_req(ep, ep->maxpacket, GFP_ATOMIC); + req = gs_alloc_req(ep, REQ_BUF_SIZE, GFP_ATOMIC); if (!req) return list_empty(head) ? -ENOMEM : 0; req->complete = fn;