Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp1564543rwd; Thu, 18 May 2023 13:57:07 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5awDudshD232ypd/4AKdtJgIND8JV0AtcecanJsSMYM8CHBiwn2FDON8oEPVIu7x8ErTeP X-Received: by 2002:a17:902:d490:b0:1aa:ed72:5c2e with SMTP id c16-20020a170902d49000b001aaed725c2emr279046plg.61.1684443427600; Thu, 18 May 2023 13:57:07 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1684443427; cv=pass; d=google.com; s=arc-20160816; b=fW9qb3IAx7U8e1bLYRvinYuD8hALMTlgxA3sHK3+hg9jhf/wSOEnwtKUD2L/A2PYPU vpdfRn2yIv/rRxmYzpaswlI/wGTUH0qs88WRCVlEXeTjCJnObqCbx7xfoLOXBudvACll +Y+NIEUgDhWIqjjjD9CrOgSH4JVtAU+HRC+2NCMbXQZcm890KzZVvkvo3Gs9Dk2Xr7cd Tc+wG9UkS4kNQS+gNhQID+szBbey+W+G5Upo/WQ/dwSxigPyX6oS5omO64XxepIPvRIV gHNgkQfEJH1GQxJg3Zk1SKQdx9Ae0OM7befgKQE/2QZfM/PESWCNSd+NRzsKKOnP/GP3 NNqA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:content-transfer-encoding :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=IrbGwBi3y5La9AdH8NwmvRP69reNLtNcsb/1Qy6ETwg=; b=0mznlqPcWRuFPl5slqOVCYEgvVD+rcHhvS5sG6URC/gLGVO9oxv3hdgReBoxU3zfj0 z5otQy5TdeQ9gD0PTaJJTMjoVpg7hzLK6pnl57w5F2uCro8Bl/AeLNZ0WZ75nltEjd2C TYUuHXcwntA7aJ0rillNtyVlMBWlJaAgQLoL+rGN0aXCacVv12CBdkjCkSAvpGG/Tvcc r2Mts6NjKQNmtNJ+BiBWG+RqfUT4RozobaLNlVSDty9XFlCYHvMBN2p7tiyXQ9Pz0wUb jIDts47tUkQQjk952QJksZCkvskp6SYNfwVArTB6LYs8qWAfkRE2CjVG41GxiJlT3omW IeVg== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@nxp.com header.s=selector2 header.b=AcXqw5qy; arc=pass (i=1 spf=pass spfdomain=nxp.com dkim=pass dkdomain=nxp.com dmarc=pass fromdomain=nxp.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=nxp.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id c9-20020a170903234900b0019cec50618csi2418686plh.159.2023.05.18.13.56.52; Thu, 18 May 2023 13:57:07 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@nxp.com header.s=selector2 header.b=AcXqw5qy; arc=pass (i=1 spf=pass spfdomain=nxp.com dkim=pass dkdomain=nxp.com dmarc=pass fromdomain=nxp.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=nxp.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230405AbjERUvH (ORCPT + 99 others); Thu, 18 May 2023 16:51:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59032 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230407AbjERUvA (ORCPT ); Thu, 18 May 2023 16:51:00 -0400 Received: from EUR05-VI1-obe.outbound.protection.outlook.com (mail-vi1eur05on20628.outbound.protection.outlook.com [IPv6:2a01:111:f400:7d00::628]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 83BD7171F; Thu, 18 May 2023 13:50:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=g7xpvvtokkMsT9m0uStMUoMTUh33Bzop+ylsn65a4GMX04FU5oxbDjfGV+qRVehD6iANrDKhctq8cxelnK/7viGY93d/rXvuSX2c1fGHi9ilPGXgYor8duwWv9O8efnbwCro9PyKpBr29FCM5DBSQr1g+Xt1NnctbHNwPWlFcx9BgH2pozNqXwNeuNnBUyjiqD6S9lwVZb/kK9ig5vybmgOw32i1Y5euQp4cQXd4bulXInxrryl/phG12do8LkJxQSbDx8LpIy2lECvfg+3seCLQz5j6svZC3EyhAI0avGY+SQlLkjLHWnnaRy7owtRJi0ciqXFas/Gk07GeIoq0hw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=IrbGwBi3y5La9AdH8NwmvRP69reNLtNcsb/1Qy6ETwg=; b=V0RgNwVdutOBHbvho5jTHG7AhO89LLXMVd+ah5FFxVS84P2CJwsl0xkawj3xwkw1rh4Q8q9xhgbXmgH+BBW1UssM9aGHRVCcEJg1n/KkQavMlniPoPQZlvimBtv9E6senD+oPyKVLw0Hd6bm2/wuSTHwgY+eaCLBA5kRyqcgcCUZqU//Ntu0wSMA3rXwKwkx5c7+RgnSV4KdhdjVnkdSJBZh7s6SyBn0nvpEu3PN5pyfLt0FQEQ5gWUBWiQD5WxSoETAOI3deESXqnC76PdxD9LuZ/BanTzD9s/kU7BYdbukyVAOdFNhhZk+VJqjcknmU3KxhHBhDDMlVgNU2Y5iAQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=IrbGwBi3y5La9AdH8NwmvRP69reNLtNcsb/1Qy6ETwg=; b=AcXqw5qyphZYO62oZKUSRxXAIwqknkfOFHS7QYQR053RmXh7Cc4uS3frEqECagSqylBkOwfHicJnYfR8ZxaV7joUK9Ql/7vvfZaXh8L6c2JxUPksMh7OxkSsjkGJXmvWA3Vwd0JAftibP8XgCpkPthILzsoV0RvtXKlCdb2QAbc= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from AM6PR04MB4838.eurprd04.prod.outlook.com (2603:10a6:20b:4::16) by DB9PR04MB8493.eurprd04.prod.outlook.com (2603:10a6:10:2c5::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6411.19; Thu, 18 May 2023 20:50:08 +0000 Received: from AM6PR04MB4838.eurprd04.prod.outlook.com ([fe80::25d3:de2:ef1:3884]) by AM6PR04MB4838.eurprd04.prod.outlook.com ([fe80::25d3:de2:ef1:3884%4]) with mapi id 15.20.6387.033; Thu, 18 May 2023 20:50:08 +0000 From: Frank Li To: Peter Chen , Pawel Laszczak , Roger Quadros , Aswath Govindraju , Greg Kroah-Hartman , linux-usb@vger.kernel.org (open list:CADENCE USB3 DRD IP DRIVER), linux-kernel@vger.kernel.org (open list) Cc: imx@lists.linux.dev Subject: [PATCH 2/2] usb: cdns3: optimize OUT transfer by copying only actual received data Date: Thu, 18 May 2023 16:49:46 -0400 Message-Id: <20230518204947.3770236-2-Frank.Li@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230518204947.3770236-1-Frank.Li@nxp.com> References: <20230518204947.3770236-1-Frank.Li@nxp.com> Content-Transfer-Encoding: 8bit Content-Type: text/plain X-ClientProxiedBy: BYAPR05CA0072.namprd05.prod.outlook.com (2603:10b6:a03:74::49) To AM6PR04MB4838.eurprd04.prod.outlook.com (2603:10a6:20b:4::16) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AM6PR04MB4838:EE_|DB9PR04MB8493:EE_ X-MS-Office365-Filtering-Correlation-Id: 1aa8cf26-6237-4324-78d9-08db57e1774d X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: siGy6BHWr2g9NvMXjPApdapllweWpf9GAutGksVlLXK6OcxY30CmdPyn8kXP9MpE+1WULuXRQlRqqpU61AM+K6zyoXcB2i/CxOSdlvMVsVVur2JsjyC1MVmitdlsVjsJBM+Tsq9YX0qvekWBONJuTXZ0aSdW33eAR8Q1CjsQwPpgfBoW4q9QwCbpq/1iDNhN6O6GEZJ1eHXiTbScY/25yc74r54BzQ01rVn2O//5ZQkce+2oZNKMGIuGkjZ5oFnzzBgyCbnnW68PmgLfRdGuXsbpVp8JiSjhN6zruR7F/lObL35GFvWhheGfu1fXnUSS0zvq6wmfKlVbFvD7U2p9qx4lsc8ukz6bMOnCw80SKpv6S5FkSKIElUjCL8uhg2gFPwoNTel84MaONkOxCOrJRRLuaya386ENZHWAhSZdEajtj21djLqXwzqlDDkmr2jg+eOQ0DamKjHWlpivoxGgKM/GvvRPVkOiBnQbl9Emi0KHGdFQZ121w8pXuLSsMMUTPiL2v4G7Zm3DCQtzl/9uGJQ56GzEmhyGSbEnVGuEbF87cH6L28kvLec6qz3qM6ZhlmU7Gg+dxhYByyIOtHdmgijq/80AG/paZHWrrFhvDMZ5mA6zuEUZ/P82AlxyClIj X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:AM6PR04MB4838.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230028)(4636009)(396003)(366004)(346002)(376002)(136003)(39860400002)(451199021)(110136005)(66476007)(4326008)(66946007)(52116002)(316002)(66556008)(478600001)(86362001)(36756003)(83380400001)(1076003)(6506007)(6512007)(186003)(26005)(2906002)(8676002)(2616005)(6666004)(8936002)(4744005)(5660300002)(41300700001)(38350700002)(6486002)(38100700002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?OgciEXco+u6x4MmN/LfqcUvXtmSnIH/+AzaRR3AcuuBoZ8mXj+g3IO4JTKq0?= =?us-ascii?Q?wgKQECO8RUovfYJ4DqdIsMdRSGP0FSr1tM03DvLHwJ/8FUTZoIr39CxM13u9?= =?us-ascii?Q?cx+RzpSwVuOwqFE4WLjQagGKplRrzD0Si61avluKWRJm7d2DDSPoFLOkyrc8?= =?us-ascii?Q?kzOVnioAIbuEbPPnoGTHK04Ko+K74+YMrkEU+uU2fEYQAxw8+B7LKrZ4q35X?= =?us-ascii?Q?OeTFE83vyYeO+hthQ1LA23eOQT6InL/K5pnL+dhg8RYiCf79D08Ad31mv20r?= =?us-ascii?Q?gATMWrDKYcxEj2fvo4kOG/f0ekWoR18n55vM/lkaXO9ck31CQG/wwu3Gvv7y?= =?us-ascii?Q?M2EW9XD3gs0DwMpR2YjsAYeLdGTN6yfHxd0L+rv7tEVB/sYcRUIkHKSpdMu6?= =?us-ascii?Q?Y/0pA8ppi1AjcvIKj4hzgCYxuFqaa4Fd0i19Kfo66VP22oMgF82taDJ5XmCS?= =?us-ascii?Q?BJZ6qb5hU5+diwC1lyJZ9Wq4fy65AnQP8jz5AeYgiNcOuZMboxG+vjTdeJJb?= =?us-ascii?Q?rDJXGPjcKyExnodVsSUFEzAeCWEWPFyYdL8Fki9S2jjanSjj9Wk7nxMcGfLO?= =?us-ascii?Q?j3u1wU/DI3y9Z3qeG1KLRn+pKdI83AKPT8IeX6lnV/kao7C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5h4YdfDt4dlKJfvJGa1ULTlmaJqN9RkzTXZTDauJC?= =?us-ascii?Q?GrcTGh1ZVEbq22dtsL4=3D?= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 1aa8cf26-6237-4324-78d9-08db57e1774d X-MS-Exchange-CrossTenant-AuthSource: AM6PR04MB4838.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 May 2023 20:50:08.6792 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: vMwivOhbEMb1zFVNSAkowk1QSCpKRGzc/MyV/yVict+Ka/JhcK7LKMkI2CjEiN7YDY/YqdlGhpMIjf2ros49vA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB9PR04MB8493 X-Spam-Status: No, score=-1.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FORGED_SPF_HELO, RCVD_IN_DNSWL_NONE,SPF_HELO_PASS,T_SCC_BODY_TEXT_LINE,T_SPF_PERMERROR autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Previously, the entire length of the request, which is equal to or greater than the actual data, was dma synced and memcpy when using the bounce buffer. Actually only the actual data indicated by request->actual need be synced and copied. Signed-off-by: Frank Li --- drivers/usb/cdns3/cdns3-gadget.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/usb/cdns3/cdns3-gadget.c b/drivers/usb/cdns3/cdns3-gadget.c index 09a0882a4e97..ea19253fd2d0 100644 --- a/drivers/usb/cdns3/cdns3-gadget.c +++ b/drivers/usb/cdns3/cdns3-gadget.c @@ -809,10 +809,10 @@ void cdns3_gadget_giveback(struct cdns3_endpoint *priv_ep, /* Make DMA buffer CPU accessible */ dma_sync_single_for_cpu(priv_dev->sysdev, priv_req->aligned_buf->dma, - priv_req->aligned_buf->size, + request->actual, priv_req->aligned_buf->dir); memcpy(request->buf, priv_req->aligned_buf->buf, - request->length); + request->actual); } priv_req->flags &= ~(REQUEST_PENDING | REQUEST_UNALIGNED); -- 2.34.1