netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Andrew Lunn <andrew@lunn.ch>
To: Tim Menninger <tmenninger@purestorage.com>
Cc: Vladimir Oltean <vladimir.oltean@nxp.com>,
	netdev-maintainers <edumazet@google.com>,
	kuba@kernel.org, pabeni@redhat.com, davem@davemloft.net,
	netdev <netdev@vger.kernel.org>,
	stable@vger.kernel.org
Subject: Re: [PATCH net v1] net: dsa: mv88e6xxx: Make unsupported C45 reads return 0xffff
Date: Tue, 23 Jan 2024 23:59:47 +0100	[thread overview]
Message-ID: <32d96dd3-7fbb-49e5-8b05-269eac1ac80d@lunn.ch> (raw)
In-Reply-To: <CAO-L_46Ltq0Ju_BO+rfvAbe7F=T6m0hZZKu9gzv7=bMV5n6naw@mail.gmail.com>

> Does that mean if there's a device there but it doesn't support C45 (no
> phy_read_c45), it will now return ENODEV?

Yes, mv88e6xxx_mdio_read_c45() will return -ENODEV if
chip->info->ops->phy_read_c45 is NULL. That will cause the scan of
that address to immediately skip to the next address. This is old
behaviour for C22:

commit 02a6efcab675fe32815d824837784c3f42a7d892
Author: Alexandre Belloni <alexandre.belloni@bootlin.com>
Date:   Tue Apr 24 18:09:04 2018 +0200

    net: phy: allow scanning busses with missing phys
    
    Some MDIO busses will error out when trying to read a phy address with no
    phy present at that address. In that case, probing the bus will fail
    because __mdiobus_register() is scanning the bus for all possible phys
    addresses.
    
    In case MII_PHYSID1 returns -EIO or -ENODEV, consider there is no phy at
    this address and set the phy ID to 0xffffffff which is then properly
    handled in get_phy_device().

And there are a few MDIO bus drivers which make use of this, e.g.

static int lan9303_phy_read(struct dsa_switch *ds, int phy, int regnum)
{
        struct lan9303 *chip = ds->priv;
        int phy_base = chip->phy_addr_base;

        if (phy == phy_base)
                return lan9303_virt_phy_reg_read(chip, regnum);
        if (phy > phy_base + 2)
                return -ENODEV;

        return chip->ops->phy_read(chip, phy, regnum);

This Ethernet switch supports only a number of PHY addresses, and
returns -ENODEV for the rest.

So its a legitimate way to say there is nothing here.

You suggestion of allowing ENOPSUPP for C45 would of fixed the
problem, but C22 and C45 would support different error codes, which i
don't like. Its better to be uniform.

	Andrew

  reply	other threads:[~2024-01-23 22:59 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-01-20 19:21 [PATCH net v1] net: dsa: mv88e6xxx: Make unsupported C45 reads return 0xffff Andrew Lunn
2024-01-22 12:24 ` Vladimir Oltean
2024-01-22 12:29   ` Vladimir Oltean
2024-01-22 12:52     ` Vladimir Oltean
2024-01-22 13:39   ` Andrew Lunn
2024-01-22 20:44     ` Tim Menninger
2024-01-22 23:01       ` Andrew Lunn
2024-01-23 15:27         ` Tim Menninger
2024-01-23 22:59           ` Andrew Lunn [this message]
2024-01-24 15:59             ` Tim Menninger

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=32d96dd3-7fbb-49e5-8b05-269eac1ac80d@lunn.ch \
    --to=andrew@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=kuba@kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=stable@vger.kernel.org \
    --cc=tmenninger@purestorage.com \
    --cc=vladimir.oltean@nxp.com \
    /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).