Received: by 2002:a5d:925a:0:0:0:0:0 with SMTP id e26csp1549553iol; Fri, 10 Jun 2022 09:40:15 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyo4YSrWqOHvuGbCyykQw0foAy19pRRP7uwSd/VoInf+lNhOsqQo6ey0kQAvPPduvhZQHPM X-Received: by 2002:a63:8242:0:b0:3fe:3601:747f with SMTP id w63-20020a638242000000b003fe3601747fmr12749047pgd.314.1654879215403; Fri, 10 Jun 2022 09:40:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1654879215; cv=none; d=google.com; s=arc-20160816; b=Ae3OK73kZXjhytcf8N2Ss19fSQuzzt/O1q3jtpcsgOmWBa0BiKjDeNB/TZKFLWK8LC kFVdpgNDhO/p1bFbXklZmBv8w8Vvoz2IJbWQQvrIQ6igFDkYM/AKPLs9yzTP20a8OdHn MDISWakgXUTvD2ms4kUV3ROWXLeR8uiPKRR7U1tVcPlQEfO/aXRwZi4D1NyzoUMDd08a cH6yv4w6OVIW7asmbiCx6LfsDSwRLMi7S4X3nlQa+BYObT6MDnEdhA7KNXC8pkai3ezy zL/K2LbTCtrK4EYKmlxupaH4zP57VJB66VNGZDTh5sxPXWS1lIahkUHQtCE/94lKiZiv ODgQ== 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=GU5EGVeTqN5+C1jzIs0AK4LYqqFPJgnxg1VAjCLxsuM=; b=MHRxAPms+FKxA1gAzxNlUOEx4uIi+EVk5zsN8ASIfZE8nhsHHJYLpH5/JNmGv6R5zK E7mTZn+CdqZMtPCZj+0ty9/mYFMGiMn4LgC0iuqW9PAqLv+rmtLUQM3bhC09SAyIoFEJ gwZnWNzwWZjE23cCrZYzlDdo9FXI8Bnd84v39lgbiQJbPKzxPu7byUPgT2710ekU9tP7 5KSPwcbNroiO13CyzXjBuqRN1dJuyfOWAFIbq5JT9Yx5G9sQJefnlWpPWJtI7kuy1qZb 8NURc0B+3h+j+MCJYtybxp7NxVhmTdWC57NPi3belVUuIHXbYU6FLZBEZmT44u07eh8l 2rzg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail (test mode) header.i=@armlinux.org.uk header.s=pandora-2019 header.b="VL/CuC9j"; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=armlinux.org.uk Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id 129-20020a630087000000b003fe26a00c53si11721243pga.519.2022.06.10.09.40.03; Fri, 10 Jun 2022 09:40:15 -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; dkim=fail (test mode) header.i=@armlinux.org.uk header.s=pandora-2019 header.b="VL/CuC9j"; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=armlinux.org.uk Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346372AbiFJQhM (ORCPT + 99 others); Fri, 10 Jun 2022 12:37:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42710 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1349369AbiFJQhA (ORCPT ); Fri, 10 Jun 2022 12:37:00 -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 843EA58E61; Fri, 10 Jun 2022 09:36:56 -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=GU5EGVeTqN5+C1jzIs0AK4LYqqFPJgnxg1VAjCLxsuM=; b=VL/CuC9jG/VSJ4pukOpiQLXsjw Duh8E9PDnQpKExZeAOfaEkvppZfvnJMxaGjA+3WIyKE3a5xgByLieyfRz0zTq7AvXaxXcBteTDt82 qmY2aKF1JlbXy0e3/eZ2hufOEk7o/FuoekMOwsbSDvRmT+48gnmKW1GoU2GAOlkXHc2M8wfL+xQMZ XDSU0hW8kSEIPXglFdSKowBLCfnUtRr8esuufnnMB3KhmxdVOMV/hb1+rNdGu886nPwd8I7tW5Ghi lcYzYo7Vn2wXrWfsfWwKXco3nnOZy7L8zdP1/WFYri7F9+CyTLSB2FgRcn+CwqDDXATNsNp5IWXHe WIVw8gZg==; Received: from shell.armlinux.org.uk ([fd8f:7570:feb6:1:5054:ff:fe00:4ec]:32818) 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 1nzhcp-0007ot-DT; Fri, 10 Jun 2022 17:36:43 +0100 Received: from linux by shell.armlinux.org.uk with local (Exim 4.94.2) (envelope-from ) id 1nzhcl-0003oO-Ib; Fri, 10 Jun 2022 17:36:39 +0100 Date: Fri, 10 Jun 2022 17:36:39 +0100 From: "Russell King (Oracle)" To: Alvin =?utf-8?Q?=C5=A0ipraga?= Cc: hauke@hauke-m.de, 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-next v2 5/5] net: dsa: realtek: rtl8365mb: handle PHY interface modes correctly Message-ID: References: <20220610153829.446516-1-alvin@pqrs.dk> <20220610153829.446516-6-alvin@pqrs.dk> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20220610153829.446516-6-alvin@pqrs.dk> Sender: Russell King (Oracle) X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_NONE, 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 On Fri, Jun 10, 2022 at 05:38:29PM +0200, Alvin Šipraga wrote: > Finally, rtl8365mb_phylink_get_caps() is fixed up to return supported > capabilities based on the external interface properties described above. > This allows for ports with an external interface to be treated as DSA > user ports, and for ports with an internal PHY to be treated as DSA CPU > ports. I've needed to read that a few times... and I'm still not sure. You seem to be saying that: - ports with an internal PHY (which presumably provide baseT connections?) are used as DSA CPU ports. - ports with an external interface supporting a range of RGMII, SGMII and HSGMII interface modes are DSA user ports. With Marvell switches, it's the other way around - the ports with an internal PHY are normally DSA user ports. Other ports can be a user, inter-switch or CPU port. So, I'm slightly confused by your description. In any ase, looking at the get_caps() (and only that): > @@ -953,7 +1026,13 @@ static int rtl8365mb_ext_config_forcemode(struct realtek_priv *priv, int port, > static void rtl8365mb_phylink_get_caps(struct dsa_switch *ds, int port, > struct phylink_config *config) > { > - if (dsa_is_user_port(ds, port)) { > + const struct rtl8365mb_extint *extint = > + rtl8365mb_get_port_extint(ds->priv, port); > + > + config->mac_capabilities = MAC_SYM_PAUSE | MAC_ASYM_PAUSE | > + MAC_10 | MAC_100 | MAC_1000FD; MAC capabilities are constant across all interfaces - okay. > + > + if (!extint) { > __set_bit(PHY_INTERFACE_MODE_INTERNAL, > config->supported_interfaces); > > @@ -962,12 +1041,16 @@ static void rtl8365mb_phylink_get_caps(struct dsa_switch *ds, int port, > */ > __set_bit(PHY_INTERFACE_MODE_GMII, > config->supported_interfaces); > - } else if (dsa_is_cpu_port(ds, port)) { > - phy_interface_set_rgmii(config->supported_interfaces); > + return; Internal ports need to support phylib, so both internal and gmii interface modes - okay. > } > > - config->mac_capabilities = MAC_SYM_PAUSE | MAC_ASYM_PAUSE | > - MAC_10 | MAC_100 | MAC_1000FD; > + /* Populate according to the modes supported by _this driver_, > + * not necessarily the modes supported by the hardware, some of > + * which remain unimplemented. > + */ > + > + if (extint->supported_interfaces & RTL8365MB_PHY_INTERFACE_MODE_RGMII) > + phy_interface_set_rgmii(config->supported_interfaces); External ports that support RGMII get all RGMII modes - also okay. So, for the get_cops() function, I'm fine with this new code, and for this alone: Acked-by: Russell King (Oracle) I haven't looked at the remainder of the changes. Thanks. -- RMK's Patch system: https://www.armlinux.org.uk/developer/patches/ FTTP is here! 40Mbps down 10Mbps up. Decent connectivity at last!