[net-next iproute2 PATCH v3 1/2] iplink: hsr: add support for creating PRP device similar to HSR

Subsystems: networking drivers, the rest

STALE2191d

7 messages, 2 authors, 2020-08-06 · open the first message on its own page

[net-next iproute2 PATCH v3 1/2] iplink: hsr: add support for creating PRP device similar to HSR

From: Murali Karicheri <hidden>
Date: 2020-07-17 15:22:11

This patch enhances the iplink command to add a proto parameters to
create PRP device/interface similar to HSR. Both protocols are
quite similar and requires a pair of Ethernet interfaces. So re-use
the existing HSR iplink command to create PRP device/interface as
well. Use proto parameter to differentiate the two protocols.

Signed-off-by: Murali Karicheri <redacted>
---
 dependent on the series "[net-next PATCH v3 0/7] Add PRP driver"
 include/uapi/linux/if_link.h | 12 +++++++++++-
 ip/iplink_hsr.c              | 19 +++++++++++++++++--
 2 files changed, 28 insertions(+), 3 deletions(-)
diff --git a/include/uapi/linux/if_link.h b/include/uapi/linux/if_link.h
index a8901a39a345..fa2e3f642deb 100644
--- a/include/uapi/linux/if_link.h
+++ b/include/uapi/linux/if_link.h
@@ -904,7 +904,14 @@ enum {
 #define IFLA_IPOIB_MAX (__IFLA_IPOIB_MAX - 1)
 
 
-/* HSR section */
+/* HSR/PRP section, both uses same interface */
+
+/* Different redundancy protocols for hsr device */
+enum {
+	HSR_PROTOCOL_HSR,
+	HSR_PROTOCOL_PRP,
+	HSR_PROTOCOL_MAX,
+};
 
 enum {
 	IFLA_HSR_UNSPEC,
@@ -914,6 +921,9 @@ enum {
 	IFLA_HSR_SUPERVISION_ADDR,	/* Supervision frame multicast addr */
 	IFLA_HSR_SEQ_NR,
 	IFLA_HSR_VERSION,		/* HSR version */
+	IFLA_HSR_PROTOCOL,		/* Indicate different protocol than
+					 * HSR. For example PRP.
+					 */
 	__IFLA_HSR_MAX,
 };
 
diff --git a/ip/iplink_hsr.c b/ip/iplink_hsr.c
index 7d9167d4e6a3..6ea138a23cbc 100644
--- a/ip/iplink_hsr.c
+++ b/ip/iplink_hsr.c
@@ -25,7 +25,7 @@ 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]\n"
+		"\t[ supervision ADDR-BYTE ] [version VERSION] [proto PROTOCOL]\n"
 		"\n"
 		"NAME\n"
 		"	name of new hsr device (e.g. hsr0)\n"
@@ -35,7 +35,9 @@ static void print_usage(FILE *f)
 		"	0-255; the last byte of the multicast address used for HSR supervision\n"
 		"	frames (default = 0)\n"
 		"VERSION\n"
-		"	0,1; the protocol version to be used. (default = 0)\n");
+		"	0,1; the protocol version to be used. (default = 0)\n"
+		"PROTOCOL\n"
+		"	0 - HSR, 1 - PRP. (default = 0 - HSR)\n");
 }
 
 static void usage(void)
