From: "Russell King (Oracle)" <linux@armlinux.org.uk>
To: Raju Lakkaraju <Raju.Lakkaraju@microchip.com>
Cc: netdev@vger.kernel.org, davem@davemloft.net, kuba@kernel.org,
Bryan.Whitehead@microchip.com, linux-kernel@vger.kernel.org,
andrew@lunn.ch, UNGLinuxDriver@microchip.com
Subject: Re: [PATCH net-next V1 6/7] net: lan743x: Add support to the phylink framework
Date: Tue, 17 Oct 2023 11:46:00 +0100 [thread overview]
Message-ID: <ZS5l6Ko0NeaotV2Q@shell.armlinux.org.uk> (raw)
In-Reply-To: <20231017094208.4956-7-Raju.Lakkaraju@microchip.com>
On Tue, Oct 17, 2023 at 03:12:07PM +0530, Raju Lakkaraju wrote:
> +static void lan743x_phylink_mac_config(struct phylink_config *config,
> + unsigned int link_an_mode,
> + const struct phylink_link_state *state)
> +{
> + struct net_device *netdev = to_net_dev(config->dev);
> + struct lan743x_adapter *adapter = netdev_priv(netdev);
> + bool status;
> + int ret;
> +
> + lan743x_mac_cfg_update(adapter, state->link, state->speed,
> + state->advertising);
Another case of not reading the phylink documentation... :( I *really*
don't see why we bother to write documentation, from my experience, it
seems to be totally a write-only thing... no one seems to bother
reading it.
/**
* mac_config() - configure the MAC for the selected mode and state
* @config: a pointer to a &struct phylink_config.
* @mode: one of %MLO_AN_FIXED, %MLO_AN_PHY, %MLO_AN_INBAND.
* @state: a pointer to a &struct phylink_link_state.
*
* Note - not all members of @state are valid. In particular,
* @state->lp_advertising, @state->link, @state->an_complete are never
* guaranteed to be correct, and so any mac_config() implementation must
* never reference these fields.
...
* The action performed depends on the currently selected mode:
*
* %MLO_AN_FIXED, %MLO_AN_PHY:
...
* Valid state members: interface, advertising.
* Deprecated state members: speed, duplex, pause.
...
* %MLO_AN_INBAND:
...
* Valid state members: interface, an_enabled, pause, advertising.
So "link" and "speed" are not valid. They're certainly not valid now
that the pre-March 2020 legacy support has been removed.
The only time that you get to know what speed the link is operating at
is after the link has been negotiated and is up - and you will be told
via the mac_link_up() function (or in the case of a PCS, via the
pcs_link_up() function.) You can't know before that point what speed
the link will be operating at because its dependent on the results of
link negotiation.
I haven't bothered to look more deeply at this patch, because I regard
any patch that gets this wrong to be utter trash (sorry that's a bit
hard, but I see people not bothering to read documentation all too
often and it pisses me off that I've gone to the bother of writing it
and it just gets ignored.)
--
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 80Mbps down 10Mbps up. Decent connectivity at last!
next prev parent reply other threads:[~2023-10-17 10:46 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-10-17 9:42 [PATCH net-next V1 0/7] Add support to PHYLINK and SFP for PCI11x1x chips Raju Lakkaraju
2023-10-17 9:42 ` [PATCH net-next V1 1/7] net: lan743x: Create separate PCS power reset function Raju Lakkaraju
2023-10-17 9:42 ` [PATCH net-next V1 2/7] net: lan743x: Create separate Link Speed Duplex state function Raju Lakkaraju
2023-10-17 9:42 ` [PATCH net-next V1 3/7] net: lan743x: Add SFP support check flag Raju Lakkaraju
2023-10-17 9:42 ` [PATCH net-next V1 4/7] net: lan743x: Add support to software-nodes for sfp and phylink Raju Lakkaraju
2023-10-17 9:42 ` [PATCH net-next V1 5/7] net: lan743x: Register the platform device for sfp pluggable module Raju Lakkaraju
2023-10-17 9:42 ` [PATCH net-next V1 6/7] net: lan743x: Add support to the phylink framework Raju Lakkaraju
2023-10-17 10:46 ` Russell King (Oracle) [this message]
2023-10-17 9:42 ` [PATCH net-next V1 7/7] net: lan743x: Add support to ethtool phylink get and set settings Raju Lakkaraju
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=ZS5l6Ko0NeaotV2Q@shell.armlinux.org.uk \
--to=linux@armlinux.org.uk \
--cc=Bryan.Whitehead@microchip.com \
--cc=Raju.Lakkaraju@microchip.com \
--cc=UNGLinuxDriver@microchip.com \
--cc=andrew@lunn.ch \
--cc=davem@davemloft.net \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--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).