Skip to contentSkip to conversation

hsr: use netdev_master_upper_dev_link() when linking lower ports

PATCH Applied Hangbin Liu 2 participants 2 messages Sep 2, 2025 – Sep 9, 2025

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 hsr: use netdev_master_upper_dev_link() when linking lower ports

Unlike VLAN devices, HSR changes the lower device’s rx_handler, which prevents the lower device from being attached to another master. Switch to using netdev_master_upper_dev_link() when setting up the lower device.

This could improves user experience, since ip link will now display the HSR device as the master for its ports.

---

v2: no code change, update description, target to net-next (Jakub Kicinski)

---
 net/hsr/hsr_slave.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
net/hsr/hsr_slave.c +4 -1
index 102eccf5ead7..8177ac6c2d26 100644
@@ -143,6 +143,7 @@ static int hsr_portdev_setup(struct hsr_priv *hsr, struct net_device *dev,
 			     struct netlink_ext_ack *extack)
 
 {
+	struct netdev_lag_upper_info lag_upper_info;
 	struct net_device *hsr_dev;
 	struct hsr_port *master;
 	int res;
@@ -159,7 +160,9 @@ static int hsr_portdev_setup(struct hsr_priv *hsr, struct net_device *dev,
 	master = hsr_port_get_hsr(hsr, HSR_PT_MASTER);
 	hsr_dev = master->dev;
 
-	res = netdev_upper_dev_link(dev, hsr_dev, extack);
+	lag_upper_info.tx_type = NETDEV_LAG_TX_TYPE_BROADCAST;
+	lag_upper_info.hash_type = NETDEV_LAG_HASH_UNKNOWN;
+	res = netdev_master_upper_dev_link(dev, hsr_dev, NULL, &lag_upper_info, extack);
 	if (res)
 		goto fail_upper_dev_link;
 
Signature · 1 line
2.50.1
#1 lore raw
This patch was applied to netdev/net-next.git (main) by Paolo Abeni <[email protected]>:

Hello:

This patch was applied to netdev/net-next.git (main) by Paolo Abeni <[email protected]>:

Quoted 9 lines · On Tue, 2 Sep 2025 06:55:58 +0000 you wrote:

Unlike VLAN devices, HSR changes the lower device’s rx_handler, which prevents the lower device from being attached to another master. Switch to using netdev_master_upper_dev_link() when setting up the lower device.

This could improves user experience, since ip link will now display the HSR device as the master for its ports.

[...]

Here is the summary with links:
- [PATCHv2,net-next] hsr: use netdev_master_upper_dev_link() when linking lower ports

    https://git.kernel.org/netdev/net-next/c/d67ca09ca39f

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html