From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-3.6 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id CEF28C47082 for ; Mon, 7 Jun 2021 12:45:09 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id BB3186108C for ; Mon, 7 Jun 2021 12:45:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230198AbhFGMq7 (ORCPT ); Mon, 7 Jun 2021 08:46:59 -0400 Received: from esa.microchip.iphmx.com ([68.232.153.233]:12121 "EHLO esa.microchip.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230444AbhFGMq6 (ORCPT ); Mon, 7 Jun 2021 08:46:58 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1623069907; x=1654605907; h=message-id:subject:from:to:cc:date:in-reply-to: references:mime-version:content-transfer-encoding; bh=ldICpVmPM5K8n+s7DsP2mONAmSrUKBI+7+MXhYW78c4=; b=EnV0+W0TnICFmbbAC4uwQusqsTaOcjPIiTJV0cYWp6ov3bCLwvRrs1DL LyjxhssJKd74d6h5HOG47nQHLw92gp6S/570v5AxIwbBjk/Motix1SFCx kqkcuD4XHIvaGWV+v2An+kfRmtW03rbxq0Au3a1cFmNstwMwEe1WxxkvT ULbXyJqh6DDIQDx+0H/fiMnNj2W/a5kva1v7g1scFA8Vvh2u4oOAofMxk 1ztjwUr1XVGVgq2Vaf0R5t13Av2kUfVib5oMyAC4SxRCjZu4ZsHrXuT9T h/ofsS9NtreNKSHjZcrcWIfp/lxr7NPg9K1nHcQlT0mmHi4phw1+r/WVM g==; IronPort-SDR: oZj/ute6IR9BD00CRNIddzFl/huqlMOXHab8fwEw3FFzmx7AcCqtQFqdqMeGCXzNIvCiUekbQO q4KyHX1EnzYSKteT08iDKqB5qfYpnjso6wJV5yJ+iGxv3BV+gvuRmjkkNwr/U2vnvbIKLzV4Sv RxWKzJCmxzW9FGkqMuO+0CFVmVnVfq/U1O/562rnVBZBU94p/LfFgbrotlEQU38yFuR2ikQUIP j7i0QcjEVifSAfFZukgEzDpF+xuSl9eUzyS5ylUxfL+2QXtpBFbzZnqNQThr4J0uFPykkxV3GZ Pww= X-IronPort-AV: E=Sophos;i="5.83,255,1616482800"; d="scan'208";a="123779583" Received: from smtpout.microchip.com (HELO email.microchip.com) ([198.175.253.82]) by esa5.microchip.iphmx.com with ESMTP/TLS/AES256-SHA256; 07 Jun 2021 05:45:06 -0700 Received: from chn-vm-ex01.mchp-main.com (10.10.85.143) by chn-vm-ex03.mchp-main.com (10.10.85.151) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2176.2; Mon, 7 Jun 2021 05:45:05 -0700 Received: from den-her-m31857h.microchip.com (10.10.115.15) by chn-vm-ex01.mchp-main.com (10.10.85.143) with Microsoft SMTP Server id 15.1.2176.2 via Frontend Transport; Mon, 7 Jun 2021 05:45:02 -0700 Message-ID: <9f4fad323e17c8ba6ebde728fcc99c87dd06fc75.camel@microchip.com> Subject: Re: [PATCH net-next v3 03/10] net: sparx5: add hostmode with phylink support From: Steen Hegelund To: "Russell King (Oracle)" CC: "David S. Miller" , Jakub Kicinski , Andrew Lunn , Microchip Linux Driver Support , Alexandre Belloni , Madalin Bucur , Mark Einon , Masahiro Yamada , Arnd Bergmann , Philipp Zabel , "Simon Horman" , , , , Bjarni Jonasson , Lars Povlsen Date: Mon, 7 Jun 2021 14:45:01 +0200 In-Reply-To: <20210607091536.GA30436@shell.armlinux.org.uk> References: <20210604085600.3014532-1-steen.hegelund@microchip.com> <20210604085600.3014532-4-steen.hegelund@microchip.com> <20210607091536.GA30436@shell.armlinux.org.uk> Content-Type: text/plain; charset="UTF-8" User-Agent: Evolution 3.36.5-0ubuntu1 MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Russell, Thanks for your comments. On Mon, 2021-06-07 at 10:15 +0100, Russell King (Oracle) wrote: > EXTERNAL EMAIL: Do not click links or open attachments unless you know the content is safe > > On Fri, Jun 04, 2021 at 10:55:53AM +0200, Steen Hegelund wrote: > > +static void sparx5_phylink_mac_config(struct phylink_config *config, > > + unsigned int mode, > > + const struct phylink_link_state *state) > > +{ > > + struct sparx5_port *port = netdev_priv(to_net_dev(config->dev)); > > + struct sparx5_port_config conf; > > + > > + conf = port->conf; > > + conf.power_down = false; > > + conf.portmode = state->interface; > > + conf.speed = state->speed; > > + conf.autoneg = state->an_enabled; > > + conf.pause = state->pause; > > + > > + if (state->interface == PHY_INTERFACE_MODE_10GBASER) { > > + if (state->speed == SPEED_UNKNOWN) { > > + /* When a SFP is plugged in we use capabilities to > > + * default to the highest supported speed > > + */ > > + if (phylink_test(state->advertising, 25000baseSR_Full) || > > + phylink_test(state->advertising, 25000baseCR_Full)) > > + conf.speed = SPEED_25000; > > + else if (state->interface == PHY_INTERFACE_MODE_10GBASER) > > + conf.speed = SPEED_10000; > > + } else if (state->speed == SPEED_2500) { > > + conf.portmode = PHY_INTERFACE_MODE_2500BASEX; > > + } else if (state->speed == SPEED_1000) { > > + conf.portmode = PHY_INTERFACE_MODE_1000BASEX; > > + } > > 1) As detailed in the documentation for phylink, state->speed is not > guaranteed to be valid in the mac_config method. OK. I will assume speed is not known in this callback. > 2) We clearly need PHY_INTERFACE_MODE_25GBASER rather than working > around this by testing bits in the advertising bitmap. Yes that would be a very useful addition. Should I add PHY_INTERFACE_MODE_25GBASER in this series or should that be added as a separate series? > > 3) I really don't get what's going on with setting the port mode to > 2500base-X and 1000base-X here when state->interface is 10GBASER. The high speed interfaces (> 2.5G) do not support any in-band signalling, so the only way that e.g a 10G interface running at 2.5G will be able to link up with its partner is if both ends configure the speed manually via ethtool. > > > + if (phylink_test(state->advertising, FIBRE)) > > + conf.media = PHY_MEDIA_SR; > > + else > > + conf.media = PHY_MEDIA_DAC; > > + } > > + > > + if (!port_conf_has_changed(&port->conf, &conf)) > > + return; > > +} > > + > > +static void sparx5_phylink_mac_link_up(struct phylink_config *config, > > + struct phy_device *phy, > > + unsigned int mode, > > + phy_interface_t interface, > > + int speed, int duplex, > > + bool tx_pause, bool rx_pause) > > +{ > > This is the only place that the MAC is guaranteed to know the > negotiated speed. OK. > > -- > RMK's Patch system: https://www.armlinux.org.uk/developer/patches/ > FTTP is here! 40Mbps down 10Mbps up. Decent connectivity at last! -- BR Steen -=-=-=-=-=-=-=-=-=-=-=-=-=-= steen.hegelund@microchip.com From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.0 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 09315C47082 for ; Mon, 7 Jun 2021 13:01:57 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id B801960FDA for ; Mon, 7 Jun 2021 13:01:56 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org B801960FDA Authentication-Results: mail.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=microchip.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Date:CC:To:From:Subject:Message-ID:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=rGLjOVuqqm4MCgvcxitPYswGyzU2Z/X4cV5sWZIblQ8=; b=t8Pv2EtV5aT0Vz C6VXFCTjdjB3Aj79GEnv21FrIsV9meTQi0tU061TChGWqbAv6tqekksPNRlJB/5HdgKvP8HZ8SEFT 4v6d0cofvpAN6QCcykmTjwAr0IRPa5GNf18cp94u4U17tU7hUh3Bq+cMJAJHRdAFsC1x9kzYOsik0 cX6WIyQestMJB993z/fgc07tG51SDZJe28fAOv4U+xOAUneDbGudgeYyx1+McLW83rPbFdadhUbGa vtOF8dZKshPMMx+dF0rW3a/xuX5QXKBBRxHTs0s2iiqjrnFvh/5jUcWNYiKRUVlzUjnK8lKAg1V9X Xcjvtiu+gQJznMm+6JTQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1lqEqe-003eSQ-HB; Mon, 07 Jun 2021 12:59:22 +0000 Received: from esa.microchip.iphmx.com ([68.232.153.233]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1lqEcu-003a00-12 for linux-arm-kernel@lists.infradead.org; Mon, 07 Jun 2021 12:45:12 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1623069908; x=1654605908; h=message-id:subject:from:to:cc:date:in-reply-to: references:mime-version:content-transfer-encoding; bh=ldICpVmPM5K8n+s7DsP2mONAmSrUKBI+7+MXhYW78c4=; b=jTUPsmRLCJH12/fLes4bL3fYv70JviQpJws9OWLgLimLQfAVi9odq5Np UzYxzAtchvVy0kaDlBJAuFSovAE1IKm+Axkr/y2x8O1f6d+xp3CbIV5dg C0ffuFuxv+dOKynMJYFUey4tjrdqkT1zMkfmQxRhoipuBmD0Jq/bnGhs+ 1HbZBpzhAaY16hIbAqJcxQ6iydEzpCBbsOy3x5Z8p3LvlS+E7VzRHdnQE qrury9RvuyHUh+3ZSlHPFAZoP5Xeq8VdwSltExOXx81S+ksMOx7837DUK HBhdnt9piGQNXKGSGJD9zPU7kfrWmgvN4E5WnMfCJCCgYxWZ3pDmzp9L0 Q==; IronPort-SDR: oZj/ute6IR9BD00CRNIddzFl/huqlMOXHab8fwEw3FFzmx7AcCqtQFqdqMeGCXzNIvCiUekbQO q4KyHX1EnzYSKteT08iDKqB5qfYpnjso6wJV5yJ+iGxv3BV+gvuRmjkkNwr/U2vnvbIKLzV4Sv RxWKzJCmxzW9FGkqMuO+0CFVmVnVfq/U1O/562rnVBZBU94p/LfFgbrotlEQU38yFuR2ikQUIP j7i0QcjEVifSAfFZukgEzDpF+xuSl9eUzyS5ylUxfL+2QXtpBFbzZnqNQThr4J0uFPykkxV3GZ Pww= X-IronPort-AV: E=Sophos;i="5.83,255,1616482800"; d="scan'208";a="123779583" Received: from smtpout.microchip.com (HELO email.microchip.com) ([198.175.253.82]) by esa5.microchip.iphmx.com with ESMTP/TLS/AES256-SHA256; 07 Jun 2021 05:45:06 -0700 Received: from chn-vm-ex01.mchp-main.com (10.10.85.143) by chn-vm-ex03.mchp-main.com (10.10.85.151) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2176.2; Mon, 7 Jun 2021 05:45:05 -0700 Received: from den-her-m31857h.microchip.com (10.10.115.15) by chn-vm-ex01.mchp-main.com (10.10.85.143) with Microsoft SMTP Server id 15.1.2176.2 via Frontend Transport; Mon, 7 Jun 2021 05:45:02 -0700 Message-ID: <9f4fad323e17c8ba6ebde728fcc99c87dd06fc75.camel@microchip.com> Subject: Re: [PATCH net-next v3 03/10] net: sparx5: add hostmode with phylink support From: Steen Hegelund To: "Russell King (Oracle)" CC: "David S. Miller" , Jakub Kicinski , Andrew Lunn , Microchip Linux Driver Support , Alexandre Belloni , Madalin Bucur , Mark Einon , Masahiro Yamada , Arnd Bergmann , Philipp Zabel , "Simon Horman" , , , , Bjarni Jonasson , Lars Povlsen Date: Mon, 7 Jun 2021 14:45:01 +0200 In-Reply-To: <20210607091536.GA30436@shell.armlinux.org.uk> References: <20210604085600.3014532-1-steen.hegelund@microchip.com> <20210604085600.3014532-4-steen.hegelund@microchip.com> <20210607091536.GA30436@shell.armlinux.org.uk> User-Agent: Evolution 3.36.5-0ubuntu1 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210607_054508_207359_F59C69BF X-CRM114-Status: GOOD ( 24.97 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Hi Russell, Thanks for your comments. On Mon, 2021-06-07 at 10:15 +0100, Russell King (Oracle) wrote: > EXTERNAL EMAIL: Do not click links or open attachments unless you know the content is safe > > On Fri, Jun 04, 2021 at 10:55:53AM +0200, Steen Hegelund wrote: > > +static void sparx5_phylink_mac_config(struct phylink_config *config, > > + unsigned int mode, > > + const struct phylink_link_state *state) > > +{ > > + struct sparx5_port *port = netdev_priv(to_net_dev(config->dev)); > > + struct sparx5_port_config conf; > > + > > + conf = port->conf; > > + conf.power_down = false; > > + conf.portmode = state->interface; > > + conf.speed = state->speed; > > + conf.autoneg = state->an_enabled; > > + conf.pause = state->pause; > > + > > + if (state->interface == PHY_INTERFACE_MODE_10GBASER) { > > + if (state->speed == SPEED_UNKNOWN) { > > + /* When a SFP is plugged in we use capabilities to > > + * default to the highest supported speed > > + */ > > + if (phylink_test(state->advertising, 25000baseSR_Full) || > > + phylink_test(state->advertising, 25000baseCR_Full)) > > + conf.speed = SPEED_25000; > > + else if (state->interface == PHY_INTERFACE_MODE_10GBASER) > > + conf.speed = SPEED_10000; > > + } else if (state->speed == SPEED_2500) { > > + conf.portmode = PHY_INTERFACE_MODE_2500BASEX; > > + } else if (state->speed == SPEED_1000) { > > + conf.portmode = PHY_INTERFACE_MODE_1000BASEX; > > + } > > 1) As detailed in the documentation for phylink, state->speed is not > guaranteed to be valid in the mac_config method. OK. I will assume speed is not known in this callback. > 2) We clearly need PHY_INTERFACE_MODE_25GBASER rather than working > around this by testing bits in the advertising bitmap. Yes that would be a very useful addition. Should I add PHY_INTERFACE_MODE_25GBASER in this series or should that be added as a separate series? > > 3) I really don't get what's going on with setting the port mode to > 2500base-X and 1000base-X here when state->interface is 10GBASER. The high speed interfaces (> 2.5G) do not support any in-band signalling, so the only way that e.g a 10G interface running at 2.5G will be able to link up with its partner is if both ends configure the speed manually via ethtool. > > > + if (phylink_test(state->advertising, FIBRE)) > > + conf.media = PHY_MEDIA_SR; > > + else > > + conf.media = PHY_MEDIA_DAC; > > + } > > + > > + if (!port_conf_has_changed(&port->conf, &conf)) > > + return; > > +} > > + > > +static void sparx5_phylink_mac_link_up(struct phylink_config *config, > > + struct phy_device *phy, > > + unsigned int mode, > > + phy_interface_t interface, > > + int speed, int duplex, > > + bool tx_pause, bool rx_pause) > > +{ > > This is the only place that the MAC is guaranteed to know the > negotiated speed. OK. > > -- > RMK's Patch system: https://www.armlinux.org.uk/developer/patches/ > FTTP is here! 40Mbps down 10Mbps up. Decent connectivity at last! -- BR Steen -=-=-=-=-=-=-=-=-=-=-=-=-=-= steen.hegelund@microchip.com _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel