Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp11368254pxu; Thu, 31 Dec 2020 07:31:59 -0800 (PST) X-Google-Smtp-Source: ABdhPJxVtEhHQJRY/HE3VW4o8fqU6/RNhvxtRy3hlYKJ3C3amLOIW0Idgp7nzMvJfVXD9yWuavJA X-Received: by 2002:aa7:d6c9:: with SMTP id x9mr2865805edr.96.1609428719295; Thu, 31 Dec 2020 07:31:59 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1609428719; cv=none; d=google.com; s=arc-20160816; b=PsRorL0i0SBNhx3kBGTanrUvyCwxZtXosFqSOcRL1gUuZW6xUP/ao1tHaavniIO26O 3U39r0OcENldCiDPvKvn88jOh2N0BvOqbzi6bZuhr6v5CCXpj4vpMbwPLQRqtlNyruRI tGAKlHcaiCRBpyoZhNX7WvSjUazF9kIbBXYqyD7q79pq3H7AAYWfOiqjk2kPftH1fOGK IBJHs7Y0tCcoQIrd33RV1eRH2nSDGUpNGJFOJ0NCsWNnCpxt9uvv3AHBpHECFihYYCHb lB+6MzxxIrl4jDOzTL6A13dM5+qVlf4QsMyph6DFOxCc7gUmDieRroinvJ2dF+m/feOB mWqg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=72YJ13WwWx1bFsb3xXRZ5LxJ42BxXxYuTIKEFRAEE5w=; b=g2r2JsN/Ertq3gOyrlwIfvI0+CTCWV74PVfvVjzS0b+zRYhohzzo0uE9EYdWyhJ3cu Sgxw493/YWJ8r4AucCVIaKjwce82cTYd9Cp5Rr7whayCYQynAnbYjm12xKBVM2tXbL2c KU61Ej4O6ZPAJ8TWFOzpzsIeeo0JhiTfK0Pikm95kriFNaKr9GD2hED9Xe0HiXGP8n2f CbeuZH8EthEBEkWFMFZY3/JytkiYqbOMyIurJJFi3rpmEvBjCFIRCR6+SSxAEvRlr5AQ bwy6vgFNtHTV7t0/hu/tPINsiZM3yDI3TzfDbRLl2ckmswGFuRIAPydDgG5vRV2FjOVi Feaw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id t1si21379855ejc.524.2020.12.31.07.31.37; Thu, 31 Dec 2020 07:31:59 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726663AbgLaPbT (ORCPT + 99 others); Thu, 31 Dec 2020 10:31:19 -0500 Received: from vps0.lunn.ch ([185.16.172.187]:45480 "EHLO vps0.lunn.ch" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726080AbgLaPbT (ORCPT ); Thu, 31 Dec 2020 10:31:19 -0500 Received: from andrew by vps0.lunn.ch with local (Exim 4.94) (envelope-from ) id 1kuzuL-00FFji-Bs; Thu, 31 Dec 2020 16:30:33 +0100 Date: Thu, 31 Dec 2020 16:30:33 +0100 From: Andrew Lunn To: Pali =?iso-8859-1?Q?Roh=E1r?= Cc: Russell King - ARM Linux admin , Heiner Kallweit , "David S. Miller" , Jakub Kicinski , Marek =?iso-8859-1?Q?Beh=FAn?= , netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 1/4] net: sfp: add workaround for Realtek RTL8672 and RTL9601C chips Message-ID: References: <20201230154755.14746-1-pali@kernel.org> <20201230154755.14746-2-pali@kernel.org> <20201230161036.GR1551@shell.armlinux.org.uk> <20201230165634.c4ty3mw6djezuyq6@pali> <20201230170546.GU1551@shell.armlinux.org.uk> <20201230174307.lvehswvj5q6c6vk3@pali> <20201230190958.GW1551@shell.armlinux.org.uk> <20201231121410.2xlxtyqjelrlysd2@pali> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20201231121410.2xlxtyqjelrlysd2@pali> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Dec 31, 2020 at 01:14:10PM +0100, Pali Roh?r wrote: > On Wednesday 30 December 2020 19:09:58 Russell King - ARM Linux admin wrote: > > On Wed, Dec 30, 2020 at 06:43:07PM +0100, Pali Roh?r wrote: > > > On Wednesday 30 December 2020 18:13:15 Andrew Lunn wrote: > > > > Hi Pali > > > > > > > > I have to agree with Russell here. I would rather have no diagnostics > > > > than untrustable diagnostics. > > > > > > Ok! > > > > > > So should we completely skip hwmon_device_register_with_info() call > > > if (i2c_block_size < 2) ? > > > > I don't think that alone is sufficient - there's also the matter of > > ethtool -m which will dump that information as well, and we don't want > > to offer it to userspace in an unreliable form. > > Any idea/preference how to disable access to these registers? Page A0, byte 92: "Diagnostic Monitoring Type" is a 1 byte field with 8 single bit indicators describing how diagnostic monitoring is implemented in the particular transceiver. Note that if bit 6, address 92 is set indicating that digital diagnostic monitoring has been implemented, received power monitoring, transmitted power monitoring, bias current monitoring, supply voltage monitoring and temperature monitoring must all be implemented. Additionally, alarm and warning thresholds must be written as specified in this document at locations 00 to 55 on two-wire serial address 1010001X (A2h) (see Table 8-5). Unfortunately, we cannot simply set sfp->id.ext.diagmon to false, because it can also be used to indicate power, software reading of TX_DISABLE, LOS, etc. These are all single bytes, so could be returned correctly, assuming they have been implemented according to the spec. Looking at sfp_module_info(), adding a check for i2c_block_size < 2 when determining what length to return. ethtool should do the right thing, know that the second page has not been returned to user space. Andrew