diff mbox series

[net-next] r8169: keep pause settings on interface down/up cycle

Message ID 30b248d6-8078-75ed-b1ad-4b1b6f17fcd5@gmail.com (mailing list archive)
State Accepted
Delegated to: Netdev Maintainers
Headers show
Series [net-next] r8169: keep pause settings on interface down/up cycle | expand

Checks

Context Check Description
netdev/apply fail Patch does not apply to net-next
netdev/tree_selection success Clearly marked for net-next

Commit Message

Heiner Kallweit April 15, 2021, 6:59 p.m. UTC
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 <hkallweit1@gmail.com>
---
 drivers/net/ethernet/realtek/r8169_main.c | 14 +++++++++-----
 1 file changed, 9 insertions(+), 5 deletions(-)

Comments

Heiner Kallweit April 15, 2021, 7:47 p.m. UTC | #1
On 15.04.2021 20:59, Heiner Kallweit wrote:
> 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 <hkallweit1@gmail.com>
> ---
>  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);
>  
> 

Just see, this patch will apply only once net is merged into net-next.
diff mbox series

Patch

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);