Message ID | 20221018215044.765044-5-w36195@motorola.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:3c08:b0:7f:eb39:1b51 with SMTP id e8csp3542369dys; Tue, 18 Oct 2022 14:56:06 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5GujXcT8/hxI1L16lD4BQbrmoBrL3KtcASDPOwdPL3KUEsY02pRbNXWfiZMRhGZIWvNnVp X-Received: by 2002:a17:906:eeca:b0:730:6880:c397 with SMTP id wu10-20020a170906eeca00b007306880c397mr4124202ejb.593.1666130166146; Tue, 18 Oct 2022 14:56:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666130166; cv=none; d=google.com; s=arc-20160816; b=SlAuYlyo4Q3ZFtu+nLXmfrYI3jsDPTIzur1Fch+Hktfds1SorLd8j3EEefHd0e2NrR Y7sn8r4thuRwTIgJOymIDZ+ZOwcaBYdGJuEZ50obhfG4xNKd6GZ8+6V5KRzQb/89Dv6u X8pQiWfahVY4UqwFyzUtY14KQxmFBeXi4gYp0PL6azyP/S06bVy83aMKsuKj7jhzFM09 BXMpZwYA/8bSUeFmIoNNNhJPxliwV/iZdG2Oba33sZzIJm0Z+iGjmi4+oiqPU+0Oey7L /Cr3nOA4tDjNMgxELu2/fVjtLSI432Rxz0zWzR1Zo+hrotu1NiOmmkbGHCqdevEJFFwZ T2iQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=sRQxZis6uCJYVoJAnHknw5dTcE1MWsQ1xSYk7VRSQkM=; b=o4NVs067mo6/EwUzH3IfDFHd7Xepr+QUOrVaElGVAcqSCr93iNha0GHgbyvwVC3RFx Td2W2kUvCe6NdMVZk+vAUp32/OcgOsIINhtUTFoDCWA7ANd3V8T+occHhoK0imtEQrCv wxOoUrcTfPjez2w1Aiw/JQvaeBHJERBQ8wbS16joigcnEtPuYiUJ/BrHWQsZh0atxweX UzioJG0vKufzblY0T+V6Z5jOQ929/cnwHCubLpi7vo/hkuKZrFy42NObgjgSGCOhZuhm Si+FbjLO+4aMk4sppFFFAMoRMajNpjlk/6g1NQmx1XbzGCsG91jvrMh38W0UqAvGEqFt Dj2Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@motorola.com header.s=Selector header.b=J8RVRD+t; 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=motorola.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id hq38-20020a1709073f2600b0078bb4d5db86si11875916ejc.77.2022.10.18.14.55.36; Tue, 18 Oct 2022 14:56:06 -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=@motorola.com header.s=Selector header.b=J8RVRD+t; 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=motorola.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230046AbiJRVvj (ORCPT <rfc822;toshivichauhan@gmail.com> + 99 others); Tue, 18 Oct 2022 17:51:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35226 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229917AbiJRVv2 (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Tue, 18 Oct 2022 17:51:28 -0400 Received: from mail1.bemta35.messagelabs.com (mail1.bemta35.messagelabs.com [67.219.250.2]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2363BBE2F5; Tue, 18 Oct 2022 14:51:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=motorola.com; s=Selector; t=1666129887; i=@motorola.com; bh=sRQxZis6uCJYVoJAnHknw5dTcE1MWsQ1xSYk7VRSQkM=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version:Content-Transfer-Encoding; b=J8RVRD+t/ZOLfV4xw6PbYaduZsKrrq6d01ANwX8eMn19amTViOxmsz4fMm0HIge/x wjpnv+snKMgESPP1fdjBzbpbCtDMyoYVloGtHOTk1xk5Yja7H3p1s1C9oFLzQ7YY+g OKuOgk+E7fzpbvxNmdk/xFgA7nSy54NUnOu83IulPLP273QHOjm674l5IB9mNHMKwZ I3FfC7F9O9MezRlvKkaX+Iy+AS/74/a2I9SezbevTFZc1Xksf/FcYjZkmRON9VvX2b 6TAiPwzvR/de4yAxYMFxJzejSJbJSOSEmE+Alz+JqKacx3ezkcu1NSUMdKOt6+vMOx 5jeQNOH5A2rlQ== X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFvrMIsWRWlGSWpSXmKPExsUyYU+Ds+49ef9 kg461ZhbH2p6wWzw50M5o0btsD5tF8+L1bBadE5ewWyxsW8JicXnXHDaLRctamS22tF1hsvjx p4/ZYsHGR4wWqxYcYHfg8ZjdMZPVY9OqTjaP/XPXsHss7pvM6tH/18Bjy/7PjB6fN8kFsEexZ uYl5VcksGbsaj7PUvCVq2JZ2y7mBsZNnF2MXBxCAtOYJDbP/MjexcgJ5Kxjkph7wRrEZhNQk1 jwehUziC0iICtx+MpvZpAGZoEGFonLPddZuhg5OIQFfCWmTzECMVkEVCUmL00GKecVsJS4cmE 1E4gtISAvsf/gWbAxnAJWEl0P21ggVllKPG69wgpRLyhxcuYTsDgzUH3z1tnMExh5ZyFJzUKS WsDItIrRrDi1qCy1SNfQQi+pKDM9oyQ3MTNHL7FKN1GvtFi3PLW4RNdIL7G8WC+1uFivuDI3O SdFLy+1ZBMjMPxTihJ6djBuX/ZH7xCjJAeTkijvnG9+yUJ8SfkplRmJxRnxRaU5qcWHGGU4OJ QkeDml/JOFBItS01Mr0jJzgLEIk5bg4FES4U2TAUrzFhck5hZnpkOkTjHqcnTu7zrALMSSl5+ XKiXOyy0LVCQAUpRRmgc3ApYWLjHKSgnzMjIwMAjxFKQW5WaWoMq/YhTnYFQS5j0AsoonM68E btMroCOYgI4w3eIHckRJIkJKqoHJ9u+xvb/2ZVtfvXRGgPP2nrRnzxiNjkWqGQaHuoQ7l3Qy3 VSfo8zU2KTExjmBRye09onuzceJStJ/nq650nz/FcdT/tq9Te8Kvc5lrFcs8K/3e5y8onCC4K 41TSdre65WPvt5nNcj9sSfyncXf1pN8y/5kth05UjAq8sTt88xkr4t1P9a5+a0lpXZTC7c1mW aHO+slxqKrE1iq3lfPHXjQdv800s/COkqWU7NcT67q3Qqw7fPNxre317C/8VParHoGs55Jw+J HFPNPb/s0yatGVYTTs87ZMqdVu+o4Xd9o/7dHVrOscqLv+72fSLK9C7w62/pqo0vLG1+N5itf 2u8huWkmlfY+lqnlwknVnuoK7EUZyQaajEXFScCABQo1EOGAwAA X-Env-Sender: w36195@motorola.com X-Msg-Ref: server-19.tower-655.messagelabs.com!1666129886!235534!1 X-Originating-IP: [144.188.128.67] X-SYMC-ESS-Client-Auth: outbound-route-from=pass X-StarScan-Received: X-StarScan-Version: 9.87.3; banners=-,-,- X-VirusChecked: Checked Received: (qmail 25603 invoked from network); 18 Oct 2022 21:51:26 -0000 Received: from unknown (HELO ilclpfpp01.lenovo.com) (144.188.128.67) by server-19.tower-655.messagelabs.com with ECDHE-RSA-AES256-GCM-SHA384 encrypted SMTP; 18 Oct 2022 21:51:26 -0000 Received: from va32lmmrp02.lenovo.com (va32lmmrp02.mot.com [10.62.176.191]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by ilclpfpp01.lenovo.com (Postfix) with ESMTPS id 4MsSHL0mqwzfBZq; Tue, 18 Oct 2022 21:51:26 +0000 (UTC) Received: from p1g3.mot.com (unknown [100.64.172.121]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) (Authenticated sender: w36195) by va32lmmrp02.lenovo.com (Postfix) with ESMTPSA id 4MsSHK56klzf6WS; Tue, 18 Oct 2022 21:51:25 +0000 (UTC) From: Dan Vacura <w36195@motorola.com> To: linux-usb@vger.kernel.org Cc: Daniel Scally <dan.scally@ideasonboard.com>, Thinh Nguyen <Thinh.Nguyen@synopsys.com>, Jeff Vanhoof <qjv001@motorola.com>, stable@vger.kernel.org, Dan Vacura <w36195@motorola.com>, Greg Kroah-Hartman <gregkh@linuxfoundation.org>, Jonathan Corbet <corbet@lwn.net>, Laurent Pinchart <laurent.pinchart@ideasonboard.com>, Felipe Balbi <balbi@kernel.org>, Paul Elder <paul.elder@ideasonboard.com>, Michael Grzeschik <m.grzeschik@pengutronix.de>, linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org Subject: [PATCH v4 4/6] usb: gadget: uvc: fix sg handling during video encode Date: Tue, 18 Oct 2022 16:50:40 -0500 Message-Id: <20221018215044.765044-5-w36195@motorola.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20221018215044.765044-1-w36195@motorola.com> References: <20221018215044.765044-1-w36195@motorola.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS autolearn=ham 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: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747064104745329020?= X-GMAIL-MSGID: =?utf-8?q?1747064104745329020?= |
Series |
uvc gadget performance issues
|
|
Commit Message
Dan Vacura
Oct. 18, 2022, 9:50 p.m. UTC
From: Jeff Vanhoof <qjv001@motorola.com> In uvc_video_encode_isoc_sg, the uvc_request's sg list is incorrectly being populated leading to corrupt video being received by the remote end. When building the sg list the usage of buf->sg's 'dma_length' field is not correct and instead its 'length' field should be used. Fixes: e81e7f9a0eb9 ("usb: gadget: uvc: add scatter gather support") Cc: <stable@vger.kernel.org> Signed-off-by: Jeff Vanhoof <qjv001@motorola.com> Signed-off-by: Dan Vacura <w36195@motorola.com> --- V1 -> V3: - no change, new patch in series V3 -> V4: - no change drivers/usb/gadget/function/uvc_video.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/usb/gadget/function/uvc_video.c b/drivers/usb/gadget/function/uvc_video.c index 5993e083819c..dd1c6b2ca7c6 100644 --- a/drivers/usb/gadget/function/uvc_video.c +++ b/drivers/usb/gadget/function/uvc_video.c @@ -157,10 +157,10 @@ uvc_video_encode_isoc_sg(struct usb_request *req, struct uvc_video *video, sg = sg_next(sg); for_each_sg(sg, iter, ureq->sgt.nents - 1, i) { - if (!len || !buf->sg || !sg_dma_len(buf->sg)) + if (!len || !buf->sg || !buf->sg->length) break; - sg_left = sg_dma_len(buf->sg) - buf->offset; + sg_left = buf->sg->length - buf->offset; part = min_t(unsigned int, len, sg_left); sg_set_page(iter, sg_page(buf->sg), part, buf->offset);