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=-8.3 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS, USER_AGENT_SANE_1 autolearn=ham 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 07459C433E0 for ; Wed, 20 May 2020 14:45:49 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id DA980207D4 for ; Wed, 20 May 2020 14:45:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726812AbgETOps (ORCPT ); Wed, 20 May 2020 10:45:48 -0400 Received: from mx2.suse.de ([195.135.220.15]:56556 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726510AbgETOpr (ORCPT ); Wed, 20 May 2020 10:45:47 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 4275AAB5C; Wed, 20 May 2020 14:45:48 +0000 (UTC) Received: by lion.mk-sys.cz (Postfix, from userid 1000) id 25BD2604F6; Wed, 20 May 2020 16:45:44 +0200 (CEST) Date: Wed, 20 May 2020 16:45:44 +0200 From: Michal Kubecek To: netdev@vger.kernel.org Cc: Oleksij Rempel , Andrew Lunn , "David S. Miller" , Florian Fainelli , Heiner Kallweit , Jakub Kicinski , Jonathan Corbet , David Jander , kernel@pengutronix.de, linux-kernel@vger.kernel.org, Russell King , mkl@pengutronix.de, Marek Vasut , Christian Herber Subject: Re: [PATCH net-next v3 1/2] ethtool: provide UAPI for PHY Signal Quality Index (SQI) Message-ID: <20200520144544.GB8771@lion.mk-sys.cz> References: <20200520062915.29493-1-o.rempel@pengutronix.de> <20200520062915.29493-2-o.rempel@pengutronix.de> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="cvVnyQ+4j833TQvp" Content-Disposition: inline In-Reply-To: <20200520062915.29493-2-o.rempel@pengutronix.de> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --cvVnyQ+4j833TQvp Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Wed, May 20, 2020 at 08:29:14AM +0200, Oleksij Rempel wrote: > Signal Quality Index is a mandatory value required by "OPEN Alliance > SIG" for the 100Base-T1 PHYs [1]. This indicator can be used for cable > integrity diagnostic and investigating other noise sources and > implement by at least two vendors: NXP[2] and TI[3]. >=20 > [1] http://www.opensig.org/download/document/218/Advanced_PHY_features_fo= r_automotive_Ethernet_V1.0.pdf > [2] https://www.nxp.com/docs/en/data-sheet/TJA1100.pdf > [3] https://www.ti.com/product/DP83TC811R-Q1 >=20 > Signed-off-by: Oleksij Rempel > --- This looks good to me, there is just one thing I'm not sure about: > diff --git a/include/linux/phy.h b/include/linux/phy.h > index 59344db43fcb1..950ba479754bd 100644 > --- a/include/linux/phy.h > +++ b/include/linux/phy.h > @@ -706,6 +706,8 @@ struct phy_driver { > struct ethtool_tunable *tuna, > const void *data); > int (*set_loopback)(struct phy_device *dev, bool enable); > + int (*get_sqi)(struct phy_device *dev); > + int (*get_sqi_max)(struct phy_device *dev); > }; > #define to_phy_driver(d) container_of(to_mdio_common_driver(d), \ > struct phy_driver, mdiodrv) I'm not sure if it's a good idea to define two separate callbacks. It means adding two pointers instead of one (for every instance of the structure, not only those implementing them), doing two calls, running the same checks twice, locking twice, checking the result twice. Also, passing a structure pointer would mean less code changed if we decide to add more related state values later. What do you think? If you don't agree, I have no objections so Reviewed-by: Michal Kubecek Michal --cvVnyQ+4j833TQvp Content-Type: application/pgp-signature; name="signature.asc" Content-Description: Digital signature -----BEGIN PGP SIGNATURE----- iQEzBAEBCAAdFiEEWN3j3bieVmp26mKO538sG/LRdpUFAl7FQpIACgkQ538sG/LR dpV0dgf9EtLDViFGNOKw6wA8VFfIA2ANEsV19HAMn4YfQZ8pORVhIoJsKw8sAK64 l9xidgkJ+CuzNSzsynX7a1jQc8inPdZ2qNsQwi6f6q/5ndtGoGtieEvMU+4EvlnN J0DehPfI9geLnzz7PjTuCYVbhBryTZoi0+otYDPPS1b1xhKlPdnNBHjnK2bsTrO4 7ysx/iQT4PRhuy8R7+1c3BwHKpq0Ofhk3zFZtrIahQF4dUIcNFSec+Hs5LEb9wwt w96SKsAhwpgUeqMs/+eHHNIbjGQtrM42Kl2oA0MIUqW72rVETsnmlVyZH8gJVwWo mgAqSTHL0MtZKJR0/Guq+4KM1AVKsQ== =uNvL -----END PGP SIGNATURE----- --cvVnyQ+4j833TQvp--