From: Hangbin Liu <liuhangbin@gmail.com>
To: netdev@vger.kernel.org
Cc: "David S. Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@google.com>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
Simon Horman <horms@kernel.org>, Jakub Acs <acsjakub@amazon.de>,
Sebastian Andrzej Siewior <bigeasy@linutronix.de>,
Fernando Fernandez Mancera <ffmancera@riseup.net>,
Taehee Yoo <ap420073@gmail.com>,
Hangbin Liu <liuhangbin@gmail.com>
Subject: [PATCH net] hsr: use netdev_master_upper_dev_link() when linking lower ports
Date: Tue, 26 Aug 2025 01:33:52 +0000 [thread overview]
Message-ID: <20250826013352.425997-1-liuhangbin@gmail.com> (raw)
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 also improves user experience, since ip link will now display the
HSR device as the master for its ports.
Fixes: e0a4b99773d3 ("hsr: use upper/lower device infrastructure")
Signed-off-by: Hangbin Liu <liuhangbin@gmail.com>
---
net/hsr/hsr_slave.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/net/hsr/hsr_slave.c b/net/hsr/hsr_slave.c
index 102eccf5ead7..8177ac6c2d26 100644
--- a/net/hsr/hsr_slave.c
+++ b/net/hsr/hsr_slave.c
@@ -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;
--
2.50.1
next reply other threads:[~2025-08-26 1:34 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-08-26 1:33 Hangbin Liu [this message]
2025-08-28 1:06 ` [PATCH net] hsr: use netdev_master_upper_dev_link() when linking lower ports Jakub Kicinski
2025-08-28 4:04 ` Hangbin Liu
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250826013352.425997-1-liuhangbin@gmail.com \
--to=liuhangbin@gmail.com \
--cc=acsjakub@amazon.de \
--cc=ap420073@gmail.com \
--cc=bigeasy@linutronix.de \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=ffmancera@riseup.net \
--cc=horms@kernel.org \
--cc=kuba@kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).