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: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20230721060019.2737-7-Raju.Lakkaraju@microchip.com>
Date: Fri, 21 Jul 2023 11:30:18 +0530
From: Raju Lakkaraju <Raju.Lakkaraju@...rochip.com>
To: <netdev@...r.kernel.org>
CC: <davem@...emloft.net>, <kuba@...nel.org>, <linux-kernel@...r.kernel.org>,
	<bryan.whitehead@...rochip.com>, <andrew@...n.ch>, <linux@...linux.org.uk>,
	<UNGLinuxDriver@...rochip.com>
Subject: [PATCH net-next 6/7] net: lan743x: Add support to ethtool phylink get and set settings

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;
+		return phylink_ethtool_ksettings_set(adapter->phylink, cmd);
+	}
+
+	return phy_ethtool_set_link_ksettings(netdev, cmd);
+}
+
+static int lan743x_ethtool_get_link_ksettings(struct net_device *netdev,
+					      struct ethtool_link_ksettings *cmd)
+{
+	struct lan743x_adapter *adapter = netdev_priv(netdev);
+
+	if (adapter->phylink)
+		return phylink_ethtool_ksettings_get(adapter->phylink, cmd);
+
+	return phy_ethtool_get_link_ksettings(netdev, cmd);
+}
+
 #ifdef CONFIG_PM
 static void lan743x_ethtool_get_wol(struct net_device *netdev,
 				    struct ethtool_wolinfo *wol)
@@ -1400,8 +1430,8 @@ const struct ethtool_ops lan743x_ethtool_ops = {
 	.get_ts_info = lan743x_ethtool_get_ts_info,
 	.get_eee = lan743x_ethtool_get_eee,
 	.set_eee = lan743x_ethtool_set_eee,
-	.get_link_ksettings = phy_ethtool_get_link_ksettings,
-	.set_link_ksettings = phy_ethtool_set_link_ksettings,
+	.get_link_ksettings = lan743x_ethtool_get_link_ksettings,
+	.set_link_ksettings = lan743x_ethtool_set_link_ksettings,
 	.get_regs_len = lan743x_get_regs_len,
 	.get_regs = lan743x_get_regs,
 	.get_pauseparam = lan743x_get_pauseparam,
-- 
2.25.1


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