Received: by 2002:a25:1985:0:0:0:0:0 with SMTP id 127csp3949241ybz; Mon, 20 Apr 2020 12:28:27 -0700 (PDT) X-Google-Smtp-Source: APiQypJ5lHy/wTvGna0gIH+qMMpfl5vfJ5mNR5pE/d4b3txQFNRnrfC02q2P16CxuuGbA0/eLBv1 X-Received: by 2002:a05:6402:749:: with SMTP id p9mr10541348edy.75.1587410906921; Mon, 20 Apr 2020 12:28:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1587410906; cv=none; d=google.com; s=arc-20160816; b=0L+XQP2h4N/cziJph52wMoElzczyqUxc0STcu3UMSC1ThFpS1/oAB3p9a13hkRj560 xjcUmZdEVHxldRg8qdv9icWyG23Y1y4+kvREAxvOzh5+OJ09jZUHoyfHXt5Yp0fyjNFo UEu81zRKRqWZHHLjCAoPXGoNEJSeqT8/+M+8JBQT0l0qOy3kGktAkujnBS49RB4+vXYZ d7sGEh1/0bgKv27kg2LRnzK/q0gQvt0zuP6Y1zqGboRVUFHAvwbrcIGi3PW4TwUEXLqP K6THHaDvXM6chGKl7BbOw7oqn1e4uPcYVjWlIgZMjcFQi8HfCYhbZzzZpAosCUrvhmzV lZig== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:ironport-sdr:dkim-signature; bh=imlEWNAoVh3FJBh6P/8Amidyf+lO1uWHYOfeACyEaIc=; b=BdHeBukkkhI+cToH9ge/ZFXNRKf83Y/Sgzf0niAuPPg/lJkt2enuqQm9DPcJrc6Ggu 7YUFFKJrkgfdQjo8lVT8xBjpzw1ucGcE2M5E9SudzezSOj213jQWJbPAGHfAa0YXEXpj iODhFIyLASQzbA+/pkrn+PZZB9rMw+UJRriSyW4zJpBXoxT2ozzIW5Lv5hmYzhcZw2RL DxLGz+uUwIYS1Z+x0gBgM8NGI/ooDCCqXddY4FXpNxyHPxuKP8W0w3ERWigd8KwIeyxA 6L91Ods6rc3dg4l1IA5Ylw7dcWxz+oaF/RaAySnnNC5gktIfxx/bx8ymipBaXen0kcc6 sBPQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@microchip.com header.s=mchp header.b=rZQftbql; 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 n21si118899ejc.113.2020.04.20.12.28.00; Mon, 20 Apr 2020 12:28:26 -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=rZQftbql; 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 S1726816AbgDTT04 (ORCPT + 99 others); Mon, 20 Apr 2020 15:26:56 -0400 Received: from esa2.microchip.iphmx.com ([68.232.149.84]:65343 "EHLO esa2.microchip.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726189AbgDTT04 (ORCPT ); Mon, 20 Apr 2020 15:26:56 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1587410815; x=1618946815; h=date:from:to:cc:subject:message-id:references: mime-version:in-reply-to; bh=2Z2X+Oe46FhVfUNdHU2pO9fm49ctsQbX913UhF7CSVU=; b=rZQftbqlAzCtG+D1KFX+CGLbJLh8ZarU+6XrlJQhiyjs0At3AzHIIS3m EGcNJhBZj1y6hGplTTQLHvjf7t006WgO/5ZVo5rEuGD3bDZjCVd4Ors3G 3tdoobQbGquE0sC1JUbzPIl44O1PT6hOawrZDF0x6qjqe7Six+6r24Bws n8mRsgNkNA37Y+/1OJCjSznMwr70/Y/cBbZ8MNINm+8+V/isi54A/eWtB 1cmXf6MV1+kt2s2r6BdMEVC/QwtB4WeF0RDJyeRVoDeqPo8f8PeSBVy+J MWJ9i3zYY4oMD2PnOOP5y2+4THqeMBr0xZtZgGH/UcuEnaDYo/LzT4je/ Q==; IronPort-SDR: uXwx1ZizNlrmPOILo6sDsgXyGOs2wcCQQFEdYCGUS5MiyBO7HJKROvOXhkWMXlqnqerD/ZTUDC Ocyiup15TJ0jP3EA9jevE/nqth0rC74riWZOeC6GvOZgzTv1E3+64uwuKASNFsPF+PQRq+FNQz tI8Q3K5gJuYeosXaL8JhRCwgJc/facu6n7Dh7UF4jnKw7ZtRAbdKVMgB66DqL1AZLUcF/X1Q6/ iRCQfBOa3jCYEFQpN/akJ+0mq9vxlYjFHhBa+2lMsJ4ySIwMEDZAA8AQAPwJcn2x38Fa49ehnk Qbo= X-IronPort-AV: E=Sophos;i="5.72,407,1580799600"; d="scan'208";a="72781184" Received: from smtpout.microchip.com (HELO email.microchip.com) ([198.175.253.82]) by esa2.microchip.iphmx.com with ESMTP/TLS/AES256-SHA256; 20 Apr 2020 12:26:55 -0700 Received: from chn-vm-ex03.mchp-main.com (10.10.85.151) by chn-vm-ex01.mchp-main.com (10.10.85.143) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1713.5; Mon, 20 Apr 2020 12:27:02 -0700 Received: from localhost (10.10.115.15) by chn-vm-ex03.mchp-main.com (10.10.85.151) with Microsoft SMTP Server id 15.1.1713.5 via Frontend Transport; Mon, 20 Apr 2020 12:26:54 -0700 Date: Mon, 20 Apr 2020 21:26:54 +0200 From: Horatiu Vultur To: Nikolay Aleksandrov CC: , , , , , , , , , , Subject: Re: [PATCH net-next 04/13] bridge: mrp: Expose function br_mrp_port_open Message-ID: <20200420192654.ivar7apyv5xnzwg3@soft-dev3.microsemi.net> References: <20200420150947.30974-1-horatiu.vultur@microchip.com> <20200420150947.30974-5-horatiu.vultur@microchip.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Disposition: inline In-Reply-To: User-Agent: NeoMutt/20180716 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The 04/20/2020 20:30, Nikolay Aleksandrov wrote: > EXTERNAL EMAIL: Do not click links or open attachments unless you know the content is safe > > On 20/04/2020 18:09, Horatiu Vultur wrote: > > In case the HW is capable to detect when the MRP ring is open or closed. It is > > expected that the network driver will notify the SW that the ring is open or > > closed. > > > > The function br_mrp_port_open is used to notify the kernel that one of the ports > > stopped receiving MRP_Test frames. The argument 'loc' has a value of '1' when > > the port stopped receiving MRP_Test and '0' when it started to receive MRP_Test. > > > > Signed-off-by: Horatiu Vultur > > --- > > include/linux/mrp_bridge.h | 27 +++++++++++++++++++++++++++ > > 1 file changed, 27 insertions(+) > > create mode 100644 include/linux/mrp_bridge.h > > > > diff --git a/include/linux/mrp_bridge.h b/include/linux/mrp_bridge.h > > new file mode 100644 > > index 000000000000..61c1f0d395c7 > > --- /dev/null > > +++ b/include/linux/mrp_bridge.h > > @@ -0,0 +1,27 @@ > > +/* SPDX-License-Identifier: GPL-2.0-or-later */ > > + > > +#ifndef _LINUX_MRP_BRIDGE_H > > +#define _LINUX_MRO_BRIDGE_H > > + > > +#include > > + > > +/* The drivers are responsible to call this function when it detects that the > > + * MRP port stopped receiving MRP_Test frames or it started to receive MRP_Test. > > + * The argument dev represents the port and loc(Lost of Continuity) has a value > > + * of 1 when it stopped receiving MRP_Test frames and a value of 0 when it > > + * started to receive frames. > > + * Needs to be called with rcu_read_lock(). > > + * > > + * This eventually notify the userspace which is required to react on these > > + * changes. > > + */ > > + > > +#if IS_ENABLED(CONFIG_BRIDGE_MRP) > > +int br_mrp_port_open(struct net_device *dev, u8 loc); > > +#else > > +static inline int br_mrp_port_open(struct net_device *dev, u8 loc) > > +{ > > +} > > +#endif > > + > > +#endif > > Hi Nik, > > I see that in order to pass this "loc" to br_ifinfo_notify() you add a new port variable, > but it's a boolean, so you can just use the port flags for it which will simplify things a lot > and remove some ifdefs along the way. And please rename it to something longer (so it's easier > to get what it does). I will update to use the port flags. > > One question - now that it's always sent to user-space as IFLA_BRPORT_MRP_RING_OPEN attribute > wouldn't it be a problem, or is it read as a current state? > I mean you'll receive that attribute about a port even if you get a completely unrelated to MRP > notification (e.g. about a vlan change). It should not be a problem. The default value is 0, which means that the port has not lost the continuity. So let's say that a port lost the continuity then the userspace will receive a call where attribute IFLA_BRPORT_MRP_RING_OPEN will have the value 1. This is as expected. Then as you suggested, there is a vlan change, the userspace will receive a notification but again the attribute IFLA_BRPORT_MRP_RING_OPEN is 1, because the actual value is stored in the port variable, or port flags in the new patch). But the userspace can detect this case and just ignores it. The same will apply also if the userspace will receive multiple notification if the port didn't lose the continuity. > > Thanks, > Nik -- /Horatiu