netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net] hsr: use netdev_master_upper_dev_link() when linking lower ports
@ 2025-08-26  1:33 Hangbin Liu
  2025-08-28  1:06 ` Jakub Kicinski
  0 siblings, 1 reply; 3+ messages in thread
From: Hangbin Liu @ 2025-08-26  1:33 UTC (permalink / raw)
  To: netdev
  Cc: David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
	Simon Horman, Jakub Acs, Sebastian Andrzej Siewior,
	Fernando Fernandez Mancera, Taehee Yoo, Hangbin Liu

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


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH net] hsr: use netdev_master_upper_dev_link() when linking lower ports
  2025-08-26  1:33 [PATCH net] hsr: use netdev_master_upper_dev_link() when linking lower ports Hangbin Liu
@ 2025-08-28  1:06 ` Jakub Kicinski
  2025-08-28  4:04   ` Hangbin Liu
  0 siblings, 1 reply; 3+ messages in thread
From: Jakub Kicinski @ 2025-08-28  1:06 UTC (permalink / raw)
  To: Hangbin Liu
  Cc: netdev, David S. Miller, Eric Dumazet, Paolo Abeni, Simon Horman,
	Jakub Acs, Sebastian Andrzej Siewior, Fernando Fernandez Mancera,
	Taehee Yoo

On Tue, 26 Aug 2025 01:33:52 +0000 Hangbin Liu 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 also improves user experience, since ip link will now display the
       ^^^^

Why this "also" here? You haven't mentioned any benefit of this change
up to this point. AFAIK having the master link is the only one?

> HSR device as the master for its ports.
> 
> Fixes: e0a4b99773d3 ("hsr: use upper/lower device infrastructure")

The current behavior is 5 years old, AFAICT. We need a reason to treat
this as a fix, right now this looks like net-next material..
-- 
pw-bot: cr

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH net] hsr: use netdev_master_upper_dev_link() when linking lower ports
  2025-08-28  1:06 ` Jakub Kicinski
@ 2025-08-28  4:04   ` Hangbin Liu
  0 siblings, 0 replies; 3+ messages in thread
From: Hangbin Liu @ 2025-08-28  4:04 UTC (permalink / raw)
  To: Jakub Kicinski
  Cc: netdev, David S. Miller, Eric Dumazet, Paolo Abeni, Simon Horman,
	Jakub Acs, Sebastian Andrzej Siewior, Fernando Fernandez Mancera,
	Taehee Yoo

On Wed, Aug 27, 2025 at 06:06:03PM -0700, Jakub Kicinski wrote:
> On Tue, 26 Aug 2025 01:33:52 +0000 Hangbin Liu 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 also improves user experience, since ip link will now display the
>        ^^^^
> 
> Why this "also" here? You haven't mentioned any benefit of this change
> up to this point. AFAIK having the master link is the only one?

Apart from the "fix"(I thought), we can "also" benefit of the ip link output.

> 
> > HSR device as the master for its ports.
> > 
> > Fixes: e0a4b99773d3 ("hsr: use upper/lower device infrastructure")
> 
> The current behavior is 5 years old, AFAICT. We need a reason to treat
> this as a fix, right now this looks like net-next material..

If you think this is not a fix. Sure I can remove the "also" word and post to
net-next :)

Thanks
Hangbin

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2025-08-28  4:04 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-08-26  1:33 [PATCH net] hsr: use netdev_master_upper_dev_link() when linking lower ports Hangbin Liu
2025-08-28  1:06 ` Jakub Kicinski
2025-08-28  4:04   ` Hangbin Liu

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).