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 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 smtp.lore.kernel.org (Postfix) with ESMTPS id 77E8CEE645F for ; Thu, 12 Sep 2024 08:19:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: Content-Type:MIME-Version:References:In-Reply-To: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-Owner; bh=IJZp6x9VX7axuaNfrvvZ3iXuDDQ2g5dIWMn+g8OKNvw=; b=Y2/uXdqJ6RZF65D+xKxCVt9HKt 9VlRvV1170oOQ1+YxJK4D2EH0ymw42DBRUqhx/AarfbPTNvrV2msHdDwqX8DHGdHMCOxSHgFGJZ2Z TualWLbu7BQP357gpsMpzQSHMcLtxxLXA4IsewmC7udC3jsXe7zd6umn+72/Gjjzkqz3QVxzPhOU7 KPRq6DtnShxvq1NRBo1zmrOgEQ5iyHH7xapfrDhyPcB4sPLYQK6wxD8xIh1YrfLAYq9c4zlw5Wghe Q9ab+ix/feGKcYtalWgX4G9lOsTfNtH+pTzUC55IoaO/8CXR20oIyL/qow87DmiF0RPeauILnKDD7 fg/fKEXA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sof3B-0000000CLqO-0ALw; Thu, 12 Sep 2024 08:19:37 +0000 Received: from relay6-d.mail.gandi.net ([2001:4b98:dc4:8::226]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sof18-0000000CKnG-222Y for linux-arm-kernel@lists.infradead.org; Thu, 12 Sep 2024 08:17:33 +0000 Received: by mail.gandi.net (Postfix) with ESMTPSA id 882A3C000F; Thu, 12 Sep 2024 08:17:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1726129047; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=IJZp6x9VX7axuaNfrvvZ3iXuDDQ2g5dIWMn+g8OKNvw=; b=NFBW+g2VuFofFDN1sfjx90QeR7elqq/RJfMmaiO4AGUuxz/GnPBoaebA89+zIkI512P2G3 hJ5g31chcW+FPgUZ/Stt1Cw2iVD38Z82KteGl0/FgZSIaCWlYj6iX/nEpLvIjXJ6F6zV1X wf+gkkus0DpYuwhYoBXBICquhPzzM96WMXkIsFf6me3yI6sTdcghoRYtX0Az+vqR8SNGqI Why50E6xie2Shp3XQn/Z9g7T0ovTomuUaTKyFQtRYe7qamjhAIYagxX87ks5PpgqyGM0Z+ 9tD7GWXLdVZ/Gxk8GtnVbc13CnzdS9s3DeB4MlsBB/j+6/pRL8x6R65K+GLJkw== Date: Thu, 12 Sep 2024 10:17:24 +0200 From: Maxime Chevallier To: Oleksij Rempel Cc: davem@davemloft.net, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, thomas.petazzoni@bootlin.com, Andrew Lunn , Jakub Kicinski , Eric Dumazet , Paolo Abeni , Russell King , linux-arm-kernel@lists.infradead.org, Christophe Leroy , Herve Codina , Florian Fainelli , Heiner Kallweit , Vladimir Oltean , Marek =?UTF-8?B?QmVow7pu?= , =?UTF-8?B?S8O2cnk=?= Maincent Subject: Re: [PATCH net-next 5/7] net: phy: introduce ethtool_phy_ops to get and set phy configuration Message-ID: <20240912101724.6233b1e4@fedora.home> In-Reply-To: References: <20240911212713.2178943-1-maxime.chevallier@bootlin.com> <20240911212713.2178943-6-maxime.chevallier@bootlin.com> Organization: Bootlin X-Mailer: Claws Mail 4.3.0 (GTK 3.24.43; x86_64-redhat-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-GND-Sasl: maxime.chevallier@bootlin.com X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240912_011731_341159_5ECE7DB0 X-CRM114-Status: GOOD ( 19.85 ) 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: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Hello Oleksij, On Thu, 12 Sep 2024 06:46:29 +0200 Oleksij Rempel wrote: > Hi Maxime, > > On Wed, Sep 11, 2024 at 11:27:09PM +0200, Maxime Chevallier wrote: > ... > > > > +/** > > + * struct phy_device_config - General PHY device configuration parameters for > > + * status reporting and bulk configuration > > + * > > + * A structure containing generic PHY device information, allowing to expose > > + * internal status to userspace, and perform PHY configuration in a controlled > > + * manner. > > + * > > + * @isolate: The MII-side isolation status of the PHY > > + * @loopback: The loopback state of the PHY > > + */ > > +struct phy_device_config { > > + bool isolate; > > + bool loopback; > > +}; > > I would recommend to have loopback enum. There are different levels of > loopback: > https://www.ti.com/document-viewer/DP83TD510E/datasheet#GUID-50834313-DEF1-42FB-BA00-9B0902B2D7E4/TITLE-SNLS656SNLS5055224 > > I imagine something like this: > > /* > * enum phy_loopback_mode - PHY loopback modes > * These modes represent different loopback configurations to > * facilitate in-circuit testing of the PHY's digital and analog paths. > */ > enum phy_loopback_mode { > PHY_LOOPBACK_NONE = 0, /* No loopback mode enabled */ > PHY_LOOPBACK_MII, /* MII Loopback: MAC to PHY internal loopback */ > PHY_LOOPBACK_PCS, /* PCS Loopback: PCS layer loopback, no signal processing */ > PHY_LOOPBACK_DIGITAL, /* Digital Loopback: Loops back entire digital TX/RX path */ > PHY_LOOPBACK_ANALOG, /* Analog Loopback: Loops back after analog front-end */ > PHY_LOOPBACK_FAR_END /* Far-End (Reverse) Loopback: Receiver to MAC interface loopback */ > }; I agree with you on that, having the ability to fine-tune where the loopback happens is really useful for debug. The main problem I would see is to come-up with a set of modes that are somewhat generic, as vendors implement a wide variety of loopback modes. For example, on BaseT4 PHYs the Analog loopback doesn't exist and is more akin to using a loopback stub, whereas the Digital loopback would be a loopback at the PMD level (I don't know if that even exists). That being said, the list of possible places to setup the loopback within a PHY is finite and it's conceivable to come-up with a set of loopback modes. Thanks a lot for the feedback, Maxime