Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp752015pxu; Mon, 23 Nov 2020 03:18:07 -0800 (PST) X-Google-Smtp-Source: ABdhPJwr/RhKJIggAr9r04ceEy+mISIim3PjbmjjdYa6ZwZ5eFrEM4RBsquqhO38beWy3ZWR+4kK X-Received: by 2002:a17:907:3da3:: with SMTP id he35mr17405466ejc.9.1606130287388; Mon, 23 Nov 2020 03:18:07 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1606130287; cv=none; d=google.com; s=arc-20160816; b=iNbvqybjGAhmItEi++uKt3hXBULviYqCmLCIRR1/OK1iYVdkEWysFKFMyWTMfOFzbJ 6/yzVTF/CN0lKdw9K17Y6jLuWSMfECNdiB+/m+tjilyyK4Nt1nteDdkaBs13gyWO5z6z H5HIwD5FHAwifob6v5G8ODsOSa7FaSzAvV14rTgge/Brj961GwhwHfbm0h5kQ/IZuHgp xUlayJCfzFxntKBgTeaCs/hyK9shR7Tmi7H7/5qo2zo3kQgbo4/AyEjQ8+izyb/c30tu 9CiQSvM5QMS+h+TdYVbwAodL/m7zPeTRB4YKZG5nCc7ngTg4elgr6bwhKxMGRv35nPnS KNpQ== 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=Bvhh23z0M2tKicn8LAl0Ew8E71sb6BwWzmx1gdB366A=; b=YVqTrWsYdKkWPGAHuoqqEZoRcScMTHQB63aThDFeD/1ezQMio3+Ag1419LnALdjGxm rDt7FYE8P2zD07bsDY6IqpPNGVZYtnu2CIch3Zhm0n9kkRNWKUUwlHK6q5Wfs50IIXT8 UZwHZqOrVM6jEkO6HNzgAkMeuJVrz0cj/1eipZuu7kzsxRk838mZlaxOD3vxedeisQTU ywzl0Zq+MwUyNMbR3JxNZU2U/CokLOe5S77087ZJ65diB+eYXzWMmmC6OsiYXdLczk2c 4hWrYTcl82LD+8rsmCdiFny2rhPSJ6WbaURwrxA98fPx9bryFfQjp4ViTvVjOPoZZ2GM xzgw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@microchip.com header.s=mchp header.b=PwY2tcUh; 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 dk11si4707767ejb.542.2020.11.23.03.17.43; Mon, 23 Nov 2020 03:18: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=PwY2tcUh; 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 S1728431AbgKWLOf (ORCPT + 99 others); Mon, 23 Nov 2020 06:14:35 -0500 Received: from esa6.microchip.iphmx.com ([216.71.154.253]:6538 "EHLO esa6.microchip.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726529AbgKWLOe (ORCPT ); Mon, 23 Nov 2020 06:14:34 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1606130074; x=1637666074; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=knfos+BqzH4dlo+fODl7yedIW3k3ViBBu3PBL+ng7bw=; b=PwY2tcUhaQb2ssFueb1uCxVgjVVXBXbSkt2N7MaFT1kt+WF/74xv7CCT iMQk0/oCRdm3ajMk905yrmzKmFCGpS7DkrZ8P2qHoaGl0I6fuPEA8UE21 zTnocCra3qpAolF+CEZoMDklmFtPxULA773VepeANmqsMFznTbQFfp+P9 c3HXZpMfUdzjkHz6c9m6Tp2Cl6k62pznQGlweGvjm7cddotvAsse4Ep+b nzxMyjraqTmhFfujQRxFAU4cNwPdI671sLHnGCL/filaEwi+KLWLKozSP YHbII2JAomeFphpAaz3hIGS/ZzlTmrVzZvcdxyAAK2rD+UbdTjCsRnN/f g==; IronPort-SDR: /eekxxeuBa1IVo708k88MVQpPGekvM5vyIxrHB/2lJDG7EfQO3s0J2iEAItQ4wo/j30G4I1D0k 2e7ojic+9xaY/Ou0wQufhDYf+rKec+4AisKMhDDq9hCT5bLGT5ibdB5MCIK9ATXsUJBENZ1iGl pl5i1elFijIHxFGIKxWl1yX3W6I4Y5xAuUBMvVQuIWnRUhf8JWMzYRYrmmLscs8LZZO43OW7DL +R8yzlIVorszjHvUNFJ/P2+3Xj59iO50ESoXE6lduo+R36ResBSXW4iVoSo6C0hiPlviFY4wun pl4= X-IronPort-AV: E=Sophos;i="5.78,363,1599548400"; d="scan'208";a="34683043" Received: from smtpout.microchip.com (HELO email.microchip.com) ([198.175.253.82]) by esa6.microchip.iphmx.com with ESMTP/TLS/AES256-SHA256; 23 Nov 2020 04:14:32 -0700 Received: from chn-vm-ex01.mchp-main.com (10.10.85.143) by chn-vm-ex02.mchp-main.com (10.10.85.144) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1979.3; Mon, 23 Nov 2020 04:14:32 -0700 Received: from soft-dev3.localdomain (10.10.115.15) by chn-vm-ex01.mchp-main.com (10.10.85.143) with Microsoft SMTP Server id 15.1.1979.3 via Frontend Transport; Mon, 23 Nov 2020 04:14:30 -0700 From: Horatiu Vultur To: , , , , , , CC: Horatiu Vultur Subject: [PATCH net-next] bridge: mrp: Implement LC mode for MRP Date: Mon, 23 Nov 2020 12:14:01 +0100 Message-ID: <20201123111401.136952-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 the frame header for the frame InLinkStatus and extends existing rules on how to forward this frame. Signed-off-by: Horatiu Vultur --- include/uapi/linux/mrp_bridge.h | 7 +++++++ net/bridge/br_mrp.c | 18 +++++++++++++++--- 2 files changed, 22 insertions(+), 3 deletions(-) diff --git a/include/uapi/linux/mrp_bridge.h b/include/uapi/linux/mrp_bridge.h index 6aeb13ef0b1e..450f6941a5a1 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, }; @@ -156,4 +157,10 @@ struct br_mrp_in_link_hdr { __be16 interval; }; +struct br_mrp_in_link_status_hdr { + __u8 sa[ETH_ALEN]; + __be16 port_role; + __be16 id; +}; + #endif 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