Received: by 2002:a5d:9c59:0:0:0:0:0 with SMTP id 25csp451130iof; Mon, 6 Jun 2022 06:40:35 -0700 (PDT) X-Google-Smtp-Source: ABdhPJytUKZexEkyaRfYMnuIKhtpKKjfFs6VlY3TyqLeLI6H1cheL6SC9AQT1cwTdeGWmIQIGDEV X-Received: by 2002:a17:902:6a85:b0:163:d764:e1a9 with SMTP id n5-20020a1709026a8500b00163d764e1a9mr24531012plk.50.1654522835537; Mon, 06 Jun 2022 06:40:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1654522835; cv=none; d=google.com; s=arc-20160816; b=bex7LEU+0GTBS5MDROz7ClcKWjgXn0DWlXBVTPWplY2fQLm5O9YbZhj/CK9u70AiXO lcYoeZcK3iyqNz5KA5o6PYF0d9/3GBUTjGQIFy5XnR0IZc5fn6It7hEreF1ZDyrNBRF2 /6EsAnEIHXfHlCAnPf2GSiK893xDjAVLx4E4y+nyjT2skPgz8NLWegzkQGfojmHfxkYY A5ygfT8i2VP3Y911XkSS2eIuWtpBOOkzFjPHKwj8y5uKdDV1rpk7ycSbcgBolHHpFhk+ RLM9NmzNvKLCqZolZWEyqr6+8AGm7irWJKtcGg14PLqdicRisxWf3I9LkrsUznY51tGY jq0Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=O73kJ0AnT0Z8YM1gj4D+7aWy/bjgMjU/TGjAUbj6GKc=; b=tas6yCggwKbr9rQa/dzacqmpbleAbNMugd/79wvAgZOS3q89QT177Un1YZKkkvUKY+ aaUqptZs6GCxKXZVfj1DJUGxtJtPFRJ+86J5N1DtKKSB6n2sQDdJc697isHoYnWj1h05 oK0U2GR/TA+w2iycGIZUv2xSATQ75aGoPPAdvMWAS/e1AdQeBFn+BeUb7XfvI82sB5H7 bneaKKpPF6JCuklunw4zcr4aiuYPjcncmryQ0mS0Y/tsacEzCV0/uYt8lWT4zx9c4rda NX1zTI+tV+OOLn6YKdUvTMqqzf5SQfBAbKolk1FFHPkAf8jPq/n6m6HAE0kQnnUKRgPh 3Rfw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail (test mode) header.i=@armlinux.org.uk header.s=pandora-2019 header.b=fLcLgNpZ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=armlinux.org.uk Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id i2-20020a1709026ac200b0016786f5a76esi2032648plt.476.2022.06.06.06.40.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 06 Jun 2022 06:40:35 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=fail (test mode) header.i=@armlinux.org.uk header.s=pandora-2019 header.b=fLcLgNpZ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=armlinux.org.uk Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 83DF119A738; Mon, 6 Jun 2022 06:31:41 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238913AbiFFNbc (ORCPT + 99 others); Mon, 6 Jun 2022 09:31:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53946 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238867AbiFFNbb (ORCPT ); Mon, 6 Jun 2022 09:31:31 -0400 Received: from pandora.armlinux.org.uk (pandora.armlinux.org.uk [IPv6:2001:4d48:ad52:32c8:5054:ff:fe00:142]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E31C1190D35; Mon, 6 Jun 2022 06:31:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=armlinux.org.uk; s=pandora-2019; h=Sender:In-Reply-To: Content-Transfer-Encoding:Content-Type:MIME-Version:References:Message-ID: Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=O73kJ0AnT0Z8YM1gj4D+7aWy/bjgMjU/TGjAUbj6GKc=; b=fLcLgNpZBH/ZmSSttDHtE2xOyx 2zhUSgJ1gMLo390BgcwFMa5B0tTZk5xfQxiCOfHBqc63JOjPuLNrxsOsTuI6/XiukLP13lVQZREz9 Or1ub9HFXZeNI0axgKRLqbp4wD1ECZMxQB1PIPVqQZBjQ/oqk5iZ1ELT8MX2qvM7raBrBH6NmGUbU 5ex+rEEbWy3NBlu7eMLQ2lIlY15A5wN3d1SnxHoxge+idOXDrjLvjfxVhzBvJNhbR62cEp/X+5U25 QTE7yt8Dh8vA7kEB+vP/PHacclrWLHNFc41gguNvQrQ6TNSxHdJy47RtTUyiA6LImlduNe5YPAz1p BLzEQbIw==; Received: from shell.armlinux.org.uk ([fd8f:7570:feb6:1:5054:ff:fe00:4ec]:60970) by pandora.armlinux.org.uk with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1nyCpD-00023V-Ku; Mon, 06 Jun 2022 14:31:19 +0100 Received: from linux by shell.armlinux.org.uk with local (Exim 4.94.2) (envelope-from ) id 1nyCpA-0008GJ-Me; Mon, 06 Jun 2022 14:31:16 +0100 Date: Mon, 6 Jun 2022 14:31:16 +0100 From: "Russell King (Oracle)" To: Alvin =?utf-8?Q?=C5=A0ipraga?= Cc: luizluca@gmail.com, Linus Walleij , Alvin =?utf-8?Q?=C5=A0ipraga?= , Andrew Lunn , Vivien Didelot , Florian Fainelli , Vladimir Oltean , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH net] net: dsa: realtek: rtl8365mb: fix GMII caps for ports with internal PHY Message-ID: References: <20220606130130.2894410-1-alvin@pqrs.dk> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20220606130130.2894410-1-alvin@pqrs.dk> Sender: Russell King (Oracle) X-Spam-Status: No, score=-1.7 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RDNS_NONE, SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no 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 Mon, Jun 06, 2022 at 03:01:30PM +0200, Alvin Šipraga wrote: > From: Alvin Šipraga > > phylib defaults to GMII when no phy-mode or phy-connection-type property > is specified in a DSA port node. > > Commit a5dba0f207e5 ("net: dsa: rtl8365mb: add GMII as user port mode") > introduced implicit support for GMII mode on ports with internal PHY to > allow a PHY connection for device trees where the phy-mode is not > explicitly set to "internal". > > Commit 6ff6064605e9 ("net: dsa: realtek: convert to phylink_generic_validate()") > then broke this behaviour by discarding the usage of > rtl8365mb_phy_mode_supported() - where this GMII support was indicated - > while switching to the new .phylink_get_caps API. > > With the new API, rtl8365mb_phy_mode_supported() is no longer needed. > Remove it altogether and add back the GMII capability - this time to > rtl8365mb_phylink_get_caps() - so that the above default behaviour works > for ports with internal PHY again. Oops - I guess this has been caused by the delay between my patch being initially prepared, it sitting around in my tree for many months while other patches get merged, and it eventually seeing the light of day. Sorry about that. > Fixes: 6ff6064605e9 ("net: dsa: realtek: convert to phylink_generic_validate()") > Signed-off-by: Alvin Šipraga > --- > > Luiz, Russel: > > Commit a5dba0f207e5 ought to have had a Fixes: tag I think, because it > claims to have been fixing a regression in the net-next tree - is that > right? I seem to have missed both referenced commits when they were > posted and never hit this issue personally. I only found things now > during some other refactoring and the test for GMII looked weird to me > so I went and investigated. > > Could you please help me identify that Fixes: tag? Just for my own > understanding of what caused this added requirement for GMII on ports > with internal PHY. I have absolutely no idea. I don't think any "requirement" has ever been added - phylib has always defaulted to GMII, so as the driver stood when it was first submitted on Oct 18 2021, I don't see how it could have worked, unless the DT it was being tested with specified a phy-mode of "internal". As you were the one who submitted it, you would have a better idea. The only suggestion I have is to bisect to find out exactly what caused the GMII vs INTERNAL issue to crop up. > > --- > drivers/net/dsa/realtek/rtl8365mb.c | 38 +++++++---------------------- > 1 file changed, 9 insertions(+), 29 deletions(-) > > diff --git a/drivers/net/dsa/realtek/rtl8365mb.c b/drivers/net/dsa/realtek/rtl8365mb.c > index 3bb42a9f236d..769f672e9128 100644 > --- a/drivers/net/dsa/realtek/rtl8365mb.c > +++ b/drivers/net/dsa/realtek/rtl8365mb.c > @@ -955,35 +955,21 @@ static int rtl8365mb_ext_config_forcemode(struct realtek_priv *priv, int port, > return 0; > } > > -static bool rtl8365mb_phy_mode_supported(struct dsa_switch *ds, int port, > - phy_interface_t interface) > -{ > - int ext_int; > - > - ext_int = rtl8365mb_extint_port_map[port]; > - > - if (ext_int < 0 && > - (interface == PHY_INTERFACE_MODE_NA || > - interface == PHY_INTERFACE_MODE_INTERNAL || > - interface == PHY_INTERFACE_MODE_GMII)) > - /* Internal PHY */ > - return true; > - else if ((ext_int >= 1) && > - phy_interface_mode_is_rgmii(interface)) > - /* Extension MAC */ > - return true; > - > - return false; > -} > - > static void rtl8365mb_phylink_get_caps(struct dsa_switch *ds, int port, > struct phylink_config *config) > { > - if (dsa_is_user_port(ds, port)) > + if (dsa_is_user_port(ds, port)) { Given the updates to rtl8365mb_phy_mode_supported(), this misses out on the check of rtl8365mb_extint_port_map[port] introduced in commit 6147631c079f ("net: dsa: realtek: rtl8365mb: allow non-cpu extint ports"). > __set_bit(PHY_INTERFACE_MODE_INTERNAL, > config->supported_interfaces); > - else if (dsa_is_cpu_port(ds, port)) > + > + /* GMII is the default interface mode for phylib, so > + * we have to support it for ports with integrated PHY. > + */ > + __set_bit(PHY_INTERFACE_MODE_GMII, > + config->supported_interfaces); > + } else if (dsa_is_cpu_port(ds, port)) { This test also needs to be updated. Not sure what rtl8365mb_extint_port_map[port] == 0 is supposed to signify - maybe port unusable? Looks that way to me. > phy_interface_set_rgmii(config->supported_interfaces); > + } > > config->mac_capabilities = MAC_SYM_PAUSE | MAC_ASYM_PAUSE | > MAC_10 | MAC_100 | MAC_1000FD; > @@ -996,12 +982,6 @@ static void rtl8365mb_phylink_mac_config(struct dsa_switch *ds, int port, > struct realtek_priv *priv = ds->priv; > int ret; > > - if (!rtl8365mb_phy_mode_supported(ds, port, state->interface)) { > - dev_err(priv->dev, "phy mode %s is unsupported on port %d\n", > - phy_modes(state->interface), port); > - return; > - } > - > if (mode != MLO_AN_PHY && mode != MLO_AN_FIXED) { > dev_err(priv->dev, > "port %d supports only conventional PHY or fixed-link\n", > -- > 2.36.0 > > -- RMK's Patch system: https://www.armlinux.org.uk/developer/patches/ FTTP is here! 40Mbps down 10Mbps up. Decent connectivity at last!