[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20240514091306.229444-1-lukma@denx.de>
Date: Tue, 14 May 2024 11:13:06 +0200
From: Lukasz Majewski <lukma@...x.de>
To: Jakub Kicinski <kuba@...nel.org>,
netdev@...r.kernel.org,
Paolo Abeni <pabeni@...hat.com>
Cc: Eric Dumazet <edumazet@...gle.com>,
Vladimir Oltean <olteanv@...il.com>,
"David S. Miller" <davem@...emloft.net>,
Oleksij Rempel <o.rempel@...gutronix.de>,
Tristram.Ha@...rochip.com,
Sebastian Andrzej Siewior <bigeasy@...utronix.de>,
Ravi Gunasekaran <r-gunasekaran@...com>,
Simon Horman <horms@...nel.org>,
Nikita Zhandarovich <n.zhandarovich@...tech.ru>,
Murali Karicheri <m-karicheri2@...com>,
Arvid Brodin <Arvid.Brodin@...n.com>,
Dan Carpenter <dan.carpenter@...aro.org>,
"Ricardo B. Marliere" <ricardo@...liere.net>,
Casper Andersson <casper.casan@...il.com>,
linux-kernel@...r.kernel.org,
Lukasz Majewski <lukma@...x.de>
Subject: [PATCH] net: hsr: Setup and delete proxy prune timer only when RedBox is enabled
The timer for removing entries in the ProxyNodeTable shall be only active
when the HSR driver works as RedBox (HSR-SAN).
Moreover, the obsolete del_timer_sync() is replaced with
timer_delete_sync().
This patch improves fix from commit 3c668cef61ad
("net: hsr: init prune_proxy_timer sooner") as the prune node
timer shall be setup only when HSR RedBox is supported in the node.
Signed-off-by: Lukasz Majewski <lukma@...x.de>
---
net/hsr/hsr_device.c | 2 +-
net/hsr/hsr_netlink.c | 3 ++-
2 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/net/hsr/hsr_device.c b/net/hsr/hsr_device.c
index e6904288d40d..d234e4134a9d 100644
--- a/net/hsr/hsr_device.c
+++ b/net/hsr/hsr_device.c
@@ -589,7 +589,6 @@ int hsr_dev_finalize(struct net_device *hsr_dev, struct net_device *slave[2],
timer_setup(&hsr->announce_timer, hsr_announce, 0);
timer_setup(&hsr->prune_timer, hsr_prune_nodes, 0);
- timer_setup(&hsr->prune_proxy_timer, hsr_prune_proxy_nodes, 0);
ether_addr_copy(hsr->sup_multicast_addr, def_multicast_addr);
hsr->sup_multicast_addr[ETH_ALEN - 1] = multicast_spec;
@@ -629,6 +628,7 @@ int hsr_dev_finalize(struct net_device *hsr_dev, struct net_device *slave[2],
hsr->redbox = true;
ether_addr_copy(hsr->macaddress_redbox, interlink->dev_addr);
+ timer_setup(&hsr->prune_proxy_timer, hsr_prune_proxy_nodes, 0);
mod_timer(&hsr->prune_proxy_timer,
jiffies + msecs_to_jiffies(PRUNE_PROXY_PERIOD));
}
diff --git a/net/hsr/hsr_netlink.c b/net/hsr/hsr_netlink.c
index 898f18c6da53..c1bd1e6eb955 100644
--- a/net/hsr/hsr_netlink.c
+++ b/net/hsr/hsr_netlink.c
@@ -129,8 +129,9 @@ static void hsr_dellink(struct net_device *dev, struct list_head *head)
struct hsr_priv *hsr = netdev_priv(dev);
del_timer_sync(&hsr->prune_timer);
- del_timer_sync(&hsr->prune_proxy_timer);
del_timer_sync(&hsr->announce_timer);
+ if (hsr->redbox)
+ timer_delete_sync(&hsr->prune_proxy_timer);
hsr_debugfs_term(hsr);
hsr_del_ports(hsr);
--
2.20.1
Powered by blists - more mailing lists