Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp1467728pxu; Tue, 24 Nov 2020 00:29:07 -0800 (PST) X-Google-Smtp-Source: ABdhPJxQ9vz4BDHNep/n5dngyTI/fiHA/ZRSiIEXV93XMqn4Gl+47C5z2oJNJpXGPugmRENYvm8d X-Received: by 2002:a50:f682:: with SMTP id d2mr2821250edn.95.1606206547668; Tue, 24 Nov 2020 00:29:07 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1606206547; cv=none; d=google.com; s=arc-20160816; b=zuKBSUQVaraV+7SSWtRz+1HkBtMKezzw51vkT5DrG1Kf89IHrCsgQew5D7IQmKIZkX oQ02ZG2/z4Y1VB0ElCu8ap3XnS7XzMSRZhEbmLvvgG7A2NMGPFvVEPeEgPhZpYVW27Yd 1eNB88O02dftt8wayuMDnlkxeX4M396P9IJc/MbQLOEQZDYs/bIR2bcAxUuH5KaVvruh 9YHi4A2aT2Vj1xkJWMAII3En9+jadLGRp5LIYXvm/7c3lTqay3K2p9fAUVW8RyDZdceJ jJDtxFst4lbSETcSimjheqzfMAIq8DPjP3E5cAcFAun8hQQmS5RGoTrYRcvVV7GaQAkY y7/w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:ironport-sdr:dkim-signature; bh=XZZOSgXvBkGUdx+odaAfXX94d3eoAa9yLTmEDEYBX1w=; b=W19A+afxh4IWzGP7R8YUmP93uGWZgIIPGdIkDRG65QoNm3uKBekyIiH8qjC9lMbRab Vrdr5bvodrGIDCM09hWtZFXPIcNmY1ALP4PWMnj431yXjAeYPSCpextdIYUW8PrwxinA 3qywkeVGS7NGxvnkSvth/94hBex0ZJHlTvSv6q8x9pZ+JH6xyDQZ9+u5siOZAr3zdFex NktgIoPw5mPK7Hm5dmnyDtfBRU8ibWEkoUH2KZZVMAfESjUyDAY7p7KGLvHwJ0wS87YJ We+VX6ng7c7h9pypr3KJiRhrIYvUDu6F54PseggQTNsT8Vslx5JNHvQUuBfjDMlVfSaf J2AQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@microchip.com header.s=mchp header.b=gkMQtnbe; 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=QUARANTINE sp=QUARANTINE 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 cm4si7867881edb.294.2020.11.24.00.28.43; Tue, 24 Nov 2020 00:29:07 -0800 (PST) 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=gkMQtnbe; 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=QUARANTINE sp=QUARANTINE dis=NONE) header.from=microchip.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730511AbgKXI0w (ORCPT + 99 others); Tue, 24 Nov 2020 03:26:52 -0500 Received: from esa3.microchip.iphmx.com ([68.232.153.233]:30024 "EHLO esa3.microchip.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730500AbgKXI0v (ORCPT ); Tue, 24 Nov 2020 03:26:51 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1606206410; x=1637742410; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=rzJrrzklVRf9eadjbGgdPrbEEAvaq8klfJmDth8IB6k=; b=gkMQtnbeOu3uOt/nIWdGcDe4JaQTV+vZLKgC75xdFQDKnx0F700d4155 QDgrLYQ9GVt8WcMOSeG3dURBwz8YH16LydUoA7x+Snz+KN6I3W3BJMDW9 PLrAYPyEuG0jUiaOsOMvLz21Y/0z6de0Wy+/Zmw/6Fqv1VzZJ5lfsmeXT 9sLAK82uE7QbsZKhM+mXCQTtNuDuDfWYkLRTYMKQ5ttAp6RTefFMg6PDT p7FBX18vy9ZUhPeVsJLmj62+hcZTs0A8GTH2fLkmLsQC22CK+RMvUMMBu ENZInHN4Inll/MXOXYdEYYYBIm+d3lfdLzXM/+Pb2HugcSxccjDeXCsnU A==; IronPort-SDR: QsNdaq2mYQ18qkeBJuDwfPejPHjc8ujw50pSYHh3XyK1VMyKomLVh+EtaLOwatoX2jpVU4REDn DWpDzE3SOBdM97PkPPqTBzfkMGW+5FjRlQiTbWzXOhMwoaKGGRIkaxBAG0M4+GdWTvdGJbwgaC p8GL+/jGfM4lvjKI4JKfFnWuVktsAfSIf1g/dyBeR4KHbNp4RNNHM0osk8oKsq+WK46sl4/143 +a9PdjqIAntwEhMTtZQGuVsf7gyPT5sK0p5yeLXAPh0IF9QRaV1+tDB4DKpce8iJEOtxSIu30H Txk= X-IronPort-AV: E=Sophos;i="5.78,365,1599548400"; d="scan'208";a="100156753" Received: from smtpout.microchip.com (HELO email.microchip.com) ([198.175.253.82]) by esa3.microchip.iphmx.com with ESMTP/TLS/AES256-SHA256; 24 Nov 2020 01:26:49 -0700 Received: from chn-vm-ex03.mchp-main.com (10.10.85.151) by chn-vm-ex03.mchp-main.com (10.10.85.151) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1979.3; Tue, 24 Nov 2020 01:26:49 -0700 Received: from soft-dev3.localdomain (10.10.115.15) by chn-vm-ex03.mchp-main.com (10.10.85.151) with Microsoft SMTP Server id 15.1.1979.3 via Frontend Transport; Tue, 24 Nov 2020 01:26:48 -0700 From: Horatiu Vultur To: , , , , , , CC: Horatiu Vultur Subject: [PATCH net-next v2] bridge: mrp: Implement LC mode for MRP Date: Tue, 24 Nov 2020 09:25:25 +0100 Message-ID: <20201124082525.273820-1-horatiu.vultur@microchip.com> X-Mailer: git-send-email 2.27.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Extend MRP to support LC mode(link check) for the interconnect port. This applies only to the interconnect ring. Opposite to RC mode(ring check) the LC mode is using CFM frames to detect when the link goes up or down and based on that the userspace will need to react. One advantage of the LC mode over RC mode is that there will be fewer frames in the normal rings. Because RC mode generates InTest on all ports while LC mode sends CFM frame only on the interconnect port. All 4 nodes part of the interconnect ring needs to have the same mode. And it is not possible to have running LC and RC mode at the same time on a node. Whenever the MIM starts it needs to detect the status of the other 3 nodes in the interconnect ring so it would send a frame called InLinkStatus, on which the clients needs to reply with their link status. This patch adds InLinkStatus frame type and extends existing rules on how to forward this frame. Acked-by: Nikolay Aleksandrov Signed-off-by: Horatiu Vultur --- v1 -> v2: - remove struct 'br_mrp_in_link_status_hdr' as is unused --- include/uapi/linux/mrp_bridge.h | 1 + net/bridge/br_mrp.c | 18 +++++++++++++++--- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/include/uapi/linux/mrp_bridge.h b/include/uapi/linux/mrp_bridge.h index 6aeb13ef0b1e..9744773de5ff 100644 --- a/include/uapi/linux/mrp_bridge.h +++ b/include/uapi/linux/mrp_bridge.h @@ -61,6 +61,7 @@ enum br_mrp_tlv_header_type { BR_MRP_TLV_HEADER_IN_TOPO = 0x7, BR_MRP_TLV_HEADER_IN_LINK_DOWN = 0x8, BR_MRP_TLV_HEADER_IN_LINK_UP = 0x9, + BR_MRP_TLV_HEADER_IN_LINK_STATUS = 0xa, BR_MRP_TLV_HEADER_OPTION = 0x7f, }; diff --git a/net/bridge/br_mrp.c b/net/bridge/br_mrp.c index bb12fbf9aaf2..cec2c4e4561d 100644 --- a/net/bridge/br_mrp.c +++ b/net/bridge/br_mrp.c @@ -858,7 +858,8 @@ static bool br_mrp_in_frame(struct sk_buff *skb) if (hdr->type == BR_MRP_TLV_HEADER_IN_TEST || hdr->type == BR_MRP_TLV_HEADER_IN_TOPO || hdr->type == BR_MRP_TLV_HEADER_IN_LINK_DOWN || - hdr->type == BR_MRP_TLV_HEADER_IN_LINK_UP) + hdr->type == BR_MRP_TLV_HEADER_IN_LINK_UP || + hdr->type == BR_MRP_TLV_HEADER_IN_LINK_STATUS) return true; return false; @@ -1126,9 +1127,9 @@ static int br_mrp_rcv(struct net_bridge_port *p, goto no_forward; } } else { - /* MIM should forward IntLinkChange and + /* MIM should forward IntLinkChange/Status and * IntTopoChange between ring ports but MIM - * should not forward IntLinkChange and + * should not forward IntLinkChange/Status and * IntTopoChange if the frame was received at * the interconnect port */ @@ -1155,6 +1156,17 @@ static int br_mrp_rcv(struct net_bridge_port *p, in_type == BR_MRP_TLV_HEADER_IN_LINK_DOWN)) goto forward; + /* MIC should forward IntLinkStatus frames only to + * interconnect port if it was received on a ring port. + * If it is received on interconnect port then, it + * should be forward on both ring ports + */ + if (br_mrp_is_ring_port(p_port, s_port, p) && + in_type == BR_MRP_TLV_HEADER_IN_LINK_STATUS) { + p_dst = NULL; + s_dst = NULL; + } + /* Should forward the InTopo frames only between the * ring ports */ -- 2.27.0