Received: by 2002:a05:6a10:f3d0:0:0:0:0 with SMTP id a16csp348853pxv; Thu, 24 Jun 2021 09:12:36 -0700 (PDT) X-Google-Smtp-Source: ABdhPJypkP7V//w25VoUJEKk4TtsShhygZc0a5uRHKe6sReMNUeFM0XFElLEWjkBeYP7uK0V++Yv X-Received: by 2002:a92:da88:: with SMTP id u8mr4259157iln.185.1624551156677; Thu, 24 Jun 2021 09:12:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1624551156; cv=none; d=google.com; s=arc-20160816; b=Bf3ANTKmIUuP7qZpvYyk6kTNddbzXuEWWP8F3NT/PfHWPkyZuOC4CiHyrXwTIJt1GR Zlp1actRuyyZq3k6C2aZ+G/HLNwGlIQVllEyx27tEBychCTOlySmr74IOPlGw6SV1i4E Ao3L7B0sJbDnx0elTk816ITH6vu9B22IlR5ogNUiOgTvDOgt+3aVyXeV4vcT2GLhrqcn SUhNQ2Oa3vEt2KqFi7IICAle+j9xVxZGiv3jEZWm3UrI8gbAL3xbEoAM7gWsbP/Tk8tW 2/9nSHRkL8ys+Jdbu/5d7UBxhOsWERvEnXwtE6Vwp/5RAdh1kpGDcOYGzdii9S2RDxGY 0rJQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=2zpxTskXtsSrCKrJdGxNHyEuYUkfYqVGKXrVSQNH2cg=; b=nLd+tmEklRnz5fAghichbm220fG5Awa2NUDh8+OZnwAefBSbIilrP9BBnR5X3kkmhS x2R0MDlz/Gb8qcqGk6rAd00/DIPIMwwAak8D2l169UjLkja6IFWYFmPSwBwNYaVYaTJv 9YmIeFlgKV0Gn9BlC2zbSyr3IB2e4FKp41EmB2Uikmyawe7xzWcCR1+XPj4LTFUxNs5E M0bC/DDD79/uoj9xORoO1jROPFdo23+GFbn8Xg35Fk0+L75CEWBDhH7SvoISbeViKScA zjH31qTQlxXFHp47bK0FdXNu4pvTVJFK7JS8W+fQ4LdbQDdJlounztrtQDjY01m4bl0U EmSQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@lunn.ch header.s=20171124 header.b=pCQpVOtx; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id d198si3867848jac.70.2021.06.24.09.12.20; Thu, 24 Jun 2021 09:12:36 -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=pass header.i=@lunn.ch header.s=20171124 header.b=pCQpVOtx; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229928AbhFXQOH (ORCPT + 99 others); Thu, 24 Jun 2021 12:14:07 -0400 Received: from vps0.lunn.ch ([185.16.172.187]:54050 "EHLO vps0.lunn.ch" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229445AbhFXQOG (ORCPT ); Thu, 24 Jun 2021 12:14:06 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lunn.ch; s=20171124; h=In-Reply-To:Content-Disposition:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:From:Sender:Reply-To:Subject: Date:Message-ID:To:Cc:MIME-Version:Content-Type:Content-Transfer-Encoding: Content-ID:Content-Description:Content-Disposition:In-Reply-To:References; bh=2zpxTskXtsSrCKrJdGxNHyEuYUkfYqVGKXrVSQNH2cg=; b=pCQpVOtxgMgXa5fmttOeaZCDS2 eGEAjIw+HJKlpBXv/y99EkzIEDk4LGG/2LWIobnETdlypWtlDiUJUMK2saxMzDiKGUZreG1Xyl3tP Uyl81+u4qfj7XRxtu4TROreTRUb9p300x+w1Bd8UAXvj6C+7FgtTu7hlWUgMB71VSNas=; Received: from andrew by vps0.lunn.ch with local (Exim 4.94.2) (envelope-from ) id 1lwRx6-00Azym-DF; Thu, 24 Jun 2021 18:11:40 +0200 Date: Thu, 24 Jun 2021 18:11:40 +0200 From: Andrew Lunn To: Lukasz Majewski Cc: "David S . Miller" , Jakub Kicinski , Madalin Bucur , Nicolas Ferre , Joakim Zhang , Florian Fainelli , Vladimir Oltean , netdev@vger.kernel.org, Arnd Bergmann , Mark Einon , NXP Linux Team , linux-kernel@vger.kernel.org Subject: Re: [RFC 2/3] net: Provide switchdev driver for NXP's More Than IP L2 switch Message-ID: References: <20210622144111.19647-1-lukma@denx.de> <20210622144111.19647-3-lukma@denx.de> <20210623133704.334a84df@ktm> <20210624125304.36636a44@ktm> <20210624163542.5b6d87ee@ktm> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210624163542.5b6d87ee@ktm> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Jun 24, 2021 at 04:35:42PM +0200, Lukasz Majewski wrote: > Hi Andrew, > > > > I'm not sure if the imx28 switch is similar to one from TI (cpsw-3g) > > > - it looks to me that the bypass mode for both seems to be very > > > different. For example, on NXP when switch is disabled we need to > > > handle two DMA[01]. When it is enabled, only one is used. The > > > approach with two DMAs is best handled with FEC driver > > > instantiation. > > > > I don't know if it applies to the FEC, but switches often have > > registers which control which egress port an ingress port can send > > packets to. So by default, you allow CPU to port0, CPU to port1, but > > block between port0 to port1. This would give you two independent > > interface, the switch enabled, and using one DMA. When the bridge is > > configured, you simply allow port0 and send/receive packets to/from > > port1. No change to the DMA setup, etc. > > Please correct me if I misunderstood this concept - but it seems like > you refer to the use case where the switch is enabled, and by changing > it's "allowed internal port's" mapping it decides if frames are passed > between engress ports (port1 and port2). Correct. > ---------- > DMA0 -> |P0 P1| -> ENET-MAC (PHY control) -> eth0 (lan1) > |L2 SW | > | P2| -> ENET-MAC (PHY control) -> eth1 (lan2) > ---------- > > DMA1 (not used) > > We can use this approach when we keep always enabled L2 switch. > > However now in FEC we use the "bypass" mode, where: > DMA0 -> ENET-MAC (FEC instance driver 1) -> eth0 > DMA1 -> ENET-MAC (FEC instance driver 2) -> eth1 > > And the "bypass" mode is the default one. Which is not a problem, when you refactor the FEC into a library and a driver, plus add a new switch driver. When the FEC loads, it uses bypass mode, the switch disabled. When the new switch driver loads, it always enables the switch, but disables communication between the two ports until they both join the same bridge. But i doubt we are actually getting anywhere. You say you don't have time to write a new driver. I'm not convinced you can hack the FEC like you are suggesting and not end up in the mess the cpsw had, before they wrote a new driver. Andrew