@@ -49,6 +51,7 @@ static int hsr_parse_opt(struct link_util *lu, int argc, char **argv,
 	int ifindex;
 	unsigned char multicast_spec;
 	unsigned char protocol_version;
+	unsigned char protocol = HSR_PROTOCOL_HSR;
 
 	while (argc > 0) {
 		if (matches(*argv, "supervision") == 0) {
@@ -64,6 +67,13 @@ static int hsr_parse_opt(struct link_util *lu, int argc, char **argv,
 				invarg("version is invalid", *argv);
 			addattr_l(n, 1024, IFLA_HSR_VERSION,
 				  &protocol_version, 1);
+		} else if (matches(*argv, "proto") == 0) {
+			NEXT_ARG();
+			if (!(get_u8(&protocol, *argv, 0) == HSR_PROTOCOL_HSR ||
+			      get_u8(&protocol, *argv, 0) == HSR_PROTOCOL_PRP))
+				invarg("protocol is invalid", *argv);
+			addattr_l(n, 1024, IFLA_HSR_PROTOCOL,
+				  &protocol, 1);
 		} else if (matches(*argv, "slave1") == 0) {
 			NEXT_ARG();
 			ifindex = ll_name_to_index(*argv);
@@ -140,6 +150,11 @@ static void hsr_print_opt(struct link_util *lu, FILE *f, struct rtattr *tb[])
 					 RTA_PAYLOAD(tb[IFLA_HSR_SUPERVISION_ADDR]),
 					 ARPHRD_VOID,
 					 b1, sizeof(b1)));
+	if (tb[IFLA_HSR_PROTOCOL])
+		print_int(PRINT_ANY,
+			  "proto",
+			  "proto %d ",
+			  rta_getattr_u8(tb[IFLA_HSR_PROTOCOL]));
 }
 
 static void hsr_print_help(struct link_util *lu, int argc, char **argv,
-- 
2.17.1

[net-next iproute2 PATCH v3 2/2] ip: iplink: prp: update man page for new parameter

From: Murali Karicheri <hidden>
Date: 2020-07-17 15:22:18

PRP support requires a proto parameter which is 0 for hsr and 1 for
prp. Default is hsr and is backward compatible.

Signed-off-by: Murali Karicheri <redacted>
---
 dependent on the series "[net-next PATCH v3 0/7] Add PRP driver"
 man/man8/ip-link.8.in | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/man/man8/ip-link.8.in b/man/man8/ip-link.8.in
index e8a25451f7cd..37d77328a5fc 100644
--- a/man/man8/ip-link.8.in
+++ b/man/man8/ip-link.8.in
@@ -1360,7 +1360,8 @@ the following additional arguments are supported:
 .BI slave1 " SLAVE1-IF " slave2 " SLAVE2-IF "
 .RB [ " supervision"
 .IR ADDR-BYTE " ] ["
-.BR version " { " 0 " | " 1 " } ]"
+.BR version " { " 0 " | " 1 " } ["
+.BR proto " { " 0 " | " 1 " } ]"
 
 .in +8
 .sp
@@ -1381,6 +1382,12 @@ Default option is "0", possible values 0-255.
 - Selects the protocol version of the interface. Default option is "0", which
 corresponds to the 2010 version of the HSR standard. Option "1" activates the
 2012 version.
+
+.BR proto " { " 0 " | " 1 " }"
+- Selects the protocol at the interface. Default option is "0", which
+corresponds to the HSR standard. Option "1" activates the Parallel
+Redundancy Protocol (PRP).
+.
 .in -8
 
 .TP
-- 
2.17.1

Re: [net-next iproute2 PATCH v3 1/2] iplink: hsr: add support for creating PRP device similar to HSR

From: Murali Karicheri <hidden>
Date: 2020-07-30 13:47:40

Hi Dave,

On 7/17/20 11:22 AM, Murali Karicheri wrote:
quoted hunk
This patch enhances the iplink command to add a proto parameters to
create PRP device/interface similar to HSR. Both protocols are
quite similar and requires a pair of Ethernet interfaces. So re-use
the existing HSR iplink command to create PRP device/interface as
well. Use proto parameter to differentiate the two protocols.

Signed-off-by: Murali Karicheri <redacted>
---
  dependent on the series "[net-next PATCH v3 0/7] Add PRP driver"
  include/uapi/linux/if_link.h | 12 +++++++++++-
  ip/iplink_hsr.c              | 19 +++++++++++++++++--
  2 files changed, 28 insertions(+), 3 deletions(-)
diff --git a/include/uapi/linux/if_link.h b/include/uapi/linux/if_link.h
index a8901a39a345..fa2e3f642deb 100644
--- a/include/uapi/linux/if_link.h
+++ b/include/uapi/linux/if_link.h
@@ -904,7 +904,14 @@ enum {
  #define IFLA_IPOIB_MAX (__IFLA_IPOIB_MAX - 1)
  
  
-/* HSR section */
+/* HSR/PRP section, both uses same interface */
+
+/* Different redundancy protocols for hsr device */
+enum {
+	HSR_PROTOCOL_HSR,
+	HSR_PROTOCOL_PRP,
+	HSR_PROTOCOL_MAX,
+};
  
  enum {
  	IFLA_HSR_UNSPEC,
@@ -914,6 +921,9 @@ enum {
  	IFLA_HSR_SUPERVISION_ADDR,	/* Supervision frame multicast addr */
  	IFLA_HSR_SEQ_NR,
  	IFLA_HSR_VERSION,		/* HSR version */
+	IFLA_HSR_PROTOCOL,		/* Indicate different protocol than
+					 * HSR. For example PRP.
+					 */
  	__IFLA_HSR_MAX,
  };
  
diff --git a/ip/iplink_hsr.c b/ip/iplink_hsr.c
index 7d9167d4e6a3..6ea138a23cbc 100644
--- a/ip/iplink_hsr.c
+++ b/ip/iplink_hsr.c
@@ -25,7 +25,7 @@ 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]\n"
+		"\t[ supervision ADDR-BYTE ] [version VERSION] [proto PROTOCOL]\n"
  		"\n"
  		"NAME\n"
  		"	name of new hsr device (e.g. hsr0)\n"
@@ -35,7 +35,9 @@ static void print_usage(FILE *f)
  		"	0-255; the last byte of the multicast address used for HSR supervision\n"
  		"	frames (default = 0)\n"
  		"VERSION\n"
-		"	0,1; the protocol version to be used. (default = 0)\n");
+		"	0,1; the protocol version to be used. (default = 0)\n"
+		"PROTOCOL\n"
+		"	0 - HSR, 1 - PRP. (default = 0 - HSR)\n");
  }
  
  static void usage(void)
@@ -49,6 +51,7 @@ static int hsr_parse_opt(struct link_util *lu, int argc, char **argv,
  	int ifindex;
  	unsigned char multicast_spec;
  	unsigned char protocol_version;
+	unsigned char protocol = HSR_PROTOCOL_HSR;
  
  	while (argc > 0) {
  		if (matches(*argv, "supervision") == 0) {
@@ -64,6 +67,13 @@ static int hsr_parse_opt(struct link_util *lu, int argc, char **argv,
  				invarg("version is invalid", *argv);
  			addattr_l(n, 1024, IFLA_HSR_VERSION,
  				  &protocol_version, 1);
+		} else if (matches(*argv, "proto") == 0) {
+			NEXT_ARG();
+			if (!(get_u8(&protocol, *argv, 0) == HSR_PROTOCOL_HSR ||
+			      get_u8(&protocol, *argv, 0) == HSR_PROTOCOL_PRP))
+				invarg("protocol is invalid", *argv);
+			addattr_l(n, 1024, IFLA_HSR_PROTOCOL,
+				  &protocol, 1);
  		} else if (matches(*argv, "slave1") == 0) {
  			NEXT_ARG();
  			ifindex = ll_name_to_index(*argv);
@@ -140,6 +150,11 @@ static void hsr_print_opt(struct link_util *lu, FILE *f, struct rtattr *tb[])
  					 RTA_PAYLOAD(tb[IFLA_HSR_SUPERVISION_ADDR]),
  					 ARPHRD_VOID,
  					 b1, sizeof(b1)));
+	if (tb[IFLA_HSR_PROTOCOL])
+		print_int(PRINT_ANY,
+			  "proto",
+			  "proto %d ",
+			  rta_getattr_u8(tb[IFLA_HSR_PROTOCOL]));
  }
  
  static void hsr_print_help(struct link_util *lu, int argc, char **argv,
Just wondering who will merge this now that PRP support series below
is applied to net-next. These iproute2 patches have to go along with 
that to have full PRP support working.

https://lkml.org/lkml/2020/7/22/638

-- 
Murali Karicheri
Texas Instruments

Re: [net-next iproute2 PATCH v3 1/2] iplink: hsr: add support for creating PRP device similar to HSR

From: Murali Karicheri <hidden>
Date: 2020-08-04 18:59:39

All,

On 7/30/20 9:47 AM, Murali Karicheri wrote:
Hi Dave,

On 7/17/20 11:22 AM, Murali Karicheri wrote:
quoted
This patch enhances the iplink command to add a proto parameters to
create PRP device/interface similar to HSR. Both protocols are
quite similar and requires a pair of Ethernet interfaces. So re-use
the existing HSR iplink command to create PRP device/interface as
well. Use proto parameter to differentiate the two protocols.

Signed-off-by: Murali Karicheri <redacted>
---
  dependent on the series "[net-next PATCH v3 0/7] Add PRP driver"
  include/uapi/linux/if_link.h | 12 +++++++++++-
  ip/iplink_hsr.c              | 19 +++++++++++++++++--
  2 files changed, 28 insertions(+), 3 deletions(-)
diff --git a/include/uapi/linux/if_link.h b/include/uapi/linux/if_link.h
index a8901a39a345..fa2e3f642deb 100644
--- a/include/uapi/linux/if_link.h
+++ b/include/uapi/linux/if_link.h
@@ -904,7 +904,14 @@ enum {
  #define IFLA_IPOIB_MAX (__IFLA_IPOIB_MAX - 1)
-/* HSR section */
+/* HSR/PRP section, both uses same interface */
+
+/* Different redundancy protocols for hsr device */
+enum {
+    HSR_PROTOCOL_HSR,
+    HSR_PROTOCOL_PRP,
+    HSR_PROTOCOL_MAX,
+};
  enum {
      IFLA_HSR_UNSPEC,
@@ -914,6 +921,9 @@ enum {
      IFLA_HSR_SUPERVISION_ADDR,    /* Supervision frame multicast 
addr */
      IFLA_HSR_SEQ_NR,
      IFLA_HSR_VERSION,        /* HSR version */
+    IFLA_HSR_PROTOCOL,        /* Indicate different protocol than
+                     * HSR. For example PRP.
+                     */
      __IFLA_HSR_MAX,
  };
diff --git a/ip/iplink_hsr.c b/ip/iplink_hsr.c
index 7d9167d4e6a3..6ea138a23cbc 100644
--- a/ip/iplink_hsr.c
+++ b/ip/iplink_hsr.c
@@ -25,7 +25,7 @@ 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]\n"
+        "\t[ supervision ADDR-BYTE ] [version VERSION] [proto 
PROTOCOL]\n"
          "\n"
          "NAME\n"
          "    name of new hsr device (e.g. hsr0)\n"
@@ -35,7 +35,9 @@ static void print_usage(FILE *f)
          "    0-255; the last byte of the multicast address used for 
HSR supervision\n"
          "    frames (default = 0)\n"
          "VERSION\n"
-        "    0,1; the protocol version to be used. (default = 0)\n");
+        "    0,1; the protocol version to be used. (default = 0)\n"
+        "PROTOCOL\n"
+        "    0 - HSR, 1 - PRP. (default = 0 - HSR)\n");
  }
  static void usage(void)
