Received: by 2002:a25:1985:0:0:0:0:0 with SMTP id 127csp214752ybz; Tue, 21 Apr 2020 07:44:15 -0700 (PDT) X-Google-Smtp-Source: APiQypJzuDZ/yzg86pzE12Y7uXx2H7rOPN2lUqgkrI9eNKhWhp9M/B79puO65SgFP/OP018881JA X-Received: by 2002:aa7:dcc3:: with SMTP id w3mr18084464edu.231.1587480254901; Tue, 21 Apr 2020 07:44:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1587480254; cv=none; d=google.com; s=arc-20160816; b=kTiKACZGPzdvZCc3NePSKwWnafLLYVzKCsNTwtseBSZZlXMHt3jsCOP2O6eKovJWAP lMj5cQH1HCHaL2dYQtzhc4/61LyahW1Scw1meAnZ5GK3wsH5FEy/2qPGeyQpGMjrO76J Ip0eY0YVzZ9UGqH/0n+uHlmHKShHtZ80y6k8aLMRubWPE/nyRl49+BF4eiwM6Ecx2zlA PXGwLGYAwFDGWJ8nk0CNeMVFyQtAy8ZFlGyEeWrYWsXKWWN9MKX7lhNBsi+H0w+JvCRu noBb02nnQx8l4vnvovbMKw36zqd71+WsSgsqYamfO7qOIJhXrG0esOdYRT4ffZjMJ9hE pKzA== 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:cc:to:from:ironport-sdr:dkim-signature; bh=Y4sltDGnGvG9CKvOku6VbazF1fJg/oZI8eXH8TMcF0U=; b=w8Un3mR8SnpfM7XACNfF61rhLO5xMfBDCLi3qaYXzKCsrMChgZpevbgkE3XFiWxzIb G3WtBILssOJIWA4TTVFI4XkREa3xYWq6k49sNldBBp54d+7dwvzkcocOyP/mP3JD47Nj MYlCFOhKMbuKtmS0pfOYZVsc6/MuD/bRapE1PeordRtrCM9qP1jhGtS35GhynptptSKA GXpnKTshuO4QYmZsM15crtMJ+u+JFPbBoCyd+TCVGXXrNnptVqEdbGCwiP4ByNX6G/Mm 8JMGk1QXZF6u2OjOlliqRPQyqqsU1oMQ/s6HGC1XW88T8PCttSv88BlJ4uXBDp0UhKKU 2UgA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@microchip.com header.s=mchp header.b=JzOsVOaV; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=microchip.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id pv24si1815779ejb.244.2020.04.21.07.43.51; Tue, 21 Apr 2020 07:44:14 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=fail header.i=@microchip.com header.s=mchp header.b=JzOsVOaV; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=microchip.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729100AbgDUOmp (ORCPT + 99 others); Tue, 21 Apr 2020 10:42:45 -0400 Received: from esa2.microchip.iphmx.com ([68.232.149.84]:61583 "EHLO esa2.microchip.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726691AbgDUOmn (ORCPT ); Tue, 21 Apr 2020 10:42:43 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1587480162; x=1619016162; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version; bh=EVrsHnpOE3AZe4JWL68hdRpJtAseA7A0xWunJ0r9P4o=; b=JzOsVOaVY1ULE4ZoCradunh9JyKdmAyWfq2HQzYbnOeUVgMuh6ZFU/ef ASgPWSALAaH0yzULtaJbWWiR3zKSL98JHrW21yPuGNBlwZbmZnp+VSzO0 tV/MsFMKs/7fqjXe0PlGDPvHr7WcLtZVR96CGVPKAiBd+vXNF8W0pB4Uz MHmIryNDgzubyfp1Er7dXNcPWOxudVnwFPPLT5WQqeE/pPBHRuPsy91N7 OQVCDxTvZEi+e9KJgNsPifhurBL243wFS9wqYm2CWGuTpqQc5REdV98Vk Hb+3eS5N6UdSwvW9PSIy7x3n3fD01OsBUj/TH5LbrPVu/wtwtZ6yq5O1V w==; IronPort-SDR: fSE02h+z2etsPb+5BR1FJ3MWQMeS3SUmFe5Hsw80V1b70SyeS1AukZxxGjRQmtIgbv63t3ZsT6 gA5oun6+UAKDTl9o//c9awy0acBCsbxtYFgof2Fzkp7TNO8sYs21LkebWF5Gw+6pUWBrYy+BSF R9eeDvqh2mHDvpBZ8iizpilzuGsyo1AWLSRJgauDSrwYEr1YGtf+SABOvY1yyeSjFd6RbcWRNR tGdDf8LbjMeziya0zPSt/ZxvFSIvS417IVNRLHFozrZb0GF6J0rkSCXIIrsYnTQYG+Drj8m2j3 u5o= X-IronPort-AV: E=Sophos;i="5.72,410,1580799600"; d="scan'208";a="72862593" Received: from smtpout.microchip.com (HELO email.microchip.com) ([198.175.253.82]) by esa2.microchip.iphmx.com with ESMTP/TLS/AES256-SHA256; 21 Apr 2020 07:42:42 -0700 Received: from chn-vm-ex04.mchp-main.com (10.10.85.152) by chn-vm-ex04.mchp-main.com (10.10.85.152) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1713.5; Tue, 21 Apr 2020 07:42:41 -0700 Received: from soft-dev3.microsemi.net (10.10.115.15) by chn-vm-ex04.mchp-main.com (10.10.85.152) with Microsoft SMTP Server id 15.1.1713.5 via Frontend Transport; Tue, 21 Apr 2020 07:42:39 -0700 From: Horatiu Vultur To: , , , , , , , , , , , CC: Horatiu Vultur Subject: [PATCH net-next v2 01/11] bridge: uapi: mrp: Add mrp attributes. Date: Tue, 21 Apr 2020 16:37:42 +0200 Message-ID: <20200421143752.2248-2-horatiu.vultur@microchip.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200421143752.2248-1-horatiu.vultur@microchip.com> References: <20200421143752.2248-1-horatiu.vultur@microchip.com> MIME-Version: 1.0 Content-Type: text/plain Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Add new nested netlink attribute to configure the MRP. These attributes are used by the userspace to add/delete/configure MRP instances and by the kernel to notify the userspace when the MRP ring gets open/closed. MRP nested attribute has the following attributes: IFLA_BRIDGE_MRP_INSTANCE - the parameter type is br_mrp_instance which contains the instance id, and the ifindex of the two ports. The ports can't be part of multiple instances. This is used to create/delete MRP instances. IFLA_BRIDGE_MRP_PORT_STATE - the parameter type is u32. Which can be forwarding, blocking or disabled. IFLA_BRIDGE_MRP_PORT_ROLE - the parameter type is br_mrp_port_role which contains the instance id and the role. The role can be primary or secondary. IFLA_BRIDGE_MRP_RING_STATE - the parameter type is br_mrp_ring_state which contains the instance id and the state. The state can be open or closed. IFLA_BRIDGE_MRP_RING_ROLE - the parameter type is br_mrp_ring_role which contains the instance id and the ring role. The role can be MRM or MRC. IFLA_BRIDGE_MRP_START_TEST - the parameter type is br_mrp_start_test which contains the instance id, the interval at which to send the MRP_Test frames, how many test frames can be missed before declaring the ring open and the period which represent for how long to send the test frames. Also add the file include/uapi/linux/mrp_bridge.h which defines all the types used by MRP that are also needed by the userpace. Signed-off-by: Horatiu Vultur --- include/uapi/linux/if_bridge.h | 42 +++++++++++++++++ include/uapi/linux/if_ether.h | 1 + include/uapi/linux/mrp_bridge.h | 84 +++++++++++++++++++++++++++++++++ 3 files changed, 127 insertions(+) create mode 100644 include/uapi/linux/mrp_bridge.h diff --git a/include/uapi/linux/if_bridge.h b/include/uapi/linux/if_bridge.h index bfe621ea51b3..bd8c95488f16 100644 --- a/include/uapi/linux/if_bridge.h +++ b/include/uapi/linux/if_bridge.h @@ -120,6 +120,7 @@ enum { IFLA_BRIDGE_MODE, IFLA_BRIDGE_VLAN_INFO, IFLA_BRIDGE_VLAN_TUNNEL_INFO, + IFLA_BRIDGE_MRP, __IFLA_BRIDGE_MAX, }; #define IFLA_BRIDGE_MAX (__IFLA_BRIDGE_MAX - 1) @@ -157,6 +158,47 @@ struct bridge_vlan_xstats { __u32 pad2; }; +enum { + IFLA_BRIDGE_MRP_UNSPEC, + IFLA_BRIDGE_MRP_INSTANCE, + IFLA_BRIDGE_MRP_PORT_STATE, + IFLA_BRIDGE_MRP_PORT_ROLE, + IFLA_BRIDGE_MRP_RING_STATE, + IFLA_BRIDGE_MRP_RING_ROLE, + IFLA_BRIDGE_MRP_START_TEST, + __IFLA_BRIDGE_MRP_MAX, +}; + +struct br_mrp_instance { + __u32 ring_id; + __u32 p_ifindex; + __u32 s_ifindex; +}; + +struct br_mrp_port_role { + __u32 ring_id; + __u32 role; +}; + +struct br_mrp_ring_state { + __u32 ring_id; + __u32 ring_state; +}; + +struct br_mrp_ring_role { + __u32 ring_id; + __u32 ring_role; +}; + +struct br_mrp_start_test { + __u32 ring_id; + __u32 interval; + __u32 max_miss; + __u32 period; +}; + +#define IFLA_BRIDGE_MRP_MAX (__IFLA_BRIDGE_MRP_MAX - 1) + struct bridge_stp_xstats { __u64 transition_blk; __u64 transition_fwd; diff --git a/include/uapi/linux/if_ether.h b/include/uapi/linux/if_ether.h index f6ceb2e63d1e..d6de2b167448 100644 --- a/include/uapi/linux/if_ether.h +++ b/include/uapi/linux/if_ether.h @@ -92,6 +92,7 @@ #define ETH_P_PREAUTH 0x88C7 /* 802.11 Preauthentication */ #define ETH_P_TIPC 0x88CA /* TIPC */ #define ETH_P_LLDP 0x88CC /* Link Layer Discovery Protocol */ +#define ETH_P_MRP 0x88E3 /* Media Redundancy Protocol */ #define ETH_P_MACSEC 0x88E5 /* 802.1ae MACsec */ #define ETH_P_8021AH 0x88E7 /* 802.1ah Backbone Service Tag */ #define ETH_P_MVRP 0x88F5 /* 802.1Q MVRP */ diff --git a/include/uapi/linux/mrp_bridge.h b/include/uapi/linux/mrp_bridge.h new file mode 100644 index 000000000000..2600cdf5a284 --- /dev/null +++ b/include/uapi/linux/mrp_bridge.h @@ -0,0 +1,84 @@ +/* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */ + +#ifndef _UAPI_LINUX_MRP_BRIDGE_H_ +#define _UAPI_LINUX_MRP_BRIDGE_H_ + +#include +#include + +#define MRP_MAX_FRAME_LENGTH 200 +#define MRP_DEFAULT_PRIO 0x8000 +#define MRP_DOMAIN_UUID_LENGTH 16 +#define MRP_VERSION 1 +#define MRP_FRAME_PRIO 7 + +enum br_mrp_ring_role_type { + BR_MRP_RING_ROLE_DISABLED, + BR_MRP_RING_ROLE_MRC, + BR_MRP_RING_ROLE_MRM, +}; + +enum br_mrp_ring_state_type { + BR_MRP_RING_STATE_OPEN, + BR_MRP_RING_STATE_CLOSED, +}; + +enum br_mrp_port_state_type { + BR_MRP_PORT_STATE_DISABLED, + BR_MRP_PORT_STATE_BLOCKED, + BR_MRP_PORT_STATE_FORWARDING, + BR_MRP_PORT_STATE_NOT_CONNECTED, +}; + +enum br_mrp_port_role_type { + BR_MRP_PORT_ROLE_PRIMARY, + BR_MRP_PORT_ROLE_SECONDARY, + BR_MRP_PORT_ROLE_NONE, +}; + +enum br_mrp_tlv_header_type { + BR_MRP_TLV_HEADER_END = 0x0, + BR_MRP_TLV_HEADER_COMMON = 0x1, + BR_MRP_TLV_HEADER_RING_TEST = 0x2, + BR_MRP_TLV_HEADER_RING_TOPO = 0x3, + BR_MRP_TLV_HEADER_RING_LINK_DOWN = 0x4, + BR_MRP_TLV_HEADER_RING_LINK_UP = 0x5, +}; + +struct br_mrp_tlv_hdr { + __u8 type; + __u8 length; +}; + +struct br_mrp_end_hdr { + struct br_mrp_tlv_hdr hdr; +}; + +struct br_mrp_common_hdr { + __u16 seq_id; + __u8 domain[MRP_DOMAIN_UUID_LENGTH]; +}; + +struct br_mrp_ring_test_hdr { + __u16 prio; + __u8 sa[ETH_ALEN]; + __u16 port_role; + __u16 state; + __u16 transitions; + __u32 timestamp; +}; + +struct br_mrp_ring_topo_hdr { + __u16 prio; + __u8 sa[ETH_ALEN]; + __u16 interval; +}; + +struct br_mrp_ring_link_hdr { + __u8 sa[ETH_ALEN]; + __u16 port_role; + __u16 interval; + __u16 blocked; +}; + +#endif -- 2.17.1