netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-next 0/2] net: add and use netdev_sw_irq_coalesce_default_on()
@ 2022-11-30 22:25 Heiner Kallweit
  2022-11-30 22:28 ` [PATCH net-next 1/2] net: add netdev_sw_irq_coalesce_default_on() Heiner Kallweit
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Heiner Kallweit @ 2022-11-30 22:25 UTC (permalink / raw)
  To: Jakub Kicinski, David Miller, Realtek linux nic maintainers,
	Eric Dumazet, Paolo Abeni
  Cc: netdev@vger.kernel.org

There are reports about r8169 not reaching full line speed on certain
systems (e.g. SBC's) with a 2.5Gbps link.
There was a time when hardware interrupt coalescing was enabled per
default, but this was changed due to ASPM-related issues on few systems.

Meanwhile we have sysfs attributes for controlling kind of
"software interrupt coalescing" on the GRO level. However most distros
and users don't know about it. So lets set a conservative default for
both involved parameters. Users can still override the defaults via
sysfs. Don't enable these settings on the fast ethernet chip versions,
they are slow enough.

Even with these conservative setting interrupt load on my 1Gbps test
system reduced significantly.

Follow Jakub's suggestion and put this functionality into net core
so that other MAC drivers can reuse it.

Heiner Kallweit (2):
  net: add netdev_sw_irq_coalesce_default_on()
  r8169: enable GRO software interrupt coalescing per default

 drivers/net/ethernet/realtek/r8169_main.c |  2 ++
 include/linux/netdevice.h                 |  1 +
 net/core/dev.c                            | 16 ++++++++++++++++
 3 files changed, 19 insertions(+)

-- 
2.38.1


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

* [PATCH net-next 1/2] net: add netdev_sw_irq_coalesce_default_on()
  2022-11-30 22:25 [PATCH net-next 0/2] net: add and use netdev_sw_irq_coalesce_default_on() Heiner Kallweit
@ 2022-11-30 22:28 ` Heiner Kallweit
  2022-11-30 22:30 ` [PATCH net-next 2/2] r8169: enable GRO software interrupt coalescing per default Heiner Kallweit
  2022-12-05  9:50 ` [PATCH net-next 0/2] net: add and use netdev_sw_irq_coalesce_default_on() patchwork-bot+netdevbpf
  2 siblings, 0 replies; 4+ messages in thread
From: Heiner Kallweit @ 2022-11-30 22:28 UTC (permalink / raw)
  To: Jakub Kicinski, David Miller, Realtek linux nic maintainers,
	Eric Dumazet, Paolo Abeni
  Cc: netdev@vger.kernel.org

Add a helper for drivers wanting to set SW IRQ coalescing
by default. The related sysfs attributes can be used to
override the default values.

Follow Jakub's suggestion and put this functionality into
net core so that drivers wanting to use software interrupt
coalescing per default don't have to open-code it.

Note that this function needs to be called before the
netdevice is registered.

Suggested-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
---
 include/linux/netdevice.h |  1 +
 net/core/dev.c            | 16 ++++++++++++++++
 2 files changed, 17 insertions(+)

diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
index 02a2318da..5be4b6a3b 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -78,6 +78,7 @@ struct xdp_buff;
 void synchronize_net(void);
 void netdev_set_default_ethtool_ops(struct net_device *dev,
 				    const struct ethtool_ops *ops);
+void netdev_sw_irq_coalesce_default_on(struct net_device *dev);
 
 /* Backlog congestion levels */
 #define NET_RX_SUCCESS		0	/* keep 'em coming, baby */
diff --git a/net/core/dev.c b/net/core/dev.c
index 117e830ca..cc6bbc0a3 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -10537,6 +10537,22 @@ void netdev_set_default_ethtool_ops(struct net_device *dev,
 }
 EXPORT_SYMBOL_GPL(netdev_set_default_ethtool_ops);
 
