* [PATCH net-next] net/hsr: add interlink to fill_info output
@ 2025-10-15 10:10 Jan Vaclav
2025-10-15 11:15 ` Fernando Fernandez Mancera
` (2 more replies)
0 siblings, 3 replies; 7+ messages in thread
From: Jan Vaclav @ 2025-10-15 10:10 UTC (permalink / raw)
To: David S. Miller, Eric Dumazet, Simon Horman, Jakub Kicinski
Cc: Paolo Abeni, netdev, Jan Vaclav
Currently, it is possible to configure the interlink
port, but no way to read it back from userspace.
Add it to the output of hsr_fill_info(), so it can be
read from userspace, for example:
$ ip -d link show hsr0
12: hsr0: <BROADCAST,MULTICAST> mtu ...
...
hsr slave1 veth0 slave2 veth1 interlink veth2 ...
Signed-off-by: Jan Vaclav <jvaclav@redhat.com>
---
net/hsr/hsr_netlink.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/net/hsr/hsr_netlink.c b/net/hsr/hsr_netlink.c
index 4461adf69623..851187130755 100644
--- a/net/hsr/hsr_netlink.c
+++ b/net/hsr/hsr_netlink.c
@@ -160,6 +160,12 @@ static int hsr_fill_info(struct sk_buff *skb, const struct net_device *dev)
goto nla_put_failure;
}
+ port = hsr_port_get_hsr(hsr, HSR_PT_INTERLINK);
+ if (port) {
+ if (nla_put_u32(skb, IFLA_HSR_INTERLINK, port->dev->ifindex))
+ goto nla_put_failure;
+ }
+
if (nla_put(skb, IFLA_HSR_SUPERVISION_ADDR, ETH_ALEN,
hsr->sup_multicast_addr) ||
nla_put_u16(skb, IFLA_HSR_SEQ_NR, hsr->sequence_nr))
--
2.51.0
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH net-next] net/hsr: add interlink to fill_info output
2025-10-15 10:10 [PATCH net-next] net/hsr: add interlink to fill_info output Jan Vaclav
@ 2025-10-15 11:15 ` Fernando Fernandez Mancera
2025-10-16 22:57 ` Jakub Kicinski
2025-10-16 23:00 ` patchwork-bot+netdevbpf
2 siblings, 0 replies; 7+ messages in thread
From: Fernando Fernandez Mancera @ 2025-10-15 11:15 UTC (permalink / raw)
To: Jan Vaclav, David S. Miller, Eric Dumazet, Simon Horman,
Jakub Kicinski
Cc: Paolo Abeni, netdev
On 10/15/25 12:10 PM, Jan Vaclav wrote:
> Currently, it is possible to configure the interlink
> port, but no way to read it back from userspace.
>
> Add it to the output of hsr_fill_info(), so it can be
> read from userspace, for example:
>
> $ ip -d link show hsr0
> 12: hsr0: <BROADCAST,MULTICAST> mtu ...
> ...
> hsr slave1 veth0 slave2 veth1 interlink veth2 ...
>
> Signed-off-by: Jan Vaclav <jvaclav@redhat.com>
> ---
> net/hsr/hsr_netlink.c | 6 ++++++
> 1 file changed, 6 insertions(+)
>
> diff --git a/net/hsr/hsr_netlink.c b/net/hsr/hsr_netlink.c
> index 4461adf69623..851187130755 100644
> --- a/net/hsr/hsr_netlink.c
> +++ b/net/hsr/hsr_netlink.c
> @@ -160,6 +160,12 @@ static int hsr_fill_info(struct sk_buff *skb, const struct net_device *dev)
> goto nla_put_failure;
> }
>
> + port = hsr_port_get_hsr(hsr, HSR_PT_INTERLINK);
> + if (port) {
> + if (nla_put_u32(skb, IFLA_HSR_INTERLINK, port->dev->ifindex))
> + goto nla_put_failure;
> + }
> +
> if (nla_put(skb, IFLA_HSR_SUPERVISION_ADDR, ETH_ALEN,
> hsr->sup_multicast_addr) ||
> nla_put_u16(skb, IFLA_HSR_SEQ_NR, hsr->sequence_nr))
Thank you Jan, it looks good to me.
Reviewed-by: Fernando Fernandez Mancera <fmancera@suse.de>
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH net-next] net/hsr: add interlink to fill_info output
2025-10-15 10:10 [PATCH net-next] net/hsr: add interlink to fill_info output Jan Vaclav
2025-10-15 11:15 ` Fernando Fernandez Mancera
@ 2025-10-16 22:57 ` Jakub Kicinski
2025-10-17 10:17 ` Fernando Fernandez Mancera
2025-10-16 23:00 ` patchwork-bot+netdevbpf
2 siblings, 1 reply; 7+ messages in thread
From: Jakub Kicinski @ 2025-10-16 22:57 UTC (permalink / raw)
To: Jan Vaclav
Cc: David S. Miller, Eric Dumazet, Simon Horman, Paolo Abeni, netdev
On Wed, 15 Oct 2025 12:10:02 +0200 Jan Vaclav wrote:
> Currently, it is possible to configure the interlink
> port, but no way to read it back from userspace.
>
> Add it to the output of hsr_fill_info(), so it can be
> read from userspace, for example:
>
> $ ip -d link show hsr0
> 12: hsr0: <BROADCAST,MULTICAST> mtu ...
> ...
> hsr slave1 veth0 slave2 veth1 interlink veth2 ...
Not entirely cleat at a glance how this driver deals with the slaves or
interlink being in a different netns, but I guess that's a pre-existing
problem..
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH net-next] net/hsr: add interlink to fill_info output
2025-10-15 10:10 [PATCH net-next] net/hsr: add interlink to fill_info output Jan Vaclav
2025-10-15 11:15 ` Fernando Fernandez Mancera
2025-10-16 22:57 ` Jakub Kicinski
@ 2025-10-16 23:00 ` patchwork-bot+netdevbpf
2 siblings, 0 replies; 7+ messages in thread
From: patchwork-bot+netdevbpf @ 2025-10-16 23:00 UTC (permalink / raw)
To: Jan Vaclav; +Cc: davem, edumazet, horms, kuba, pabeni, netdev
Hello:
This patch was applied to netdev/net-next.git (main)
by Jakub Kicinski <kuba@kernel.org>:
On Wed, 15 Oct 2025 12:10:02 +0200 you wrote:
> Currently, it is possible to configure the interlink
> port, but no way to read it back from userspace.
>
> Add it to the output of hsr_fill_info(), so it can be
> read from userspace, for example:
>
> $ ip -d link show hsr0
> 12: hsr0: <BROADCAST,MULTICAST> mtu ...
> ...
> hsr slave1 veth0 slave2 veth1 interlink veth2 ...
>
> [...]
Here is the summary with links:
- [net-next] net/hsr: add interlink to fill_info output
https://git.kernel.org/netdev/net-next/c/f18c231fb12a
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH net-next] net/hsr: add interlink to fill_info output
2025-10-16 22:57 ` Jakub Kicinski
@ 2025-10-17 10:17 ` Fernando Fernandez Mancera
2025-10-17 22:17 ` Jakub Kicinski
0 siblings, 1 reply; 7+ messages in thread
From: Fernando Fernandez Mancera @ 2025-10-17 10:17 UTC (permalink / raw)
To: Jakub Kicinski, Jan Vaclav
Cc: David S. Miller, Eric Dumazet, Simon Horman, Paolo Abeni, netdev
On 10/17/25 12:57 AM, Jakub Kicinski wrote:
> On Wed, 15 Oct 2025 12:10:02 +0200 Jan Vaclav wrote:
>> Currently, it is possible to configure the interlink port, but no
>> way to read it back from userspace.
>>
>> Add it to the output of hsr_fill_info(), so it can be read from
>> userspace, for example:
>>
>> $ ip -d link show hsr0 12: hsr0: <BROADCAST,MULTICAST> mtu ... ...
>> hsr slave1 veth0 slave2 veth1 interlink veth2 ...
>
> Not entirely cleat at a glance how this driver deals with the slaves
> or interlink being in a different netns, but I guess that's a pre-
> existing problem..
>
FTR, I just did a quick round of testing and it handles it correctly.
When moving a port to a different netns it notifies NETDEV_UNREGISTER -
net/hsr/hsr_main.c handles the notification removing the port from the
list. If the port list is empty, removes the hsr link.
All good or at least as I would expect.
Thanks,
Fernando.
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH net-next] net/hsr: add interlink to fill_info output
2025-10-17 10:17 ` Fernando Fernandez Mancera
@ 2025-10-17 22:17 ` Jakub Kicinski
2025-10-18 10:10 ` Fernando Fernandez Mancera
0 siblings, 1 reply; 7+ messages in thread
From: Jakub Kicinski @ 2025-10-17 22:17 UTC (permalink / raw)
To: Fernando Fernandez Mancera
Cc: Jan Vaclav, David S. Miller, Eric Dumazet, Simon Horman,
Paolo Abeni, netdev
On Fri, 17 Oct 2025 12:17:21 +0200 Fernando Fernandez Mancera wrote:
> On 10/17/25 12:57 AM, Jakub Kicinski wrote:
> > On Wed, 15 Oct 2025 12:10:02 +0200 Jan Vaclav wrote:
> >> Currently, it is possible to configure the interlink port, but no
> >> way to read it back from userspace.
> >>
> >> Add it to the output of hsr_fill_info(), so it can be read from
> >> userspace, for example:
> >>
> >> $ ip -d link show hsr0 12: hsr0: <BROADCAST,MULTICAST> mtu ... ...
> >> hsr slave1 veth0 slave2 veth1 interlink veth2 ...
> >
> > Not entirely cleat at a glance how this driver deals with the slaves
> > or interlink being in a different netns, but I guess that's a pre-
> > existing problem..
> >
>
> FTR, I just did a quick round of testing and it handles it correctly.
> When moving a port to a different netns it notifies NETDEV_UNREGISTER -
> net/hsr/hsr_main.c handles the notification removing the port from the
> list. If the port list is empty, removes the hsr link.
>
> All good or at least as I would expect.
Did you try to make the slave/interlink be in a different namespace
when HSR interface is created? It should be possible with the right
combination of NEWLINK attributes, and that's the config I was
particularly concerned about..
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH net-next] net/hsr: add interlink to fill_info output
2025-10-17 22:17 ` Jakub Kicinski
@ 2025-10-18 10:10 ` Fernando Fernandez Mancera
0 siblings, 0 replies; 7+ messages in thread
From: Fernando Fernandez Mancera @ 2025-10-18 10:10 UTC (permalink / raw)
To: Jakub Kicinski
Cc: Jan Vaclav, David S. Miller, Eric Dumazet, Simon Horman,
Paolo Abeni, netdev
On 10/18/25 12:17 AM, Jakub Kicinski wrote:
> On Fri, 17 Oct 2025 12:17:21 +0200 Fernando Fernandez Mancera wrote:
>> On 10/17/25 12:57 AM, Jakub Kicinski wrote:
>>> On Wed, 15 Oct 2025 12:10:02 +0200 Jan Vaclav wrote:
>>>> Currently, it is possible to configure the interlink port, but no
>>>> way to read it back from userspace.
>>>>
>>>> Add it to the output of hsr_fill_info(), so it can be read from
>>>> userspace, for example:
>>>>
>>>> $ ip -d link show hsr0 12: hsr0: <BROADCAST,MULTICAST> mtu ... ...
>>>> hsr slave1 veth0 slave2 veth1 interlink veth2 ...
>>>
>>> Not entirely cleat at a glance how this driver deals with the slaves
>>> or interlink being in a different netns, but I guess that's a pre-
>>> existing problem..
>>>
>>
>> FTR, I just did a quick round of testing and it handles it correctly.
>> When moving a port to a different netns it notifies NETDEV_UNREGISTER -
>> net/hsr/hsr_main.c handles the notification removing the port from the
>> list. If the port list is empty, removes the hsr link.
>>
>> All good or at least as I would expect.
>
> Did you try to make the slave/interlink be in a different namespace
> when HSR interface is created? It should be possible with the right
> combination of NEWLINK attributes, and that's the config I was
> particularly concerned about..
>
Ugh, right. It is completely messed up indeed. I am handling this in a
patch series. Thanks you Jakub.
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2025-10-18 10:11 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-10-15 10:10 [PATCH net-next] net/hsr: add interlink to fill_info output Jan Vaclav
2025-10-15 11:15 ` Fernando Fernandez Mancera
2025-10-16 22:57 ` Jakub Kicinski
2025-10-17 10:17 ` Fernando Fernandez Mancera
2025-10-17 22:17 ` Jakub Kicinski
2025-10-18 10:10 ` Fernando Fernandez Mancera
2025-10-16 23:00 ` patchwork-bot+netdevbpf
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).