Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp11429372pxu; Thu, 31 Dec 2020 09:04:28 -0800 (PST) X-Google-Smtp-Source: ABdhPJyqLs7fq4ztX0+PfA9t+yUXa+j+Da/OlR3QjDowXpXl4OuVOvkIB9mqSbeaREzqS2G7doql X-Received: by 2002:a50:9f4a:: with SMTP id b68mr55342714edf.296.1609434268129; Thu, 31 Dec 2020 09:04:28 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1609434268; cv=none; d=google.com; s=arc-20160816; b=NnX2B+QbPXSgmP7s8tgFt4EVPm5n95LxTZO2AfTFWDFOYaimGw8cW3tpJbwpWbSCzM MfdEmkw6/d/MxSniQ8kQjVL7CPr8iMb9xE6YrrRr46Juag12zll06Tlb9FiNKbklIwGG HbCzSEnrDtmyUJgfRP0fsiQlSFbTkKlesGPFPsEu9A//l/TH2ykArIgrJN2HM9EhFX7t M/vkrGxbe2Ei+xUM28PAUP9Rxak5dPgOz7uB4HzRf4n65sIEIaLlwD+pXm2Gm65vk84V DHx16fbQlqsHtm9dI4Gha0RFWaWR29bdFyp8wTEfL32H/3LiCq5jPk2GDkvAe7b9AJdo PZCA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=MqoWSG6MBjoS4OV5OWaLkASybHuUgXxFaE2LuZLQkyE=; b=K2rYS0d2nGmkOwZb9TrGsNSBuHKI/+EQ5FndNxoWrbFN3o+o/QRxhCWiykhU8X0jz0 Ngrzy3F3H254XYRyZ4x4kmDb5QXYyqSA0ook97+bX9V5Y7Ir31qF4M134sgAEOfsz/zq ASlVEf3ZH26Va0VePAKBxXKQlkFmrC36Pwtfu8cpTllZYlMwEiHpjAfi9T/66p4N5bg8 Oj9IjPgTWJSq5ptUiuqyT6yvN044sCG0Sq586e1OPTqAxRVdz/JKkX90cWIxI3jUwF0N 9qGLdm6HOAJuD8eCjvNRGUWAFtiKpv+XxRPcmwBCm/gL2kum8uxXs9StTg4X+9K3UVrq b0Iw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=YBZAjw2B; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id j19si16096939eja.233.2020.12.31.09.04.05; Thu, 31 Dec 2020 09:04:28 -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; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=YBZAjw2B; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727044AbgLaRBX (ORCPT + 99 others); Thu, 31 Dec 2020 12:01:23 -0500 Received: from mail.kernel.org ([198.145.29.99]:46424 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726314AbgLaRBW (ORCPT ); Thu, 31 Dec 2020 12:01:22 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 1E3D120786; Thu, 31 Dec 2020 17:00:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1609434042; bh=2Q5/jyDzLCoOHxjn8Vg8jD4DTmyCYtWu95co3RUHzSw=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=YBZAjw2BCycDoFvK5sF5nxlRKhMLgEp7rAonCNjbeyllByiPv7bdypip/8XC3rxJ/ 5+nFJu+TVo9MtyR6vnr5zO0c5iAIb7bUliWZvZcKd0o0MV6IbhkQtr5qMprlYq3mZ2 xQPrMD7eJIe9hoUhtGXb6dIwJPshQlh3PTMor9K2ziRgy16fTOft0utAzUSZdEEEeO o3ccxhMAk04H6qTXwptgCRkcvtAZa8laoW1HqZbqDVMIijleWQ08d1qbDa7nzRkRJr HIEwcwHIa7w7Oc0He+polkS4PNgh017AkmJnPyep0K8GqCqBp4Szk0nvMz2v13GcZg h6zuqcPny7SSw== Received: by pali.im (Postfix) id C2D5EC35; Thu, 31 Dec 2020 18:00:39 +0100 (CET) Date: Thu, 31 Dec 2020 18:00:39 +0100 From: Pali =?utf-8?B?Um9ow6Fy?= To: Andrew Lunn Cc: Russell King - ARM Linux admin , Heiner Kallweit , "David S. Miller" , Jakub Kicinski , Marek =?utf-8?B?QmVow7pu?= , 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: <20201231170039.zkoa6mij3q3gt7c6@pali> 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=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: User-Agent: NeoMutt/20180716 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thursday 31 December 2020 16:30:33 Andrew Lunn wrote: > 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. But if we limit length of eeprom then userspace would not be able to access those TX_DISABLE, LOS and other bits from byte 110 at address A2. Problematic two-byte values are in byte range 96-109 at address A2. Therefore before byte 110.