From: Horatiu Vultur <horatiu.vultur@microchip.com>
To: <netdev@vger.kernel.org>, <linux-kernel@vger.kernel.org>
Cc: <andrew@lunn.ch>, <hkallweit1@gmail.com>, <linux@armlinux.org.uk>,
<davem@davemloft.net>, <kuba@kernel.org>,
<richardcochran@gmail.com>, <UNGLinuxDriver@microchip.com>,
Horatiu Vultur <horatiu.vultur@microchip.com>
Subject: [RFC PATCH net-next 1/2] ethtool: Extend to allow to set PHY latencies
Date: Fri, 1 Apr 2022 11:39:08 +0200 [thread overview]
Message-ID: <20220401093909.3341836-2-horatiu.vultur@microchip.com> (raw)
In-Reply-To: <20220401093909.3341836-1-horatiu.vultur@microchip.com>
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@microchip.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
next prev parent reply other threads:[~2022-04-01 9:37 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-04-01 9:39 [RFC PATCH net-next 0/2] ethtool: Extend " Horatiu Vultur
2022-04-01 9:39 ` Horatiu Vultur [this message]
2022-04-01 12:36 ` [RFC PATCH net-next 1/2] ethtool: Extend to allow " Andrew Lunn
2022-04-01 13:40 ` Horatiu Vultur
2022-04-01 9:39 ` [RFC PATCH net-next 2/2] net: phy: micrel: Implement set/get_tunable Horatiu Vultur
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=20220401093909.3341836-2-horatiu.vultur@microchip.com \
--to=horatiu.vultur@microchip.com \
--cc=UNGLinuxDriver@microchip.com \
--cc=andrew@lunn.ch \
--cc=davem@davemloft.net \
--cc=hkallweit1@gmail.com \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@armlinux.org.uk \
--cc=netdev@vger.kernel.org \
--cc=richardcochran@gmail.com \
/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
Powered by JetHome