Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp1490681rwd; Sat, 20 May 2023 23:02:19 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6AGs057mcDxKOOam7ay3a4cqzQ2XgveoQHzKVkKJljK902L4cexT3bRHX87GQgY2vJ/ZTJ X-Received: by 2002:a17:90b:1003:b0:253:34da:487 with SMTP id gm3-20020a17090b100300b0025334da0487mr6084471pjb.35.1684648939234; Sat, 20 May 2023 23:02:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1684648939; cv=none; d=google.com; s=arc-20160816; b=csOT/WNmqLkCNODZXoHDn/sEVfFRJcnAdAwq5Fl4gsCJKJe0/NoxxAwge4c+0IxD3u iLybkfjUIzjaeJIo9/Z3GxUVKkfbDQEI/iov1Se9/b48Jow9hoNemhhzHU1JkZED2Lst NAvwRYPeOsoRoT0eJr2E8BmG8t8FzpwtZVHrEKeE01gOMRSciO/iafzNabAuHFjOqBD2 VR9FGE9nZ7qxLl4QFw9Lx3YjvPgi651vq64cvt+94pws/kefyiIYGLVhPM3SYkGeToDN XvgL5tUwOZZJBmz9jaiyZ4KNn786S+W9Wgl2CN6Y+jQeEw5toyzaXko+Dp5fM16W4f8x 0+xQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date; bh=cYOEvSS1IxPrknD+aoqdSm348FpZyJgClUHpbXn62BQ=; b=kpusk9It4Kmo9Dpdtw9X6AkQ3YfQCrXJuNXh1eLjjcPyCUtx1JlHfa2V9r7dFJRVw8 y++DwVMYVFjoSqoHZaMhGjRofdZxXTh2t0jcPZtmZ/7s6epqLOkEOdsYftzK8lmz31/3 WZ0b0qo0C6jNHdFD9CphCTt1nMU7819o7wfVOZNEEeuakmoyPOhRgkk7JcDC53UdWcre LjqNxrmj+oJGCaCzqbbetqhwLgAghgOsNKqhr4qDpDBYXwAdrCvLkZB2ZbeHBm6iqfsf zg65NaLRT+UNBGat4aCSQjxG0/L0TUIG301NCrECRVfXFY3mM01Ht9Vb/gDfbbVlIrM+ XJvQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id h16-20020a633850000000b0053477e09967si23964pgn.833.2023.05.20.23.01.53; Sat, 20 May 2023 23:02:19 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229697AbjEUEi5 (ORCPT + 99 others); Sun, 21 May 2023 00:38:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60246 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229481AbjEUEi4 (ORCPT ); Sun, 21 May 2023 00:38:56 -0400 Received: from metis.ext.pengutronix.de (metis.ext.pengutronix.de [IPv6:2001:67c:670:201:290:27ff:fe1d:cc33]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 25F9F10A for ; Sat, 20 May 2023 21:38:55 -0700 (PDT) Received: from ptx.hi.pengutronix.de ([2001:67c:670:100:1d::c0]) by metis.ext.pengutronix.de with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1q0aqD-0005hY-W3; Sun, 21 May 2023 06:38:46 +0200 Received: from ore by ptx.hi.pengutronix.de with local (Exim 4.92) (envelope-from ) id 1q0aq9-0000RO-Na; Sun, 21 May 2023 06:38:41 +0200 Date: Sun, 21 May 2023 06:38:41 +0200 From: Oleksij Rempel To: Vladimir Oltean Cc: Woojung Huh , Andrew Lunn , Arun Ramadoss , Florian Fainelli , Simon Horman , "Russell King (Oracle)" , linux-kernel@vger.kernel.org, Eric Dumazet , Paolo Abeni , kernel@pengutronix.de, netdev@vger.kernel.org, Jakub Kicinski , UNGLinuxDriver@microchip.com, "David S. Miller" Subject: Re: [PATCH net-next v4 1/2] net: dsa: microchip: ksz8: Make flow control, speed, and duplex on CPU port configurable Message-ID: <20230521043841.GA22442@pengutronix.de> References: <20230519124700.635041-1-o.rempel@pengutronix.de> <20230519124700.635041-2-o.rempel@pengutronix.de> <20230519143004.luvz73jiyvnqxk4y@skbuf> <20230519185015.GA18246@pengutronix.de> <20230519203449.pc5vbfgbfc6rdo6i@skbuf> <20230520050317.GC18246@pengutronix.de> <20230520151708.24duenxufth4xsh5@skbuf> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20230520151708.24duenxufth4xsh5@skbuf> X-Sent-From: Pengutronix Hildesheim X-URL: http://www.pengutronix.de/ X-Accept-Language: de,en X-Accept-Content-Type: text/plain User-Agent: Mutt/1.10.1 (2018-07-13) X-SA-Exim-Connect-IP: 2001:67c:670:100:1d::c0 X-SA-Exim-Mail-From: ore@pengutronix.de X-SA-Exim-Scanned: No (on metis.ext.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-kernel@vger.kernel.org X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat, May 20, 2023 at 06:17:08PM +0300, Vladimir Oltean wrote: > On Sat, May 20, 2023 at 07:03:17AM +0200, Oleksij Rempel wrote: > > On Fri, May 19, 2023 at 11:34:49PM +0300, Vladimir Oltean wrote: > > > On Fri, May 19, 2023 at 08:50:15PM +0200, Oleksij Rempel wrote: > > > > Thank you for your feedback. I see your point. > > > > > > > > We need to remember that the KSZ switch series has different types of > > > > ports. Specifically, for the KSZ8 series, there's a unique port. This > > > > port is unique because it's the only one that can be configured with > > > > global registers, and it is only one supports tail tagging. This special > > > > port is already referenced in the driver by "dev->cpu_port", so I continued > > > > using it in my patch. > > > > > > Ok, I understand, so for the KSZ8 family, the assumption about which > > > port will use tail tagging is baked into the hardware. > > > > > > > It is important to note that while this port has an xMII interface, it > > > > is not the only port that could have an xMII interface. Therefore, using > > > > "dev->info->internal_phy" may not be the best way to identify this port, > > > > because there can be ports that are not global/cpu, have an xMII > > > > interface, but don't have an internal PHY. > > > > > > Right, but since we're talking about phylink, the goal is to identify > > > the xMII ports, not the CPU ports... This is a particularly denatured > > > case because the xMII port is global and is also the CPU port. > > > > I see. Do you have any suggestions for a better or more suitable > > implementation? I'm open to ideas. > > Trying to answer here for both questions. In the RFC/RFT patch set I had > posted, I introduced the concept of "wacky" registers, which are registers > which should be per port (and are accessed as per-port by the driver), > but because there is a single such port in the switch, the hardware > design degenerated into moving them in the global area. Nonetheless, > treating the xMII global registers as per-port makes it possible for the > common driver to share more code between KSZ8 and others. > > If you look at ksz9477_phylink_mac_link_up() - renamed to just > ksz_phylink_mac_link_up() in my patch set - hard enough, you can see > that it makes an attempt to generalize the "link up" procedure for all > switch families, via these regs and fields. At the end of that regfield > series, I theoretically converted KSZ8765/KSZ8794/KSZ8795 to reuse > ksz9477_phylink_mac_link_up(). Theoretically because no one commented > on whether the result still worked. > > I think that regfields and that KSZ_WACKY_REG_FIELD_8() are an avenue > worth exploring here. > Looks good, I like the idea with "wacky" registers! Would you prefer that I start working on adapting your patch set to the KSZ8873? Or should I make a review to move forward the existing patch set? Just a heads up, I don't have access to the KSZ87xx series switches, so I won't be able to test the changes on these models. Let me know what you think and how we should proceed. Regards, Oleksij -- Pengutronix e.K. | | Steuerwalder Str. 21 | http://www.pengutronix.de/ | 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |