Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp2921896rwd; Fri, 19 May 2023 12:04:33 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ54IEP9St0dMLAaso4+iWPl1F2MIT9ShUQPBzK+3YHZ3DnST2nh7HdHYMzzTsUC108fR+wS X-Received: by 2002:a05:6a20:1587:b0:104:d82a:63c5 with SMTP id h7-20020a056a20158700b00104d82a63c5mr3229060pzj.53.1684523073181; Fri, 19 May 2023 12:04:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1684523073; cv=none; d=google.com; s=arc-20160816; b=YEQJECZgHom/qtWfNMb3nr43XcPpRvpaWBwqnceN19BF/FrXE+hA0Y3GPcxvZopfLy aWV9I1RWKNj92LIJgGkAA9njS2CrVuKNJhh3vu8HJSePFecwVFwjrLhPscv7m5PNsXJT /gevEVGZmaZxCOMmJ0m2Mi2de/zJqxPAtgiEk0SqvbROJWTxwHrekYQTOm999NhNvHRZ F5kFA04cCNjK/vt1vDa/pSvqieIp8EnaxK79H1MJcPxGf0xO+PEaTDr5bEWmO91+lhrz d6+zWnkdV9wOqsE5MbgxhpcGBetElfftMVk11OubHF4Pt4/tXYyAkiDiVGp+xhIIEli1 7RBw== 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=xj0jrIpZUwDsBiVmWUFjDzSiVXk+0nRC5RjNUKHLdVg=; b=o2LCvnzqIGDKiOBdLlkS4y7YVX8p6GQrGau63tN7fs806Vhga5mxo/KEiuOnxa3Wjq PErZKlai76ZxPA2umSsrosWeqG1mU/nt1JLGNz1867A8KtBjRXHRyBl+XoVG0BzRPtw8 6IT4lbQo3ZUqWSZbmAzst9mZLif7Aw0zkbzhrvLuBiQd8Q4AgPmg4/WqQ7rjICPbM9Fl IUA+XBv+Vqm9F3XlloX6OsNYeqTQFd5GIGAJZMb4ja6p2fSc71488CBHgEEjiDa509NJ K9ONqQDro1M5s6hHM01VozL4rdZcpDvPdKGeff61orADZe47rGMkhkxXH6rJy8x3+G9q jIMA== 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 a26-20020aa795ba000000b0064399c05a12si61615pfk.232.2023.05.19.12.04.19; Fri, 19 May 2023 12:04:33 -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 S229875AbjESSuw (ORCPT + 99 others); Fri, 19 May 2023 14:50:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46002 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229877AbjESSuu (ORCPT ); Fri, 19 May 2023 14:50:50 -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 E7DF1E72 for ; Fri, 19 May 2023 11:50:30 -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 1q05BC-0000rT-Ex; Fri, 19 May 2023 20:50:18 +0200 Received: from ore by ptx.hi.pengutronix.de with local (Exim 4.92) (envelope-from ) id 1q05B9-00025q-TE; Fri, 19 May 2023 20:50:15 +0200 Date: Fri, 19 May 2023 20:50:15 +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, UNGLinuxDriver@microchip.com, Eric Dumazet , kernel@pengutronix.de, netdev@vger.kernel.org, Jakub Kicinski , Paolo Abeni , "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: <20230519185015.GA18246@pengutronix.de> References: <20230519124700.635041-1-o.rempel@pengutronix.de> <20230519124700.635041-2-o.rempel@pengutronix.de> <20230519143004.luvz73jiyvnqxk4y@skbuf> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20230519143004.luvz73jiyvnqxk4y@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,URIBL_BLOCKED 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 Hi Vladimir, On Fri, May 19, 2023 at 05:30:04PM +0300, Vladimir Oltean wrote: > On Fri, May 19, 2023 at 02:46:59PM +0200, Oleksij Rempel wrote: > > +void ksz8_phylink_mac_link_up(struct ksz_device *dev, int port, > > + unsigned int mode, phy_interface_t interface, > > + struct phy_device *phydev, int speed, int duplex, > > + bool tx_pause, bool rx_pause) > > +{ > > + /* If the port is the CPU port, apply special handling. Only the CPU > > + * port is configured via global registers. > > + */ > > + if (dev->cpu_port == port) > > + ksz8_cpu_port_link_up(dev, speed, duplex, tx_pause, rx_pause); > > +} > > I'm sorry, but this is also baking in assumptions related to the > topology of the tree (that the xMII port is used as a CPU port). > The ksz8 driver may make this assumption in other places too, > but I don't want to make it even worse to fix. Is the > !dev->info->internal_phy[port] condition not enough here? 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. 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. 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 |