mirror of
https://github.com/openwrt/openwrt.git
synced 2024-12-22 06:57:57 +00:00
27b816d545
- improve RTL8411b phy-down fixup - remove not needed check in rtl_fw_write_firmware - remove multicast filter limit - improve handling task scheduling - simplify EEE handling - simplify code by using core-provided pcpu stats allocation - add generic rtl_set_eee_txidle_timer function - support setting the EEE tx idle timer on RTL8168h - add support for returning tx_lpi_timer in ethtool get_eee - annotate writes on dev->mtu from ndo_change_mtu() - disable interrupt source RxOverflow - remove detection of chip version 11 (early RTL8168b) Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
61 lines
2.1 KiB
Diff
61 lines
2.1 KiB
Diff
From 1eb2cded45b35816085c1f962933c187d970f9dc Mon Sep 17 00:00:00 2001
|
|
From: Eric Dumazet <edumazet@google.com>
|
|
Date: Mon, 6 May 2024 10:28:12 +0000
|
|
Subject: [PATCH] net: annotate writes on dev->mtu from ndo_change_mtu()
|
|
|
|
Simon reported that ndo_change_mtu() methods were never
|
|
updated to use WRITE_ONCE(dev->mtu, new_mtu) as hinted
|
|
in commit 501a90c94510 ("inet: protect against too small
|
|
mtu values.")
|
|
|
|
We read dev->mtu without holding RTNL in many places,
|
|
with READ_ONCE() annotations.
|
|
|
|
It is time to take care of ndo_change_mtu() methods
|
|
to use corresponding WRITE_ONCE()
|
|
|
|
Signed-off-by: Eric Dumazet <edumazet@google.com>
|
|
Reported-by: Simon Horman <horms@kernel.org>
|
|
Closes: https://lore.kernel.org/netdev/20240505144608.GB67882@kernel.org/
|
|
Reviewed-by: Jacob Keller <jacob.e.keller@intel.com>
|
|
Reviewed-by: Sabrina Dubroca <sd@queasysnail.net>
|
|
Reviewed-by: Simon Horman <horms@kernel.org>
|
|
Acked-by: Shannon Nelson <shannon.nelson@amd.com>
|
|
Link: https://lore.kernel.org/r/20240506102812.3025432-1-edumazet@google.com
|
|
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
|
|
---
|
|
drivers/net/ethernet/realtek/8139cp.c | 4 ++--
|
|
drivers/net/ethernet/realtek/r8169_main.c | 2 +-
|
|
2 files changed, 3 insertions(+), 3 deletions(-)
|
|
|
|
--- a/drivers/net/ethernet/realtek/8139cp.c
|
|
+++ b/drivers/net/ethernet/realtek/8139cp.c
|
|
@@ -1277,14 +1277,14 @@ static int cp_change_mtu(struct net_devi
|
|
|
|
/* if network interface not up, no need for complexity */
|
|
if (!netif_running(dev)) {
|
|
- dev->mtu = new_mtu;
|
|
+ WRITE_ONCE(dev->mtu, new_mtu);
|
|
cp_set_rxbufsize(cp); /* set new rx buf size */
|
|
return 0;
|
|
}
|
|
|
|
/* network IS up, close it, reset MTU, and come up again. */
|
|
cp_close(dev);
|
|
- dev->mtu = new_mtu;
|
|
+ WRITE_ONCE(dev->mtu, new_mtu);
|
|
cp_set_rxbufsize(cp);
|
|
return cp_open(dev);
|
|
}
|
|
--- a/drivers/net/ethernet/realtek/r8169_main.c
|
|
+++ b/drivers/net/ethernet/realtek/r8169_main.c
|
|
@@ -3925,7 +3925,7 @@ static int rtl8169_change_mtu(struct net
|
|
{
|
|
struct rtl8169_private *tp = netdev_priv(dev);
|
|
|
|
- dev->mtu = new_mtu;
|
|
+ WRITE_ONCE(dev->mtu, new_mtu);
|
|
netdev_update_features(dev);
|
|
rtl_jumbo_config(tp);
|
|
rtl_set_eee_txidle_timer(tp);
|