From patchwork Thu Apr 15 18:59:47 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Heiner Kallweit X-Patchwork-Id: 12205997 X-Patchwork-Delegate: kuba@kernel.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-14.2 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1F597C433B4 for ; Thu, 15 Apr 2021 19:00:01 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id D9ED061152 for ; Thu, 15 Apr 2021 19:00:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234718AbhDOTAX (ORCPT ); Thu, 15 Apr 2021 15:00:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41556 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234130AbhDOTAV (ORCPT ); Thu, 15 Apr 2021 15:00:21 -0400 Received: from mail-wr1-x430.google.com (mail-wr1-x430.google.com [IPv6:2a00:1450:4864:20::430]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 79A55C061574 for ; Thu, 15 Apr 2021 11:59:56 -0700 (PDT) Received: by mail-wr1-x430.google.com with SMTP id a4so24359601wrr.2 for ; Thu, 15 Apr 2021 11:59:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:message-id:date:user-agent:mime-version :content-language:content-transfer-encoding; bh=3sOlGS76qLSBmRx11w/OrasaEOdaaTC+d4M4RXvMj3k=; b=nEheOU8nXLDPfIC14ehc+qs7F7ZuQjxqXC8+g8AjuOITISdCu1iqDBDWfUs+mC3jpe PYrD4omA9jMluCZVG6kqBnIhHe1LFPnNUcgoys4TFke5LIcyKQ/7bIXO5PohnprmoMLO UJOwCOlvxAQD4/PEMUZAfpfYxD1AUjC9ChJZVrtC0HvgxeVbdnS3+VZd1STdiSN0bxRj oZ484sI3T91f28RrzRK9JKTm5D9vqFI2o6DGAX/ERmaAPZDrAEB5hF5TEMPLSzVRVTPJ QIHL1WA2nB85U+dtwf7SA8L9piZ1WneH2LNH0LhcOsma8PVNMFG8rLvKdHGqfC3WsHWL 5Shw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:message-id:date:user-agent :mime-version:content-language:content-transfer-encoding; bh=3sOlGS76qLSBmRx11w/OrasaEOdaaTC+d4M4RXvMj3k=; b=VrRAJms2KSDeMo3Nkn9GNpqzH0GD3Ad8q+odRUScvTHagn3xEMnfPiULxnNPYoSZcT 6AA1e/sJdYwg9Ib4cF1HNeLaItgVwJ+oNcfKmfAaPyjGgsS53ZXnIUqM/VUu69Ngx0F1 Cu6+0b0JQn5jdzjTC/2PXzmhrMvN8uaM52D75m8B3TB9z+I0D5awOUMfPj4XhBVlUeni hD2fpRMZPye3oaLA6uLgbDJFl8a2G+5m/xRVPueNBGpXdxBjU0uoi2KATcD/jp+lp8ug RPGDbp1/Kuy7h2m/ivf0A82OVkw8ewavkGCmVwJnnsh+3JTbkxXKczmiRUbyDZUbiFcc PuMw== X-Gm-Message-State: AOAM533IvkspLMtXvGmCxpTPL9kMdt19Q/Lni6SS3B/qoOc0a8NhGcph iOcfGkIudfQwfB2mbZnfiOyL6c+Kn/BCWw== X-Google-Smtp-Source: ABdhPJxNi7N6UXrue0vH6+EXDI1fVNUkJttgc6skZiM0mHe85XdO3EO4dYUIl8aAbV2E7XzQg+K4FQ== X-Received: by 2002:a5d:6242:: with SMTP id m2mr4956142wrv.384.1618513194966; Thu, 15 Apr 2021 11:59:54 -0700 (PDT) Received: from ?IPv6:2003:ea:8f38:4600:a8a1:99e1:b713:6999? (p200300ea8f384600a8a199e1b7136999.dip0.t-ipconnect.de. [2003:ea:8f38:4600:a8a1:99e1:b713:6999]) by smtp.googlemail.com with ESMTPSA id u2sm4988372wmm.5.2021.04.15.11.59.51 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 15 Apr 2021 11:59:54 -0700 (PDT) From: Heiner Kallweit To: Jakub Kicinski , David Miller , Realtek linux nic maintainers Cc: "netdev@vger.kernel.org" Subject: [PATCH net-next] r8169: keep pause settings on interface down/up cycle Message-ID: <30b248d6-8078-75ed-b1ad-4b1b6f17fcd5@gmail.com> Date: Thu, 15 Apr 2021 20:59:47 +0200 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.9.1 MIME-Version: 1.0 Content-Language: en-US Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org Currently, if the user changes the pause settings, the default settings will be restored after an interface down/up cycle, and also when resuming from suspend. This doesn't seem to provide the best user experience. Change this to keep user settings, and just ensure that in jumbo mode pause is disabled. Small drawback: When switching back mtu from jumbo to non-jumbo then pause remains disabled (but user can enable it using ethtool). I think that's a not too common scenario and acceptable. Signed-off-by: Heiner Kallweit --- drivers/net/ethernet/realtek/r8169_main.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/drivers/net/ethernet/realtek/r8169_main.c b/drivers/net/ethernet/realtek/r8169_main.c index 7d02bab1c..2c89cde7d 100644 --- a/drivers/net/ethernet/realtek/r8169_main.c +++ b/drivers/net/ethernet/realtek/r8169_main.c @@ -2388,11 +2388,13 @@ static void rtl_jumbo_config(struct rtl8169_private *tp) pcie_set_readrq(tp->pci_dev, readrq); /* Chip doesn't support pause in jumbo mode */ - linkmode_mod_bit(ETHTOOL_LINK_MODE_Pause_BIT, - tp->phydev->advertising, !jumbo); - linkmode_mod_bit(ETHTOOL_LINK_MODE_Asym_Pause_BIT, - tp->phydev->advertising, !jumbo); - phy_start_aneg(tp->phydev); + if (jumbo) { + linkmode_clear_bit(ETHTOOL_LINK_MODE_Pause_BIT, + tp->phydev->advertising); + linkmode_clear_bit(ETHTOOL_LINK_MODE_Asym_Pause_BIT, + tp->phydev->advertising); + phy_start_aneg(tp->phydev); + } } DECLARE_RTL_COND(rtl_chipcmd_cond) @@ -5107,6 +5109,8 @@ static int r8169_mdio_register(struct rtl8169_private *tp) tp->phydev->mac_managed_pm = 1; + phy_support_asym_pause(tp->phydev); + /* PHY will be woken up in rtl_open() */ phy_suspend(tp->phydev);