Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp599659pxu; Thu, 26 Nov 2020 06:49:14 -0800 (PST) X-Google-Smtp-Source: ABdhPJxQo9f/NqV8SXAXeeQ54FpUnZ0Jt/03u81Xvu1b0vr7PCUN9+iaU//E9WJgml69hz1Teylw X-Received: by 2002:a17:907:2043:: with SMTP id pg3mr2890865ejb.95.1606402154648; Thu, 26 Nov 2020 06:49:14 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1606402154; cv=none; d=google.com; s=arc-20160816; b=Pk7+IWWebcSPQ5h0Vxx2oFWI0y96qrzcHIhi/IYpke5I9xmba0dysqE+sd1lyrmgFC H6itY0pdcbxD1FjHYxyTr0rFo7OJNphdKRPDNoT+DMvj7ErpNL+w5XXQVob1HfSnqzk/ D4wIsmrdk0LQH26uHj1sEahP5lAxE6i1/2yD2uu6uQ+8AggEmSl20zor8NmQ+lq19oOz Lqtw6hidyXEiigdWnOEQk2Rt9ii7DPpVEKWAZs+hZnMabJC3SSTBcLyzvmX71KCnA9aP s0s7Ecrpc/USq9EvT+nEViAcCW3hizOGZ2ICZwqwGxUSrRIhL6H6NLBnyNWQ4sgKjHSa b8nw== 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; bh=YVhJwkvf7Yz3dV3ABHCu4SLUJOziwjNV2EwRpxdlWrY=; b=qrb5HEyulG8bLh/WuYeXgJ+UsVQEmXPPGLHchE28t4BpPKIDPJoTGe7B7WKahKdGnt +skcZ5QvF3xOJMbgaak3E0EuvIygJ9Z57E5fGRc4F+q6EL7I3SNR07SyBd/CAPkcuu30 rIA49iwogFJKkX8B5FjRODq4nNETtvL+G6rYHPctpWCQvifSSWStssBKMPq84lMNe9rt b/Tnn7fnl0112cb02q4WwO5rk+/BLQ7nCytMkkodgBfFegIn7kg7a1QzzfTFUnS4hPcm Kz7ZoJj3VYKF+KgQAtJyU+m0CtOiA7Wnz+yDg2G9oIUTZHIrNK6b13wG8+lTmn0H1qt6 MOdQ== ARC-Authentication-Results: i=1; mx.google.com; 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 d14si3556987eds.434.2020.11.26.06.48.51; Thu, 26 Nov 2020 06:49:14 -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; 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 S2391127AbgKZOpu (ORCPT + 99 others); Thu, 26 Nov 2020 09:45:50 -0500 Received: from vps0.lunn.ch ([185.16.172.187]:51432 "EHLO vps0.lunn.ch" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2389847AbgKZOpu (ORCPT ); Thu, 26 Nov 2020 09:45:50 -0500 Received: from andrew by vps0.lunn.ch with local (Exim 4.94) (envelope-from ) id 1kiIWo-008zJb-AI; Thu, 26 Nov 2020 15:45:46 +0100 Date: Thu, 26 Nov 2020 15:45:46 +0100 From: Andrew Lunn To: Lukasz Majewski Cc: Florian Fainelli , Peng Fan , Fugang Duan , Shawn Guo , stefan.agner@toradex.com, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, krzk@kernel.org, "David S . Miller" , NXP Linux Team , Jakub Kicinski , Vladimir Oltean , Fabio Estevam , Vivien Didelot , linux-arm-kernel@lists.infradead.org Subject: Re: [RFC 0/4] net: l2switch: Provide support for L2 switch on i.MX28 SoC Message-ID: <20201126144546.GN2075216@lunn.ch> References: <20201125232459.378-1-lukma@denx.de> <20201126000049.GL2073444@lunn.ch> <20201126031021.GK2075216@lunn.ch> <20201126111014.5a6a2049@jawa> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20201126111014.5a6a2049@jawa> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org > > What is not yet clear to me is how you direct frames out specific > > interfaces. This is where i think we hit problems. I don't see a > > generic mechanism, which is probably why Lukasz put tagger as None. > > I've put the "None" tag just to share the "testable" RFC code. Tagging is a core feature of DSA. Without being able to direct a packet out a specific port, it is not really a DSA driver. It is also core requirement of integrating a switch into Linux. A DSA driver, or a pure switchdev driver expects to be able to forward frames out specific ports. > It is possible to "tag" frames - at least from the manual [0]: > Chapter: "29.4.9.2 Forced Forwarding". > > With using register HW_ENET_SWI_FORCE_FWD_P0 > 29.9.34 ENET SWI Enable forced forwarding for a frame processed > from port 0 (HW_ENET_SWI_FORCE_FWD_P0) > > One can "tag" the packet going from port0 (internal one from SoC) to be > forwarded to port1 (ENET-MAC0) or port2 (ENET-MAC1). > > According to the legacy driver [1]: > "* It only replace the MAC lookup function, > * all other filtering(eg.VLAN verification) act as normal" This might solve your outgoing frame problems. But you need to dive deep into how the FEC driver works, especially in a DSA like setup. The normal path would be, the slave interface passes a frame to the tagger driver, living in net/dsa/tag_*.c. Normally, it adds a header/trailer which the switch looks at. It then hands to packet over to the master Ethernet driver, which at some point will send the frame. Because the frame is self contained, we don't care what that ethernet driver actually does. It can add it to a queue and send it later. It can look at the QoS tags and send it with low priority after other frames, or could put it to the head of the queue and send it before other frames etc. Since you don't have self contained frames, this is a problem. After writing to this register, you need to ensure what is transmitted next is the specific frame you intend. It cannot be added to an existing queue etc. You need to know when the frame has been sent, so you can re-write this register for the next frame. This is why i said i don't know if the DSA architecture will work. You need a close coupling between the tagger setting the force bits, and the DMA engine sending the frame. The other option is you totally ignore most of this and statically assign VLANs. Frames sent with VLAN 1 are forwarded out port 1. Frames sent with VLAN 2 are sent out port 2. You need the port to append/strip these VLAN tags for ingress/egress. tag_8021q.c gives you some code to help with this. But can you still use the hardware to switch frames between ports 1 and 2 without them going via the CPU? Andrew.