Skip to content

Commit 3216349

Browse files
committed
Merge branch 'r8169-irq-coalesce'
Heiner Kallweit says: ==================== net: add and use netdev_sw_irq_coalesce_default_on() 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. ==================== Signed-off-by: David S. Miller <[email protected]>
2 parents 65e6af6 + 42f66a4 commit 3216349

File tree

3 files changed

+19
-0
lines changed

3 files changed

+19
-0
lines changed

drivers/net/ethernet/realtek/r8169_main.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5283,6 +5283,8 @@ static int rtl_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
52835283
dev->hw_features |= NETIF_F_RXALL;
52845284
dev->hw_features |= NETIF_F_RXFCS;
52855285

5286+
netdev_sw_irq_coalesce_default_on(dev);
5287+
52865288
/* configure chip for default features */
52875289
rtl8169_set_features(dev, dev->features);
52885290

include/linux/netdevice.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@ struct xdp_buff;
7878
void synchronize_net(void);
7979
void netdev_set_default_ethtool_ops(struct net_device *dev,
8080
const struct ethtool_ops *ops);
81+
void netdev_sw_irq_coalesce_default_on(struct net_device *dev);
8182

8283
/* Backlog congestion levels */
8384
#define NET_RX_SUCCESS 0 /* keep 'em coming, baby */

net/core/dev.c

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10517,6 +10517,22 @@ void netdev_set_default_ethtool_ops(struct net_device *dev,
1051710517
}
1051810518
EXPORT_SYMBOL_GPL(netdev_set_default_ethtool_ops);
1051910519

10520+
/**
10521+
* netdev_sw_irq_coalesce_default_on() - enable SW IRQ coalescing by default
10522+
* @dev: netdev to enable the IRQ coalescing on
10523+
*
10524+
* Sets a conservative default for SW IRQ coalescing. Users can use
10525+
* sysfs attributes to override the default values.
10526+
*/
10527+
void netdev_sw_irq_coalesce_default_on(struct net_device *dev)
10528+
{
10529+
WARN_ON(dev->reg_state == NETREG_REGISTERED);
10530+
10531+
dev->gro_flush_timeout = 20000;
10532+
dev->napi_defer_hard_irqs = 1;
10533+
}
10534+
EXPORT_SYMBOL_GPL(netdev_sw_irq_coalesce_default_on);
10535+
1052010536
void netdev_freemem(struct net_device *dev)
1052110537
{
1052210538
char *addr = (char *)dev - dev->padded;

0 commit comments

Comments
 (0)