lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Fri, 21 Jul 2023 09:53:33 +0100
From: "Russell King (Oracle)" <linux@...linux.org.uk>
To: Raju Lakkaraju <Raju.Lakkaraju@...rochip.com>
Cc: netdev@...r.kernel.org, davem@...emloft.net, kuba@...nel.org,
	linux-kernel@...r.kernel.org, bryan.whitehead@...rochip.com,
	andrew@...n.ch, UNGLinuxDriver@...rochip.com
Subject: Re: [PATCH net-next 6/7] net: lan743x: Add support to ethtool
 phylink get and set settings

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@...rochip.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!

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