linux/net/hsr
Lukasz Majewski 4893b8b3ef hsr: Simplify code for announcing HSR nodes timer setup
Up till now the code to start HSR announce timer, which triggers sending
supervisory frames, was assuming that hsr_netdev_notify() would be called
at least twice for hsrX interface. This was required to have different
values for old and current values of network device's operstate.

This is problematic for a case where hsrX interface is already in the
operational state when hsr_netdev_notify() is called, so timer is not
configured to trigger and as a result the hsrX is not sending supervisory
frames to HSR ring.

This error has been discovered when hsr_ping.sh script was run. To be
more specific - for the hsr1 and hsr2 the hsr_netdev_notify() was
called at least twice with different IF_OPER_{LOWERDOWN|DOWN|UP} states
assigned in hsr_check_carrier_and_operstate(hsr). As a result there was
no issue with sending supervisory frames.
However, with hsr3, the notify function was called only once with
operstate set to IF_OPER_UP and timer responsible for triggering
supervisory frames was not fired.

The solution is to use netif_oper_up() and netif_running() helper
functions to assess if network hsrX device is up.
Only then, when the timer is not already pending, it is started.
Otherwise it is deactivated.

Fixes: f421436a59 ("net/hsr: Add support for the High-availability Seamless Redundancy protocol (HSRv0)")
Signed-off-by: Lukasz Majewski <lukma@denx.de>
Reviewed-by: Simon Horman <horms@kernel.org>
Link: https://lore.kernel.org/r/20240507111214.3519800-1-lukma@denx.de
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2024-05-08 18:56:30 -07:00
..
hsr_debugfs.c Revert "net: hsr: use hlist_head instead of list_head for mac addresses" 2022-12-01 20:26:20 -08:00
hsr_device.c hsr: Simplify code for announcing HSR nodes timer setup 2024-05-08 18:56:30 -07:00
hsr_device.h net: hsr: add offloading support 2021-02-11 13:24:44 -08:00
hsr_forward.c net: hsr: Use correct offset for HSR TLV values in supervisory HSR frames 2024-02-29 10:42:46 +01:00
hsr_forward.h net: hsr: fix mac_len checks 2021-05-24 14:10:28 -07:00
hsr_framereg.c hsr: Fix uninit-value access in hsr_get_node() 2024-03-14 13:02:51 +01:00
hsr_framereg.h hsr: Synchronize sequence number updates. 2022-12-01 20:26:21 -08:00
hsr_main.c hsr: Handle failures in module init 2024-03-19 13:38:17 +01:00
hsr_main.h net: hsr: Add __packed to struct hsr_sup_tlv. 2023-09-18 08:26:19 +01:00
hsr_netlink.c Revert "net: hsr: use hlist_head instead of list_head for mac addresses" 2022-12-01 20:26:20 -08:00
hsr_netlink.h net/hsr: Remove unused function declarations 2023-07-31 20:11:47 -07:00
hsr_slave.c net: hsr: hsr_slave: Fix the promiscuous mode in offload mode 2024-03-25 19:51:56 -07:00
hsr_slave.h net: prp: add packet handling support 2020-07-27 12:20:40 -07:00
Kconfig hsr: enhance netlink socket interface to support PRP 2020-07-27 12:20:40 -07:00
Makefile treewide: Add SPDX license identifier - Makefile/Kconfig 2019-05-21 10:50:46 +02:00