netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-next] r8169: add support for pause ethtool ops
@ 2021-04-14  6:23 Heiner Kallweit
  2021-04-14 20:10 ` patchwork-bot+netdevbpf
  2021-04-14 23:12 ` Jakub Kicinski
  0 siblings, 2 replies; 4+ messages in thread
From: Heiner Kallweit @ 2021-04-14  6:23 UTC (permalink / raw)
  To: Jakub Kicinski, David Miller, Realtek linux nic maintainers; +Cc: netdev

This adds support for the [g|s]et_pauseparam ethtool ops. It considers
that the chip doesn't support pause frame use in jumbo mode.

Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
---
 drivers/net/ethernet/realtek/r8169_main.c | 28 +++++++++++++++++++++++
 1 file changed, 28 insertions(+)

diff --git a/drivers/net/ethernet/realtek/r8169_main.c b/drivers/net/ethernet/realtek/r8169_main.c
index eb6da93ac..1b48084f2 100644
--- a/drivers/net/ethernet/realtek/r8169_main.c
+++ b/drivers/net/ethernet/realtek/r8169_main.c
@@ -1910,6 +1910,32 @@ static void rtl8169_get_ringparam(struct net_device *dev,
 	data->tx_pending = NUM_TX_DESC;
 }
 
+static void rtl8169_get_pauseparam(struct net_device *dev,
+				   struct ethtool_pauseparam *data)
+{
+	struct rtl8169_private *tp = netdev_priv(dev);
+	bool tx_pause, rx_pause;
+
+	phy_get_pause(tp->phydev, &tx_pause, &rx_pause);
+
+	data->autoneg = tp->phydev->autoneg;
+	data->tx_pause = tx_pause ? 1 : 0;
+	data->rx_pause = rx_pause ? 1 : 0;
+}
+
+static int rtl8169_set_pauseparam(struct net_device *dev,
+				  struct ethtool_pauseparam *data)
+{
+	struct rtl8169_private *tp = netdev_priv(dev);
+
+	if (dev->mtu > ETH_DATA_LEN)
+		return -EOPNOTSUPP;
+
+	phy_set_asym_pause(tp->phydev, data->rx_pause, data->tx_pause);
+
+	return 0;
+}
+
 static const struct ethtool_ops rtl8169_ethtool_ops = {
 	.supported_coalesce_params = ETHTOOL_COALESCE_USECS |
 				     ETHTOOL_COALESCE_MAX_FRAMES,
@@ -1931,6 +1957,8 @@ static const struct ethtool_ops rtl8169_ethtool_ops = {
 	.get_link_ksettings	= phy_ethtool_get_link_ksettings,
 	.set_link_ksettings	= phy_ethtool_set_link_ksettings,
 	.get_ringparam		= rtl8169_get_ringparam,
+	.get_pauseparam		= rtl8169_get_pauseparam,
+	.set_pauseparam		= rtl8169_set_pauseparam,
 };
 
 static void rtl_enable_eee(struct rtl8169_private *tp)
-- 
2.31.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH net-next] r8169: add support for pause ethtool ops
  2021-04-14  6:23 [PATCH net-next] r8169: add support for pause ethtool ops Heiner Kallweit
@ 2021-04-14 20:10 ` patchwork-bot+netdevbpf
  2021-04-14 23:12 ` Jakub Kicinski
  1 sibling, 0 replies; 4+ messages in thread
From: patchwork-bot+netdevbpf @ 2021-04-14 20:10 UTC (permalink / raw)
  To: Heiner Kallweit; +Cc: kuba, davem, nic_swsd, netdev

Hello:

This patch was applied to netdev/net-next.git (refs/heads/master):

On Wed, 14 Apr 2021 08:23:15 +0200 you wrote:
> This adds support for the [g|s]et_pauseparam ethtool ops. It considers
> that the chip doesn't support pause frame use in jumbo mode.
> 
> Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
> ---
>  drivers/net/ethernet/realtek/r8169_main.c | 28 +++++++++++++++++++++++
>  1 file changed, 28 insertions(+)

Here is the summary with links:
  - [net-next] r8169: add support for pause ethtool ops
    https://git.kernel.org/netdev/net-next/c/216f78ea8cf6

You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH net-next] r8169: add support for pause ethtool ops
  2021-04-14  6:23 [PATCH net-next] r8169: add support for pause ethtool ops Heiner Kallweit
  2021-04-14 20:10 ` patchwork-bot+netdevbpf
@ 2021-04-14 23:12 ` Jakub Kicinski
  2021-04-15  6:09   ` Heiner Kallweit
  1 sibling, 1 reply; 4+ messages in thread
From: Jakub Kicinski @ 2021-04-14 23:12 UTC (permalink / raw)
  To: Heiner Kallweit; +Cc: David Miller, Realtek linux nic maintainers, netdev

On Wed, 14 Apr 2021 08:23:15 +0200 Heiner Kallweit wrote:
> This adds support for the [g|s]et_pauseparam ethtool ops. It considers
> that the chip doesn't support pause frame use in jumbo mode.

what happens if the MTU is changed afterwards?

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH net-next] r8169: add support for pause ethtool ops
  2021-04-14 23:12 ` Jakub Kicinski
@ 2021-04-15  6:09   ` Heiner Kallweit
  0 siblings, 0 replies; 4+ messages in thread
From: Heiner Kallweit @ 2021-04-15  6:09 UTC (permalink / raw)
  To: Jakub Kicinski; +Cc: David Miller, Realtek linux nic maintainers, netdev

On 15.04.2021 01:12, Jakub Kicinski wrote:
> On Wed, 14 Apr 2021 08:23:15 +0200 Heiner Kallweit wrote:
>> This adds support for the [g|s]et_pauseparam ethtool ops. It considers
>> that the chip doesn't support pause frame use in jumbo mode.
> 
> what happens if the MTU is changed afterwards?
> 

This patch is complemented by 453a77894efa ("r8169: don't advertise pause
in jumbo mode") that went via net. Changing MTU triggers rtl_jumbo_config()
that aligns the pause parameters with the new MTU.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2021-04-15  6:09 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-14  6:23 [PATCH net-next] r8169: add support for pause ethtool ops Heiner Kallweit
2021-04-14 20:10 ` patchwork-bot+netdevbpf
2021-04-14 23:12 ` Jakub Kicinski
2021-04-15  6:09   ` Heiner Kallweit

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).