Received: by 2002:a05:6a10:f3d0:0:0:0:0 with SMTP id a16csp222735pxv; Thu, 24 Jun 2021 06:36:50 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxTm94sV1LprGXY4V8Hq94FZGoTz4rlft0vm7gINenZVHVXV1lvPlu3aB/WrT1jmaJDzE12 X-Received: by 2002:a92:d9d2:: with SMTP id n18mr3646333ilq.118.1624541810397; Thu, 24 Jun 2021 06:36:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1624541810; cv=none; d=google.com; s=arc-20160816; b=Lji9pd8gG7N5+fleVwb6zS2wSC9HtxobcA+mil8mfESqxINH9EsFggQvHxvQDr0BcK heb5aW/b81jao2yY1sA/lquEkjVJTKVuMuCMIuUe5Z/qins5v4uVkU4j9msR/C1C1aRC pL3EITcbGk18Ru5dVG7EeIVIoTfxmZHaeiPVfY88CrFZ61jrl3YDbS2cg5IaGaThNwy8 DU26+FmPg7YeZhLayTyJfRmHNf2Na4ZrfyFuSYrNj8hr+Vx92DyD01jPHEllPIYiH4S4 2kFn6Hqsm6WWffrJgbzrUlRWw46yxfYSJPLs8RO4cU3Q/1c7hef6m6sP8644IE1tt5d/ Bzow== 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=/QoD2olOKiTnq2WBqvcr2a3obQ9nSZsgcbVeh4n1M8o=; b=YfeAVSaDvGhWGSBOZaCOvq6XCp/5KMN0oFxgN7lN/R4uJZNBTbYOENL5yBvjDZjCpB 4g6VWx+y/4keHYBdnOjzzqtKFe5QyMkTg6LqmwddRbgrLeBcoCegSjCwExTXczrNn8M/ sJZedBcuSfajWUztUMYU3EkjFU6gMJE60rhVVEUusOuZa1tYjR19mnA88S4Po102z2pT S2D7Lwjzn7waD8/CA3jxW+Khe4PL2YUWMVnIejudLBWQU8nPEyQ5tcURmj5Z0tzNWOEM O+Hmzdpqpz+GGGa7XnDY215Uq3oh45SsqGL/a73MmhcmE3g2uqjVIQRQSd8a9BybL/pp Lq/A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@lunn.ch header.s=20171124 header.b=eZ+A88OW; 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 l8si3246780ilk.17.2021.06.24.06.36.38; Thu, 24 Jun 2021 06:36:50 -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=eZ+A88OW; 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 S231516AbhFXNgg (ORCPT + 99 others); Thu, 24 Jun 2021 09:36:36 -0400 Received: from vps0.lunn.ch ([185.16.172.187]:53700 "EHLO vps0.lunn.ch" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229878AbhFXNgf (ORCPT ); Thu, 24 Jun 2021 09:36:35 -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=/QoD2olOKiTnq2WBqvcr2a3obQ9nSZsgcbVeh4n1M8o=; b=eZ+A88OWuWRVcJCGkjiY3qUVtT YZXBYa4kedsiNRipnvHUTk/z0/cuWTSN0vGoadd9CyKKQ1MhFYtOkIEnFJ9vCiz5yb3Og0NcDVqUs hK8JmGNRBmqZ3CdpijySE22MhseVFGWxYsI+PZCgw9Eekk01qQVH8vTVrgNBBtfXALsU=; Received: from andrew by vps0.lunn.ch with local (Exim 4.94.2) (envelope-from ) id 1lwPUX-00AyWz-CJ; Thu, 24 Jun 2021 15:34:01 +0200 Date: Thu, 24 Jun 2021 15:34:01 +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> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210624125304.36636a44@ktm> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org > 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. > The code from [2] needs some vendor ioctl based tool (or hardcode) to > configure the switch. This would not be allowed. You configure switches in Linux using the existing user space tools. No vendor tools are used. > > and how well future features can be added. Do you have > > support for VLANS? Adding and removing entries to the lookup tables? > > How will IGMP snooping work? How will STP work? > > This can be easily added with serving netstack hooks (as it is already > done with cpsw_new) in the new switchdev based version [3] (based on > v5.12). Here i'm less convinced. I expect a fully functioning switch driver is going to need switch specific versions of some of the netdev ops functions, maybe the ethtool ops as well. It is going to want to add devlink ops. By hacking around with the FEC driver in the way you are, you might get very basic switch operation working. But as we have seen with cpsw, going from very basic to a fully functioning switchdev driver required a new driver, cpsw_new. It was getting more and more difficult to add features because its structure was just wrong. We don't want to add code to the kernel which is probably a dead end. Andrew