* [PATCH v3] ip link: hsr: Add support for passing information about INTERLINK device
@ 2024-04-02 12:49 Lukasz Majewski
2024-04-26 15:13 ` Lukasz Majewski
0 siblings, 1 reply; 4+ messages in thread
From: Lukasz Majewski @ 2024-04-02 12:49 UTC (permalink / raw)
To: Andrew Lunn, Stephen Hemminger
Cc: Eric Dumazet, Florian Fainelli, Vladimir Oltean, David S. Miller,
Jakub Kicinski, netdev, Lukasz Majewski
The HSR capable device can operate in two modes of operations -
Doubly Attached Node for HSR (DANH) and RedBOX (HSR-SAN).
The latter one allows connection of non-HSR aware device(s) to HSR
network.
This node is called SAN (Singly Attached Network) and is connected via
INTERLINK network device.
This patch adds support for passing information about the INTERLINK
device, so the Linux driver can properly setup it.
Signed-off-by: Lukasz Majewski <lukma@denx.de>
---
Changes for v2:
- Rebase the patch on top of iproute2-next/main repo
- Replace matches() with strcmp() when interlink
- Use print_color_string() instead of just print_string()
Changes for v3:
- Add proper description to ip/iplink.c and man/man8/ip-link.8.in
---
ip/iplink.c | 4 ++--
ip/iplink_hsr.c | 18 +++++++++++++++++-
man/man8/ip-link.8.in | 5 +++++
3 files changed, 24 insertions(+), 3 deletions(-)
diff --git a/ip/iplink.c b/ip/iplink.c
index 95314af5..bca365ce 100644
--- a/ip/iplink.c
+++ b/ip/iplink.c
@@ -40,8 +40,8 @@ void iplink_types_usage(void)
/* Remember to add new entry here if new type is added. */
fprintf(stderr,
"TYPE := { amt | bareudp | bond | bond_slave | bridge | bridge_slave |\n"
- " dsa | dummy | erspan | geneve | gre | gretap | gtp | ifb |\n"
- " ip6erspan | ip6gre | ip6gretap | ip6tnl |\n"
+ " dsa | dummy | erspan | geneve | gre | gretap | gtp | hsr |\n"
+ " ifb | ip6erspan | ip6gre | ip6gretap | ip6tnl |\n"
" ipip | ipoib | ipvlan | ipvtap |\n"
" macsec | macvlan | macvtap | netdevsim |\n"
" netkit | nlmon | rmnet | sit | team | team_slave |\n"
diff --git a/ip/iplink_hsr.c b/ip/iplink_hsr.c
index 76f24a6a..42adb430 100644
--- a/ip/iplink_hsr.c
+++ b/ip/iplink_hsr.c
@@ -21,12 +21,15 @@ static void print_usage(FILE *f)
{
fprintf(f,
"Usage:\tip link add name NAME type hsr slave1 SLAVE1-IF slave2 SLAVE2-IF\n"
- "\t[ supervision ADDR-BYTE ] [version VERSION] [proto PROTOCOL]\n"
+ "\t[ interlink INTERLINK-IF ] [ supervision ADDR-BYTE ] [ version VERSION ]\n"
+ "\t[ proto PROTOCOL ]\n"
"\n"
"NAME\n"
" name of new hsr device (e.g. hsr0)\n"
"SLAVE1-IF, SLAVE2-IF\n"
" the two slave devices bound to the HSR device\n"
+ "INTERLINK-IF\n"
+ " the interlink device bound to the HSR network to connect SAN device(s)\n"
"ADDR-BYTE\n"
" 0-255; the last byte of the multicast address used for HSR supervision\n"
" frames (default = 0)\n"
@@ -82,6 +85,12 @@ static int hsr_parse_opt(struct link_util *lu, int argc, char **argv,
if (ifindex == 0)
invarg("No such interface", *argv);
addattr_l(n, 1024, IFLA_HSR_SLAVE2, &ifindex, 4);
+ } else if (strcmp(*argv, "interlink") == 0) {
+ NEXT_ARG();
+ ifindex = ll_name_to_index(*argv);
+ if (ifindex == 0)
+ invarg("No such interface", *argv);
+ addattr_l(n, 1024, IFLA_HSR_INTERLINK, &ifindex, 4);
} else if (matches(*argv, "help") == 0) {
usage();
return -1;
@@ -109,6 +118,9 @@ static void hsr_print_opt(struct link_util *lu, FILE *f, struct rtattr *tb[])
if (tb[IFLA_HSR_SLAVE2] &&
RTA_PAYLOAD(tb[IFLA_HSR_SLAVE2]) < sizeof(__u32))
return;
+ if (tb[IFLA_HSR_INTERLINK] &&
+ RTA_PAYLOAD(tb[IFLA_HSR_INTERLINK]) < sizeof(__u32))
+ return;
if (tb[IFLA_HSR_SEQ_NR] &&
RTA_PAYLOAD(tb[IFLA_HSR_SEQ_NR]) < sizeof(__u16))
return;
@@ -132,6 +144,10 @@ static void hsr_print_opt(struct link_util *lu, FILE *f, struct rtattr *tb[])
else
print_null(PRINT_ANY, "slave2", "slave2 %s ", "<none>");
+ if (tb[IFLA_HSR_INTERLINK])
+ print_color_string(PRINT_ANY, COLOR_IFNAME, "interlink", "interlink %s ",
+ ll_index_to_name(rta_getattr_u32(tb[IFLA_HSR_INTERLINK])));
+
if (tb[IFLA_HSR_SEQ_NR])
print_int(PRINT_ANY,
"seq_nr",
diff --git a/man/man8/ip-link.8.in b/man/man8/ip-link.8.in
index 31e2d7f0..8aab29bf 100644
--- a/man/man8/ip-link.8.in
+++ b/man/man8/ip-link.8.in
@@ -1621,6 +1621,8 @@ the following additional arguments are supported:
.BI "ip link add link " DEVICE " name " NAME " type hsr"
.BI slave1 " SLAVE1-IF " slave2 " SLAVE2-IF "
+.RB [ " interlink"
+.IR INTERLINK-IF " ] "
.RB [ " supervision"
.IR ADDR-BYTE " ] ["
.BR version " { " 0 " | " 1 " } ["
@@ -1637,6 +1639,9 @@ the following additional arguments are supported:
.BI slave2 " SLAVE2-IF "
- Specifies the physical device used for the second of the two ring ports.
+.BI interlink " INTERLINK-IF"
+- The interlink device bound to the HSR network to connect SAN device(s).
+
.BI supervision " ADDR-BYTE"
- The last byte of the multicast address used for HSR supervision frames.
Default option is "0", possible values 0-255.
--
2.20.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH v3] ip link: hsr: Add support for passing information about INTERLINK device
2024-04-02 12:49 [PATCH v3] ip link: hsr: Add support for passing information about INTERLINK device Lukasz Majewski
@ 2024-04-26 15:13 ` Lukasz Majewski
2024-04-26 23:05 ` David Ahern
0 siblings, 1 reply; 4+ messages in thread
From: Lukasz Majewski @ 2024-04-26 15:13 UTC (permalink / raw)
To: Andrew Lunn, Stephen Hemminger
Cc: Eric Dumazet, Florian Fainelli, Vladimir Oltean, David S. Miller,
Jakub Kicinski, netdev
[-- Attachment #1: Type: text/plain, Size: 5460 bytes --]
Hi Stephen,
> The HSR capable device can operate in two modes of operations -
> Doubly Attached Node for HSR (DANH) and RedBOX (HSR-SAN).
>
> The latter one allows connection of non-HSR aware device(s) to HSR
> network.
> This node is called SAN (Singly Attached Network) and is connected via
> INTERLINK network device.
>
> This patch adds support for passing information about the INTERLINK
> device, so the Linux driver can properly setup it.
>
As the HSR-SAN support patches have been already pulled to next-next, I
would like to gentle remind about this patch.
Thanks in advance.
> Signed-off-by: Lukasz Majewski <lukma@denx.de>
>
> ---
> Changes for v2:
>
> - Rebase the patch on top of iproute2-next/main repo
> - Replace matches() with strcmp() when interlink
> - Use print_color_string() instead of just print_string()
>
> Changes for v3:
> - Add proper description to ip/iplink.c and man/man8/ip-link.8.in
> ---
> ip/iplink.c | 4 ++--
> ip/iplink_hsr.c | 18 +++++++++++++++++-
> man/man8/ip-link.8.in | 5 +++++
> 3 files changed, 24 insertions(+), 3 deletions(-)
>
> diff --git a/ip/iplink.c b/ip/iplink.c
> index 95314af5..bca365ce 100644
> --- a/ip/iplink.c
> +++ b/ip/iplink.c
> @@ -40,8 +40,8 @@ void iplink_types_usage(void)
> /* Remember to add new entry here if new type is added. */
> fprintf(stderr,
> "TYPE := { amt | bareudp | bond | bond_slave |
> bridge | bridge_slave |\n"
> - " dsa | dummy | erspan | geneve | gre |
> gretap | gtp | ifb |\n"
> - " ip6erspan | ip6gre | ip6gretap | ip6tnl
> |\n"
> + " dsa | dummy | erspan | geneve | gre |
> gretap | gtp | hsr |\n"
> + " ifb | ip6erspan | ip6gre | ip6gretap |
> ip6tnl |\n" " ipip | ipoib | ipvlan | ipvtap |\n"
> " macsec | macvlan | macvtap | netdevsim
> |\n" " netkit | nlmon | rmnet | sit | team | team_slave |\n"
> diff --git a/ip/iplink_hsr.c b/ip/iplink_hsr.c
> index 76f24a6a..42adb430 100644
> --- a/ip/iplink_hsr.c
> +++ b/ip/iplink_hsr.c
> @@ -21,12 +21,15 @@ static void print_usage(FILE *f)
> {
> fprintf(f,
> "Usage:\tip link add name NAME type hsr slave1
> SLAVE1-IF slave2 SLAVE2-IF\n"
> - "\t[ supervision ADDR-BYTE ] [version VERSION]
> [proto PROTOCOL]\n"
> + "\t[ interlink INTERLINK-IF ] [ supervision
> ADDR-BYTE ] [ version VERSION ]\n"
> + "\t[ proto PROTOCOL ]\n"
> "\n"
> "NAME\n"
> " name of new hsr device (e.g. hsr0)\n"
> "SLAVE1-IF, SLAVE2-IF\n"
> " the two slave devices bound to the HSR
> device\n"
> + "INTERLINK-IF\n"
> + " the interlink device bound to the HSR
> network to connect SAN device(s)\n" "ADDR-BYTE\n"
> " 0-255; the last byte of the multicast
> address used for HSR supervision\n" " frames (default = 0)\n"
> @@ -82,6 +85,12 @@ static int hsr_parse_opt(struct link_util *lu, int
> argc, char **argv, if (ifindex == 0)
> invarg("No such interface", *argv);
> addattr_l(n, 1024, IFLA_HSR_SLAVE2,
> &ifindex, 4);
> + } else if (strcmp(*argv, "interlink") == 0) {
> + NEXT_ARG();
> + ifindex = ll_name_to_index(*argv);
> + if (ifindex == 0)
> + invarg("No such interface", *argv);
> + addattr_l(n, 1024, IFLA_HSR_INTERLINK,
> &ifindex, 4); } else if (matches(*argv, "help") == 0) {
> usage();
> return -1;
> @@ -109,6 +118,9 @@ static void hsr_print_opt(struct link_util *lu,
> FILE *f, struct rtattr *tb[]) if (tb[IFLA_HSR_SLAVE2] &&
> RTA_PAYLOAD(tb[IFLA_HSR_SLAVE2]) < sizeof(__u32))
> return;
> + if (tb[IFLA_HSR_INTERLINK] &&
> + RTA_PAYLOAD(tb[IFLA_HSR_INTERLINK]) < sizeof(__u32))
> + return;
> if (tb[IFLA_HSR_SEQ_NR] &&
> RTA_PAYLOAD(tb[IFLA_HSR_SEQ_NR]) < sizeof(__u16))
> return;
> @@ -132,6 +144,10 @@ static void hsr_print_opt(struct link_util *lu,
> FILE *f, struct rtattr *tb[]) else
> print_null(PRINT_ANY, "slave2", "slave2 %s ",
> "<none>");
> + if (tb[IFLA_HSR_INTERLINK])
> + print_color_string(PRINT_ANY, COLOR_IFNAME,
> "interlink", "interlink %s ",
> +
> ll_index_to_name(rta_getattr_u32(tb[IFLA_HSR_INTERLINK]))); +
> if (tb[IFLA_HSR_SEQ_NR])
> print_int(PRINT_ANY,
> "seq_nr",
> diff --git a/man/man8/ip-link.8.in b/man/man8/ip-link.8.in
> index 31e2d7f0..8aab29bf 100644
> --- a/man/man8/ip-link.8.in
> +++ b/man/man8/ip-link.8.in
> @@ -1621,6 +1621,8 @@ the following additional arguments are
> supported:
> .BI "ip link add link " DEVICE " name " NAME " type hsr"
> .BI slave1 " SLAVE1-IF " slave2 " SLAVE2-IF "
> +.RB [ " interlink"
> +.IR INTERLINK-IF " ] "
> .RB [ " supervision"
> .IR ADDR-BYTE " ] ["
> .BR version " { " 0 " | " 1 " } ["
> @@ -1637,6 +1639,9 @@ the following additional arguments are
> supported: .BI slave2 " SLAVE2-IF "
> - Specifies the physical device used for the second of the two ring
> ports.
> +.BI interlink " INTERLINK-IF"
> +- The interlink device bound to the HSR network to connect SAN
> device(s). +
> .BI supervision " ADDR-BYTE"
> - The last byte of the multicast address used for HSR supervision
> frames. Default option is "0", possible values 0-255.
Best regards,
Lukasz Majewski
--
DENX Software Engineering GmbH, Managing Director: Erika Unter
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-59 Fax: (+49)-8142-66989-80 Email: lukma@denx.de
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH v3] ip link: hsr: Add support for passing information about INTERLINK device
2024-04-26 15:13 ` Lukasz Majewski
@ 2024-04-26 23:05 ` David Ahern
2024-04-29 9:24 ` Lukasz Majewski
0 siblings, 1 reply; 4+ messages in thread
From: David Ahern @ 2024-04-26 23:05 UTC (permalink / raw)
To: Lukasz Majewski, Andrew Lunn, Stephen Hemminger
Cc: Eric Dumazet, Florian Fainelli, Vladimir Oltean, David S. Miller,
Jakub Kicinski, netdev
On 4/26/24 9:13 AM, Lukasz Majewski wrote:
> Hi Stephen,
>
>> The HSR capable device can operate in two modes of operations -
>> Doubly Attached Node for HSR (DANH) and RedBOX (HSR-SAN).
>>
>> The latter one allows connection of non-HSR aware device(s) to HSR
>> network.
>> This node is called SAN (Singly Attached Network) and is connected via
>> INTERLINK network device.
>>
>> This patch adds support for passing information about the INTERLINK
>> device, so the Linux driver can properly setup it.
>>
>
> As the HSR-SAN support patches have been already pulled to next-next, I
> would like to gentle remind about this patch.
>
You need to re-send. It took so long for the kernel side to merge, I
marked it as waiting upstream.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH v3] ip link: hsr: Add support for passing information about INTERLINK device
2024-04-26 23:05 ` David Ahern
@ 2024-04-29 9:24 ` Lukasz Majewski
0 siblings, 0 replies; 4+ messages in thread
From: Lukasz Majewski @ 2024-04-29 9:24 UTC (permalink / raw)
To: David Ahern
Cc: Andrew Lunn, Stephen Hemminger, Eric Dumazet, Florian Fainelli,
Vladimir Oltean, David S. Miller, Jakub Kicinski, netdev
[-- Attachment #1: Type: text/plain, Size: 1114 bytes --]
Hi David,
> On 4/26/24 9:13 AM, Lukasz Majewski wrote:
> > Hi Stephen,
> >
> >> The HSR capable device can operate in two modes of operations -
> >> Doubly Attached Node for HSR (DANH) and RedBOX (HSR-SAN).
> >>
> >> The latter one allows connection of non-HSR aware device(s) to HSR
> >> network.
> >> This node is called SAN (Singly Attached Network) and is connected
> >> via INTERLINK network device.
> >>
> >> This patch adds support for passing information about the INTERLINK
> >> device, so the Linux driver can properly setup it.
> >>
> >
> > As the HSR-SAN support patches have been already pulled to
> > next-next, I would like to gentle remind about this patch.
> >
>
> You need to re-send. It took so long for the kernel side to merge, I
> marked it as waiting upstream.
>
I've just re-send the patch.
Best regards,
Lukasz Majewski
--
DENX Software Engineering GmbH, Managing Director: Erika Unter
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-59 Fax: (+49)-8142-66989-80 Email: lukma@denx.de
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2024-04-29 9:24 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-04-02 12:49 [PATCH v3] ip link: hsr: Add support for passing information about INTERLINK device Lukasz Majewski
2024-04-26 15:13 ` Lukasz Majewski
2024-04-26 23:05 ` David Ahern
2024-04-29 9:24 ` Lukasz Majewski
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).