Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp282846rwl; Thu, 6 Apr 2023 19:14:20 -0700 (PDT) X-Google-Smtp-Source: AKy350bpx3C38ffe6nj2nKisVQyBiEE6bAfNL0sOEASuVCvGcdWBF619vWZNR8hMjQeEhxcB5Ijt X-Received: by 2002:a17:906:f244:b0:931:cd1b:3c0 with SMTP id gy4-20020a170906f24400b00931cd1b03c0mr6979524ejb.3.1680833659970; Thu, 06 Apr 2023 19:14:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1680833659; cv=none; d=google.com; s=arc-20160816; b=k6XJGa4Hv4qL7756jiEBbWhx16KFRJ1e6dWT4jwft08eLVXVF1Fkwq8MtJuHPYPDcz aFhZhL7iNIZ1lrzQzmU/QR/LaYYvjnT161Aul2U55An6Tuh6cG/Jj5ERxZHGP6uSnP1j BS+EVIu/GMcbGPFb8HHLx6wvkUqbKZNI3uUEhWqrnjlxhplOBwfRaphMjGL0p2Og6SYy aIzdGTm0zCzIwT/NE83XtYrRh23klhfVhSugEy0rbjfOe202UVgqoeV/3lf+aLI4whzt PyB+/81jPuwTI4vsiVSeHiHj+vXoWf9H9YHCuQLnA2z5KOW2d6FpBz8NagTAstBZ8rVl 8LoA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date :dkim-signature; bh=jKLLDIrW5QNFpGjH2/p8kulhogFaw/dm27NRXa5+8Kg=; b=FMzSEuHdMFpsZZcTsxNsywWTqj2/T3I0EdJdV45EYZY4u+ZrH8GHIa8PsXH9mVDtqj xeCFVV64J4TKDYe/zXAOHzGYf/iJ/WGqokm/y28u3wQySvfjDHv2vDM7H8YnK4MEKCVA /cXjJEIEWWrDTd+I1e3rfK+xOMZWN9vZNyplgNQGrnzEzsEY/f9AbBJ3bSXQdyRjxB9R tRgnyFaDeP22dbhHqV17RfaiNLhKXoi1ardNO4DMaZPgSJA2kigRPpDD5X17i3g6EiDF 7j+86acLCUefO/B1wMGVKYYh204eenLAmnddaQfN0FUYE23g+erfHcMaew6bOeq7raxq rT7g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=L9N4xh16; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id u21-20020a170906b11500b00947eb1bd823si1417420ejy.747.2023.04.06.19.13.54; Thu, 06 Apr 2023 19:14:19 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=L9N4xh16; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S238910AbjDGCMq (ORCPT + 99 others); Thu, 6 Apr 2023 22:12:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46258 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237111AbjDGCMe (ORCPT ); Thu, 6 Apr 2023 22:12:34 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4B7421AC; Thu, 6 Apr 2023 19:12:33 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id EE08E64E8A; Fri, 7 Apr 2023 02:02:10 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E06F0C433A7; Fri, 7 Apr 2023 02:02:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1680832930; bh=irhquyIMOLv8aFbHLZ/CLVb/o6ZsppXDK0dippASpfg=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=L9N4xh16jzWS8SndxFsXU41qyS5Vl1UEfU/z51m2/CKjgnrNuwNFmAYAqG1aikaq2 BqppE7yDJ+nz+HpsZzKa+uF6KQp084WJhKjx3VfmU+5YZEJ3+5grvUujhKGJRJW7sl sxD/lG2SbHaT6MHoNNDo/DpCPv9rdivnknbUrUsoq5Y/H4bVHNeJ8XHgA95FYFX9Hp 2Sshhuc7aE5hN33wPxYKukPAXOovweSqWHUNXNGQ/jnD+H/T9At4S60itzw1jhaGyj +gG+fp0/0tz4aHWH8AfjyFkJpJ0MOoKb9mRcwBs1ZbEjcLKIjx+3qjAMMPVEBIhmdm v8K62ZqrZyBug== Date: Thu, 6 Apr 2023 19:02:08 -0700 From: Jakub Kicinski To: linux@armlinux.org.uk Cc: Ivan Bornyakov , netdev@vger.kernel.org, andrew@lunn.ch, hkallweit1@gmail.com, davem@davemloft.net, edumazet@google.com, pabeni@redhat.com, linux-kernel@vger.kernel.org, system@metrotek.ru, stable@vger.kernel.org Subject: Re: [PATCH net] net: sfp: initialize sfp->i2c_block_size at sfp allocation Message-ID: <20230406190208.7918c71e@kernel.org> In-Reply-To: <20230405153900.747-1-i.bornyakov@metrotek.ru> References: <20230405153900.747-1-i.bornyakov@metrotek.ru> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-2.5 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, 5 Apr 2023 18:39:00 +0300 Ivan Bornyakov wrote: > sfp->i2c_block_size is initialized at SFP module insertion in > sfp_sm_mod_probe(). Because of that, if SFP module was not inserted > since boot, ethtool -m leads to zero-length I2C read attempt. > > # ethtool -m xge0 > i2c i2c-3: adapter quirk: no zero length (addr 0x0050, size 0, read) > Cannot get Module EEPROM data: Operation not supported > > If SFP module was plugged then removed at least once, > sfp->i2c_block_size will be initialized and ethtool -m will fail with > different error > > # ethtool -m xge0 > Cannot get Module EEPROM data: Remote I/O error > > Fix this by initializing sfp->i2_block_size at struct sfp allocation > stage so ethtool -m with SFP module removed will fail the same way, i.e. > -EREMOTEIO, in both cases and without errors from I2C adapter. Hi Russell - yes / no / come back when both patches are ready?