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,
linux-kernel@vger.kernel.org, bryan.whitehead@microchip.com,
andrew@lunn.ch, UNGLinuxDriver@microchip.com
Subject: Re: [PATCH net-next 6/7] net: lan743x: Add support to ethtool phylink get and set settings
Date: Fri, 21 Jul 2023 09:53:33 +0100 [thread overview]
Message-ID: <ZLpHjQsBkC8SXQHy@shell.armlinux.org.uk> (raw)
In-Reply-To: <20230721060019.2737-7-Raju.Lakkaraju@microchip.com>
On Fri, Jul 21, 2023 at 11:30:18AM +0530, Raju Lakkaraju wrote:
> Add support to ethtool phylink get/set settings for the network interface via
> ethtool like speed, duplex etc.
>
> Signed-off-by: Raju Lakkaraju <Raju.Lakkaraju@microchip.com>
> ---
> .../net/ethernet/microchip/lan743x_ethtool.c | 34 +++++++++++++++++--
> 1 file changed, 32 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/net/ethernet/microchip/lan743x_ethtool.c b/drivers/net/ethernet/microchip/lan743x_ethtool.c
> index 2db5949b4c7e..3004863bebf8 100644
> --- a/drivers/net/ethernet/microchip/lan743x_ethtool.c
> +++ b/drivers/net/ethernet/microchip/lan743x_ethtool.c
> @@ -1134,6 +1134,36 @@ static int lan743x_ethtool_set_eee(struct net_device *netdev,
> return phy_ethtool_set_eee(phydev, eee);
> }
>
> +static int lan743x_ethtool_set_link_ksettings(struct net_device *netdev,
> + const struct ethtool_link_ksettings *cmd)
> +{
> + struct lan743x_adapter *adapter = netdev_priv(netdev);
> + int ret;
> +
> + if (adapter->phylink) {
> + ret = lan743x_lsd_update(cmd->base.speed, cmd->base.duplex,
> + cmd->base.master_slave_state);
> + if (ret < 0)
> + return ret;
> +
> + adapter->sgmii_lsd = ret;
I guess this is how you are hacking SGMII to do what you want - using
the ethtool master_slave_state to control whether SGMII is operating as
a "host" or a "PHY", and I would say it's a hack to make stuff work the
way you want it to, so you can run SGMII over a DAC cable at speeds
such as 100M. I really don't see what the point of that is.
In any case, doing this is buggy. You update state, and then call
into phylink. What if phylink returns an error? You've updated the
state which may take effect if the link goes up/down but maybe the
settings were rejected by phylink.
Sorry, but no, this to me is a gross hack.
--
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-07-21 8:53 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-07-21 6:00 [PATCH net-next 0/7] Add support to PHYLINK and SFP for PCI11x1x chips Raju Lakkaraju
2023-07-21 6:00 ` [PATCH net-next 1/7] net: lan743x: Create separate PCS power reset function Raju Lakkaraju
2023-07-22 20:24 ` Simon Horman
2023-07-21 6:00 ` [PATCH net-next 2/7] net: lan743x: Create separate Link Speed Duplex state function Raju Lakkaraju
2023-07-21 6:00 ` [PATCH net-next 3/7] net: lan743x: Add SFP support check flag Raju Lakkaraju
2023-07-21 6:00 ` [PATCH net-next 4/7] net: lan743x: Add support to software-nodes for SFP and PHYLINK Raju Lakkaraju
2023-07-21 6:00 ` [PATCH net-next 5/7] net: lan743x: Add support to the Phylink framework Raju Lakkaraju
2023-07-21 8:49 ` Russell King (Oracle)
2023-07-21 11:57 ` Russell King (Oracle)
2023-07-24 8:24 ` Raju Lakkaraju
2023-08-01 14:36 ` Russell King (Oracle)
2023-07-22 20:27 ` Simon Horman
2023-07-21 6:00 ` [PATCH net-next 6/7] net: lan743x: Add support to ethtool phylink get and set settings Raju Lakkaraju
2023-07-21 8:53 ` Russell King (Oracle) [this message]
2023-07-21 6:00 ` [PATCH net-next 7/7] net: lan743x: Register the platform device for sfp pluggable module 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=ZLpHjQsBkC8SXQHy@shell.armlinux.org.uk \
--to=linux@armlinux.org.uk \
--cc=Raju.Lakkaraju@microchip.com \
--cc=UNGLinuxDriver@microchip.com \
--cc=andrew@lunn.ch \
--cc=bryan.whitehead@microchip.com \
--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).