@@ -49,6 +51,7 @@ static int hsr_parse_opt(struct link_util *lu, int 
argc, char **argv,
      int ifindex;
      unsigned char multicast_spec;
      unsigned char protocol_version;
+    unsigned char protocol = HSR_PROTOCOL_HSR;
      while (argc > 0) {
          if (matches(*argv, "supervision") == 0) {
@@ -64,6 +67,13 @@ static int hsr_parse_opt(struct link_util *lu, int 
argc, char **argv,
                  invarg("version is invalid", *argv);
              addattr_l(n, 1024, IFLA_HSR_VERSION,
                    &protocol_version, 1);
+        } else if (matches(*argv, "proto") == 0) {
+            NEXT_ARG();
+            if (!(get_u8(&protocol, *argv, 0) == HSR_PROTOCOL_HSR ||
+                  get_u8(&protocol, *argv, 0) == HSR_PROTOCOL_PRP))
+                invarg("protocol is invalid", *argv);
+            addattr_l(n, 1024, IFLA_HSR_PROTOCOL,
+                  &protocol, 1);
          } else if (matches(*argv, "slave1") == 0) {
              NEXT_ARG();
              ifindex = ll_name_to_index(*argv);
@@ -140,6 +150,11 @@ static void hsr_print_opt(struct link_util *lu, 
FILE *f, struct rtattr *tb[])
                       RTA_PAYLOAD(tb[IFLA_HSR_SUPERVISION_ADDR]),
                       ARPHRD_VOID,
                       b1, sizeof(b1)));
+    if (tb[IFLA_HSR_PROTOCOL])
+        print_int(PRINT_ANY,
+              "proto",
+              "proto %d ",
+              rta_getattr_u8(tb[IFLA_HSR_PROTOCOL]));
  }
  static void hsr_print_help(struct link_util *lu, int argc, char **argv,
Just wondering who will merge this now that PRP support series below
is applied to net-next. These iproute2 patches have to go along with 
that to have full PRP support working.

https://lkml.org/lkml/2020/7/22/638
Who can apply these patches for iproute2?
-- 
Murali Karicheri
Texas Instruments

Re: [net-next iproute2 PATCH v3 1/2] iplink: hsr: add support for creating PRP device similar to HSR

From: Murali Karicheri <hidden>
Date: 2020-08-06 17:00:52

Hi Stephen, Alexey,

On 7/17/20 11:22 AM, Murali Karicheri wrote:
quoted hunk
This patch enhances the iplink command to add a proto parameters to
create PRP device/interface similar to HSR. Both protocols are
quite similar and requires a pair of Ethernet interfaces. So re-use
the existing HSR iplink command to create PRP device/interface as
well. Use proto parameter to differentiate the two protocols.

Signed-off-by: Murali Karicheri <redacted>
---
  dependent on the series "[net-next PATCH v3 0/7] Add PRP driver"
  include/uapi/linux/if_link.h | 12 +++++++++++-
  ip/iplink_hsr.c              | 19 +++++++++++++++++--
  2 files changed, 28 insertions(+), 3 deletions(-)
diff --git a/include/uapi/linux/if_link.h b/include/uapi/linux/if_link.h
index a8901a39a345..fa2e3f642deb 100644
--- a/include/uapi/linux/if_link.h
+++ b/include/uapi/linux/if_link.h
@@ -904,7 +904,14 @@ enum {
  #define IFLA_IPOIB_MAX (__IFLA_IPOIB_MAX - 1)
  
  
-/* HSR section */
+/* HSR/PRP section, both uses same interface */
+
+/* Different redundancy protocols for hsr device */
+enum {
+	HSR_PROTOCOL_HSR,
+	HSR_PROTOCOL_PRP,
+	HSR_PROTOCOL_MAX,
+};
  
  enum {
  	IFLA_HSR_UNSPEC,
@@ -914,6 +921,9 @@ enum {
  	IFLA_HSR_SUPERVISION_ADDR,	/* Supervision frame multicast addr */
  	IFLA_HSR_SEQ_NR,
  	IFLA_HSR_VERSION,		/* HSR version */
+	IFLA_HSR_PROTOCOL,		/* Indicate different protocol than
+					 * HSR. For example PRP.
+					 */
  	__IFLA_HSR_MAX,
  };
  
diff --git a/ip/iplink_hsr.c b/ip/iplink_hsr.c
index 7d9167d4e6a3..6ea138a23cbc 100644
--- a/ip/iplink_hsr.c
+++ b/ip/iplink_hsr.c
@@ -25,7 +25,7 @@ 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]\n"
+		"\t[ supervision ADDR-BYTE ] [version VERSION] [proto PROTOCOL]\n"
  		"\n"
  		"NAME\n"
  		"	name of new hsr device (e.g. hsr0)\n"
@@ -35,7 +35,9 @@ static void print_usage(FILE *f)
  		"	0-255; the last byte of the multicast address used for HSR supervision\n"
  		"	frames (default = 0)\n"
  		"VERSION\n"
-		"	0,1; the protocol version to be used. (default = 0)\n");
+		"	0,1; the protocol version to be used. (default = 0)\n"
+		"PROTOCOL\n"
+		"	0 - HSR, 1 - PRP. (default = 0 - HSR)\n");
  }
  
  static void usage(void)
