mirror-linux/net/hsr
Xiaoliang Yang a0244e7621 net: hsr: create an API to get hsr port type
Since the introduction of HSR_PT_INTERLINK in commit 5055cccfc2 ("net:
hsr: Provide RedBox support (HSR-SAN)"), we see that different port
types require different settings for hardware offload, which was not the
case before when we only had HSR_PT_SLAVE_A and HSR_PT_SLAVE_B. But
there is currently no way to know which port is which type, so create
the hsr_get_port_type() API function and export it.

When hsr_get_port_type() is called from the device driver, the port can
must be found in the HSR port list. An important use case is for this
function to work from offloading drivers' NETDEV_CHANGEUPPER handler,
which is triggered by hsr_portdev_setup() -> netdev_master_upper_dev_link().
Therefore, we need to move the addition of the hsr_port to the HSR port
list prior to calling hsr_portdev_setup(). This makes the error
restoration path also more similar to hsr_del_port(), where
kfree_rcu(port) is already used.

Cc: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Cc: Lukasz Majewski <lukma@denx.de>
Signed-off-by: Xiaoliang Yang <xiaoliang.yang_1@nxp.com>
Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Reviewed-by: Łukasz Majewski <lukma@nabladev.com>
Link: https://patch.msgid.link/20251130131657.65080-3-vladimir.oltean@nxp.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2025-12-01 16:45:06 -08:00
..
Kconfig net: hsr: Add KUnit test for PRP 2025-03-13 10:04:22 +01:00
Makefile net: hsr: Add KUnit test for PRP 2025-03-13 10:04:22 +01:00
hsr_debugfs.c saner replacement for debugfs_rename() 2025-01-15 13:14:37 +01:00
hsr_device.c net: hsr: create an API to get hsr port type 2025-12-01 16:45:06 -08:00
hsr_device.h net: hsr: Provide RedBox support (HSR-SAN) 2024-04-26 12:04:43 +02:00
hsr_forward.c hsr: Follow standard for HSRv0 supervision frames 2025-11-13 15:55:04 +01:00
hsr_forward.h net: hsr: fix mac_len checks 2021-05-24 14:10:28 -07:00
hsr_framereg.c treewide, timers: Rename from_timer() to timer_container_of() 2025-06-08 09:07:37 +02:00
hsr_framereg.h net: hsr: Fix PRP duplicate detection 2025-03-13 10:04:22 +01:00
hsr_main.c hsr: use hsr_for_each_port_rtnl in hsr_port_get_hsr 2025-09-11 11:49:19 +02:00
hsr_main.h hsr: use rtnl lock when iterating over ports 2025-09-11 11:49:19 +02:00
hsr_netlink.c Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net 2025-10-23 10:53:08 -07:00
hsr_netlink.h net/hsr: Remove unused function declarations 2023-07-31 20:11:47 -07:00
hsr_slave.c net: hsr: create an API to get hsr port type 2025-12-01 16:45:06 -08:00
hsr_slave.h net: prp: add packet handling support 2020-07-27 12:20:40 -07:00
prp_dup_discard_test.c net: hsr: Add KUnit test for PRP 2025-03-13 10:04:22 +01:00