From patchwork Wed Apr 26 12:28:03 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hayes Wang X-Patchwork-Id: 87854 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp210106vqo; Wed, 26 Apr 2023 05:41:40 -0700 (PDT) X-Google-Smtp-Source: AKy350YhQtsJkf5IIaJIYAtDyNAItbEThK6WLQ0AkaGX6zhvz4z9sZOycL7hwuIuHAsSBV4a9NB2 X-Received: by 2002:a17:902:d482:b0:1a2:2091:eeae with SMTP id c2-20020a170902d48200b001a22091eeaemr25845720plg.40.1682512900077; Wed, 26 Apr 2023 05:41:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1682512900; cv=none; d=google.com; s=arc-20160816; b=iDBmcmEF3wMz5sp2o5l77asKB/yab57w8OxFuOvgdO4sgSwXJwnG9GYdSrdZsupmMK eW/xS9Di1EBJxFdBFi6bp4y11y3GWS/OMqnuJeFgo1yJSXabQeunJn6PL9WZdVW684Jr LdYb99bECnOd6N/Wy6beMqVCegFRmS1MA2OxcH0ZR095umKjL3suhu15XdnBz8cGUsC4 2BMqoBY+5zTY8xnWDCK/uLE4xVttOp3+BaqD3A/jG0yJuP/1QGcTy+nzX5GzF6cf86BZ HF566YFWXeprpYfnxaeM9931KoragW3M5bRTj1daj7Oncu1qp+EiY1jGZaUax3CamYao mC7g== 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 :authenticated-by; bh=amhLFH1dvjc6SKJVfbdg+P6HDBLg+FkhB+CakLv0w44=; b=T0hWc6oJJr8SXNxusPmYQwaBKjBfoe1o3x1x+LMcOGef6bLF/u4FE6Ijf0hBU/NCYO nVqtkCLW3BauISf7p/KHEpULpDbYAU+nj8TW7NrHHvdQckrr0P35tDgrOxAj1RXfn4i2 JA8zON7PCBw8lKVU7GG61oOzVC3w7yjN5OO+QXfpu2nPeOTWXMVQyjGoOMoWknIT5pJb vYEzR/3c4Y7Sog8ymcd0YDuV/ILBfUI+ByPUB5+WUulzWwSWgOwwz5pW5m8F1kzG94dq 0/T2JQ+Ot6OuIk9MVPZKTwLAndLS8uBwmSKJwI3dj6n8zoOvMcJfvGvqx5/maNB6DNtt 5IEQ== ARC-Authentication-Results: i=1; mx.google.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 Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id k13-20020a170902c40d00b001a679c04970si18858004plk.251.2023.04.26.05.41.27; Wed, 26 Apr 2023 05:41:40 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240869AbjDZM24 (ORCPT + 99 others); Wed, 26 Apr 2023 08:28:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39770 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240293AbjDZM2z (ORCPT ); Wed, 26 Apr 2023 08:28:55 -0400 Received: from rtits2.realtek.com.tw (rtits2.realtek.com [211.75.126.72]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B6D615B9B; Wed, 26 Apr 2023 05:28:50 -0700 (PDT) Authenticated-By: X-SpamFilter-By: ArmorX SpamTrap 5.77 with qID 33QCScPrA006155, This message is accepted by code: ctloc85258 Received: from mail.realtek.com (rtexh36505.realtek.com.tw[172.21.6.25]) by rtits2.realtek.com.tw (8.15.2/2.81/5.90) with ESMTPS id 33QCScPrA006155 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=OK); Wed, 26 Apr 2023 20:28:38 +0800 Received: from RTEXMBS04.realtek.com.tw (172.21.6.97) by RTEXH36505.realtek.com.tw (172.21.6.25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.32; Wed, 26 Apr 2023 20:28:40 +0800 Received: from fc34.localdomain (172.22.228.98) by RTEXMBS04.realtek.com.tw (172.21.6.97) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.7; Wed, 26 Apr 2023 20:28:38 +0800 From: Hayes Wang To: , CC: , , , , Hayes Wang Subject: [PATCH net 1/3] r8152: fix flow control issue of RTL8156A Date: Wed, 26 Apr 2023 20:28:03 +0800 Message-ID: <20230426122805.23301-401-nic_swsd@realtek.com> X-Mailer: git-send-email 2.40.0 In-Reply-To: <20230426122805.23301-400-nic_swsd@realtek.com> References: <20230426122805.23301-400-nic_swsd@realtek.com> MIME-Version: 1.0 X-Originating-IP: [172.22.228.98] X-ClientProxiedBy: RTEXH36505.realtek.com.tw (172.21.6.25) To RTEXMBS04.realtek.com.tw (172.21.6.97) X-KSE-ServerInfo: RTEXMBS04.realtek.com.tw, 9 X-KSE-AntiSpam-Interceptor-Info: fallback X-KSE-Antivirus-Interceptor-Info: fallback X-KSE-AntiSpam-Interceptor-Info: fallback X-KSE-ServerInfo: RTEXH36505.realtek.com.tw, 9 X-KSE-AntiSpam-Interceptor-Info: fallback X-KSE-Antivirus-Interceptor-Info: fallback X-KSE-AntiSpam-Interceptor-Info: fallback X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE 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: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1764242646459368402?= X-GMAIL-MSGID: =?utf-8?q?1764242646459368402?= The feature of flow control becomes abnormal, if the device sends a pause frame and the tx/rx is disabled before sending a release frame. It causes the lost of packets. Set PLA_RX_FIFO_FULL and PLA_RX_FIFO_EMPTY to zeros before disabling the tx/rx. And, toggle FC_PATCH_TASK before enabling tx/rx to reset the flow control patch and timer. Then, the hardware could clear the state and the flow control becomes normal after enabling tx/rx. Fixes: 195aae321c82 ("r8152: support new chips") Signed-off-by: Hayes Wang --- drivers/net/usb/r8152.c | 56 ++++++++++++++++++++++++++--------------- 1 file changed, 36 insertions(+), 20 deletions(-) diff --git a/drivers/net/usb/r8152.c b/drivers/net/usb/r8152.c index 0fc4b959edc1..08d1786135f2 100644 --- a/drivers/net/usb/r8152.c +++ b/drivers/net/usb/r8152.c @@ -5986,6 +5986,25 @@ static void rtl8153_disable(struct r8152 *tp) r8153_aldps_en(tp, true); } +static inline u32 fc_pause_on_auto(struct r8152 *tp) +{ + return (ALIGN(mtu_to_size(tp->netdev->mtu), 1024) + 6 * 1024); +} + +static inline u32 fc_pause_off_auto(struct r8152 *tp) +{ + return (ALIGN(mtu_to_size(tp->netdev->mtu), 1024) + 14 * 1024); +} + +static void r8156_fc_parameter(struct r8152 *tp) +{ + u32 pause_on = tp->fc_pause_on ? tp->fc_pause_on : fc_pause_on_auto(tp); + u32 pause_off = tp->fc_pause_off ? tp->fc_pause_off : fc_pause_off_auto(tp); + + ocp_write_word(tp, MCU_TYPE_PLA, PLA_RX_FIFO_FULL, pause_on / 16); + ocp_write_word(tp, MCU_TYPE_PLA, PLA_RX_FIFO_EMPTY, pause_off / 16); +} + static int rtl8156_enable(struct r8152 *tp) { u32 ocp_data; @@ -5994,6 +6013,7 @@ static int rtl8156_enable(struct r8152 *tp) if (test_bit(RTL8152_UNPLUG, &tp->flags)) return -ENODEV; + r8156_fc_parameter(tp); set_tx_qlen(tp); rtl_set_eee_plus(tp); r8153_set_rx_early_timeout(tp); @@ -6025,9 +6045,24 @@ static int rtl8156_enable(struct r8152 *tp) ocp_write_word(tp, MCU_TYPE_USB, USB_L1_CTRL, ocp_data); } + ocp_data = ocp_read_word(tp, MCU_TYPE_USB, USB_FW_TASK); + ocp_data &= ~FC_PATCH_TASK; + ocp_write_word(tp, MCU_TYPE_USB, USB_FW_TASK, ocp_data); + usleep_range(1000, 2000); + ocp_data |= FC_PATCH_TASK; + ocp_write_word(tp, MCU_TYPE_USB, USB_FW_TASK, ocp_data); + return rtl_enable(tp); } +static void rtl8156_disable(struct r8152 *tp) +{ + ocp_write_word(tp, MCU_TYPE_PLA, PLA_RX_FIFO_FULL, 0); + ocp_write_word(tp, MCU_TYPE_PLA, PLA_RX_FIFO_EMPTY, 0); + + rtl8153_disable(tp); +} + static int rtl8156b_enable(struct r8152 *tp) { u32 ocp_data; @@ -6429,25 +6464,6 @@ static void rtl8153c_up(struct r8152 *tp) r8153b_u1u2en(tp, true); } -static inline u32 fc_pause_on_auto(struct r8152 *tp) -{ - return (ALIGN(mtu_to_size(tp->netdev->mtu), 1024) + 6 * 1024); -} - -static inline u32 fc_pause_off_auto(struct r8152 *tp) -{ - return (ALIGN(mtu_to_size(tp->netdev->mtu), 1024) + 14 * 1024); -} - -static void r8156_fc_parameter(struct r8152 *tp) -{ - u32 pause_on = tp->fc_pause_on ? tp->fc_pause_on : fc_pause_on_auto(tp); - u32 pause_off = tp->fc_pause_off ? tp->fc_pause_off : fc_pause_off_auto(tp); - - ocp_write_word(tp, MCU_TYPE_PLA, PLA_RX_FIFO_FULL, pause_on / 16); - ocp_write_word(tp, MCU_TYPE_PLA, PLA_RX_FIFO_EMPTY, pause_off / 16); -} - static void rtl8156_change_mtu(struct r8152 *tp) { u32 rx_max_size = mtu_to_size(tp->netdev->mtu); @@ -9340,7 +9356,7 @@ static int rtl_ops_init(struct r8152 *tp) case RTL_VER_10: ops->init = r8156_init; ops->enable = rtl8156_enable; - ops->disable = rtl8153_disable; + ops->disable = rtl8156_disable; ops->up = rtl8156_up; ops->down = rtl8156_down; ops->unload = rtl8153_unload; From patchwork Wed Apr 26 12:28:04 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hayes Wang X-Patchwork-Id: 87853 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp209987vqo; Wed, 26 Apr 2023 05:41:28 -0700 (PDT) X-Google-Smtp-Source: AKy350bXFDk/ty8/HjEzaO6ES5gdd8h446HyQh7lluBMHESy0p7Dp4eVz1lz8lSOzbdBwO1FGC/0 X-Received: by 2002:a05:6a20:8e1b:b0:d9:77f7:d62e with SMTP id y27-20020a056a208e1b00b000d977f7d62emr27776857pzj.36.1682512888297; Wed, 26 Apr 2023 05:41:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1682512888; cv=none; d=google.com; s=arc-20160816; b=zkERZWyMNN3nehUvfYraFQnojXYj/aAArnGGbCmAefW8i31z1PcehfkWXavT4hoWNI FExy05VplUz3PlB/UolpG9KkkxiLpyT8BLFYExM9xS3nKhrvgl8DNlIkZAMwWJEuGxCK lqQXHDJgGJGd+lmEzqLQuwBjOfCCM3nw0Xgv0tHRyd7cBtHtnXs7kNj5ACwVHowC3zNB qmxjwrsDeYBgEF/uKofXTk+ZIpP7yevllwRw/ac75Dbg8iMZkWKWXnSPzjfHCPbOGOgE +fXaSxKgWpo313SIUM2FuRi8GZkw09ZcfP3QT1I6kSE3LgBJ7NkCWkg/vSHsEXWQEzBR iS+w== 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 :authenticated-by; bh=BtOjKS9F2dgQZt6bllxbMA473BeBkqWD9YY/lvE4h3c=; b=tENB+78IBzo45rETxB4f3F3xjasJ1adge8iP3YLaYv1pLKgrVnIYyvZPSk25qEY7oB BhwB/vItCB4mEEB3kyAjexNxFdCmHoezMamoftsIavpRHqr5LwNxmWqo7sVDiwSmMMgT /+Df64lthbTnt7xexFePz3FGfgj5UCAo69kp+zYVefWpcPakopyNpZVbJnPiR57UoQPa cPHdVsNwgYiDmBhXueXwlH5/gyYPcfj6TgBU+EOzPhbdKmlwLytRANMb9QvrFlHoLQSG 7aQEKUNERwW0TPIsFV8Q+uzVDsfn1HZvaqLVxK5ayUKJOGNvSP40N3HnasIqfa2nuhVl wqsA== ARC-Authentication-Results: i=1; mx.google.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 Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id m14-20020a63580e000000b005137bf7e2d4si16614778pgb.652.2023.04.26.05.41.16; Wed, 26 Apr 2023 05:41:28 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240861AbjDZM3I (ORCPT + 99 others); Wed, 26 Apr 2023 08:29:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39914 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240873AbjDZM3F (ORCPT ); Wed, 26 Apr 2023 08:29:05 -0400 Received: from rtits2.realtek.com.tw (rtits2.realtek.com [211.75.126.72]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3A5415FCE; Wed, 26 Apr 2023 05:28:58 -0700 (PDT) Authenticated-By: X-SpamFilter-By: ArmorX SpamTrap 5.77 with qID 33QCSlRW2006564, This message is accepted by code: ctloc85258 Received: from mail.realtek.com (rtexh36506.realtek.com.tw[172.21.6.27]) by rtits2.realtek.com.tw (8.15.2/2.81/5.90) with ESMTPS id 33QCSlRW2006564 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=OK); Wed, 26 Apr 2023 20:28:47 +0800 Received: from RTEXMBS04.realtek.com.tw (172.21.6.97) by RTEXH36506.realtek.com.tw (172.21.6.27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.17; Wed, 26 Apr 2023 20:28:49 +0800 Received: from fc34.localdomain (172.22.228.98) by RTEXMBS04.realtek.com.tw (172.21.6.97) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.7; Wed, 26 Apr 2023 20:28:48 +0800 From: Hayes Wang To: , CC: , , , , Hayes Wang Subject: [PATCH net 2/3] r8152: fix the poor throughput for 2.5G devices Date: Wed, 26 Apr 2023 20:28:04 +0800 Message-ID: <20230426122805.23301-402-nic_swsd@realtek.com> X-Mailer: git-send-email 2.40.0 In-Reply-To: <20230426122805.23301-400-nic_swsd@realtek.com> References: <20230426122805.23301-400-nic_swsd@realtek.com> MIME-Version: 1.0 X-Originating-IP: [172.22.228.98] X-ClientProxiedBy: RTEXH36505.realtek.com.tw (172.21.6.25) To RTEXMBS04.realtek.com.tw (172.21.6.97) X-KSE-ServerInfo: RTEXMBS04.realtek.com.tw, 9 X-KSE-AntiSpam-Interceptor-Info: fallback X-KSE-Antivirus-Interceptor-Info: fallback X-KSE-AntiSpam-Interceptor-Info: fallback X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE 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: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1764242634067561722?= X-GMAIL-MSGID: =?utf-8?q?1764242634067561722?= Fix the poor throughput for 2.5G devices, when changing the speed from auto mode to force mode. This patch is used to notify the MAC when the mode is changed. Fixes: 195aae321c82 ("r8152: support new chips") Signed-off-by: Hayes Wang --- drivers/net/usb/r8152.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/drivers/net/usb/r8152.c b/drivers/net/usb/r8152.c index 08d1786135f2..3ecd4651ae29 100644 --- a/drivers/net/usb/r8152.c +++ b/drivers/net/usb/r8152.c @@ -7554,6 +7554,11 @@ static void r8156_hw_phy_cfg(struct r8152 *tp) ((swap_a & 0x1f) << 8) | ((swap_a >> 8) & 0x1f)); } + + /* set intr_en[3] */ + data = ocp_reg_read(tp, 0xa424); + data |= BIT(3); + ocp_reg_write(tp, 0xa424, data); break; default: break; @@ -7949,6 +7954,11 @@ static void r8156b_hw_phy_cfg(struct r8152 *tp) break; } + /* set intr_en[3] */ + data = ocp_reg_read(tp, 0xa424); + data |= BIT(3); + ocp_reg_write(tp, 0xa424, data); + if (rtl_phy_patch_request(tp, true, true)) return; From patchwork Wed Apr 26 12:28:05 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hayes Wang X-Patchwork-Id: 87852 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp209863vqo; Wed, 26 Apr 2023 05:41:15 -0700 (PDT) X-Google-Smtp-Source: AKy350a5rx4c/2vuU23ta99oIWRUKgbhXjzRE/M/2a2B7VRRAexhzbouUkM81MhdEgyN3DMCUDSM X-Received: by 2002:a17:903:848:b0:1a6:4200:bef4 with SMTP id ks8-20020a170903084800b001a64200bef4mr20579405plb.56.1682512875219; Wed, 26 Apr 2023 05:41:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1682512875; cv=none; d=google.com; s=arc-20160816; b=wYqkwGTk/1oKwASDj+7yOg/rPetnea//yp8dFB5cZWblZg8EMfGzxs2rdIbOKVpivF Z87DGMWooqmKx+qOp7SmD2bfQgZeGVgPx00PfYmZNaNa2Y9KhswvWsBtrdzeR8UT6BEP hX9uk/d6/E1i7jJEZtOMjrtIKR5u3CadkQHOyDARy3+wkjBZgKiUaStaok7AbPhvtmr1 MXpcrp2c0SThfldOxHnfDnFob0MxhTc3j9FoBWinIv88U3M5R5/zGiwamEP2kcXUj7Y5 /LbgwTj5/SEMCrRiqGvyiFbps+CDA3rbuf2MVLjwI8YFV1s8p1nNRdEWmZMx6Qs5w80y 2xpg== 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 :authenticated-by; bh=PTN1Fo/sB42RRKU+r0EnlSAXjKD5wDyaGBCXkZ10o5I=; b=wDYboumPoqvztAHVuoCI9yN0sgICtVUY99xPDgDkU/LtGAirhxtQNZ3RJ/XEXUqLg4 /24YIONvjf5JeaaLv6tBYj9V9JD1SqeqzKN0QnppKheAfPVTxvDuLpEyNHy3FlI6/N6X Q0M2MmvdFpEzpJE23mfhJV6pQf0svvEJoHy/Zk9qKMepZ86vH6RiqyzB1/Zu+6gpx2mF LkDjtNKAso0Vb/t0YlP1h6QPFxo0Eja5rnKAYhwK/741qTa8HMiFBjrgZEQLLfoQiMUO ak+ELA6QxmNUgZ869UXzWG5uY6VOv0OaZGB5GX43lXyVKIqIuIEEBfURAWR+NDpXCVs8 f8hQ== ARC-Authentication-Results: i=1; mx.google.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 Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id a7-20020a170902ecc700b001a656fe6c48si12894493plh.296.2023.04.26.05.40.46; Wed, 26 Apr 2023 05:41:15 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240884AbjDZM3Z (ORCPT + 99 others); Wed, 26 Apr 2023 08:29:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40566 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240887AbjDZM3T (ORCPT ); Wed, 26 Apr 2023 08:29:19 -0400 Received: from rtits2.realtek.com.tw (rtits2.realtek.com [211.75.126.72]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 109995FCE; Wed, 26 Apr 2023 05:29:06 -0700 (PDT) Authenticated-By: X-SpamFilter-By: ArmorX SpamTrap 5.77 with qID 33QCStOE2006642, This message is accepted by code: ctloc85258 Received: from mail.realtek.com (rtexh36505.realtek.com.tw[172.21.6.25]) by rtits2.realtek.com.tw (8.15.2/2.81/5.90) with ESMTPS id 33QCStOE2006642 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=OK); Wed, 26 Apr 2023 20:28:55 +0800 Received: from RTEXMBS04.realtek.com.tw (172.21.6.97) by RTEXH36505.realtek.com.tw (172.21.6.25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.32; Wed, 26 Apr 2023 20:28:57 +0800 Received: from fc34.localdomain (172.22.228.98) by RTEXMBS04.realtek.com.tw (172.21.6.97) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.7; Wed, 26 Apr 2023 20:28:55 +0800 From: Hayes Wang To: , CC: , , , , Hayes Wang Subject: [PATCH net 3/3] r8152: move setting r8153b_rx_agg_chg_indicate() Date: Wed, 26 Apr 2023 20:28:05 +0800 Message-ID: <20230426122805.23301-403-nic_swsd@realtek.com> X-Mailer: git-send-email 2.40.0 In-Reply-To: <20230426122805.23301-400-nic_swsd@realtek.com> References: <20230426122805.23301-400-nic_swsd@realtek.com> MIME-Version: 1.0 X-Originating-IP: [172.22.228.98] X-ClientProxiedBy: RTEXH36505.realtek.com.tw (172.21.6.25) To RTEXMBS04.realtek.com.tw (172.21.6.97) X-KSE-ServerInfo: RTEXMBS04.realtek.com.tw, 9 X-KSE-AntiSpam-Interceptor-Info: fallback X-KSE-Antivirus-Interceptor-Info: fallback X-KSE-AntiSpam-Interceptor-Info: fallback X-KSE-ServerInfo: RTEXH36505.realtek.com.tw, 9 X-KSE-AntiSpam-Interceptor-Info: fallback X-KSE-Antivirus-Interceptor-Info: fallback X-KSE-AntiSpam-Interceptor-Info: fallback X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE 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: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1764242620627901560?= X-GMAIL-MSGID: =?utf-8?q?1764242620627901560?= Move setting r8153b_rx_agg_chg_indicate() for 2.5G devices. The r8153b_rx_agg_chg_indicate() has to be called after enabling tx/rx. Otherwise, the coalescing settings are useless. Fixes: 195aae321c82 ("r8152: support new chips") Signed-off-by: Hayes Wang --- drivers/net/usb/r8152.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/drivers/net/usb/r8152.c b/drivers/net/usb/r8152.c index 3ecd4651ae29..c464da385511 100644 --- a/drivers/net/usb/r8152.c +++ b/drivers/net/usb/r8152.c @@ -3023,12 +3023,16 @@ static int rtl_enable(struct r8152 *tp) ocp_write_byte(tp, MCU_TYPE_PLA, PLA_CR, ocp_data); switch (tp->version) { - case RTL_VER_08: - case RTL_VER_09: - case RTL_VER_14: - r8153b_rx_agg_chg_indicate(tp); + case RTL_VER_01: + case RTL_VER_02: + case RTL_VER_03: + case RTL_VER_04: + case RTL_VER_05: + case RTL_VER_06: + case RTL_VER_07: break; default: + r8153b_rx_agg_chg_indicate(tp); break; } @@ -3082,7 +3086,6 @@ static void r8153_set_rx_early_timeout(struct r8152 *tp) 640 / 8); ocp_write_word(tp, MCU_TYPE_USB, USB_RX_EXTRA_AGGR_TMR, ocp_data); - r8153b_rx_agg_chg_indicate(tp); break; default: @@ -3116,7 +3119,6 @@ static void r8153_set_rx_early_size(struct r8152 *tp) case RTL_VER_15: ocp_write_word(tp, MCU_TYPE_USB, USB_RX_EARLY_SIZE, ocp_data / 8); - r8153b_rx_agg_chg_indicate(tp); break; default: WARN_ON_ONCE(1);