Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp3424847pxf; Mon, 29 Mar 2021 01:41:49 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyCZwURq/Z2mzbOm8znY5NlqW4MQDQGXC/qLwomxeKHKSPZA/75XJM20E71Ofa1f0bnAnUt X-Received: by 2002:a05:6402:105a:: with SMTP id e26mr27523374edu.164.1617007309362; Mon, 29 Mar 2021 01:41:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1617007309; cv=none; d=google.com; s=arc-20160816; b=iWxe/0A0rlhOeMYprBWwDRi/QrEFgd4zdN7xKY6tgYEeTN/gzrSADlb4Qx3NP5nHMp nXVraxyLd0EKWNUWXlE0fwZaZZaJSUVDVRt84WgoMmhAEM53ZeFqwW3AWPIDl1j7lARU qZz7bXWOROx/GRXG4XnSnPkvQC5VEDopmafxKrKojQOg9Gyd5K/YJyPurVvyxk+ETOKA 6Fc6/YHhcfeGrwqzkFRVECp1pPXUkMk6TVYM7gCzdl7ncsfoLh4E+k4hE+dN8HZvXT8G mnkR2nHLb0EDZg04+zRsG25i4/T6WR1/bEGT7KHSju+z8Azsnzrdus5h6r6wOo+9thjs hX+g== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=Kqwllqn81+0gJbjDBTFcKc8Maf6LShE/edz8u3YrZ3Q=; b=VYlaTy9tN4BdOGemtTv6W1eHfyNhhcsGzIW5PRMepQxojiBCJQoV8rJi3gcds4cuCA k7+M8OqddL3Ap5xIpERuVtnSxvE3JFGPIZRzeZQj0cpKlV983SuitEaf0aHRPTZK75Iq NiAobYP4bNSvVirMsY/FyeMi+p04C3HMyxW7xJzu9FWC+X47oiYPxitDR5TWQ6rjOSOD 2+6dxCyQqiFP8Llskd2T3RIhfb1sM5zKKWTvs2toQEot53FabycNnZbbX40dr+vMOvu4 UeDe3EFz49zIdjv9uIDb3ZMTu9RgxJTnYiNq9x8BXnYQSqa9Jt+9X6t0JLO0kLtq7NOw 6Aaw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=BDdUERaN; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id h15si12583812edv.182.2021.03.29.01.41.27; Mon, 29 Mar 2021 01:41:49 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=BDdUERaN; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234861AbhC2Ijr (ORCPT + 99 others); Mon, 29 Mar 2021 04:39:47 -0400 Received: from mail.kernel.org ([198.145.29.99]:40920 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233532AbhC2IXe (ORCPT ); Mon, 29 Mar 2021 04:23:34 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 5C9DA61580; Mon, 29 Mar 2021 08:23:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1617006213; bh=RjTHXO6Y1HVtNgvT3dwUnJOsHYYDzs5H0UOvVN4LW5M=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=BDdUERaNDkIV0z18ipNedtVIJsK2vwMnRt9uktyAXwfNEIPxs6uGouMb675nIrhgQ 2IcE81RRMmztVDcQ4HxAmZllwdx4G+dmJquvVOK18Ky0W6qSiNvE7g6va2QuSlwKji /5yZq51EjP7+JqSBScUGUgdh5fncA67e13yx0SWc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Robert Davies , Hayes Wang , "David S. Miller" , Sasha Levin Subject: [PATCH 5.10 159/221] r8152: limit the RX buffer size of RTL8153A for USB 2.0 Date: Mon, 29 Mar 2021 09:58:10 +0200 Message-Id: <20210329075634.467235800@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210329075629.172032742@linuxfoundation.org> References: <20210329075629.172032742@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Hayes Wang [ Upstream commit f91a50d8b51b5c8ef1cfb08115a005bba4250507 ] If the USB host controller is EHCI, the throughput is reduced from 300Mb/s to 60Mb/s, when the rx buffer size is modified from 16K to 32K. According to the EHCI spec, the maximum size of the qTD is 20K. Therefore, when the driver uses more than 20K buffer, the latency time of EHCI would be increased. And, it let the RTL8153A get worse throughput. However, the driver uses alloc_pages() for rx buffer, so I limit the rx buffer to 16K rather than 20K. BugLink: https://bugzilla.kernel.org/show_bug.cgi?id=205923 Fixes: ec5791c202ac ("r8152: separate the rx buffer size") Reported-by: Robert Davies Signed-off-by: Hayes Wang Signed-off-by: David S. Miller Signed-off-by: Sasha Levin --- drivers/net/usb/r8152.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/net/usb/r8152.c b/drivers/net/usb/r8152.c index d2862071b697..f5010f8ac1ec 100644 --- a/drivers/net/usb/r8152.c +++ b/drivers/net/usb/r8152.c @@ -6519,7 +6519,10 @@ static int rtl_ops_init(struct r8152 *tp) ops->in_nway = rtl8153_in_nway; ops->hw_phy_cfg = r8153_hw_phy_cfg; ops->autosuspend_en = rtl8153_runtime_enable; - tp->rx_buf_sz = 32 * 1024; + if (tp->udev->speed < USB_SPEED_SUPER) + tp->rx_buf_sz = 16 * 1024; + else + tp->rx_buf_sz = 32 * 1024; tp->eee_en = true; tp->eee_adv = MDIO_EEE_1000T | MDIO_EEE_100TX; break; -- 2.30.1