[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <8e34fb09-87e0-4bab-bfd8-dd35b76eac53@lunn.ch>
Date: Thu, 6 Apr 2023 16:05:38 +0200
From: Andrew Lunn <andrew@...n.ch>
To: Ivan Bornyakov <i.bornyakov@...rotek.ru>
Cc: netdev@...r.kernel.org, linux@...linux.org.uk,
hkallweit1@...il.com, davem@...emloft.net, edumazet@...gle.com,
kuba@...nel.org, pabeni@...hat.com, linux-kernel@...r.kernel.org,
system@...rotek.ru, stable@...r.kernel.org
Subject: Re: [PATCH net v2 1/2] net: sfp: initialize sfp->i2c_block_size at
sfp allocation
On Thu, Apr 06, 2023 at 04:08:32PM +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 never inserted
> since boot, sfp_read() call will lead to zero-length I2C read attempt,
> and not all I2C controllers are happy with zero-length reads.
>
> One way to issue sfp_read() on empty SFP cage is to execute ethtool -m.
> If SFP module was never plugged since boot, there will be a 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 exit code and without I2C 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 no wild sfp_read() could issue zero-length I2C read.
>
> Signed-off-by: Ivan Bornyakov <i.bornyakov@...rotek.ru>
> Fixes: 0d035bed2a4a ("net: sfp: VSOL V2801F / CarlitoxxPro CPGOS03-0490 v2.0 workaround")
> Cc: stable@...r.kernel.org
Reviewed-by: Andrew Lunn <andrew@...n.ch>
Andrew
Powered by blists - more mailing lists