]> www.infradead.org Git - users/hch/misc.git/commitdiff
hsr: use netdev_master_upper_dev_link() when linking lower ports
authorHangbin Liu <liuhangbin@gmail.com>
Tue, 2 Sep 2025 06:55:58 +0000 (06:55 +0000)
committerPaolo Abeni <pabeni@redhat.com>
Tue, 9 Sep 2025 09:27:37 +0000 (11:27 +0200)
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.

Signed-off-by: Hangbin Liu <liuhangbin@gmail.com>
Link: https://patch.msgid.link/20250902065558.360927-1-liuhangbin@gmail.com
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
net/hsr/hsr_slave.c

index 102eccf5ead73451dc2e7b9736017b0766035d12..8177ac6c2d26de75ec12cd33e41c1511069b0e00 100644 (file)
@@ -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;