summaryrefslogtreecommitdiff
path: root/net/core/link_watch.c
diff options
context:
space:
mode:
authorEric Dumazet <edumazet@google.com>2024-02-13 06:32:42 +0000
committerDavid S. Miller <davem@davemloft.net>2024-02-14 11:20:13 +0000
commit6a2968ee1ee2cc6fce30f6f5724442b34b1483b3 (patch)
tree0a41642980c841e40bbcd58ce7b4b1612362aeac /net/core/link_watch.c
parent328771deab16fcac55763309bb59e28b1c050853 (diff)
net: add netdev_set_operstate() helper
dev_base_lock is going away, add netdev_set_operstate() helper so that hsr does not have to know core internals. Remove dev_base_lock acquisition from rfc2863_policy() v3: use an "unsigned int" for dev->operstate, so that try_cmpxchg() can work on all arches. ( https://lore.kernel.org/oe-kbuild-all/202402081918.OLyGaea3-lkp@intel.com/ ) Signed-off-by: Eric Dumazet <edumazet@google.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/core/link_watch.c')
-rw-r--r--net/core/link_watch.c9
1 files changed, 2 insertions, 7 deletions
diff --git a/net/core/link_watch.c b/net/core/link_watch.c
index 1b93e054c9a3..8ec35194bfcb 100644
--- a/net/core/link_watch.c
+++ b/net/core/link_watch.c
@@ -33,7 +33,7 @@ static DECLARE_DELAYED_WORK(linkwatch_work, linkwatch_event);
static LIST_HEAD(lweventlist);
static DEFINE_SPINLOCK(lweventlist_lock);
-static unsigned char default_operstate(const struct net_device *dev)
+static unsigned int default_operstate(const struct net_device *dev)
{
if (netif_testing(dev))
return IF_OPER_TESTING;
@@ -62,16 +62,13 @@ static unsigned char default_operstate(const struct net_device *dev)
return IF_OPER_UP;
}
-
static void rfc2863_policy(struct net_device *dev)
{
- unsigned char operstate = default_operstate(dev);
+ unsigned int operstate = default_operstate(dev);
if (operstate == READ_ONCE(dev->operstate))
return;
- write_lock(&dev_base_lock);
-
switch(dev->link_mode) {
case IF_LINK_MODE_TESTING:
if (operstate == IF_OPER_UP)
@@ -88,8 +85,6 @@ static void rfc2863_policy(struct net_device *dev)
}
WRITE_ONCE(dev->operstate, operstate);
-
- write_unlock(&dev_base_lock);
}