From patchwork Fri Jul 17 15:22:04 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Murali Karicheri X-Patchwork-Id: 235726 Delivered-To: patch@linaro.org Received: by 2002:a92:d244:0:0:0:0:0 with SMTP id v4csp1801684ilg; Fri, 17 Jul 2020 08:22:11 -0700 (PDT) X-Google-Smtp-Source: ABdhPJySyUBTtO7URYAUtBMM4wOx3VN+tDgtLp8G8sZGV0ZdzjNHUlGTygoxh078kuYAaw2+DMIo X-Received: by 2002:a50:f702:: with SMTP id g2mr9954370edn.348.1594999331530; Fri, 17 Jul 2020 08:22:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1594999331; cv=none; d=google.com; s=arc-20160816; b=ZWJiziHuIaON45ctRO8LsFM6t8A4+u6rcpwc+12+ZHtEQt46QPMkyY6SAMljPYfBNf WiRb9nGNiGvmBn5C5G0hJBkmmGZToGclqu62I4KGBbxjEhaqUQTV1P1oAuu9UgYBSbWy Prcls3bjvQVJVF/FnZhD9CTeetVAP8s+uf45D5uPfkqa44Y7KWeygaSFyI4UwuNaW8/L RI7DeXIfLK1oGwlVQ2SaG1b1hjQj8eIu0avDGbvNcOEztLOx0jjNMpeXpXQ1cULPTkDl 8EKmXnITdOlGXcLGz1uJzD/tgCFggNDVKeBIzO0Pb0wvGJ6Sbda2eiG81vS3w4Yzw3RT 0n/Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:message-id:date:subject:to :from:dkim-signature; bh=aw+J/tHE6RtdyvulzmQouirBtRSflen0Ky4kvZPHqPE=; b=YoLYBuzzn5GZPG0OS9TmXtbZYQ6rlvfeUfN1+p8H9hgwpaWgEOdWdeXa2Kk9/mxULe 7Rhy1Qmid2pM1NdKEofMGgpPP5FXGCGbUvQYyiI2Xu2/OsHrRANglICp2kwK8qS2REhU s3cFXG0biYb7F9gM420I6RL3El0wZoFpbV4IG4bdk9QTEj5F3xav9KOQtsepz6fGsLtu qCKbISoSYxRgM8j/7ClpLt54n4Hjc7YbAG+BoNujXaQbNU/kepcNkouBt4M84VdEC+vF e36/qbQMu8OBOvHkllf/CyURuya5VlU8318tX+5nhTzgkl9bF7UjXABqfpZNJHe630L8 qF0A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b="FsMT/eMH"; spf=pass (google.com: domain of netdev-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=netdev-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id w4si5609361ede.607.2020.07.17.08.22.11; Fri, 17 Jul 2020 08:22:11 -0700 (PDT) Received-SPF: pass (google.com: domain of netdev-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b="FsMT/eMH"; spf=pass (google.com: domain of netdev-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=netdev-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727033AbgGQPWK (ORCPT + 9 others); Fri, 17 Jul 2020 11:22:10 -0400 Received: from lelv0142.ext.ti.com ([198.47.23.249]:36674 "EHLO lelv0142.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726232AbgGQPWK (ORCPT ); Fri, 17 Jul 2020 11:22:10 -0400 Received: from lelv0266.itg.ti.com ([10.180.67.225]) by lelv0142.ext.ti.com (8.15.2/8.15.2) with ESMTP id 06HFM6So015052; Fri, 17 Jul 2020 10:22:06 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1594999326; bh=aw+J/tHE6RtdyvulzmQouirBtRSflen0Ky4kvZPHqPE=; h=From:To:Subject:Date; b=FsMT/eMHV/GSWIYS4g96BO16siKvqiSup8GuvtD1RmW3+gB4h4aCEFgZHJzPxMsgb iScYMbRxGbtrkzJcGyhTQ8QdCNTWLReneW5poytmGD2szreKNpTHqzs/x7m9ZnsiBP Vur0D1mFGjM7LR0p28oe8H05/wQrx3SWzaT+IutA= Received: from DLEE113.ent.ti.com (dlee113.ent.ti.com [157.170.170.24]) by lelv0266.itg.ti.com (8.15.2/8.15.2) with ESMTPS id 06HFM6GX078822 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Fri, 17 Jul 2020 10:22:06 -0500 Received: from DLEE111.ent.ti.com (157.170.170.22) by DLEE113.ent.ti.com (157.170.170.24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1979.3; Fri, 17 Jul 2020 10:22:05 -0500 Received: from lelv0327.itg.ti.com (10.180.67.183) by DLEE111.ent.ti.com (157.170.170.22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1979.3 via Frontend Transport; Fri, 17 Jul 2020 10:22:06 -0500 Received: from uda0868495.fios-router.home (ileax41-snat.itg.ti.com [10.172.224.153]) by lelv0327.itg.ti.com (8.15.2/8.15.2) with ESMTP id 06HFM51P022443; Fri, 17 Jul 2020 10:22:05 -0500 From: Murali Karicheri To: , , , , , , , Subject: [net-next iproute2 PATCH v3 1/2] iplink: hsr: add support for creating PRP device similar to HSR Date: Fri, 17 Jul 2020 11:22:04 -0400 Message-ID: <20200717152205.826-1-m-karicheri2@ti.com> X-Mailer: git-send-email 2.17.1 MIME-Version: 1.0 X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org 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 --- 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(-) -- 2.17.1 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, From patchwork Fri Jul 17 15:22:05 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Murali Karicheri X-Patchwork-Id: 235727 Delivered-To: patch@linaro.org Received: by 2002:a92:d244:0:0:0:0:0 with SMTP id v4csp1801796ilg; Fri, 17 Jul 2020 08:22:20 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyBemH1mTHCdYMtoI8FHo5eEQRu1AszOiaR8OALrIOAU+SUzcEKxXGaZVLZohCImbkXudZP X-Received: by 2002:a17:906:7115:: with SMTP id x21mr8838547ejj.86.1594999340135; Fri, 17 Jul 2020 08:22:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1594999340; cv=none; d=google.com; s=arc-20160816; b=0nY6llEpuXz9ERkN9EFBnhBqSk8z2QdDlp2r/4h/GFCThlMDrAwAqHyyKs7XwFExM6 vLHMyP7kjip1hwJOc1JPv9S6T8ugmVK/LPLsOaU7DUqZNxIDpT9A1j850V2zRzM+wZ03 wy8lOAjAlIYmJPKNmTcDIv+WBQz0R51RfmOlxAZ2/v46E78dfEjFwko/qO+rmIj60AlS 1WOWUJH8b/tb0QBcod+mGQShUuZsE+nWETd4TkV4CFsmINUZTc9NHHrnxeFVnNDihcBJ rVyI3fdxYf2jDYHXha3dNqzP6PnS8VvH0TCTTqcYzDqTVccWMHMHx5BjAkK9zAvHePkh SbCQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:references:in-reply-to :message-id:date:subject:to:from:dkim-signature; bh=nWmi1N267mykLXBFK8hhRu1dzohcmL3IImqJTPPwDqQ=; b=CC9wiIL44x5aSxxa3L6qyg3S6V5Ab5Rkub0ZFqJPxbX6Ylak42MQUoPMPNmJobCXrJ 1IeQotNWWpMxEhBA3mN7zHDh+L2L//CpWShFTADz83RQ7bNOVEs8IaEllkXi+9Y42OmV 4jhqBWdZbZTyiakSHv2qkpwQnF4BANd+MjmTZVqOx1zC4Eul1skXfV+prXQa+9/pRnhg i32vMhR4D41bnR4lwnmQgSKO7SJgIM46890oO30K/fo6nQSL+QD0RsRqTZN0N2a3TVzS hm0qX/BkSDRKUv5la1Q7YFz+o0PG9f0vKrfh/oh3fstdHLHdcYOaj2icAZkf2OlSMBAh Di/A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b="b6/KEkti"; spf=pass (google.com: domain of netdev-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=netdev-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id w4si5609361ede.607.2020.07.17.08.22.19; Fri, 17 Jul 2020 08:22:20 -0700 (PDT) Received-SPF: pass (google.com: domain of netdev-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b="b6/KEkti"; spf=pass (google.com: domain of netdev-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=netdev-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727103AbgGQPWQ (ORCPT + 9 others); Fri, 17 Jul 2020 11:22:16 -0400 Received: from fllv0016.ext.ti.com ([198.47.19.142]:55300 "EHLO fllv0016.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726232AbgGQPWQ (ORCPT ); Fri, 17 Jul 2020 11:22:16 -0400 Received: from fllv0035.itg.ti.com ([10.64.41.0]) by fllv0016.ext.ti.com (8.15.2/8.15.2) with ESMTP id 06HFM7to083326; Fri, 17 Jul 2020 10:22:07 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1594999327; bh=nWmi1N267mykLXBFK8hhRu1dzohcmL3IImqJTPPwDqQ=; h=From:To:Subject:Date:In-Reply-To:References; b=b6/KEktigmbyOrBsYAT+Ym9uD23cUrq1bqXLF7/OyrXnLlSfA+0dvRchAA/CeorL6 49J1uhi465tUnbHO9YWYw4a0l/tLeqfFRipVfgrG193pigQqMPm/DQsxekhAxt5bv9 f6xBl8+xitGyZ0JL7PWXsMy+yFpGmmh56kZvEgXY= Received: from DLEE108.ent.ti.com (dlee108.ent.ti.com [157.170.170.38]) by fllv0035.itg.ti.com (8.15.2/8.15.2) with ESMTP id 06HFM757106522; Fri, 17 Jul 2020 10:22:07 -0500 Received: from DLEE103.ent.ti.com (157.170.170.33) by DLEE108.ent.ti.com (157.170.170.38) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1979.3; Fri, 17 Jul 2020 10:22:06 -0500 Received: from lelv0327.itg.ti.com (10.180.67.183) by DLEE103.ent.ti.com (157.170.170.33) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1979.3 via Frontend Transport; Fri, 17 Jul 2020 10:22:06 -0500 Received: from uda0868495.fios-router.home (ileax41-snat.itg.ti.com [10.172.224.153]) by lelv0327.itg.ti.com (8.15.2/8.15.2) with ESMTP id 06HFM51Q022443; Fri, 17 Jul 2020 10:22:06 -0500 From: Murali Karicheri To: , , , , , , , Subject: [net-next iproute2 PATCH v3 2/2] ip: iplink: prp: update man page for new parameter Date: Fri, 17 Jul 2020 11:22:05 -0400 Message-ID: <20200717152205.826-2-m-karicheri2@ti.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200717152205.826-1-m-karicheri2@ti.com> References: <20200717152205.826-1-m-karicheri2@ti.com> MIME-Version: 1.0 X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org 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 --- 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(-) -- 2.17.1 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