Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp4497857ybl; Mon, 13 Jan 2020 14:59:19 -0800 (PST) X-Google-Smtp-Source: APXvYqyQs1zoKIRQAzFWEI+6zK3YDpA9agt6iWPZmAsLRPdfRlEuzB/KWdOQ+QN2pmDLzQ/SUfBq X-Received: by 2002:a9d:7f12:: with SMTP id j18mr15371243otq.17.1578956359101; Mon, 13 Jan 2020 14:59:19 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1578956359; cv=none; d=google.com; s=arc-20160816; b=Std4xBGefhHU1TN3IPYQAFn7GtSoj/xKAeGVWQgUyaO1fEo0p/MiuSoGO90wWQlE3a xuk+t3Oydst669zGThY1+5xQeOl/c0vJyWFkm4zc1fnSHAWsAqa1cu5xyXmK1xcsHGsi bi//oJoLZNyHGScYCm6y/jyqmPzkLDq5tpQzx+WoGXPbUt85iINqkobd1sBp57dkLmZu F9aOgu8mYgWaCYvjNLUb90syo9UFi00vDv4B3bMP89HIoTe8XYa4laxlwuHCtcrYrvP6 yEB7m0C3nqCA3JiN+px7RZGhqD2QGsvIItkUitB0fWBzbxbnFLJ3w+4sh3l0gyPDS+ZN 9ACQ== 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; bh=SokcUF5hQB4x0xVlOYwvECdqGPxUOe6lefWr1oQctbc=; b=RzKftja0fDCOGTPlBjZScar7cFLQQcX8LAyYfty78q5bPBfBxabbVtYx7FkB/klFC7 fnWjm7H/C4h9H37vVsigsn66JamDqHgTLFZM4ZkKXzWiniDAixxc/U64U0uT0jg+UeiV 4XoSSv7KcCRp2uHVxSvkWDnkYETlznIhk559vP5OfaCWfpnV6z9ANoxDEz9chW2A3x4M yzr6Zx07d57KhKF/nRB1TWCeyxrcALf74e6bHzT7S1uHCY+WsgZaPkSspThbc/iB+BK7 2SM7N3lY1Dv/goLYiqtEm3m0DIeS/qXhmVH4SPh556Z4n81jPzf62Uc7mNOa1v5M5ZCl zIrA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 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. [209.132.180.67]) by mx.google.com with ESMTP id r26si7963376otc.163.2020.01.13.14.59.07; Mon, 13 Jan 2020 14:59:19 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 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 S1729154AbgAMW5z (ORCPT + 99 others); Mon, 13 Jan 2020 17:57:55 -0500 Received: from esa2.microchip.iphmx.com ([68.232.149.84]:12990 "EHLO esa2.microchip.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728829AbgAMW5z (ORCPT ); Mon, 13 Jan 2020 17:57:55 -0500 Received-SPF: Pass (esa2.microchip.iphmx.com: domain of Horatiu.Vultur@microchip.com designates 198.175.253.82 as permitted sender) identity=mailfrom; client-ip=198.175.253.82; receiver=esa2.microchip.iphmx.com; envelope-from="Horatiu.Vultur@microchip.com"; x-sender="Horatiu.Vultur@microchip.com"; x-conformance=spf_only; x-record-type="v=spf1"; x-record-text="v=spf1 mx a:ushub1.microchip.com a:smtpout.microchip.com -exists:%{i}.spf.microchip.iphmx.com include:servers.mcsv.net include:mktomail.com include:spf.protection.outlook.com ~all" Received-SPF: None (esa2.microchip.iphmx.com: no sender authenticity information available from domain of postmaster@email.microchip.com) identity=helo; client-ip=198.175.253.82; receiver=esa2.microchip.iphmx.com; envelope-from="Horatiu.Vultur@microchip.com"; x-sender="postmaster@email.microchip.com"; x-conformance=spf_only Authentication-Results: esa2.microchip.iphmx.com; dkim=none (message not signed) header.i=none; spf=Pass smtp.mailfrom=Horatiu.Vultur@microchip.com; spf=None smtp.helo=postmaster@email.microchip.com; dmarc=pass (p=none dis=none) d=microchip.com IronPort-SDR: uLdyb5/8R7WdrAuvZZJHHEW+0FURP8Mm7nPewEH2KVe415sRQZBrXTBFgHGr82rS96k4G+y9ZN 5Knjg7uZxTqBsg55Kd+EQFNnqmnwYYiwbgZc4BUmPTRBZx4DCoRfoIDcF/d2vPeS33qmRIiGaH y7udqvM+Y/3eEx6VInACJRR0lz7nKbF9N0P32Ez78dNlCZkyP0UxpK6Lud29bDFNqq4G6/Fgmf qDk6mqEx892r/ff3Jakj7LeNegALia07v1Q1SY6Oq2KDRP+hw7dLXOGeE4drnrUTXCGJUXUk4K eeo= X-IronPort-AV: E=Sophos;i="5.69,430,1571727600"; d="scan'208";a="62491319" Received: from smtpout.microchip.com (HELO email.microchip.com) ([198.175.253.82]) by esa2.microchip.iphmx.com with ESMTP/TLS/AES256-SHA256; 13 Jan 2020 15:57:54 -0700 Received: from chn-vm-ex02.mchp-main.com (10.10.85.144) 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.1713.5; Mon, 13 Jan 2020 15:57:52 -0700 Received: from localhost (10.10.85.251) by chn-vm-ex02.mchp-main.com (10.10.85.144) with Microsoft SMTP Server id 15.1.1713.5 via Frontend Transport; Mon, 13 Jan 2020 15:57:51 -0700 Date: Mon, 13 Jan 2020 23:57:51 +0100 From: Horatiu Vultur To: Andrew Lunn CC: , , , , , , , , , , , , , Subject: Re: [RFC net-next Patch v2 4/4] net: bridge: mrp: switchdev: Add HW offload Message-ID: <20200113225751.jkkio4rztyuff4xj@soft-dev3.microsemi.net> References: <20200113124620.18657-1-horatiu.vultur@microchip.com> <20200113124620.18657-5-horatiu.vultur@microchip.com> <20200113140053.GE11788@lunn.ch> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Disposition: inline In-Reply-To: <20200113140053.GE11788@lunn.ch> User-Agent: NeoMutt/20180716 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The 01/13/2020 15:00, Andrew Lunn wrote: > EXTERNAL EMAIL: Do not click links or open attachments unless you know the content is safe > > On Mon, Jan 13, 2020 at 01:46:20PM +0100, Horatiu Vultur wrote: > > +#ifdef CONFIG_BRIDGE_MRP > > +/* SWITCHDEV_OBJ_ID_PORT_MRP */ > > +struct switchdev_obj_port_mrp { > > + struct switchdev_obj obj; > > + struct net_device *port; > > + u32 ring_nr; > > +}; > > + > > +#define SWITCHDEV_OBJ_PORT_MRP(OBJ) \ > > + container_of((OBJ), struct switchdev_obj_port_mrp, obj) > > + > > +/* SWITCHDEV_OBJ_ID_RING_TEST_MRP */ > > +struct switchdev_obj_ring_test_mrp { > > + struct switchdev_obj obj; > > + /* The value is in us and a value of 0 represents to stop */ > > + u32 interval; > > + u8 max; > > + u32 ring_nr; > > +}; > > + > > +#define SWITCHDEV_OBJ_RING_TEST_MRP(OBJ) \ > > + container_of((OBJ), struct switchdev_obj_ring_test_mrp, obj) > > + > > +/* SWITCHDEV_OBJ_ID_RING_ROLE_MRP */ > > +struct switchdev_obj_ring_role_mrp { > > + struct switchdev_obj obj; > > + u8 ring_role; > > + u32 ring_nr; > > +}; > > Hi Horatiu > > The structures above should give me enough information to build this, > correct? Hi Andrew, You will need also these attributes to build a minimum MRP_Test frame: SWITCHDEV_ATTR_ID_MRP_PORT_STATE, SWITCHDEV_ATTR_ID_MRP_PORT_ROLE, SWITCHDEV_ATTR_ID_MRP_RING_STATE, SWITCHDEV_ATTR_ID_MRP_RING_TRANS, > > Ethernet II, Src: 7a:8b:b1:35:96:e1 (7a:8b:b1:35:96:e1), Dst: Iec_00:00:01 (01:15:4e:00:00:01) > Destination: Iec_00:00:01 (01:15:4e:00:00:01) > Source: 7a:8b:b1:35:96:e1 (7a:8b:b1:35:96:e1) > Type: MRP (0x88e3) > PROFINET MRP MRP_Test, MRP_Common, MRP_End > MRP_Version: 1 > MRP_TLVHeader.Type: MRP_Test (0x02) > MRP_TLVHeader.Type: MRP_Test (0x02) > MRP_TLVHeader.Length: 18 > MRP_Prio: 0x1f40 High priorities > MRP_SA: 7a:8b:b1:35:96:e1 (7a:8b:b1:35:96:e1) > MRP_PortRole: Primary ring port (0x0000) > MRP_RingState: Ring closed (0x0001) > MRP_Transition: 0x0001 > MRP_TimeStamp [ms]: 0x000cf574 <---------- Updated automatic > MRP_TLVHeader.Type: MRP_Common (0x01) > MRP_TLVHeader.Type: MRP_Common (0x01) > MRP_TLVHeader.Length: 18 > MRP_SequenceID: 0x00e9 <---------- Updated automatic > MRP_DomainUUID: ffffffff-ffff-ffff-ffff-ffffffffffff > MRP_TLVHeader.Type: MRP_End (0x00) > MRP_TLVHeader.Type: MRP_End (0x00) > MRP_TLVHeader.Length: 0 > > There are a couple of fields i don't see. MRP_SA, MRP_Transition. Regarding the MRP_SA, which represents the bridge MAC address, we could get this information from listening to the notifications in the driver. So I don't think we need a special call for this. The same could be for MRP_Transition, which counts the number of times the ring goes in open state. In theory we could get information by counting in the driver how many times the ring gets in the open state. And we get this information through the attribute SWITCHDEV_ATTR_ID_MRP_RING_STATE. The other fields that are missing are MRP_Prio and MRP_DomainUUID. But these values could be set to a default values for now because they are used by MRA(Media Redundancy Auto-manager), which is not part of this patch series. > > What are max and ring_nr used for? The max represents the number of MRP_Test frames that can be missed by receiver before it declares the ring open. For example if the receiver expects a MRP_Frame every 10ms and it sets the max to 3. Then it means that if it didn't receive a frame in 30ms, it would set that the port didn't receive MRP_Test. The ring_nr represents the ID of the MRP instance. For example, on a switch which has 8 ports, there can be 4 MRP instances. Because each instance requires 2 ports. And to be able to differences them, each instance has it's own ID, which is this ring_nr. > > Do you need to set the first value MRP_SequenceID uses? Often, in > order to detect a reset, a random value is used to initialise the > sequence number. Also, does the time stamp need initializing? I couldn't see in the standard if they required an initial for MRP_SequenceID. From what I have seen on some switches that have their own MRP implementation, they set the initial value of MRP_SequenceID to 0 and they increase for it frame. Regarding the timestamp, again the standard doesn't say anything about initial value. This timestamp is used by MRM to determine the maximum travel time of the MRP_Test frames in a ring. > > Thanks > Andrew -- /Horatiu