netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Pali Rohár" <pali@kernel.org>
To: Russell King - ARM Linux admin <linux@armlinux.org.uk>
Cc: "Marek Behún" <kabel@kernel.org>,
	netdev@vger.kernel.org, "Andrew Lunn" <andrew@lunn.ch>,
	"Jakub Kicinski" <kuba@kernel.org>,
	davem@davemloft.net
Subject: Re: [PATCH net-next v4 4/4] net: sfp: add support for multigig RollBall transceivers
Date: Wed, 13 Jan 2021 12:26:46 +0100	[thread overview]
Message-ID: <20210113112646.lcowenak5sbrzwjs@pali> (raw)
In-Reply-To: <20210113110852.GH1551@shell.armlinux.org.uk>

On Wednesday 13 January 2021 11:08:52 Russell King - ARM Linux admin wrote:
> On Wed, Jan 13, 2021 at 11:49:36AM +0100, Pali Rohár wrote:
> > On Monday 11 January 2021 06:00:44 Marek Behún wrote:
> > > @@ -1453,7 +1459,7 @@ static int sfp_sm_probe_phy(struct sfp *sfp, bool is_c45)
> > >  	struct phy_device *phy;
> > >  	int err;
> > >  
> > > -	phy = get_phy_device(sfp->i2c_mii, SFP_PHY_ADDR, is_c45);
> > > +	phy = get_phy_device(sfp->i2c_mii, sfp->phy_addr, is_c45);
> > >  	if (phy == ERR_PTR(-ENODEV))
> > >  		return PTR_ERR(phy);
> > >  	if (IS_ERR(phy)) {
> > > @@ -1835,6 +1841,23 @@ static int sfp_sm_mod_probe(struct sfp *sfp, bool report)
> > >  
> > >  	sfp->mdio_protocol = MDIO_I2C_DEFAULT;
> > >  
> > > +	sfp->phy_addr = SFP_PHY_ADDR;
> > > +	sfp->module_t_wait = T_WAIT;
> > > +
> > > +	if (((!memcmp(id.base.vendor_name, "OEM             ", 16) ||
> > > +	      !memcmp(id.base.vendor_name, "Turris          ", 16)) &&
> > > +	     (!memcmp(id.base.vendor_pn, "SFP-10G-T       ", 16) ||
> > > +	      !memcmp(id.base.vendor_pn, "RTSFP-10", 8)))) {
> > > +		sfp->mdio_protocol = MDIO_I2C_ROLLBALL;
> > > +		sfp->phy_addr = SFP_PHY_ADDR_ROLLBALL;
> > > +		sfp->module_t_wait = T_WAIT_ROLLBALL;
> > > +
> > > +		/* RollBall SFPs may have wrong (zero) extended compliacne code
> 
> Spelling error - "compliance"
> 
> > > +		 * burned in EEPROM. For PHY probing we need the correct one.
> > > +		 */
> > > +		id.base.extended_cc = SFF8024_ECC_10GBASE_T_SFI;
> > 
> > Should not we rather in sfp_sm_probe_for_phy() function in "default"
> > section try to probe also for clause 45 PHY when clause 22 fails?
> 
> Why? That's opening the possibilities for more problems - remember,
> the access method is vendor defined, and we already have the situation
> where I2C address 0x56 is used in two different styles that are
> indistinguishable:
> 
> - Clause 22 write:
> 	Write register address, value high, value low.
> - Clause 22 read:
> 	Write register address.
> 	Read value high, low.
> - Clause 45 write:
> 	Write devad, register address high, register address low,
> 		value high, value low.
> - Clause 45 read:
> 	Write devad, register address high, register address low.
> 	Read value high, low.
> 
> Look closely at the similarities of Clause 22 write and Clause 45
> read, you'll see that if you issue a clause 45 read to a SFP module
> that implements Clause 22, you actually end up issuing a write to it.
> 
> Sending random MDIO cycles to a SFP is a really bad idea.

I see, thank you for explanation. Incorrect data in SFP EEPROM may cause
lot of other issues :-(

      reply	other threads:[~2021-01-13 11:27 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-11  5:00 [PATCH net-next v4 0/4] Support for RollBall 10G copper SFP modules Marek Behún
2021-01-11  5:00 ` [PATCH net-next v4 1/4] net: phy: mdio-i2c: support I2C MDIO protocol for RollBall " Marek Behún
2021-01-12  8:42   ` Heiner Kallweit
2021-01-12 14:02     ` Andrew Lunn
2021-01-12 14:40       ` Heiner Kallweit
2021-01-12 17:49       ` Marek Behún
2021-01-12 19:22     ` Russell King - ARM Linux admin
2021-01-18 12:13       ` Pali Rohár
2021-01-18 15:45         ` Russell King - ARM Linux admin
2021-01-12 20:20   ` Andrew Lunn
2021-01-12 20:43   ` Andrew Lunn
2021-01-12 20:53     ` Marek Behún
2021-01-12 20:55       ` Andrew Lunn
2021-01-12 20:54   ` Andrew Lunn
2021-01-12 21:01     ` Marek Behún
2021-01-13 10:51       ` Pali Rohár
2021-01-12 21:22     ` Russell King - ARM Linux admin
2021-01-13 11:22   ` Pali Rohár
2021-01-13 13:56     ` Andrew Lunn
2021-01-13 13:58       ` Pali Rohár
2021-01-13 16:14       ` Russell King - ARM Linux admin
2021-01-11  5:00 ` [PATCH net-next v4 2/4] net: phylink: allow attaching phy for SFP modules on 802.3z mode Marek Behún
2021-01-13 10:38   ` Pali Rohár
2021-01-11  5:00 ` [PATCH net-next v4 3/4] net: sfp: create/destroy I2C mdiobus before PHY probe/after PHY release Marek Behún
2021-01-13 10:41   ` Pali Rohár
2021-01-11  5:00 ` [PATCH net-next v4 4/4] net: sfp: add support for multigig RollBall transceivers Marek Behún
2021-01-13 10:49   ` Pali Rohár
2021-01-13 11:08     ` Russell King - ARM Linux admin
2021-01-13 11:26       ` Pali Rohár [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210113112646.lcowenak5sbrzwjs@pali \
    --to=pali@kernel.org \
    --cc=andrew@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=kabel@kernel.org \
    --cc=kuba@kernel.org \
    --cc=linux@armlinux.org.uk \
    --cc=netdev@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).