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]
Date:   Fri, 1 Apr 2022 11:39:08 +0200
From:   Horatiu Vultur <horatiu.vultur@...rochip.com>
To:     <netdev@...r.kernel.org>, <linux-kernel@...r.kernel.org>
CC:     <andrew@...n.ch>, <hkallweit1@...il.com>, <linux@...linux.org.uk>,
        <davem@...emloft.net>, <kuba@...nel.org>,
        <richardcochran@...il.com>, <UNGLinuxDriver@...rochip.com>,
        Horatiu Vultur <horatiu.vultur@...rochip.com>
Subject: [RFC PATCH net-next 1/2] ethtool: Extend to allow to set PHY latencies

Extend ethtool uapi to allow to configure the latencies for the PHY.
Allow to configure the latency per speed and per direction.

Signed-off-by: Horatiu Vultur <horatiu.vultur@...rochip.com>
---
 include/uapi/linux/ethtool.h |  6 ++++++
 net/ethtool/common.c         |  6 ++++++
 net/ethtool/ioctl.c          | 10 ++++++++++
 3 files changed, 22 insertions(+)

diff --git a/include/uapi/linux/ethtool.h b/include/uapi/linux/ethtool.h
index 7bc4b8def12c..f120904a4e43 100644
--- a/include/uapi/linux/ethtool.h
+++ b/include/uapi/linux/ethtool.h
@@ -296,6 +296,12 @@ enum phy_tunable_id {
 	ETHTOOL_PHY_DOWNSHIFT,
 	ETHTOOL_PHY_FAST_LINK_DOWN,
 	ETHTOOL_PHY_EDPD,
+	ETHTOOL_PHY_LATENCY_RX_10MBIT,
+	ETHTOOL_PHY_LATENCY_TX_10MBIT,
+	ETHTOOL_PHY_LATENCY_RX_100MBIT,
+	ETHTOOL_PHY_LATENCY_TX_100MBIT,
+	ETHTOOL_PHY_LATENCY_RX_1000MBIT,
+	ETHTOOL_PHY_LATENCY_TX_1000MBIT,
 	/*
 	 * Add your fresh new phy tunable attribute above and remember to update
 	 * phy_tunable_strings[] in net/ethtool/common.c
diff --git a/net/ethtool/common.c b/net/ethtool/common.c
index 0c5210015911..e0fec9eec047 100644
--- a/net/ethtool/common.c
+++ b/net/ethtool/common.c
@@ -98,6 +98,12 @@ phy_tunable_strings[__ETHTOOL_PHY_TUNABLE_COUNT][ETH_GSTRING_LEN] = {
 	[ETHTOOL_PHY_DOWNSHIFT]	= "phy-downshift",
 	[ETHTOOL_PHY_FAST_LINK_DOWN] = "phy-fast-link-down",
 	[ETHTOOL_PHY_EDPD]	= "phy-energy-detect-power-down",
+	[ETHTOOL_PHY_LATENCY_RX_10MBIT] = "phy-latency-rx-10mbit",
+	[ETHTOOL_PHY_LATENCY_TX_10MBIT] = "phy-latency-tx-10mbit",
+	[ETHTOOL_PHY_LATENCY_RX_100MBIT] = "phy-latency-rx-100mbit",
+	[ETHTOOL_PHY_LATENCY_TX_100MBIT] = "phy-lantecy-tx-100mbit",
+	[ETHTOOL_PHY_LATENCY_RX_1000MBIT] = "phy-latency-rx-1000mbit",
+	[ETHTOOL_PHY_LATENCY_TX_1000MBIT] = "phy-latency-tx-1000mbit",
 };
 
 #define __LINK_MODE_NAME(speed, type, duplex) \
diff --git a/net/ethtool/ioctl.c b/net/ethtool/ioctl.c
index 326e14ee05db..a1caee4ef5b9 100644
--- a/net/ethtool/ioctl.c
+++ b/net/ethtool/ioctl.c
@@ -2605,6 +2605,16 @@ static int ethtool_phy_tunable_valid(const struct ethtool_tunable *tuna)
 		    tuna->type_id != ETHTOOL_TUNABLE_U16)
 			return -EINVAL;
 		break;
+	case ETHTOOL_PHY_LATENCY_RX_10MBIT:
+	case ETHTOOL_PHY_LATENCY_TX_10MBIT:
+	case ETHTOOL_PHY_LATENCY_RX_100MBIT:
+	case ETHTOOL_PHY_LATENCY_TX_100MBIT:
+	case ETHTOOL_PHY_LATENCY_RX_1000MBIT:
+	case ETHTOOL_PHY_LATENCY_TX_1000MBIT:
+		if (tuna->len != sizeof(s32) ||
+		    tuna->type_id != ETHTOOL_TUNABLE_S32)
+			return -EINVAL;
+		break;
 	default:
 		return -EINVAL;
 	}
-- 
2.33.0

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