@@ -49,6 +51,7 @@ static int hsr_parse_opt(struct link_util *lu, int argc, char **argv,
  	int ifindex;
  	unsigned char multicast_spec;
  	unsigned char protocol_version;
+	unsigned char protocol = HSR_PROTOCOL_HSR;
  
  	while (argc > 0) {
  		if (matches(*argv, "supervision") == 0) {
@@ -64,6 +67,13 @@ static int hsr_parse_opt(struct link_util *lu, int argc, char **argv,
  				invarg("version is invalid", *argv);
  			addattr_l(n, 1024, IFLA_HSR_VERSION,
  				  &protocol_version, 1);
+		} else if (matches(*argv, "proto") == 0) {
+			NEXT_ARG();
+			if (!(get_u8(&protocol, *argv, 0) == HSR_PROTOCOL_HSR ||
+			      get_u8(&protocol, *argv, 0) == HSR_PROTOCOL_PRP))
+				invarg("protocol is invalid", *argv);
+			addattr_l(n, 1024, IFLA_HSR_PROTOCOL,
+				  &protocol, 1);
  		} else if (matches(*argv, "slave1") == 0) {
  			NEXT_ARG();
  			ifindex = ll_name_to_index(*argv);
@@ -140,6 +150,11 @@ static void hsr_print_opt(struct link_util *lu, FILE *f, struct rtattr *tb[])
  					 RTA_PAYLOAD(tb[IFLA_HSR_SUPERVISION_ADDR]),
  					 ARPHRD_VOID,
  					 b1, sizeof(b1)));
+	if (tb[IFLA_HSR_PROTOCOL])
+		print_int(PRINT_ANY,
+			  "proto",
+			  "proto %d ",
+			  rta_getattr_u8(tb[IFLA_HSR_PROTOCOL]));
  }
  
  static void hsr_print_help(struct link_util *lu, int argc, char **argv,
Sorry, I missed you in my email on this patch set as I didn't realize
that the maintainers are different than the netdev maintainers. My bad.
The PRP driver support in kernel is merged by Dave to net-next and this
iproute2 change has to go with it. So please review and apply this if it
looks good. The kernel part merged is at

https://www.spinics.net/lists/linux-api/msg42615.html

-- 
Murali Karicheri
Texas Instruments

Re: [net-next iproute2 PATCH v3 1/2] iplink: hsr: add support for creating PRP device similar to HSR

From: David Ahern <hidden>
Date: 2020-08-06 17:13:46

On 8/6/20 10:04 AM, Murali Karicheri wrote:
that the maintainers are different than the netdev maintainers. My bad.
The PRP driver support in kernel is merged by Dave to net-next and this
iproute2 change has to go with it. So please review and apply this if it
looks good. The kernel part merged is at
there was a long delay between iproute2 and commit to net-next. You need
to re-send the iproute2 patches.

Re: [net-next iproute2 PATCH v3 1/2] iplink: hsr: add support for creating PRP device similar to HSR

From: Murali Karicheri <hidden>
Date: 2020-08-06 20:20:23


On 8/6/20 1:12 PM, David Ahern wrote:
On 8/6/20 10:04 AM, Murali Karicheri wrote:
quoted
that the maintainers are different than the netdev maintainers. My bad.
The PRP driver support in kernel is merged by Dave to net-next and this
iproute2 change has to go with it. So please review and apply this if it
looks good. The kernel part merged is at
there was a long delay between iproute2 and commit to net-next. You need
to re-send the iproute2 patches.
OK. Will do. Thanks
-- 
Murali Karicheri
Texas Instruments
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help