+/**
+ * netdev_sw_irq_coalesce_default_on() - enable SW IRQ coalescing by default
+ * @dev: netdev to enable the IRQ coalescing on
+ *
+ * Sets a conservative default for SW IRQ coalescing. Users can use
+ * sysfs attributes to override the default values.
+ */
+void netdev_sw_irq_coalesce_default_on(struct net_device *dev)
+{
+	WARN_ON(dev->reg_state == NETREG_REGISTERED);
+
+	dev->gro_flush_timeout = 20000;
+	dev->napi_defer_hard_irqs = 1;
+}
+EXPORT_SYMBOL_GPL(netdev_sw_irq_coalesce_default_on);
+
 void netdev_freemem(struct net_device *dev)
 {
 	char *addr = (char *)dev - dev->padded;
-- 
2.38.1



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

* [PATCH net-next 2/2] r8169: enable GRO software interrupt coalescing per default
  2022-11-30 22:25 [PATCH net-next 0/2] net: add and use netdev_sw_irq_coalesce_default_on() Heiner Kallweit
  2022-11-30 22:28 ` [PATCH net-next 1/2] net: add netdev_sw_irq_coalesce_default_on() Heiner Kallweit
@ 2022-11-30 22:30 ` Heiner Kallweit
  2022-12-05  9:50 ` [PATCH net-next 0/2] net: add and use netdev_sw_irq_coalesce_default_on() patchwork-bot+netdevbpf
  2 siblings, 0 replies; 4+ messages in thread
From: Heiner Kallweit @ 2022-11-30 22:30 UTC (permalink / raw)
  To: Jakub Kicinski, David Miller, Realtek linux nic maintainers,
	Eric Dumazet, Paolo Abeni
  Cc: netdev@vger.kernel.org

There are reports about r8169 not reaching full line speed on certain
systems (e.g. SBC's) with a 2.5Gbps link.
There was a time when hardware interrupt coalescing was enabled per
default, but this was changed due to ASPM-related issues on few systems.
So let's use software interrupt coalescing instead and enable it
using new function netdev_sw_irq_coalesce_default_on().

Even with these conservative settings interrupt load on my 1Gbps test
system reduced significantly.

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

diff --git a/drivers/net/ethernet/realtek/r8169_main.c b/drivers/net/ethernet/realtek/r8169_main.c
index 5bc1181f8..f4e160888 100644
--- a/drivers/net/ethernet/realtek/r8169_main.c
+++ b/drivers/net/ethernet/realtek/r8169_main.c
@@ -5282,6 +5282,8 @@ static int rtl_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
 	dev->hw_features |= NETIF_F_RXALL;
 	dev->hw_features |= NETIF_F_RXFCS;
 
+	netdev_sw_irq_coalesce_default_on(dev);
+
 	/* configure chip for default features */
 	rtl8169_set_features(dev, dev->features);
 
-- 
2.38.1


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

* Re: [PATCH net-next 0/2] net: add and use netdev_sw_irq_coalesce_default_on()
  2022-11-30 22:25 [PATCH net-next 0/2] net: add and use netdev_sw_irq_coalesce_default_on() Heiner Kallweit
  2022-11-30 22:28 ` [PATCH net-next 1/2] net: add netdev_sw_irq_coalesce_default_on() Heiner Kallweit
  2022-11-30 22:30 ` [PATCH net-next 2/2] r8169: enable GRO software interrupt coalescing per default Heiner Kallweit
@ 2022-12-05  9:50 ` patchwork-bot+netdevbpf
  2 siblings, 0 replies; 4+ messages in thread
From: patchwork-bot+netdevbpf @ 2022-12-05  9:50 UTC (permalink / raw)
  To: Heiner Kallweit; +Cc: kuba, davem, nic_swsd, edumazet, pabeni, netdev

Hello:

This series was applied to netdev/net-next.git (master)
by David S. Miller <davem@davemloft.net>:

On Wed, 30 Nov 2022 23:25:23 +0100 you wrote:
> There are reports about r8169 not reaching full line speed on certain
> systems (e.g. SBC's) with a 2.5Gbps link.
> There was a time when hardware interrupt coalescing was enabled per
> default, but this was changed due to ASPM-related issues on few systems.
> 
> Meanwhile we have sysfs attributes for controlling kind of
> "software interrupt coalescing" on the GRO level. However most distros
> and users don't know about it. So lets set a conservative default for
> both involved parameters. Users can still override the defaults via
> sysfs. Don't enable these settings on the fast ethernet chip versions,
> they are slow enough.
> 
> [...]

Here is the summary with links:
  - [net-next,1/2] net: add netdev_sw_irq_coalesce_default_on()
    https://git.kernel.org/netdev/net-next/c/d93607082e98
  - [net-next,2/2] r8169: enable GRO software interrupt coalescing per default
    https://git.kernel.org/netdev/net-next/c/42f66a44d837

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

end of thread, other threads:[~2022-12-05  9:50 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-11-30 22:25 [PATCH net-next 0/2] net: add and use netdev_sw_irq_coalesce_default_on() Heiner Kallweit
2022-11-30 22:28 ` [PATCH net-next 1/2] net: add netdev_sw_irq_coalesce_default_on() Heiner Kallweit
2022-11-30 22:30 ` [PATCH net-next 2/2] r8169: enable GRO software interrupt coalescing per default Heiner Kallweit
2022-12-05  9:50 ` [PATCH net-next 0/2] net: add and use netdev_sw_irq_coalesce_default_on() patchwork-bot+netdevbpf

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