From patchwork Fri Apr 28 08:53:29 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hayes Wang X-Patchwork-Id: 88544 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp805530vqo; Fri, 28 Apr 2023 02:34:08 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5IeiOR13wnM/jUsBBOwm1XxNeWIjRItwFqwqJAeIGmbf8W9MEiEQLTyk7rge3QFmZJsG5s X-Received: by 2002:a17:902:6507:b0:1a6:5575:9059 with SMTP id b7-20020a170902650700b001a655759059mr3892049plk.62.1682674447923; Fri, 28 Apr 2023 02:34:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1682674447; cv=none; d=google.com; s=arc-20160816; b=QloHcu2Rlu319UFa+/+3Ei0fIBV2T8EFOy3NtogvPbTgmfID7R0nbIhQxjrIwj4PgY w8c8jfzrJ0HEp0wv5VgQQHwp8msJN/uDZxSdajLpEYvCsoWqr2NkbcsRNArLMPRFUQoM m25O61o3gyH7y8Y7tnOCNd8Fk0ZbOIbZtooCG+MAy1kTiMgUGuFqcqpM+suE42h0TWfc eFn36epNGAvsKbgJhPr1NyXHCrcMVjlK8WhGMDwYmnl+ptYTeCAo6JojAkVccUlBe2Ut HrQdjjUcBudx60QJfEQFdxkJTqLReTPC3EnNgoBgPUoP++6rIS9rSt3udvhxu1XTwixn PGEQ== 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; bh=K4GgAnW+j9liGHIyTAZxuA5Ah72oaAdvBhMMUY8C5FE=; b=RzuZ72TnzQnptyGgKKcAXN8gOp0miT5mlNhTpEEdGm8YBRjcSVmvyjfqOYdqHQtfny QUlDlsPGSbSPEliPfHUbWw3Qo6COlxZ/9GAKmCWunU5YWrohJ20YVX9gvp/aDran+OQP VjqcfmnWPb7cMQpFSo1PL09N419Uf4vjwRPGuTJ8cu2OS7emTB+wKpGcWshGvhnGkR98 IfzlvkPB7b0a1s80drztVQx7QKWdmYwkUZzDhTgr8IhZkwIZwaqS9g9CsEAZvG2ww0tG pSlRH0YT/h8dFzuURdmMeRlEZI/dOcctckfYiDKH13QG31R6vR0X4gkMURckHWYUyfDT XPZA== 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 i8-20020a17090a4b8800b0023409b3983fsi1864198pjh.99.2023.04.28.02.33.52; Fri, 28 Apr 2023 02:34: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; 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 S1345626AbjD1JNA (ORCPT + 99 others); Fri, 28 Apr 2023 05:13:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45530 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229803AbjD1JM6 (ORCPT ); Fri, 28 Apr 2023 05:12:58 -0400 Received: from rtits2.realtek.com.tw (rtits2.realtek.com [211.75.126.72]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 564CF1FCA; Fri, 28 Apr 2023 02:12:55 -0700 (PDT) X-SpamFilter-By: ArmorX SpamTrap 5.77 with qID 33S8rkMoB023977, 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 33S8rkMoB023977 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=OK); Fri, 28 Apr 2023 16:53:46 +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; Fri, 28 Apr 2023 16:53:48 +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; Fri, 28 Apr 2023 16:53:47 +0800 From: Hayes Wang To: , CC: , , , , Hayes Wang Subject: [PATCH net v3 1/3] r8152: fix flow control issue of RTL8156A Date: Fri, 28 Apr 2023 16:53:29 +0800 Message-ID: <20230428085331.34550-410-nic_swsd@realtek.com> X-Mailer: git-send-email 2.40.0 In-Reply-To: <20230428085331.34550-409-nic_swsd@realtek.com> References: <20230428085331.34550-409-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?1764412042069943136?= X-GMAIL-MSGID: =?utf-8?q?1764412042069943136?= 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. Besides, remove inline for fc_pause_on_auto() and fc_pause_off_auto(). 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..afd50e90d1fe 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 u32 fc_pause_on_auto(struct r8152 *tp) +{ + return (ALIGN(mtu_to_size(tp->netdev->mtu), 1024) + 6 * 1024); +} + +static 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 Fri Apr 28 08:53:30 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hayes Wang X-Patchwork-Id: 88536 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp796161vqo; Fri, 28 Apr 2023 02:11:53 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5WohZnIX+PRmMvsT7im8aa/5TYRc0qadIKpe9GYUToU6jpY5QF6fmkETChQkuUHBiHg0y9 X-Received: by 2002:a17:90a:764f:b0:24b:6301:17ce with SMTP id s15-20020a17090a764f00b0024b630117cemr4808937pjl.39.1682673112784; Fri, 28 Apr 2023 02:11:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1682673112; cv=none; d=google.com; s=arc-20160816; b=SSbogOI32E1PGIoCWZXChTzPexNgZJ/GfA3vt+eR9vVogdZc3sXIS30/UZHhI72NlF jpIsMc6IINYkkchMYSRW+tn8ItWatKWBG+yyW2LPLsFVZ5Buqiab2gs7DjLtDgacyAT4 EItYOhNpAtI6cGqXZxt2nVgJ+hHSqTrOi8k0qeb6KrtQazPcAN7EAj2LxeJCoPvmaYll knnZ62Sj+e+Ig7ZoNWA9B1viELJbE2T87BTlRLazMeXUe0aXuKFxuSzCHNVwpzNyirOb Gn73atdq6z/+rxijlZFVNN5dqkeExjY8JNqvq4uRucyGli8VenOp+1jEWheiR+wmR3wU nZiw== 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=tk1UAX9UhWRZmxU7jTxIepo0Y/b7yY3DzTa8lJUPuuM=; b=B7uIhS8OVuZiCKOMpaVXXrt0u3QvYz1LpMiBRuC6q8Bq/6IG5MilryDwRGWuQmqdbz L7eXVo9FdHvxsPGxWbuw4TGZq1Hp9M3k+E7MtNPqq3bzE62ydvuzP6V0DFaEQVi8hqE/ 4g6nM45t4vgADLpGrWYHQZzUhH5xIBp2w0sWn0dwuLHPRxXxhGaR5vkb3NDABCtTQC/I XE55EaiUYNP5tLEVIUp4XBcYUK/t/SQ0H5u7Fa1DAKUY5q2XRmkyAiksLdGa2ang2s80 qd7U/dxUvQkuinOen8ryVSwghsnzZ/o0dSu23Z6xk6npCStKZZRAzgRWDs0WY7CoBKa4 PSCQ== 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 bk13-20020a056a02028d00b005192652814bsi20838580pgb.541.2023.04.28.02.11.38; Fri, 28 Apr 2023 02:11:52 -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 S1345335AbjD1Izt (ORCPT + 99 others); Fri, 28 Apr 2023 04:55:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:32816 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345600AbjD1IzY (ORCPT ); Fri, 28 Apr 2023 04:55:24 -0400 Received: from rtits2.realtek.com.tw (rtits2.realtek.com [211.75.126.72]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6956E59E5; Fri, 28 Apr 2023 01:54:50 -0700 (PDT) Authenticated-By: X-SpamFilter-By: ArmorX SpamTrap 5.77 with qID 33S8rkMqB023977, 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 33S8rkMqB023977 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=OK); Fri, 28 Apr 2023 16:53:46 +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; Fri, 28 Apr 2023 16:53:48 +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; Fri, 28 Apr 2023 16:53:47 +0800 From: Hayes Wang To: , CC: , , , , Hayes Wang Subject: [PATCH net v3 2/3] r8152: fix the poor throughput for 2.5G devices Date: Fri, 28 Apr 2023 16:53:30 +0800 Message-ID: <20230428085331.34550-411-nic_swsd@realtek.com> X-Mailer: git-send-email 2.40.0 In-Reply-To: <20230428085331.34550-409-nic_swsd@realtek.com> References: <20230428085331.34550-409-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?1764410641900185101?= X-GMAIL-MSGID: =?utf-8?q?1764410641900185101?= 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 Reviewed-by: Andrew Lunn --- drivers/net/usb/r8152.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/drivers/net/usb/r8152.c b/drivers/net/usb/r8152.c index afd50e90d1fe..58670a65b840 100644 --- a/drivers/net/usb/r8152.c +++ b/drivers/net/usb/r8152.c @@ -199,6 +199,7 @@ #define OCP_EEE_AR 0xa41a #define OCP_EEE_DATA 0xa41c #define OCP_PHY_STATUS 0xa420 +#define OCP_INTR_EN 0xa424 #define OCP_NCTL_CFG 0xa42c #define OCP_POWER_CFG 0xa430 #define OCP_EEE_CFG 0xa432 @@ -620,6 +621,9 @@ enum spd_duplex { #define PHY_STAT_LAN_ON 3 #define PHY_STAT_PWRDN 5 +/* OCP_INTR_EN */ +#define INTR_SPEED_FORCE BIT(3) + /* OCP_NCTL_CFG */ #define PGA_RETURN_EN BIT(1) @@ -7554,6 +7558,11 @@ static void r8156_hw_phy_cfg(struct r8152 *tp) ((swap_a & 0x1f) << 8) | ((swap_a >> 8) & 0x1f)); } + + /* Notify the MAC when the speed is changed to force mode. */ + data = ocp_reg_read(tp, OCP_INTR_EN); + data |= INTR_SPEED_FORCE; + ocp_reg_write(tp, OCP_INTR_EN, data); break; default: break; @@ -7949,6 +7958,11 @@ static void r8156b_hw_phy_cfg(struct r8152 *tp) break; } + /* Notify the MAC when the speed is changed to force mode. */ + data = ocp_reg_read(tp, OCP_INTR_EN); + data |= INTR_SPEED_FORCE; + ocp_reg_write(tp, OCP_INTR_EN, data); + if (rtl_phy_patch_request(tp, true, true)) return; From patchwork Fri Apr 28 08:53:31 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hayes Wang X-Patchwork-Id: 88532 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp789201vqo; Fri, 28 Apr 2023 01:56:16 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6H7wA36/w3tNKN5IkkV+jA7IWFvtdFZSxW19VChVryDQB+dIxNvHkst5dr694G2p5V0RH8 X-Received: by 2002:a05:6a00:842:b0:5a8:8535:18b with SMTP id q2-20020a056a00084200b005a88535018bmr6529879pfk.11.1682672176720; Fri, 28 Apr 2023 01:56:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1682672176; cv=none; d=google.com; s=arc-20160816; b=RKHXT1wcj/MfD0D0Tok5N7peDaZXrK8wYv8xnTXTSaCOFxeQxylTAJ3iL0IydPgxe1 wfnNzTabztf6bu6NiqSsClWadGMFJs7uo6CLO7ojP7I9yjKGRajpkuyDMDzTMXY+WJnD vOKksfckX2I67gqnWuJM4YVbYg5K6iyzNHfJlGNsZ/7MZp7mVueVXThp1TVTXyn1+fF/ aDJKkx7GzIZHWmC8itkB7Hg+oTOxk/9BFC/C/7MDrNhgRd2OMtIH+C02SQXZNojaClEA KouHrS5BssFin3m47446sY1B1L+J6rCADILFOqnAhSRtvBkmgB6mV4F4QQv+vn7USPb/ x4oQ== 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=XdZRgboAIskK486QdD/tgL2gyBwW8gxCRwft7M0Zmtk=; b=xMTUS2dMDCqPn/jTUCHykixAKadNtKEly6kgNJwhu2wr+N16bhkvIFol6Uf02lKf7G p/bKDPXXFc8MtKtP7ka/KHa/eI+geabG488SjJ9756ekvWAmUf0qUdwCj8+OdOY3R3oh 0D/sRbids5cxxBMQI5ri/piFXrMhcub6rDwsCyHFXHSinGtfpGjCvwPbn1AXPSpH5J3c GygCbBkOK0TpBONybdjJHX39RL6+nxuX5DJ17OUd+N0haw8UcJwMdr22zS2dfaDQqFls 2WtL6zy5ZD45zKFeuzpWGILEGVW2lnOTTMfdUK5EavhF9M2Xm+KLKC6liHPoA4KJqXG4 Ry1w== 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 l63-20020a638842000000b00513f15fed4fsi20824610pgd.590.2023.04.28.01.56.04; Fri, 28 Apr 2023 01:56:16 -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 S1345731AbjD1Izq (ORCPT + 99 others); Fri, 28 Apr 2023 04:55:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35408 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345727AbjD1IzV (ORCPT ); Fri, 28 Apr 2023 04:55:21 -0400 Received: from rtits2.realtek.com.tw (rtits2.realtek.com [211.75.126.72]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1C8CC5FC4; Fri, 28 Apr 2023 01:54:48 -0700 (PDT) Authenticated-By: X-SpamFilter-By: ArmorX SpamTrap 5.77 with qID 33S8rkMrB023977, 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 33S8rkMrB023977 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=OK); Fri, 28 Apr 2023 16:53:46 +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; Fri, 28 Apr 2023 16:53:48 +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; Fri, 28 Apr 2023 16:53:48 +0800 From: Hayes Wang To: , CC: , , , , Hayes Wang Subject: [PATCH net v3 3/3] r8152: move setting r8153b_rx_agg_chg_indicate() Date: Fri, 28 Apr 2023 16:53:31 +0800 Message-ID: <20230428085331.34550-412-nic_swsd@realtek.com> X-Mailer: git-send-email 2.40.0 In-Reply-To: <20230428085331.34550-409-nic_swsd@realtek.com> References: <20230428085331.34550-409-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?1764409660553454532?= X-GMAIL-MSGID: =?utf-8?q?1764409660553454532?= 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 58670a65b840..755b0f72dd44 100644 --- a/drivers/net/usb/r8152.c +++ b/drivers/net/usb/r8152.c @@ -3027,12 +3027,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; } @@ -3086,7 +3090,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: @@ -3120,7 +3123,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);