All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Russell King (Oracle)" <linux@armlinux.org.uk>
To: Romain Gantois <romain.gantois@bootlin.com>
Cc: Andrew Lunn <andrew@lunn.ch>,
	Heiner Kallweit <hkallweit1@gmail.com>,
	"David S. Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@google.com>,
	Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
	Dan Murphy <dmurphy@ti.com>,
	Florian Fainelli <f.fainelli@gmail.com>,
	Thomas Petazzoni <thomas.petazzoni@bootlin.com>,
	Maxime Chevallier <maxime.chevallier@bootlin.com>,
	netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
	stable@vger.kernel.org
Subject: Re: [PATCH net v2] net: phy: dp83869: fix status reporting for 1000base-x autonegotiation
Date: Thu, 7 Nov 2024 17:36:30 +0000	[thread overview]
Message-ID: <Zyz6nolj9-9bjyx8@shell.armlinux.org.uk> (raw)
In-Reply-To: <20241104-dp83869-1000base-x-v2-1-f97e39a778bf@bootlin.com>

On Mon, Nov 04, 2024 at 09:52:32AM +0100, Romain Gantois wrote:
> The DP83869 PHY transceiver supports converting from RGMII to 1000base-x.
> In this operation mode, autonegotiation can be performed, as described in
> IEEE802.3.
> 
> The DP83869 has a set of fiber-specific registers located at offset 0xc00.
> When the transceiver is configured in RGMII-to-1000base-x mode, these
> registers are mapped onto offset 0, which should, in theory, make reading
> the autonegotiation status transparent.
> 
> However, the fiber registers at offset 0xc04 and 0xc05 do not follow the
> bit layout of their standard counterparts. Thus, genphy_read_status()
> doesn't properly read the capabilities advertised by the link partner,
> resulting in incorrect link parameters.

This description is wrong. The format of registers 4 and 5 depends on
the media.

In twisted-pair ethernet, then:

ADVERTISE_PAUSE_ASYM / LPA_PAUSE_ASYM
ADVERTISE_PAUSE_CAP / LPA_PAUSE_CAP
ADVERTISE_100FULL / LPA_100FULL
ADVERTISE_100HALF / LPA_100HALF
ADVERTISE_10FULL / LPA_10FULL
ADVERTISE_10HALF / LPA_10HALF
ADVERTISE_CSMA

apply. In 1000base-X:

ADVERTISE_1000XPSE_ASYM / LPA_1000XPAUSE_ASYM
ADVERTISE_1000XPAUSE / LPA_1000XPAUSE
ADVERTISE_1000XHALF / LPA_1000XHALF
ADVERTISE_1000XFULL / LPA_1000XFULL

apply - these being bits 8, 7, 6, 5:

> +#define DP83869_LPA_1000FULL   BIT(5)
> +#define DP83869_LPA_PAUSE_CAP  BIT(7)
> +#define DP83869_LPA_PAUSE_ASYM BIT(8)
> +#define DP83869_LPA_LPACK      BIT(14)

so these are just reimplementing definitions we already have. Please
use the existing definitions. Even better, use mii_lpa_mod_linkmode_x()
and linkmode_adv_to_mii_adv_x() which we already have in your code.

Same likely goes for DP83869_BP_*

Thanks.

-- 
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 80Mbps down 10Mbps up. Decent connectivity at last!

      parent reply	other threads:[~2024-11-07 17:36 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-11-04  8:52 [PATCH net v2] net: phy: dp83869: fix status reporting for 1000base-x autonegotiation Romain Gantois
2024-11-07 16:26 ` Jakub Kicinski
2024-11-07 17:36 ` Russell King (Oracle) [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=Zyz6nolj9-9bjyx8@shell.armlinux.org.uk \
    --to=linux@armlinux.org.uk \
    --cc=andrew@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=dmurphy@ti.com \
    --cc=edumazet@google.com \
    --cc=f.fainelli@gmail.com \
    --cc=hkallweit1@gmail.com \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=maxime.chevallier@bootlin.com \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=romain.gantois@bootlin.com \
    --cc=stable@vger.kernel.org \
    --cc=thomas.petazzoni@bootlin.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.