Re: [RFC net-next 0/2] hsr: Use only one MAC address per node

Fernando Fernandez Mancera <[email protected]> Tue, 4 Aug 2026 15:18:42 +0200
Newsgroups gmane.linux.network
Message-ID <[email protected]>
On 7/14/26 12:52 PM, Felix Maurer wrote:
> Many places in the hsr module assumed that a single node could be using
> multiple MAC addresses to communicate in the network. The standard is
> explicit that PRP nodes should use the same MAC for frames on both
> ports and commit b65999e7238e ("net: hsr: sync hw addr of slave2
> according to slave1 hw addr on PRP") made this clear. For HSR, the
> standard is less explicit. But after quite some discussions and reading
> standards, Fernando, Sebastian, and I concluded that it never mentions
> different MAC addresses for HSR either and instead often suggests using
> equal addresses for both ports and this should be what hsr interfaces
> do.
> 
> A short history of how this assumption formed in the kernel supports
> this as well: the original HSRv0 code implemented IEC 62439-3:2010 where
> node tables had two MAC addresses per node. It was an optional feature
> to support an unspecified address substitution mechanism for _PRP_, also
> referred to as PICS_SUBS. Note that we never even supported PRPv0 from
> the :2010 standard. In IEC 62439-3:2012, the feature was explicitly
> removed. But with two addresses per node in the node table and selftests
> setting different addresses for both interfaces, the assumption emerged
> that all nodes can have two addresses. In :2010, this was optional and
> the standard is written so that a node not supporting PICS_SUBS could
> just ignore it. Since 2012:, nodes must use the same address for both
> ports in the ring.
> 
> To prevent misconfiguration and simplify the hsr code, this patchset
> removes the notion of two different MAC addresses for one node in the
> network entirely. The first patch sets equal addresses on both ports so
> that we are not running in invalid configurations. I also updates the
> selftest to not use/expect different addresses on the two ports. The
> second patch removes MAC address B from the node table and thereby
> eliminates a lot of code, including the node merging.
> 
> I am posting as an RFC for now mostly for two reasons: First, I want to
> make sure it's generally accepted to have only a single MAC address per
> node and give everyone the chance to speak up against this.
> 
> Second, I adapted the PRP address handling to HSR as well, i.e., to copy
> the address from port A to port B and master, mostly because it is low
> effort. I am not sure though if this is the best approach now that we
> touch this part of the code anyways. I have two alternative ideas how
> addresses should be handled:
> 
> 1) Make the master control the port MAC addresses: when the hsr
>     interface is created, generate a MAC address and assign it to both
>     ports. Changing the address afterwards would also only go through the
>     hsr interface which would update both ports.
> 2) Don't change the MAC addresses of the port interfaces at all. Instead
>     behave similar to bridge where the ports keep their addresses and
>     traffic from the bridge/master gets its own MAC address assigned.
> 
> What do you think? Do you prefer any of these approaches?
> 

Hi Felix, thank you very much for this work. I agree with the overall 
analysis you provided here.

I would try to go for the same solution in both PRP and HSR. Why the 
current approach isn't suitable? If we are going to change the approach 
(for a good reason) I would go for 1).

FWIW, I didn't test this yet.

> Thanks,
>     Felix
> 
> 
> Cc: Fernando Fernandez Mancera <[email protected]>
> Cc: Sebastian Andrzej Siewior <[email protected]>
> 
> Felix Maurer (2):
>    hsr: Set equal MAC addresses on port A and B for HSR
>    hsr: Remove second MAC address from node table
> 
>   net/hsr/hsr_debugfs.c                         |   9 +-
>   net/hsr/hsr_device.c                          |  23 +-
>   net/hsr/hsr_forward.c                         |   8 +-
>   net/hsr/hsr_framereg.c                        | 250 ++----------------
>   net/hsr/hsr_framereg.h                        |  14 +-
>   net/hsr/hsr_main.c                            |  18 +-
>   net/hsr/hsr_main.h                            |   5 +-
>   net/hsr/hsr_netlink.c                         |  18 +-
>   tools/testing/selftests/net/hsr/hsr_ping.sh   |  33 +--
>   tools/testing/selftests/net/hsr/hsr_redbox.sh |  13 +-
>   .../testing/selftests/net/hsr/link_faults.sh  |  26 --
>   11 files changed, 62 insertions(+), 355 deletions(-)
> 
> 
> base-commit: f6f3b36c15ed44de1fbb44e645e4fae8c4a4453e
> --
> 2.55.0
>